# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1239849166 25200
# Node ID 7b81278fbdd9d4337ac7422e98bcfebc93b70e64
# Parent 4ec367c94c356de7fac5a19ffe215c316d0cdcd1
[TEST]#2 Fix 03_hs_to_settdefcap.py with the provider's changes of the output of ac
association when using DiskPool as input
Updates from 1 to 2:
Query libvirt to get the number of DiskRASD instances and then compare to the result
Tested for KVM with current sources and rpm
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r 4ec367c94c35 -r 7b81278fbdd9
suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py
--- a/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py Wed Apr 08 02:22:53
2009 -0700
+++ b/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py Wed Apr 15 19:32:46
2009 -0700
@@ -40,7 +40,9 @@
# Feb 13 2008
import sys
-from VirtLib.live import full_hostname
+from VirtLib.live import full_hostname
+from VirtLib.utils import run_remote
+from XenKvmLib.xm_virt_util import virt2uri
from XenKvmLib.common_util import get_host_info
from XenKvmLib.assoc import Associators
from XenKvmLib.vxml import XenXML, KVMXML, get_class
@@ -57,6 +59,7 @@
test_vcpus = 1
libvirt_rasd_template_changes = 707
libvirt_rasd_new_changes = 805
+libvirt_rasd_dpool_changes = 839
def setup_env(server, virt="Xen"):
status = PASS
@@ -216,6 +219,16 @@
curr_cim_rev, changeset = get_provider_version(virt, server)
exp_len = 4
+
+ volume = 0
+ cmd = "virsh -c %s vol-list %s" % (virt2uri(server),
'cimtest-diskpool')
+ ret, out = run_remote(server ,cmd)
+ if ret != 0:
+ return None
+ lines = out.split("\n")
+ for line in lines:
+ volume = volume + 1
+
if 'DiskPool' in ap['InstanceID']:
# For Diskpool, we have info 1 for each of Min, Max,
# default, Increment and 1 for each of PV and FV
@@ -227,8 +240,11 @@
if curr_cim_rev >= libvirt_rasd_new_changes:
exp_len = 16
if virt == 'KVM':
- if curr_cim_rev >= libvirt_rasd_new_changes:
+ if curr_cim_rev >= libvirt_rasd_new_changes and \
+ curr_cim_rev < libvirt_rasd_dpool_changes:
exp_len = 8
+ if curr_cim_rev >= libvirt_rasd_dpool_changes:
+ exp_len = volume
if len(assoc_info) != exp_len:
logger.error("'%s' returned %i RASD objects instead of
%i",