Commit 9675661c authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Michael Hanselmann
Browse files

Export UUID and serial no in network queries



Add uuid and serial_no to _NETWORK_SIMPLE_FIELDS in order to export
them in network queries. Modify gnt-network to list them too.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 1ea0e8a8
......@@ -186,24 +186,27 @@ def ShowNetworkConfig(_, args):
"mac_prefix", "network_type",
"free_count", "reserved_count",
"map", "group_list", "inst_list",
"external_reservations"],
"external_reservations",
"serial_no", "uuid"],
names=args, use_locking=False)
for (name, network, gateway, network6, gateway6,
mac_prefix, network_type, free_count, reserved_count,
mapping, group_list, instances, ext_res) in result:
mapping, group_list, instances, ext_res, serial, uuid) in result:
size = free_count + reserved_count
ToStdout("Network name: %s", name)
ToStdout(" subnet: %s", network)
ToStdout(" gateway: %s", gateway)
ToStdout(" subnet6: %s", network6)
ToStdout(" gateway6: %s", gateway6)
ToStdout(" mac prefix: %s", mac_prefix)
ToStdout(" type: %s", network_type)
ToStdout(" size: %d", size)
ToStdout(" free: %d (%.2f%%)", free_count,
100 * float(free_count) / float(size))
ToStdout(" usage map:")
ToStdout("UUID: %s", uuid)
ToStdout("Serial number: %d", serial)
ToStdout(" Subnet: %s", network)
ToStdout(" Gateway: %s", gateway)
ToStdout(" IPv6 Subnet: %s", network6)
ToStdout(" IPv6 Gateway: %s", gateway6)
ToStdout(" Mac Prefix: %s", mac_prefix)
ToStdout(" Type: %s", network_type)
ToStdout(" Size: %d", size)
ToStdout(" Free: %d (%.2f%%)", free_count,
100 * float(free_count)/float(size))
ToStdout(" Usage map:")
idx = 0
for line in wrap(mapping, width=64):
ToStdout(" %s %s %d", str(idx).rjust(3), line.ljust(64), idx + 63)
......
......@@ -2481,6 +2481,8 @@ _NETWORK_SIMPLE_FIELDS = {
"gateway6": ("IPv6Gateway", QFT_OTHER, 0, "The ipv6 gateway"),
"mac_prefix": ("MacPrefix", QFT_OTHER, 0, "The mac prefix"),
"network_type": ("NetworkType", QFT_OTHER, 0, "The network type"),
"serial_no": ("SerialNo", QFT_NUMBER, 0, _SERIAL_NO_DOC % "Network"),
"uuid": ("UUID", QFT_TEXT, 0, "Network UUID"),
}
......
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