[Libvirt-cim] [PATCH] [TEST] Improve enum volumes

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Sun Apr 19 23:14:46 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1240002683 25200
# Node ID 5706fea95239f1633296e2fbce13ada882848e13
# Parent  ced161a8198115797a6036f3f22e02d234439a76
[TEST] Improve enum volumes

The providers don't return a template RASD for volumes that libvirt is
unable to get volume info for.  So the testsuite needs to do the same.

Also, don't use a hardcoded disk pool name - use the default value from const.py

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

diff -r ced161a81981 -r 5706fea95239 suites/libvirt-cim/lib/XenKvmLib/pool.py
--- a/suites/libvirt-cim/lib/XenKvmLib/pool.py	Wed Apr 15 20:19:31 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py	Fri Apr 17 14:11:23 2009 -0700
@@ -24,7 +24,7 @@
 from CimTest.Globals import logger
 from CimTest.ReturnCodes import PASS, FAIL
 from XenKvmLib.classes import get_typed_class
-from XenKvmLib.const import get_provider_version 
+from XenKvmLib.const import get_provider_version, default_pool_name 
 from XenKvmLib.enumclass import EnumInstances
 from VirtLib.utils import run_remote
 from XenKvmLib.xm_virt_util import virt2uri
@@ -83,13 +83,19 @@
 def enum_volumes(virt, server):
     volume = 0
     cmd = "virsh -c %s vol-list %s | sed -e '1,2 d' -e '$ d'" % \
-          (virt2uri(virt), 'cimtest-diskpool')
+          (virt2uri(virt), default_pool_name)
     ret, out = run_remote(server ,cmd)
     if ret != 0:
         return None
     lines = out.split("\n")
     for line in lines:
-        volume = volume + 1
+        vol = line.split()[0]   
+        cmd = "virsh vol-info --pool cimtest-diskpool meep"
+        cmd = "virsh -c %s vol-info --pool %s %s" % (virt2uri(virt), 
+              default_pool_name, vol)
+        ret, out = run_remote(server ,cmd)
+        if ret == 0:
+            volume = volume + 1
 
     return volume
 




More information about the Libvirt-cim mailing list