[Libvirt-cim] [PATCH] [TEST] Change create_diskpool() to use virsh pool-info

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Fri Nov 20 20:55:18 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1258750445 28800
# Node ID 269167924d0e969ff190fde80596033c28f414a7
# Parent  ed3a9593a2acb7fc7ac124666d873d51e3c315fd
[TEST] Change create_diskpool() to use virsh pool-info

Instead of checking the output of pool-list.  pool-info will return a error if
the guest isn't found.  You can run into a problem checking the output of
virsh pool-list is libvirt returns extra debug messages (etc).

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r ed3a9593a2ac -r 269167924d0e suites/libvirt-cim/lib/XenKvmLib/common_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py	Thu Nov 19 03:51:03 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py	Fri Nov 20 12:54:05 2009 -0800
@@ -341,10 +341,9 @@
                 dpoolname=dpool_list[0]
 
         if dpoolname == None:
-            cmd = "virsh -c %s pool-list --all | grep %s" % \
-                  (virt2uri(virt), dpool)
+            cmd = "virsh -c %s pool-info %s" % (virt2uri(virt), dpool)
             ret, out = utils.run_remote(server, cmd)
-            if out != "":
+            if ret == 0:
                 logger.error("Disk pool with name '%s' already exists", dpool)
                 return FAIL, "Unknown"
 




More information about the Libvirt-cim mailing list