Commit 49bea583 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Klaus Aehlig
Browse files

Fix gnt-network info



QueryNetworks() returns the uuids of the instances that are
inside a network. Since QueryInstances() uses names and not uuids
for search, we create a uuid2name dict to get each instance name
and then retrieve its nics and networks.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent e78a8c0b
......@@ -246,9 +246,13 @@ def ShowNetworkConfig(_, args):
ToStdout(" not connected to any node group")
if instances:
idata = cl.QueryInstances([], ["uuid", "name"], False)
uuid2name = dict(idata)
ToStdout(" used by %d instances:", len(instances))
for inst in instances:
((ips, networks), ) = cl.QueryInstances([inst],
name = uuid2name[inst]
((ips, networks), ) = cl.QueryInstances([name],
["nic.ips", "nic.networks"],
use_locking=False)
......@@ -256,7 +260,7 @@ def ShowNetworkConfig(_, args):
for idx, (ip, net) in enumerate(value)
if net == uuid)
ToStdout(" %s : %s", inst, l(zip(ips, networks)))
ToStdout(" %s: %s", name, l(zip(ips, networks)))
else:
ToStdout(" not used by any instances")
......
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