[PATCH 14/16] Listing running sandbox containers takes a long time using the current protocol.

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

 



So I am execing a virsh list command to show all of the running containers.
---
 bin/virt-sandbox-service | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index b559cf5..ceb05b3 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -907,22 +907,27 @@ def usage(parser, msg):
     sys.exit(1)
 
 def sandbox_list(args):
+    if args.running:
+        import libvirt
+        conn = libvirt.open("lxc:///")
+        running = conn.listAllDomains(0)
+        conn.close()
+        running.sort()
+        for d in running:
+            print d.name()
+        return
+
     import glob
     g = glob.glob(CONFIG_PATH + "*.sandbox")
     g.sort()
     for gc in g:
         try:
             c = LibvirtSandbox.Config.load_from_path(gc)
-            if args.running:
-                if c.running():
-                    print c.get_name()
-            else:
-                print c.get_name()
+            print c.get_name()
 
         except OSError, e:
             print "Invalid container %s: %s", (gc, e)
 
-
 def sandbox_reload(args):
     config = read_config(args.name)
     if isinstance(config, gi.repository.LibvirtSandbox.ConfigInteractive):
-- 
1.8.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]