[Libvirt-cim] [PATCH] [TEST] Improve libvirt virt support check in main.py

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Oct 22 00:11:28 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1224634275 25200
# Node ID 0ceafbdc8a2d17b52ca72401b7ffaeb220069b66
# Parent  868aa0f5175568c5752787c1fcbd2b1df4001aad
[TEST] Improve libvirt virt support check in main.py

If /usr/bin/qemu does not exist on the system (or if libvirt cannot find it),
it is possible to define KVM guests but not run them.  Instead of returning a
error saying libvirt doesn't support the virt type, we need to return an error
that indicates a problem with libvirt was encountered.

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

diff -r 868aa0f51755 -r 0ceafbdc8a2d suites/libvirt-cim/main.py
--- a/suites/libvirt-cim/main.py	Tue Oct 21 01:31:11 2008 -0700
+++ b/suites/libvirt-cim/main.py	Tue Oct 21 17:11:15 2008 -0700
@@ -90,10 +90,15 @@
     print "Cleaned log files."
 
 def pre_check(ip, virt):
-    cmd = "virsh -c %s version " % utils.virt2uri(virt)
+    cmd = "virsh -c %s list --all" % utils.virt2uri(virt)
     ret, out = utils.run_remote(ip, cmd)
     if ret != 0:
         return "This libvirt install does not support %s"  % virt
+
+    cmd = "virsh -c %s version" % utils.virt2uri(virt)
+    ret, out = utils.run_remote(ip, cmd)
+    if ret != 0:
+        return "Encountered an error querying libvirt with: %s" % cmd
 
     cmd = "ps -ef | grep -v grep | grep cimserver"
     rc, out = utils.run_remote(ip, cmd)




More information about the Libvirt-cim mailing list