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

Sharad Mishra snmishra at us.ibm.com
Tue Dec 1 01:37:36 UTC 2009


+1

Sharad Mishra
System x Enablement
Linux Technology Center
IBM


                                                                           
             Kaitlin Rupert                                                
             <kaitlin at linux.vn                                             
             et.ibm.com>                                                To 
             Sent by:                  libvirt-cim at redhat.com              
             libvirt-cim-bounc                                          cc 
             es at redhat.com                                                 
                                                                   Subject 
                                       [Libvirt-cim] [PATCH] [TEST] Change 
             11/20/2009 12:55          create_diskpool() to use virsh      
             PM                        pool-info                           
                                                                           
                                                                           
             Please respond to                                             
                 List for                                                  
              discussion and                                               
              development of                                               
                libvirt CIM                                                
             <libvirt-cim at redh                                             
                  at.com>                                                  
                                                                           
                                                                           




# 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"


_______________________________________________
Libvirt-cim mailing list
Libvirt-cim at redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20091130/33a23cac/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20091130/33a23cac/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic25436.gif
Type: image/gif
Size: 1255 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20091130/33a23cac/attachment-0001.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20091130/33a23cac/attachment-0002.gif>


More information about the Libvirt-cim mailing list