
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1239851524 25200 # Node ID 352e8509493cfce2620bca94798a1012c63cb410 # 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 instead of hardcode Tested for KVM with current sources and rpm Signed-off-by: Guolian Yun<yunguol@cn.ibm.com> diff -r 4ec367c94c35 -r 352e8509493c 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 20:12:04 2009 -0700 @@ -51,12 +51,14 @@ from XenKvmLib.test_xml import testxml from XenKvmLib.test_doms import destroy_and_undefine_all from XenKvmLib.const import get_provider_version +from XenKvmLib.pool import enum_volumes sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] test_dom = "domgst_test" 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 @@ -227,8 +229,12 @@ 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: + volumes = enum_volumes(virt, server) + exp_len = volumes * 4 if len(assoc_info) != exp_len: logger.error("'%s' returned %i RASD objects instead of %i", diff -r 4ec367c94c35 -r 352e8509493c suites/libvirt-cim/lib/XenKvmLib/pool.py --- a/suites/libvirt-cim/lib/XenKvmLib/pool.py Wed Apr 08 02:22:53 2009 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py Wed Apr 15 20:12:04 2009 -0700 @@ -26,6 +26,8 @@ from XenKvmLib.classes import get_typed_class from XenKvmLib.const import get_provider_version from XenKvmLib.enumclass import EnumInstances +from VirtLib.utils import run_remote +from XenKvmLib.xm_virt_util import virt2uri input_graphics_pool_rev = 757 @@ -78,3 +80,16 @@ return pool_insts, PASS +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') + ret, out = run_remote(server ,cmd) + if ret != 0: + return None + lines = out.split("\n") + for line in lines: + volume = volume + 1 + + return volume +