Commit 38d7239a authored by Iustin Pop's avatar Iustin Pop
Browse files

Allow listing of the serial_no via gnt-* list

This patch adds listing of the serial_no attribute in gnt-instance and
gnt-node list, and updates to the manpages to reflect the change.

Reviewed-by: ultrotter
parent b989e85d
......@@ -1423,6 +1423,7 @@ class LUQueryNodes(NoHooksLU):
"name", "pinst_cnt", "sinst_cnt",
"pinst_list", "sinst_list",
"pip", "sip", "tags",
"serial_no",
])
_CheckOutputFields(static=self.static_fields,
......@@ -1528,6 +1529,8 @@ class LUQueryNodes(NoHooksLU):
val = node.secondary_ip
elif field == "tags":
val = list(node.GetTags())
elif field == "serial_no":
val = node.serial_no
elif field in self.dynamic_fields:
val = live_data[node.name].get(field, None)
else:
......@@ -2576,6 +2579,7 @@ class LUQueryInstances(NoHooksLU):
"hvm_boot_order", "hvm_acpi", "hvm_pae",
"hvm_cdrom_image_path", "hvm_nic_type",
"hvm_disk_type", "vnc_bind_address",
"serial_no",
])
_CheckOutputFields(static=self.static_fields,
dynamic=self.dynamic_fields,
......@@ -2705,6 +2709,8 @@ class LUQueryInstances(NoHooksLU):
val = instance.vcpus
elif field == "tags":
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",
......
......@@ -612,6 +612,15 @@
tags</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>serial_no</term>
<listitem>
<simpara>the so called 'serial number' of the
instance; this is a numeric field that is incremented
each time the instance is modified, and it can be used
to detect modifications</simpara>
</listitem>
</varlistentry>
</variablelist>
</para>
......
......@@ -333,6 +333,15 @@
tags</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>serial_no</term>
<listitem>
<simpara>the so called 'serial number' of the instance;
this is a numeric field that is incremented each time
the instance is modified, and it can be used to detect
modifications</simpara>
</listitem>
</varlistentry>
</variablelist>
</para>
......
......@@ -197,6 +197,7 @@ def ListInstances(opts, args):
"hvm_nic_type": "HVM_NIC_type",
"hvm_disk_type": "HVM_disk_type",
"vnc_bind_address": "VNC_bind_address",
"serial_no": "SerialNo",
}
else:
headers = None
......@@ -206,7 +207,8 @@ def ListInstances(opts, args):
else:
unitfields = None
numfields = ["admin_ram", "oper_ram", "sda_size", "sdb_size", "vcpus"]
numfields = ["admin_ram", "oper_ram", "sda_size", "sdb_size", "vcpus",
"serial_no"]
list_type_fields = ("tags",)
# change raw values to nicer strings
......@@ -972,7 +974,8 @@ commands = {
"Lists the instances and their status. The available fields are"
" (see the man page for details): status, oper_state, oper_ram,"
" name, os, pnode, snodes, admin_state, admin_ram, disk_template,"
" ip, mac, bridge, sda_size, sdb_size, vcpus. The default field"
" ip, mac, bridge, sda_size, sdb_size, vcpus, serial_no."
" The default field"
" list is (in order): %s." % ", ".join(_LIST_DEF_FIELDS),
),
'reinstall': (ReinstallInstance, ARGS_ONE,
......
......@@ -91,6 +91,7 @@ def ListNodes(opts, args):
"bootid": "BootID",
"ctotal": "CTotal",
"tags": "Tags",
"serial_no": "SerialNo",
}
else:
headers = None
......@@ -103,7 +104,7 @@ def ListNodes(opts, args):
numfields = ["dtotal", "dfree",
"mtotal", "mnode", "mfree",
"pinst_cnt", "sinst_cnt",
"ctotal"]
"ctotal", "serial_no"]
list_type_fields = ("pinst_list", "sinst_list", "tags")
# change raw values to nicer strings
......@@ -344,7 +345,8 @@ commands = {
"", "Lists the nodes in the cluster. The available fields"
" are (see the man page for details): name, pinst_cnt, pinst_list,"
" sinst_cnt, sinst_list, pip, sip, dtotal, dfree, mtotal, mnode,"
" mfree, bootid, cpu_count. The default field list is"
" mfree, bootid, cpu_count, serial_no."
" The default field list is"
" (in order): %s." % ", ".join(_LIST_DEF_FIELDS),
),
'remove': (RemoveNode, ARGS_ONE, [DEBUG_OPT],
......
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