+1 from me.
libvirt-cim-bounces(a)redhat.com wrote on 2009-04-21 02:19:13:
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1240002683 25200
# Node ID eea660ff3ad6e589f76bf17b3697d30465e54398
# Parent ced161a8198115797a6036f3f22e02d234439a76
[TEST] (#2) 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
Updates:
-Remove test code
-Allow caller to specify pool name, or use default pool name if one
isn't
specified
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r ced161a81981 -r eea660ff3ad6
suites/libvirt-cim/lib/XenKvmLib/pool.py
--- a/suites/libvirt-cim/lib/XenKvmLib/pool.py Wed Apr 15
20:19:312009
-0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py Fri Apr 17
14:11:232009
-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
@@ -80,16 +80,20 @@
return pool_insts, PASS
-def enum_volumes(virt, server):
+def enum_volumes(virt, server, pooln=default_pool_name):
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 -c %s vol-info --pool %s %s" %
(virt2uri(virt), pooln, vol)
+ ret, out = run_remote(server ,cmd)
+ if ret == 0:
+ volume = volume + 1
return volume
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim