Revision dfff41f8

b/scripts/gnt-instance
1110 1110
    if instance.has_key("network_port"):
1111 1111
      buf.write("  Allocated network port: %s\n" % instance["network_port"])
1112 1112
    buf.write("  Hypervisor: %s\n" % instance["hypervisor"])
1113
    if instance["hypervisor"] == constants.HT_XEN_PVM:
1114
      hvattrs = ((constants.HV_KERNEL_PATH, "kernel path"),
1115
                 (constants.HV_INITRD_PATH, "initrd path"))
1116
    elif instance["hypervisor"] == constants.HT_XEN_HVM:
1117
      hvattrs = ((constants.HV_BOOT_ORDER, "boot order"),
1118
                 (constants.HV_ACPI, "ACPI"),
1119
                 (constants.HV_PAE, "PAE"),
1120
                 (constants.HV_CDROM_IMAGE_PATH, "virtual CDROM"),
1121
                 (constants.HV_NIC_TYPE, "NIC type"),
1122
                 (constants.HV_DISK_TYPE, "Disk type"),
1123
                 (constants.HV_VNC_BIND_ADDRESS, "VNC bind address"),
1124
                 )
1125
      # custom console information for HVM
1126
      vnc_bind_address = instance["hv_actual"][constants.HV_VNC_BIND_ADDRESS]
1127
      if vnc_bind_address == constants.BIND_ADDRESS_GLOBAL:
1128
        vnc_console_port = "%s:%s" % (instance["pnode"],
1129
                                      instance["network_port"])
1130
      elif vnc_bind_address == constants.LOCALHOST_IP_ADDRESS:
1131
        vnc_console_port = "%s:%s on node %s" % (vnc_bind_address,
1132
                                                 instance["network_port"],
1133
                                                 instance["pnode"])
1113

  
1114
    # custom VNC console information
1115
    vnc_bind_address = instance["hv_actual"].get(constants.HV_VNC_BIND_ADDRESS,
1116
                                                 None)
1117
    if vnc_bind_address:
1118
      port = instance["network_port"]
1119
      display = int(port) - constants.VNC_BASE_PORT
1120
      if display > 0 and vnc_bind_address == constants.BIND_ADDRESS_GLOBAL:
1121
        vnc_console_port = "%s:%s (display %s)" % (instance["pnode"],
1122
                                                   port,
1123
                                                   display)
1124
      elif display > 0 and utils.IsValidIP(vnc_bind_address):
1125
        vnc_console_port = ("%s:%s (node %s) (display %s)" %
1126
                             (vnc_bind_address, port,
1127
                              instance["pnode"], display))
1134 1128
      else:
1135
        vnc_console_port = "%s:%s" % (vnc_bind_address,
1136
                                      instance["network_port"])
1129
        # vnc bind address is a file
1130
        vnc_console_port = "%s:%s" % (instance["pnode"],
1131
                                      vnc_bind_address)
1137 1132
      buf.write("    - console connection: vnc to %s\n" % vnc_console_port)
1138 1133

  
1139
    else:
1140
      # auto-handle other hypervisor types
1141
      hvattrs = [(key, key) for key in instance["hv_actual"]]
1142

  
1143
    for key, desc in hvattrs:
1134
    for key in instance["hv_actual"]:
1144 1135
      if key in instance["hv_instance"]:
1145 1136
        val = instance["hv_instance"][key]
1146 1137
      else:
1147 1138
        val = "default (%s)" % instance["hv_actual"][key]
1148
      buf.write("    - %s: %s\n" % (desc, val))
1139
      buf.write("    - %s: %s\n" % (key, val))
1149 1140
    buf.write("  Hardware:\n")
1150 1141
    buf.write("    - VCPUs: %d\n" %
1151 1142
              instance["be_actual"][constants.BE_VCPUS])

Also available in: Unified diff