# HG changeset patch
# User Deepti B.Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1249366976 25200
# Node ID 09572d5c821abbe37abd9f9a773345c4fe6266aa
# Parent 99510f152e670db0948e26add79869f266b826e5
[TEST] Fixing SettingsDefineCapabilities/01_forward.py
Tested with KVM on F10 and current sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 99510f152e67 -r 09572d5c821a
suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py
--- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py Mon Aug 03
23:21:10 2009 -0700
+++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py Mon Aug 03
23:22:56 2009 -0700
@@ -59,11 +59,13 @@
from XenKvmLib import enumclass
from XenKvmLib.xm_virt_util import virsh_version
from CimTest.ReturnCodes import PASS, FAIL, SKIP
-from CimTest.Globals import logger, CIM_ERROR_GETINSTANCE, CIM_ERROR_ASSOCIATORS
-from XenKvmLib.const import do_main, default_pool_name, default_network_name
+from CimTest.Globals import logger, CIM_ERROR_GETINSTANCE, \
+ CIM_ERROR_ASSOCIATORS
+from XenKvmLib.const import do_main, default_pool_name, default_network_name, \
+ get_provider_version
from XenKvmLib.classes import get_typed_class
-from XenKvmLib.common_util import print_field_error
-from XenKvmLib.rasd import get_exp_template_rasd_len
+from XenKvmLib.rasd import get_exp_template_rasd_len, \
+ libvirt_rasd_storagepool_changes
platform_sup = ['Xen', 'KVM', 'XenFV', 'LXC']
@@ -86,7 +88,7 @@
sys.exit(FAIL)
return instance
-def init_list(virt, pool):
+def init_list(virt, server, pool):
"""
Creating the lists that will be used for comparisons.
"""
@@ -98,7 +100,6 @@
if virt == 'LXC':
instlist = [ pool[1].InstanceID ]
- cllist = [ memrasd ]
rtype = { memrasd : 4 }
else:
instlist = [
@@ -107,20 +108,27 @@
pool[2].InstanceID,
pool[3].InstanceID
]
- cllist = [ diskrasd, memrasd, netrasd, procrasd ]
+
rtype = {
diskrasd : 17,
memrasd : 4,
netrasd : 10,
procrasd : 3
}
+
+ curr_cim_rev, changeset = get_provider_version(virt, server)
+ if curr_cim_rev >= libvirt_rasd_storagepool_changes:
+ sto_vol_cn = 'StorageVolumeResourceAllocationSettingData'
+ storagevol_rasd_cn = get_typed_class(virt, sto_vol_cn)
+ rtype[storagevol_rasd_cn] = 32768
+
rangelist = {
"Default" : 0,
"Minimum" : 1,
"Maximum" : 2,
"Increment" : 3
}
- return instlist, cllist, rtype, rangelist
+ return instlist, rtype, rangelist
def get_pool_info(virt, server, devid, poolname=""):
pool_cname = get_typed_class(virt, poolname)
@@ -147,21 +155,21 @@
return PASS, pool_set
-def verify_rasd_fields(loop, assoc_info, cllist, rtype, rangelist):
+def verify_rasd_fields(assoc_info, rtype, rangelist):
for inst in assoc_info:
- if inst.classname != cllist[loop]:
- print_field_error("Classname", inst.classname, cllist[loop])
+ if not inst.classname in rtype.keys():
+ logger.error("Classname Mismatch, '%s' not in
'%s'",
+ inst.classname, rtype.keys())
return FAIL
- if inst['ResourceType'] != rtype[cllist[loop]]:
- print_field_error("ResourceType", inst['ResourceType'],
- rtype[cllist[loop]])
+ if inst['ResourceType'] != rtype[inst.classname]:
+ logger.error("ResourceType Mismatch, got '%s' expected
'%s'",
+ inst['ResourceType'], rtype[inst.classname])
return FAIL
return PASS
def verify_sdc_with_ac(virt, server, pool):
- loop = 0
- instlist, cllist, rtype, rangelist = init_list(virt, pool)
+ instlist, rtype, rangelist = init_list(virt, server, pool)
assoc_cname = get_typed_class(virt, "SettingsDefineCapabilities")
cn = get_typed_class(virt, "AllocationCapabilities")
for instid in sorted(instlist):
@@ -176,12 +184,9 @@
" of %i", assoc_cname, len(assoc_info), exp_len)
status = FAIL
break
- status = verify_rasd_fields(loop, assoc_info, cllist, rtype,
- rangelist)
+ status = verify_rasd_fields(assoc_info, rtype, rangelist)
if status != PASS:
break
- else:
- loop = loop + 1
except Exception, detail:
logger.error(CIM_ERROR_ASSOCIATORS, assoc_cname)