Commit d6d415e8 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add option for the number of VCPUs in instance listing

Reviewed-by: ultrotter
parent b32f9859
......@@ -2403,7 +2403,7 @@ class LUQueryInstances(NoHooksLU):
_CheckOutputFields(static=["name", "os", "pnode", "snodes",
"admin_state", "admin_ram",
"disk_template", "ip", "mac", "bridge",
"sda_size", "sdb_size"],
"sda_size", "sdb_size", "vcpus"],
dynamic=self.dynamic_fields,
selected=self.op.output_fields)
......@@ -2479,6 +2479,8 @@ class LUQueryInstances(NoHooksLU):
val = None
else:
val = disk.size
elif field == "vcpus":
val = instance.vcpus
else:
raise errors.ParameterError(field)
iout.append(val)
......
......@@ -176,7 +176,7 @@ def ListInstances(opts, args):
"oper_state": "Status", "admin_ram": "Configured_memory",
"oper_ram": "Memory", "disk_template": "Disk_template",
"ip": "IP Address", "mac": "MAC Address",
"bridge": "Bridge",
"bridge": "Bridge", "vcpus": "VCPUs",
"sda_size": "Disk/0", "sdb_size": "Disk/1"}
else:
headers = None
......@@ -186,7 +186,7 @@ def ListInstances(opts, args):
else:
unitfields = None
numfields = ["admin_ram", "oper_ram", "sda_size", "sdb_size"]
numfields = ["admin_ram", "oper_ram", "sda_size", "sdb_size", "vcpus"]
# change raw values to nicer strings
for row in output:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment