"admin_state", "admin_ram",
"disk_template", "ip", "mac", "bridge",
"sda_size", "sdb_size", "vcpus", "tags",
- "network_port", "kernel_path", "initrd_path",
- "hvm_boot_order", "hvm_acpi", "hvm_pae",
- "hvm_cdrom_image_path", "hvm_nic_type",
- "hvm_disk_type", "vnc_bind_address",
- "serial_no", "hypervisor",
- ])
+ "network_port",
+ "serial_no", "hypervisor", "hvparams",
+ ] + ["hv/%s" % name for name in constants.HVS_PARAMETERS])
_CheckOutputFields(static=self.static_fields,
dynamic=self.dynamic_fields,
selected=self.op.output_fields)
# end data gathering
+ HVPREFIX = "hv/"
output = []
for instance in instance_list:
iout = []
+ i_hv = self.cfg.GetClusterInfo().FillHV(instance)
for field in self.op.output_fields:
if field == "name":
val = instance.name
val = list(instance.GetTags())
elif field == "serial_no":
val = instance.serial_no
- elif field in ("network_port", "kernel_path", "initrd_path",
- "hvm_boot_order", "hvm_acpi", "hvm_pae",
- "hvm_cdrom_image_path", "hvm_nic_type",
- "hvm_disk_type", "vnc_bind_address"):
- val = getattr(instance, field, None)
- if val is not None:
- pass
- elif field in ("hvm_nic_type", "hvm_disk_type",
- "kernel_path", "initrd_path"):
- val = "default"
- else:
- val = "-"
+ elif field == "network_port":
+ val = instance.network_port
+ elif (field.startswith(HVPREFIX) and
+ field[len(HVPREFIX):] in constants.HVS_PARAMETERS):
+ val = i_hv.get(field[len(HVPREFIX):], None)
+ elif field == "hvparams":
+ val = i_hv
elif field == "hypervisor":
val = instance.hypervisor
else:
"sda_size": "Disk/0", "sdb_size": "Disk/1",
"status": "Status", "tags": "Tags",
"network_port": "Network_port",
- "kernel_path": "Kernel_path",
- "initrd_path": "Initrd_path",
- "hvm_boot_order": "HVM_boot_order",
- "hvm_acpi": "HVM_ACPI",
- "hvm_pae": "HVM_PAE",
- "hvm_cdrom_image_path": "HVM_CDROM_image_path",
- "hvm_nic_type": "HVM_NIC_type",
- "hvm_disk_type": "HVM_disk_type",
+ "hv/kernel_path": "Kernel_path",
+ "hv/initrd_path": "Initrd_path",
+ "hv/boot_order": "HVM_boot_order",
+ "hv/acpi": "HVM_ACPI",
+ "hv/pae": "HVM_PAE",
+ "hv/cdrom_image_path": "HVM_CDROM_image_path",
+ "hv/nic_type": "HVM_NIC_type",
+ "hv/disk_type": "HVM_Disk_type",
"vnc_bind_address": "VNC_bind_address",
"serial_no": "SerialNo", "hypervisor": "Hypervisor",
+ "hvparams": "Hypervisor_parameters",
}
else:
headers = None
val = "N/A"
elif field in list_type_fields:
val = ",".join(val)
+ elif val is None:
+ val = "-"
row[idx] = str(val)
data = GenerateTable(separator=opts.separator, headers=headers,