scripts/func-list-vms-per-host

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 scripts/func-list-vms-per-host |   17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

New commits:
commit d9ab50f7a87cfdeb1e9135211a0c1b14e8ee23a1
Author: Ricky Zhou <ricky@xxxxxxxxxxxxxxxxx>
Date:   Tue Dec 7 16:53:49 2010 -0500

    This allows for easier filtering out of shutdown vms.

diff --git a/scripts/func-list-vms-per-host b/scripts/func-list-vms-per-host
index ab461fe..24689c5 100755
--- a/scripts/func-list-vms-per-host
+++ b/scripts/func-list-vms-per-host
@@ -24,7 +24,7 @@ def parse_args(args):
             hosts = sys.stdin.readlines()
         else:
             hosts = open(opts.hostfile, 'r').readlines()
-        
+
         for hn in hosts:
             hn = hn.strip()
             if hn.startswith('#'):
@@ -49,18 +49,11 @@ for (hn, mods) in results.items():
         hosts_to_scan.append(hn)
 
 fc = func.overlord.client.Client(';'.join(hosts_to_scan), timeout=opts.timeout, nforks=len(hosts_to_scan))
-results = fc.virt.list_vms()
-vms_per_host = {}
+results = fc.virt.info()
 
-for (hn, vms) in results.items():
-    vms_per_host[hn] = []
-    for vm in vms:
+for (hn, vms) in sorted(results.items()):
+    for (vm, info) in sorted(vms.items()):
         if vm == 'Domain-0':
             continue
-        vms_per_host[hn].append(vm)
+        print '%s:%s:%s' % (hn, vm, info['state'])
 
-for hn in sorted(vms_per_host.keys()):
-    if vms_per_host[hn]:
-        for vm in sorted(vms_per_host[hn]):
-            print '%s:%s' % (hn, vm)
-        


_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list


[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux