[PATCH] [TEST] Fixing and updating 03_hs_to_settdefcap.py of HS
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1223459421 25200
# Node ID 814a0e67bb1023607349ecc9b95a4636aabcc24d
# Parent 98c505b354576e9150943b9f7f1bfd4a70347dab
[TEST] Fixing and updating 03_hs_to_settdefcap.py of HS.
1) Fixed the tc which was failing for Xen and XenFV bcs of the changes as part of "Add condensed template functions, update sdc_rasds_for_type() & sdc_rasd_inst()"
2) Updated the tc to use cim_define.
3) updated the bug no for sblim-base-provider
4) Removed the rangelist param since it was not being used, we can verify the RASD specific things which are available when queried with SDC in the SDC/01_forward.py tc.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 98c505b35457 -r 814a0e67bb10 suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py
--- a/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py Tue Oct 07 02:42:02 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py Wed Oct 08 02:50:21 2008 -0700
@@ -47,13 +47,14 @@ from XenKvmLib.classes import get_typed_
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORNAMES
from XenKvmLib.const import do_main
-from CimTest.ReturnCodes import PASS, FAIL
+from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
from XenKvmLib.test_xml import testxml
from XenKvmLib.test_doms import destroy_and_undefine_all
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
-test_dom = "domgst"
+test_dom = "domgst_test"
test_vcpus = 1
+bug_sblim='00007'
def setup_env(server, virt="Xen"):
status = PASS
@@ -63,7 +64,7 @@ def setup_env(server, virt="Xen"):
else:
vsxml = get_class(virt)(test_dom, vcpus=test_vcpus)
- ret = vsxml.define(server)
+ ret = vsxml.cim_define(server)
if not ret:
logger.error("Failed to define the dom: %s", test_dom)
status = FAIL
@@ -95,7 +96,6 @@ def get_inst_from_list(cn, qcn, list, fi
return status, inst
def get_hostsys(server, virt="Xen"):
- cn = '%s_HostSystem' % virt
status = PASS
host = live.hostname(server)
@@ -103,7 +103,7 @@ def get_hostsys(server, virt="Xen"):
status, hostname, clsname = get_host_info(server, virt)
if hostname != host:
status = FAIL
- logger.error("Hostname mismatch %s : %s" % (cn, host))
+ logger.error("Hostname mismatch")
except Exception, detail:
logger.error("Exception in %s : %s" % (cn, detail))
@@ -112,8 +112,7 @@ def get_hostsys(server, virt="Xen"):
return status, hostname, clsname
def get_hostrespool(server, hostsys, clsname, virt="Xen"):
- ccn1 = '%s_HostSystem' % virt
- an1 = '%s_HostedResourcePool' % virt
+ an1 = get_typed_class(virt, "HostedResourcePool")
status = PASS
devpool = []
@@ -127,14 +126,16 @@ def get_hostrespool(server, hostsys, cls
try:
assoc_info = Associators(server,
an1,
- ccn1,
+ clsname,
CreationClassName = clsname,
Name = hostsys)
if len(assoc_info) < 4:
- logger.error("HostedResourcePool has returned %i instances, expected 4 \
-instances", len(assoc_info))
- status = FAIL
- return status, devpool
+ if clsname == 'Linux_ComputerSystem':
+ return XFAIL_RC(bug_sblim), devpool
+ else:
+ logger.error("'%s' has returned %i instances, expected 4"
+ " instances", an1, len(assoc_info))
+ return FAIL, devpool
for inst in assoc_info:
for a, val in ccnlist.items():
@@ -143,14 +144,14 @@ instances", len(assoc_info))
devpool.append(inst)
except Exception, detail:
- print_err(CIM_ERROR_ASSOCIATORNAMES, detail, ccn1)
+ print_err(CIM_ERROR_ASSOCIATORNAMES, detail, clsname)
status = FAIL
return status, devpool
def get_alloccap(server, devpool, virt="Xen"):
- an = '%s_ElementCapabilities' % virt
- cn = '%s_AllocationCapabilities' % virt
+ an = get_typed_class(virt, 'ElementCapabilities')
+ cn = get_typed_class(virt, 'AllocationCapabilities')
status = FAIL
alloccap = []
filter = {"key" : "ResourceType"}
@@ -171,7 +172,7 @@ def get_alloccap(server, devpool, virt="
InstanceID = inst['InstanceID'])
if len(assoc_info) < 1:
- logger.error("ElementCapabilities has returned %i objects", len(assoc_info))
+ logger.error("'%s' has returned %i objects", an, len(assoc_info))
status = FAIL
return status, alloccap
@@ -195,8 +196,8 @@ def get_rasddetails(server, alloccap, vi
def get_rasddetails(server, alloccap, virt="Xen"):
status = PASS
- ccn = '%s_AllocationCapabilities' % virt
- an = '%s_SettingsDefineCapabilities' % virt
+ ccn = get_typed_class(virt, 'AllocationCapabilities')
+ an = get_typed_class(virt, 'SettingsDefineCapabilities')
if virt == 'LXC':
rtype = { "%s_MemResourceAllocationSettingData" % virt : 4 }
@@ -207,13 +208,6 @@ def get_rasddetails(server, alloccap, vi
"%s_NetResourceAllocationSettingData" % virt : 10, \
"%s_ProcResourceAllocationSettingData" % virt : 3
}
- rangelist = {
- "Default" : 0, \
- "Minimum" : 1, \
- "Maximum" : 2, \
- "Increment" : 3
- }
-
try:
for ap in alloccap:
assoc_info = Associators(server,
@@ -221,19 +215,26 @@ def get_rasddetails(server, alloccap, vi
ccn,
InstanceID = ap['InstanceID'])
- if len(assoc_info) != 4:
- logger.error("SettingsDefineCapabilities returned %i ResourcePool \
-objects instead of 4", len(assoc_info))
+ if 'DiskPool' in ap['InstanceID'] and virt =='Xen':
+ # For Diskpool, we have info 1 for each of Min, Max,
+ # default, Increment and 1 for each of PV and FV
+ # hence 4 * 2 = 8 records
+ exp_len = 8
+ else:
+ exp_len = 4
+
+ if len(assoc_info) != exp_len:
+ logger.error("'%s' returned %i ResourcePool"
+ " objects instead of 4", an, len(assoc_info))
return FAIL
for inst in assoc_info:
cn = inst.classname
if cn in rtype:
- status = check_rasd_vals(inst, cn, rtype[cn], rangelist)
+ status = check_rasd_vals(inst, rtype[cn])
if status != PASS:
return status
-
else:
logger.error("Unexpected instance type %s" % cn)
return FAIL
@@ -244,12 +245,11 @@ objects instead of 4", len(assoc_info))
return status
-def check_rasd_vals(inst, cn, rt, rangelist):
+def check_rasd_vals(inst, rt):
try:
if inst['ResourceType'] != rt:
logger.error("In ResourceType for %s " % rt)
return FAIL
-
except Exception, detail:
logger.error("Error checking RASD attribute values %s" % detail)
return FAIL
15 years, 11 months
[PATCH] [TEST]#6 Fix HostedService - 04_reverse_errs.py to work with sblim base provider installed
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1223373237 25200
# Node ID bc0dc02df8c3f5ac46d251c2b6534feb8a927011
# Parent 311bf6eda3786eb8e47ede06c4da6dc1570aff61
[TEST]#6 Fix HostedService - 04_reverse_errs.py to work with sblim base provider installed
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 311bf6eda378 -r bc0dc02df8c3 suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py
--- a/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Sun Oct 05 23:56:40 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Tue Oct 07 02:53:57 2008 -0700
@@ -25,6 +25,7 @@ from pywbem.cim_obj import CIMInstanceNa
from pywbem.cim_obj import CIMInstanceName
from XenKvmLib import assoc
from XenKvmLib import enumclass
+from XenKvmLib.common_util import get_host_info, try_assoc
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \
CIM_PASS, CIM_NS
@@ -32,8 +33,12 @@ from CimTest.ReturnCodes import PASS, FA
from CimTest.ReturnCodes import PASS, FAIL, XFAIL
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
-exp_rc = 6 #CIM_ERR_NOT_FOUND
-exp_desc = "No such instance"
+exp_values = {
+ "invalid_ccname" : {"rc" : pywbem.CIM_ERR_NOT_FOUND, \
+ "desc" : "No such instance (CreationClassName)"},
+ "invalid_name" : {"rc" : pywbem.CIM_ERR_NOT_FOUND, \
+ "desc" : "No such instance (Name)"}
+ }
@do_main(sup_types)
def main():
@@ -41,45 +46,41 @@ def main():
rc = -1
status = FAIL
keys = ['Name', 'CreationClassName']
- try:
- host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0]
- except Exception:
- logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
+ status, host_name, host_ccn = get_host_info(options.ip, options.virt)
+ if status != PASS:
+ logger.error("Error in calling get_host_info function")
return FAIL
-
- servicelist = {get_typed_class(options.virt, "ResourcePoolConfigurationService") : "RPCS",
- get_typed_class(options.virt, "VirtualSystemManagementService") : "Management Service",
- get_typed_class(options.virt, "VirtualSystemMigrationService") : "MigrationService"}
+ rpcs = get_typed_class(options.virt, "ResourcePoolConfigurationService")
+ vsms = get_typed_class(options.virt, "VirtualSystemManagementService")
+ vsmigrations = get_typed_class(options.virt, "VirtualSystemMigrationService")
+
+ servicelist = {rpcs : "RPCS",
+ vsms : "Management Service",
+ vsmigrations : "MigrationService"}
conn = assoc.myWBEMConnection('http://%s' % options.ip,
(CIM_USER, CIM_PASS),
CIM_NS)
+ assoc_classname = get_typed_class(options.virt, "HostedService")
for k, v in servicelist.items():
- instanceref = CIMInstanceName(k,
- keybindings = {"Wrong" : v,
- "CreationClassName" : "wrong",
- "SystemCreationClassName" : host_sys.CreationClassName,
- "SystemName" : host_sys.Name})
- names = []
- try:
- names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService"))
- rc = 0
- except pywbem.CIMError, (rc, desc):
- if rc == exp_rc and desc.find(exp_desc) >= 0:
- logger.info("Got excepted rc code and error string")
- status = PASS
- else:
- logger.error("Unexpected rc code %s and description %s\n" %(rc, desc))
- except Exception, details:
- logger.error("Unknown exception happened")
- logger.error(details)
+ keys = {"Wrong" : v, "CreationClassName": k,\
+ "SystemCreationClassName": host_ccn, "SystemName" : host_name}
+ ret = try_assoc(conn, k, assoc_classname, keys, "Name",\
+ exp_values['invalid_name'], bug_no="")
+ if ret != PASS:
+ logger.error("------ FAILED: Invalid Name Key Name.------")
+ return FAIL
- if rc == 0:
- logger.error("HostedService associator should NOT return excepted result with a wrong key name and value of %s input" % k)
- status = FAIL
+ keys = {"Name" : v, "Wrong": k, "SystemCreationClassName":\
+ host_ccn, "SystemName" : host_name}
+ ret = try_assoc(conn, k, assoc_classname, keys, "Name",\
+ exp_values['invalid_ccname'], bug_no="")
+ if ret != PASS:
+ logger.error("------ FAILED: Invalid Name Key Name.------")
+ return FAIL
return status
15 years, 11 months
[PATCH] [TEST] #6 Fix HostedService - 03_forward_errs.py to work with sblim base provider installed
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1223372522 25200
# Node ID 7111776695d084f031873ca00c4e9a966ec41b7d
# Parent 311bf6eda3786eb8e47ede06c4da6dc1570aff61
[TEST] #6 Fix HostedService - 03_forward_errs.py to work with sblim base provider installed
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 311bf6eda378 -r 7111776695d0 suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Sun Oct 05 23:56:40 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Tue Oct 07 02:42:02 2008 -0700
@@ -25,15 +25,21 @@ from pywbem.cim_obj import CIMInstanceNa
from pywbem.cim_obj import CIMInstanceName
from XenKvmLib import assoc
from XenKvmLib import enumclass
+from XenKvmLib.common_util import get_host_info, try_assoc
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \
CIM_PASS, CIM_NS
from XenKvmLib.const import do_main
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL
+from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+bug = '00007'
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
-exp_rc = 6 #CIM_ERR_NOT_FOUND
-exp_desc = "No such instance"
+exp_values = {
+ "invalid_ccname" : {"rc" : pywbem.CIM_ERR_NOT_FOUND, \
+ "desc" : "No such instance (CreationClassName)"},
+ "invalid_name" : {"rc" : pywbem.CIM_ERR_NOT_FOUND, \
+ "desc" : "No such instance (Name)"}
+ }
@do_main(sup_types)
def main():
@@ -41,38 +47,38 @@ def main():
rc = -1
status = FAIL
keys = ['Name', 'CreationClassName']
- try:
- host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0]
- except Exception:
- logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
+ status, host_name, host_ccn = get_host_info(options.ip, options.virt)
+ if status != PASS:
+ logger.error("Error in calling get_host_info function")
return FAIL
conn = assoc.myWBEMConnection('http://%s' % options.ip,
(CIM_USER, CIM_PASS),
CIM_NS)
- instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"),
- keybindings = {"Wrong" : "wrong", "CreationClassName" : host_sys.CreationClassName})
+ assoc_classname = get_typed_class(options.virt, "HostedService")
+
+ keys = {"Wrong" : host_name, "CreationClassName": host_ccn}
+ ret = try_assoc(conn, host_ccn, assoc_classname, keys, "Name", \
+ exp_values['invalid_name'], bug_no="")
+ if ret != PASS:
+ if host_ccn == 'Linux_ComputerSystem':
+ return XFAIL_RC(bug)
+ else:
+ logger.error("------ FAILED: Invalid Name Key Name.------")
+ return FAIL
- names = []
+ keys = {"Name" : host_name, "Wrong" : host_ccn}
+ ret = try_assoc(conn, host_ccn, assoc_classname, keys, "CreationClassName", \
+ exp_values['invalid_ccname'], bug_no="")
+ if ret != PASS:
+ if host_ccn == 'Linux_ComputerSystem':
+ return XFAIL_RC(bug)
+ else:
+ logger.error("------ FAILED: Invalid CreationClassName Key Name.------")
+ return FAIL
- try:
- names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService"))
- rc = 0
- except pywbem.CIMError, (rc, desc):
- if rc == exp_rc and desc.find(exp_desc) >= 0:
- logger.info("Got excepted rc code and error string")
- status = PASS
- else:
- logger.error("Unexpected rc code %s and description %s\n" %(rc, desc))
- except Exception, details:
- logger.error("Unknown exception happened")
- logger.error(details)
- if rc == 0:
- logger.error("HostedService associator should NOT return excepted result with a wrong key name and value of HostSystem input")
- status = FAIL
-
return status
if __name__ == "__main__":
15 years, 11 months
[PATCH] [TEST] #5 Fix HostedService - 03_forward_errs.py to work with sblim base provider installed
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1223348123 25200
# Node ID 617b6fb544d62f056f281e75c15d2fcbebe3dac0
# Parent 311bf6eda3786eb8e47ede06c4da6dc1570aff61
[TEST] #5 Fix HostedService - 03_forward_errs.py to work with sblim base provider installed
Updats from 4 to 5:
Using try_assoc() function to verify the exceptions for the associtations
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 311bf6eda378 -r 617b6fb544d6 suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Sun Oct 05 23:56:40 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Mon Oct 06 19:55:23 2008 -0700
@@ -25,6 +25,7 @@ from pywbem.cim_obj import CIMInstanceNa
from pywbem.cim_obj import CIMInstanceName
from XenKvmLib import assoc
from XenKvmLib import enumclass
+from XenKvmLib.common_util import get_host_info, try_assoc
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \
CIM_PASS, CIM_NS
@@ -32,8 +33,12 @@ from CimTest.ReturnCodes import PASS, FA
from CimTest.ReturnCodes import PASS, FAIL, XFAIL
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
-exp_rc = 6 #CIM_ERR_NOT_FOUND
-exp_desc = "No such instance"
+exp_values = {
+ "invalid_ccname" : {"rc" : pywbem.CIM_ERR_NOT_FOUND, \
+ "desc" : "No such instance (CreationClassName)"},
+ "invalid_name" : {"rc" : pywbem.CIM_ERR_NOT_FOUND, \
+ "desc" : "No such instance (Name)"}
+ }
@do_main(sup_types)
def main():
@@ -41,38 +46,31 @@ def main():
rc = -1
status = FAIL
keys = ['Name', 'CreationClassName']
- try:
- host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0]
- except Exception:
- logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
+ status, host_name, host_ccn = get_host_info(options.ip, options.virt)
+ if status != PASS:
+ logger.error("Error in calling get_host_info function")
return FAIL
conn = assoc.myWBEMConnection('http://%s' % options.ip,
(CIM_USER, CIM_PASS),
CIM_NS)
- instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"),
- keybindings = {"Wrong" : "wrong", "CreationClassName" : host_sys.CreationClassName})
+ assoc_classname = get_typed_class(options.virt, "HostedService")
+ classname = get_typed_class(options.virt, "HostSystem")
+
+ keys = {"Wrong" : host_name, "CreationClassName": host_ccn}
+ ret = try_assoc(conn, host_ccn, assoc_classname, keys, "Name", exp_values['invalid_name'], bug_no="00007")
+ if ret != PASS and host_ccn == classname:
+ logger.error("------ FAILED: Invalid Name Key Name.------")
+ status = ret
- names = []
+ keys = {"Name" : host_name, "Wrong" : host_ccn}
+ ret = try_assoc(conn, host_ccn, assoc_classname, keys, "CreationClassName", exp_values['invalid_ccname'], bug_no="00007")
+ if ret != PASS and host_ccn == classname:
+ logger.error("------ FAILED: Invalid CreationClassName Key Name.------")
+ status = ret
- try:
- names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService"))
- rc = 0
- except pywbem.CIMError, (rc, desc):
- if rc == exp_rc and desc.find(exp_desc) >= 0:
- logger.info("Got excepted rc code and error string")
- status = PASS
- else:
- logger.error("Unexpected rc code %s and description %s\n" %(rc, desc))
- except Exception, details:
- logger.error("Unknown exception happened")
- logger.error(details)
- if rc == 0:
- logger.error("HostedService associator should NOT return excepted result with a wrong key name and value of HostSystem input")
- status = FAIL
-
return status
if __name__ == "__main__":
15 years, 11 months
[PATCH] [TEST] #5 Fix HostedService - 04_reverse_errs.py to work with sblim base provider installed
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1223349190 25200
# Node ID 4650104669be81d74b92db23176fbc3ea36a8829
# Parent 311bf6eda3786eb8e47ede06c4da6dc1570aff61
[TEST] #5 Fix HostedService - 04_reverse_errs.py to work with sblim base provider installed
Updats from 4 to 5:
Using try_assoc() function to verify the exceptions for the associtations
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 311bf6eda378 -r 4650104669be suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py
--- a/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Sun Oct 05 23:56:40 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Mon Oct 06 20:13:10 2008 -0700
@@ -25,6 +25,7 @@ from pywbem.cim_obj import CIMInstanceNa
from pywbem.cim_obj import CIMInstanceName
from XenKvmLib import assoc
from XenKvmLib import enumclass
+from XenKvmLib.common_util import get_host_info, try_assoc
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \
CIM_PASS, CIM_NS
@@ -32,8 +33,12 @@ from CimTest.ReturnCodes import PASS, FA
from CimTest.ReturnCodes import PASS, FAIL, XFAIL
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
-exp_rc = 6 #CIM_ERR_NOT_FOUND
-exp_desc = "No such instance"
+exp_values = {
+ "invalid_ccname" : {"rc" : pywbem.CIM_ERR_NOT_FOUND, \
+ "desc" : "No such instance (CreationClassName)"},
+ "invalid_name" : {"rc" : pywbem.CIM_ERR_NOT_FOUND, \
+ "desc" : "No such instance (Name)"}
+ }
@do_main(sup_types)
def main():
@@ -41,45 +46,38 @@ def main():
rc = -1
status = FAIL
keys = ['Name', 'CreationClassName']
- try:
- host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0]
- except Exception:
- logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
+ status, host_name, host_ccn = get_host_info(options.ip, options.virt)
+ if status != PASS:
+ logger.error("Error in calling get_host_info function")
return FAIL
-
- servicelist = {get_typed_class(options.virt, "ResourcePoolConfigurationService") : "RPCS",
- get_typed_class(options.virt, "VirtualSystemManagementService") : "Management Service",
- get_typed_class(options.virt, "VirtualSystemMigrationService") : "MigrationService"}
+ rpcs = get_typed_class(options.virt, "ResourcePoolConfigurationService")
+ vsms = get_typed_class(options.virt, "VirtualSystemManagementService")
+ vsmigrations = get_typed_class(options.virt, "VirtualSystemMigrationService")
+
+ servicelist = {rpcs : "RPCS",
+ vsms : "Management Service",
+ vsmigrations : "MigrationService"}
conn = assoc.myWBEMConnection('http://%s' % options.ip,
(CIM_USER, CIM_PASS),
CIM_NS)
+ assoc_classname = get_typed_class(options.virt, "HostedService")
for k, v in servicelist.items():
- instanceref = CIMInstanceName(k,
- keybindings = {"Wrong" : v,
- "CreationClassName" : "wrong",
- "SystemCreationClassName" : host_sys.CreationClassName,
- "SystemName" : host_sys.Name})
- names = []
- try:
- names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService"))
- rc = 0
- except pywbem.CIMError, (rc, desc):
- if rc == exp_rc and desc.find(exp_desc) >= 0:
- logger.info("Got excepted rc code and error string")
- status = PASS
- else:
- logger.error("Unexpected rc code %s and description %s\n" %(rc, desc))
- except Exception, details:
- logger.error("Unknown exception happened")
- logger.error(details)
+ keys = {"Wrong" : v, "CreationClassName": k, \
+ "SystemCreationClassName": host_ccn, "SystemName" : host_name}
+ ret = try_assoc(conn, k, assoc_classname, keys, "Name", exp_values['invalid_name'], bug_no="")
+ if ret != PASS:
+ logger.error("------ FAILED: Invalid Name Key Name.------")
+ status = ret
- if rc == 0:
- logger.error("HostedService associator should NOT return excepted result with a wrong key name and value of %s input" % k)
- status = FAIL
+ keys = {"Name" : v, "Wrong": k, "SystemCreationClassName": host_ccn, "SystemName" : host_name}
+ ret = try_assoc(conn, k, assoc_classname, keys, "Name", exp_values['invalid_ccname'], bug_no="")
+ if ret != PASS:
+ logger.error("------ FAILED: Invalid Name Key Name.------")
+ status = ret
return status
15 years, 11 months
[PATCH] [TEST]#2 Updating enumclass.py library and Rebasing, Fixing and updating ElementCapabilities tc to work with and without sblim-base-provider
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1223364340 25200
# Node ID 459e07fb1d302923d2734ce96d92839f0d5b370c
# Parent 311bf6eda3786eb8e47ede06c4da6dc1570aff61
[TEST]#2 Updating enumclass.py library and Rebasing, Fixing and updating ElementCapabilities tc to work with and without sblim-base-provider.
Changes from patch 1 to 2:
--------------------------
1) In 01_forward.py
Fixed the typo error from excepted to expected.
Returned FAIL instead of assigning it to status and then returning
2) In 02_reverse.py
Indented the import block
Removed the param intialisation in the verify_service fn, and changed the way verify_service() for the param change.
included the missing undefine of the guest.
changes to 01_forward.py:
-------------------------
1) Rebased and Updated the tc to work with/without sblim-base-provider.
2) Updated the tc to use cim_define(). This is req bcs the association of ElementCapabilities with the CS would not be excercised for KVM.
3) Included the bug no 00007. Included XFAIL .
4) Updated the tc to use cim.undefine().
changes to 02_reverse.py:
-------------------------
1) Fixed the return statement, this was causing the tc to pass with a false positive.
2) Updated the tc to work with/without sblim-base-provider.
3) Updated the tc to use cim_define(). This is req bcs the association of ElementCapabilities with the
EnabledLogicalElementCapabilities would not be excercised for KVM.
4) Updated the tc to use cim.undefine().
5) Added verification of the VirtualSystemMigrationService service.
6) Updated enumclas to support VirtualSystemMigrationService and VirtualSystemManagementService.
7) Removed Enumerate instance and used getInstance instead to verify the VirtualSystemMigrationService and VirtualSystemManagementService
values in the association.
Tested with Xen, XenFV, KVM on current sources and with/without sblim-base-provider installed.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 311bf6eda378 -r 459e07fb1d30 suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py
--- a/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py Sun Oct 05 23:56:40 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py Tue Oct 07 00:25:40 2008 -0700
@@ -23,17 +23,19 @@
import sys
from VirtLib import utils
from VirtLib import live
+from XenKvmLib import vxml
from XenKvmLib import assoc
from XenKvmLib import enumclass
from XenKvmLib.classes import get_typed_class
-from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORNAMES, \
- CIM_ERROR_ENUMERATE
+from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORNAMES
from XenKvmLib.const import do_main
-from CimTest.ReturnCodes import PASS, FAIL, SKIP
+from CimTest.ReturnCodes import PASS, FAIL, SKIP, XFAIL_RC
from XenKvmLib.enumclass import enumerate
from XenKvmLib.common_util import get_host_info
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
+test_dom = "dom_elecap"
+bug_sblim = "00007"
def append_to_list(server, virt, poolname, valid_elc_id):
keys_list = ['InstanceID']
@@ -67,7 +69,6 @@
logger.error("Failed to get host info")
return status
-
try:
an = get_typed_class(virt, "ElementCapabilities")
elc = assoc.AssociatorNames(server,
@@ -91,35 +92,52 @@
return status
if len(elc) == 0:
- logger.error("ElementCapabilities association failed, excepted at least one instance")
- return FAIL
+ logger.error("'%s' association failed, expected at least one instance",
+ an)
+ if host_ccn == 'Linux_ComputerSystem':
+ return XFAIL_RC(bug_sblim)
+ else:
+ return FAIL
for i in elc:
if i.classname not in valid_elc_name:
- logger.error("ElementCapabilities association classname error")
+ logger.error("'%s' association classname error", an)
return FAIL
if i['InstanceID'] not in valid_elc_id:
- logger.error("ElementCapabilities association InstanceID error ")
+ logger.error("'%s' association InstanceID error ", an)
return FAIL
+
+ virtxml = vxml.get_class(virt)
+ cxml = virtxml(test_dom)
+ ret = cxml.cim_define(server)
+ if not ret:
+ logger.error("Failed to define the dom: %s", test_dom)
+ return FAIL
cs = live.domain_list(server, virt)
ccn = get_typed_class(virt, "ComputerSystem")
for system in cs:
try:
- elec = assoc.AssociatorNames(server,
- an, ccn, Name = system,
+ elec = assoc.AssociatorNames(server, an, ccn, Name = system,
CreationClassName = ccn)
except Exception:
logger.error(CIM_ERROR_ASSOCIATORNAMES % system)
+ cxml.undefine(server)
return FAIL
+
cn = get_typed_class(virt, "EnabledLogicalElementCapabilities")
if elec[0].classname != cn:
- logger.error("ElementCapabilities association classname error")
- return FAIL
- elif elec[0].keybindings['InstanceID'] != system:
- logger.error("ElementCapabilities association InstanceID error")
+ cxml.undefine(server)
+ logger.error("'%s' association classname error", an)
return FAIL
+ if elec[0].keybindings['InstanceID'] != system:
+ logger.error("ElementCapabilities association InstanceID error")
+ cxml.undefine(server)
+ logger.error("'%s' association InstanceID error", an)
+ return FAIL
+
+ cxml.undefine(server)
return PASS
if __name__ == "__main__":
diff -r 311bf6eda378 -r 459e07fb1d30 suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py
--- a/suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py Sun Oct 05 23:56:40 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py Tue Oct 07 00:25:40 2008 -0700
@@ -26,26 +26,30 @@
from VirtLib import live
from XenKvmLib import assoc
from XenKvmLib import enumclass
-from XenKvmLib import vsms
-from XenKvmLib.classes import get_typed_class
-from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_ERROR_ASSOCIATORNAMES
+from XenKvmLib import vxml
+from XenKvmLib.classes import get_typed_class
+from XenKvmLib.classes import get_class_basename
+from XenKvmLib.common_util import get_host_info
+from CimTest.Globals import logger, CIM_ERROR_GETINSTANCE, \
+ CIM_ERROR_ASSOCIATORNAMES
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL, SKIP
+from XenKvmLib.enumclass import getInstance
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
+test_dom = "dom_elecap"
def call_assoc(ip, cn, id, virt="Xen"):
status = PASS
ec_ele = []
+ assoc_cn = get_typed_class(virt, "ElementCapabilities")
try:
ec_ele = assoc.AssociatorNames(ip,
- "ElementCapabilities",
+ assoc_cn,
cn,
- virt,
InstanceID = id)
except Exception:
- logger.error(CIM_ERROR_ASSOCIATORNAMES,
- 'ElementCapabilities')
+ logger.error(CIM_ERROR_ASSOCIATORNAMES, assoc_cn)
status = FAIL
return status, ec_ele
@@ -57,102 +61,127 @@
return FAIL, new_list
return PASS, new_list
-def verify_host(inst_list, ip, virt="Xen"):
- hs = get_typed_class(virt, 'HostSystem')
- status, list = filter(inst_list, hs, 1)
+def verify_host(inst_list, host_name, host_ccn):
+ status, list = filter(inst_list, host_ccn, 1)
if status != PASS:
return status
inst = list[0]
- keys = ['Name', 'CreationClassName']
+ creationclassname = inst.keybindings['CreationClassName']
+ name = inst.keybindings['Name']
+
+ if creationclassname != host_ccn:
+ logger.error("CreationClassName doesn't match")
+ return FAIL
+
+ if name != host_name:
+ logger.error("Name doesn't match")
+ return FAIL
+
+ return PASS
+
+def verify_service(inst_list, ip, virt, host_name, host_ccn,
+ name, ser_cn):
+ status, list = filter(inst_list, ser_cn, 1)
+ if status != PASS:
+ return status
+
+ inst = list[0]
+ keys = {
+ 'CreationClassName' : ser_cn,
+ 'Name' : name,
+ 'SystemName' : host_name,
+ 'SystemCreationClassName' : host_ccn
+ }
try:
- host_sys = enumclass.enumerate(ip, 'HostSystem', keys, virt)[0]
- except Exception:
- logger.error(CIM_ERROR_ENUMERATE, 'HostSystem')
+ basename = get_class_basename(ser_cn)
+ service = getInstance(ip, basename, keys, virt)
+ except Exception, detail:
+ logger.error(CIM_ERROR_GETINSTANCE, ser_cn)
+ logger.error("Exeption : %s", detail)
return FAIL
creationclassname = inst.keybindings['CreationClassName']
name = inst.keybindings['Name']
- if creationclassname != host_sys.CreationClassName:
+ if creationclassname != service.CreationClassName:
logger.error("CreationClassName doesn't match")
return FAIL
- elif name != host_sys.Name:
- logger.error("Name doesn't match")
- return FAIL
- return PASS
-
-def verify_service(inst_list, ip, virt):
- service = get_typed_class(virt, "VirtualSystemManagementService")
- status, list = filter(inst_list, service, 1)
- if status != PASS:
- return status
-
- inst = list[0]
- try:
- service = vsms.enumerate_instances(ip, virt)[0]
- except Exception:
- logger.error(CIM_ERROR_ENUMERATE,
- 'VirtualSystemManagementService')
- return FAIL
-
- creationclassname = inst.keybindings['CreationClassName']
- name = inst.keybindings['Name']
-
- if creationclassname != service['CreationClassName']:
- logger.error("CreationClassName doesn't match")
- return FAIL
- elif name != service['Name']:
+ if name != service.Name:
logger.error("InstanceID doesn't match")
return FAIL
-
return PASS
@do_main(sup_types)
def main():
options = main.options
-
+
cap_list = {"VirtualSystemManagementCapabilities" : "ManagementCapabilities",
- "VirtualSystemMigrationCapabilities" : "MigrationCapabilities"}
- import pdb
- #pdb.set_trace()
+ "VirtualSystemMigrationCapabilities" : "MigrationCapabilities"}
+
+ status, host_name, host_ccn = get_host_info(options.ip, options.virt)
+ if status != PASS:
+ logger.error("Failed to get host info")
+ return status
+
for k, v in cap_list.iteritems():
- status, ec_ele = call_assoc(options.ip, k, v, options.virt)
+ cn = get_typed_class(options.virt, k)
+ status, ec_ele = call_assoc(options.ip, cn, v, options.virt)
if status != PASS:
- return
-
- status = verify_host(ec_ele, options.ip, options.virt)
+ return FAIL
+
+ status = verify_host(ec_ele, host_name, host_ccn)
if status != PASS:
return status
-
+
if v == 'ManagementCapabilities':
- status = verify_service(ec_ele, options.ip, options.virt)
- if status != PASS:
- return status
+ cn = get_typed_class(options.virt, "VirtualSystemManagementService")
+ status = verify_service(ec_ele, options.ip, options.virt,
+ host_name, host_ccn,
+ "Management Service", cn)
+ else:
+ cn = get_typed_class(options.virt, "VirtualSystemMigrationService")
+ status = verify_service(ec_ele, options.ip, options.virt,
+ host_name, host_ccn,
+ "MigrationService", cn)
+ if status != PASS:
+ return status
+
+ virtxml = vxml.get_class(options.virt)
+ cxml = virtxml(test_dom)
+ ret = cxml.cim_define(options.ip)
+ if not ret:
+ logger.error("Failed to define the dom: %s" % test_dom)
+ return FAIL
cs = live.domain_list(options.ip, options.virt)
for system in cs:
- status, elec_cs = call_assoc(options.ip,
- "EnabledLogicalElementCapabilities",
- system,
- options.virt)
+ cn = get_typed_class(options.virt, "EnabledLogicalElementCapabilities")
+ status, elec_cs = call_assoc(options.ip, cn, system, options.virt)
if status != PASS:
- return
+ cxml.undefine(options.ip)
+ return FAIL
if len(elec_cs) < 1:
logger.error("No ELEC instances returned")
+ cxml.undefine(options.ip)
return FAIL
- if elec_cs[0].keybindings['CreationClassName'] != get_typed_class(options.virt, "ComputerSystem"):
- logger.error("Excpeted CreationClassName %s, got %s" %
- ("ComputerSystem",
- elec_cs[0].keybindings['CreationClassName']))
- return FAIL
- elif elec_cs[0].keybindings['Name'] != system:
- logger.error("ElementCapabilities association Name error")
+ if elec_cs[0].keybindings['CreationClassName'] != \
+ get_typed_class(options.virt, "ComputerSystem"):
+ logger.error("Excpeted CreationClassName %s, got %s",
+ "ComputerSystem",
+ elec_cs[0].keybindings['CreationClassName'])
+ cxml.undefine(options.ip)
return FAIL
+ if elec_cs[0].keybindings['Name'] != system:
+ logger.error("ElementCapabilities association Name error")
+ cxml.undefine(options.ip)
+ return FAIL
+
+ cxml.undefine(options.ip)
return PASS
if __name__ == "__main__":
diff -r 311bf6eda378 -r 459e07fb1d30 suites/libvirt-cim/lib/XenKvmLib/enumclass.py
--- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Sun Oct 05 23:56:40 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Tue Oct 07 00:25:40 2008 -0700
@@ -336,6 +336,25 @@
class KVM_DiskResourceAllocationSettingData(CIM_DiskResourceAllocationSettingData):
pass
+class KVM_VirtualSystemMigrationService(CIM_MyClass):
+ pass
+
+class Xen_VirtualSystemMigrationService(CIM_MyClass):
+ pass
+
+class LXC_VirtualSystemMigrationService(CIM_MyClass):
+ pass
+
+class Xen_VirtualSystemManagementService(CIM_MyClass):
+ pass
+
+class KVM_VirtualSystemManagementService(CIM_MyClass):
+ pass
+
+class LXC_VirtualSystemManagementService(CIM_MyClass):
+ pass
+
+
# Generic function which can be used to get the enumerate instances of any
# class when the following fields are specified
# classname = any class for which we want obtain the instances
15 years, 11 months
[PATCH] [TEST] #4 Fix HostedService - 03_forward_errs.py to work with sblim base provider installed
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1223272339 25200
# Node ID bdb5911993d5e56c6398a447b3e5eabc5d41f83d
# Parent b710ecb26adf500caa6b801fdf10e4efbed3877e
[TEST] #4 Fix HostedService - 03_forward_errs.py to work with sblim base provider installed
Updates from 3 to 4:
1) Update the tc to verify the case when we pass Invalid CreationClassName
2) Verify the complete exception instead of just verifying part of it
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r b710ecb26adf -r bdb5911993d5 suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py
--- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Fri Oct 03 06:34:29 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Sun Oct 05 22:52:19 2008 -0700
@@ -25,6 +25,7 @@ from pywbem.cim_obj import CIMInstanceNa
from pywbem.cim_obj import CIMInstanceName
from XenKvmLib import assoc
from XenKvmLib import enumclass
+from XenKvmLib.common_util import get_host_info
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \
CIM_PASS, CIM_NS
@@ -33,7 +34,8 @@ from CimTest.ReturnCodes import PASS, FA
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
exp_rc = 6 #CIM_ERR_NOT_FOUND
-exp_desc = "No such instance"
+exp_desc = ["No such instance (Name)",
+ "No such instance (CreationClassName)"]
@do_main(sup_types)
def main():
@@ -41,37 +43,41 @@ def main():
rc = -1
status = FAIL
keys = ['Name', 'CreationClassName']
- try:
- host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0]
- except Exception:
- logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
+ status, host_name, host_ccn = get_host_info(options.ip, options.virt)
+ if status != PASS:
+ logger.error("Error in calling get_host_info function")
return FAIL
-
conn = assoc.myWBEMConnection('http://%s' % options.ip,
(CIM_USER, CIM_PASS),
CIM_NS)
- instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"),
- keybindings = {"Wrong" : "wrong", "CreationClassName" : host_sys.CreationClassName})
-
+ hostsystem = get_typed_class(options.virt, "HostSystem")
+ instanceref = [CIMInstanceName(hostsystem,
+ keybindings = {"Wrong" : "wrong", "CreationClassName" : host_ccn}),
+ CIMInstanceName(hostsystem,
+ keybindings = {"Name" : host_name, "Wrong" : "wrong"})]
+
names = []
- try:
- names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService"))
- rc = 0
- except pywbem.CIMError, (rc, desc):
- if rc == exp_rc and desc.find(exp_desc) >= 0:
- logger.info("Got excepted rc code and error string")
- status = PASS
- else:
- logger.error("Unexpected rc code %s and description %s\n" %(rc, desc))
- except Exception, details:
- logger.error("Unknown exception happened")
- logger.error(details)
+ hostedservice = get_typed_class(options.virt, "HostedService")
+ for i in range(0, len(instanceref)):
+ try:
+ names = conn.AssociatorNames(instanceref[i], AssocClass = hostedservice)
+ rc = 0
+ except pywbem.CIMError, (rc, desc):
+ if rc == exp_rc and desc.find(exp_desc[i]) >= 0:
+ logger.info("Got excepted rc code and error string")
+ status = PASS
+ else:
+ logger.error("Unexpected rc code %s and description %s\n" %(rc, desc))
+ except Exception, details:
+ logger.error("Unknown exception happened")
+ logger.error(details)
- if rc == 0:
- logger.error("HostedService associator should NOT return excepted result with a wrong key name and value of HostSystem input")
- status = FAIL
+ if rc == 0:
+ logger.error("HostedService associator should NOT return excepted result\
+ with a wrong key name and value of HostSystem input")
+ status = FAIL
return status
15 years, 11 months
[PATCH] [TEST] #4 Fix HostedService-04_reverse_errs.py to work with sblim base provider installed
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1223273159 25200
# Node ID 3e0a467ec1227d04e2478ff7c10447a00459d246
# Parent b710ecb26adf500caa6b801fdf10e4efbed3877e
[TEST] #4 Fix HostedService-04_reverse_errs.py to work with sblim base provider installed
Updates form 3 to 4:
verifying the complete exception instead of just verifying part of it
Follow up patch will to verify other exceptions except invalid Name
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r b710ecb26adf -r 3e0a467ec122 suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py
--- a/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Fri Oct 03 06:34:29 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Sun Oct 05 23:05:59 2008 -0700
@@ -25,6 +25,7 @@ from pywbem.cim_obj import CIMInstanceNa
from pywbem.cim_obj import CIMInstanceName
from XenKvmLib import assoc
from XenKvmLib import enumclass
+from XenKvmLib.common_util import get_host_info
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \
CIM_PASS, CIM_NS
@@ -33,20 +34,17 @@ from CimTest.ReturnCodes import PASS, FA
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
exp_rc = 6 #CIM_ERR_NOT_FOUND
-exp_desc = "No such instance"
+exp_desc = "No such instance (Name)"
@do_main(sup_types)
def main():
options = main.options
rc = -1
status = FAIL
- keys = ['Name', 'CreationClassName']
- try:
- host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0]
- except Exception:
- logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
+ status, host_name, host_ccn = get_host_info(options.ip, options.virt)
+ if status != PASS:
+ logger.error("Error in calling get_host_info function")
return FAIL
-
servicelist = {get_typed_class(options.virt, "ResourcePoolConfigurationService") : "RPCS",
get_typed_class(options.virt, "VirtualSystemManagementService") : "Management Service",
@@ -59,13 +57,14 @@ def main():
for k, v in servicelist.items():
instanceref = CIMInstanceName(k,
keybindings = {"Wrong" : v,
- "CreationClassName" : "wrong",
- "SystemCreationClassName" : host_sys.CreationClassName,
- "SystemName" : host_sys.Name})
+ "CreationClassName" : k,
+ "SystemCreationClassName" : host_ccn,
+ "SystemName" : host_name})
names = []
-
+
+ assoc_class = get_typed_class(options.virt, "HostedService")
try:
- names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService"))
+ names = conn.AssociatorNames(instanceref, AssocClass = assoc_class)
rc = 0
except pywbem.CIMError, (rc, desc):
if rc == exp_rc and desc.find(exp_desc) >= 0:
@@ -78,7 +77,8 @@ def main():
logger.error(details)
if rc == 0:
- logger.error("HostedService associator should NOT return excepted result with a wrong key name and value of %s input" % k)
+ logger.error("HostedService associator should NOT return excepted result\
+ with a wrong key name and value of %s input" % k)
status = FAIL
return status
15 years, 11 months
[PATCH] [TEST] Updating enumclass.py library and Rebasing, Fixing and updating ElementCapabilities tc to work with and without sblim-base-provider
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1223289748 25200
# Node ID 13af302129be5d68230f6eabf2a268eb5f17f1e3
# Parent b710ecb26adf500caa6b801fdf10e4efbed3877e
[TEST] Updating enumclass.py library and Rebasing, Fixing and updating ElementCapabilities tc to work with and without sblim-base-provider.
changes to 01_forward.py:
-------------------------
1) Rebased and Updated the tc to work with/without sblim-base-provider.
2) Updated the tc to use cim_define(). This is req bcs the association of ElementCapabilities with the CS would not be excercised for KVM.
3) Included the bug no 00007. Included XFAIL .
4) Updated the tc to use cim.undefine().
changes to 02_reverse.py:
-------------------------
1) Fixed the return statement, this was causing the tc to pass with a false positive.
2) Updated the tc to work with/without sblim-base-provider.
3) Updated the tc to use cim_define(). This is req bcs the association of ElementCapabilities with the
EnabledLogicalElementCapabilities would not be excercised for KVM.
4) Updated the tc to use cim.undefine().
5) Added verification of the VirtualSystemMigrationService service.
6) Updated enumclas to support VirtualSystemMigrationService and VirtualSystemManagementService.
7) Removed Enumerate instance and used getInstance instead to verify the VirtualSystemMigrationService and VirtualSystemManagementService
values in the association.
Tested with Xen, XenFV, KVM on current sources and with/without sblim-base-provider installed.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r b710ecb26adf -r 13af302129be suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py
--- a/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py Fri Oct 03 06:34:29 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py Mon Oct 06 03:42:28 2008 -0700
@@ -23,17 +23,19 @@
import sys
from VirtLib import utils
from VirtLib import live
+from XenKvmLib import vxml
from XenKvmLib import assoc
from XenKvmLib import enumclass
from XenKvmLib.classes import get_typed_class
-from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORNAMES, \
- CIM_ERROR_ENUMERATE
+from CimTest.Globals import logger, CIM_ERROR_ASSOCIATORNAMES
from XenKvmLib.const import do_main
-from CimTest.ReturnCodes import PASS, FAIL, SKIP
+from CimTest.ReturnCodes import PASS, FAIL, SKIP, XFAIL_RC
from XenKvmLib.enumclass import enumerate
from XenKvmLib.common_util import get_host_info
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
+test_dom = "dom_elecap"
+bug_sblim = "00007"
def append_to_list(server, virt, poolname, valid_elc_id):
keys_list = ['InstanceID']
@@ -67,7 +69,6 @@
logger.error("Failed to get host info")
return status
-
try:
an = get_typed_class(virt, "ElementCapabilities")
elc = assoc.AssociatorNames(server,
@@ -91,35 +92,52 @@
return status
if len(elc) == 0:
- logger.error("ElementCapabilities association failed, excepted at least one instance")
- return FAIL
+ logger.error("'%s' association failed, excepted at least one instance",
+ an)
+ if host_ccn == 'Linux_ComputerSystem':
+ return XFAIL_RC(bug_sblim)
+ else:
+ return FAIL
for i in elc:
if i.classname not in valid_elc_name:
- logger.error("ElementCapabilities association classname error")
+ logger.error("'%s' association classname error", an)
return FAIL
if i['InstanceID'] not in valid_elc_id:
- logger.error("ElementCapabilities association InstanceID error ")
+ logger.error("'%s' association InstanceID error ", an)
return FAIL
+
+ virtxml = vxml.get_class(virt)
+ cxml = virtxml(test_dom)
+ ret = cxml.cim_define(server)
+ if not ret:
+ logger.error("Failed to define the dom: %s", test_dom)
+ status = FAIL
+ return status
cs = live.domain_list(server, virt)
ccn = get_typed_class(virt, "ComputerSystem")
for system in cs:
try:
- elec = assoc.AssociatorNames(server,
- an, ccn, Name = system,
+ elec = assoc.AssociatorNames(server, an, ccn, Name = system,
CreationClassName = ccn)
except Exception:
logger.error(CIM_ERROR_ASSOCIATORNAMES % system)
+ cxml.undefine(server)
return FAIL
+
cn = get_typed_class(virt, "EnabledLogicalElementCapabilities")
if elec[0].classname != cn:
- logger.error("ElementCapabilities association classname error")
+ cxml.undefine(server)
+ logger.error("'%s' association classname error", an)
return FAIL
elif elec[0].keybindings['InstanceID'] != system:
logger.error("ElementCapabilities association InstanceID error")
+ cxml.undefine(server)
+ logger.error("'%s' association InstanceID error", an)
return FAIL
+ cxml.undefine(server)
return PASS
if __name__ == "__main__":
diff -r b710ecb26adf -r 13af302129be suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py
--- a/suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py Fri Oct 03 06:34:29 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py Mon Oct 06 03:42:28 2008 -0700
@@ -26,26 +26,30 @@
from VirtLib import live
from XenKvmLib import assoc
from XenKvmLib import enumclass
-from XenKvmLib import vsms
-from XenKvmLib.classes import get_typed_class
-from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_ERROR_ASSOCIATORNAMES
+from XenKvmLib import vxml
+from XenKvmLib.classes import get_typed_class
+from XenKvmLib.classes import get_class_basename
+from XenKvmLib.common_util import get_host_info
+from CimTest.Globals import logger, CIM_ERROR_GETINSTANCE, \
+CIM_ERROR_ASSOCIATORNAMES
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL, SKIP
+from XenKvmLib.enumclass import getInstance
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
+test_dom = "dom_elecap"
def call_assoc(ip, cn, id, virt="Xen"):
status = PASS
ec_ele = []
+ assoc_cn = get_typed_class(virt, "ElementCapabilities")
try:
ec_ele = assoc.AssociatorNames(ip,
- "ElementCapabilities",
+ assoc_cn,
cn,
- virt,
InstanceID = id)
except Exception:
- logger.error(CIM_ERROR_ASSOCIATORNAMES,
- 'ElementCapabilities')
+ logger.error(CIM_ERROR_ASSOCIATORNAMES, assoc_cn)
status = FAIL
return status, ec_ele
@@ -57,102 +61,126 @@
return FAIL, new_list
return PASS, new_list
-def verify_host(inst_list, ip, virt="Xen"):
- hs = get_typed_class(virt, 'HostSystem')
- status, list = filter(inst_list, hs, 1)
+def verify_host(inst_list, host_name, host_ccn):
+ status, list = filter(inst_list, host_ccn, 1)
if status != PASS:
return status
inst = list[0]
- keys = ['Name', 'CreationClassName']
+ creationclassname = inst.keybindings['CreationClassName']
+ name = inst.keybindings['Name']
+
+ if creationclassname != host_ccn:
+ logger.error("CreationClassName doesn't match")
+ return FAIL
+
+ if name != host_name:
+ logger.error("Name doesn't match")
+ return FAIL
+
+ return PASS
+
+def verify_service(inst_list, ip, virt, host_name, host_ccn,
+ name=" ", ser_cn=""):
+ status, list = filter(inst_list, ser_cn, 1)
+ if status != PASS:
+ return status
+
+ inst = list[0]
+ keys = {
+ 'CreationClassName' : ser_cn,
+ 'Name' : name,
+ 'SystemName' : host_name,
+ 'SystemCreationClassName' : host_ccn
+ }
try:
- host_sys = enumclass.enumerate(ip, 'HostSystem', keys, virt)[0]
- except Exception:
- logger.error(CIM_ERROR_ENUMERATE, 'HostSystem')
+ basename = get_class_basename(ser_cn)
+ service = getInstance(ip, basename, keys, virt)
+ except Exception, detail:
+ logger.error(CIM_ERROR_GETINSTANCE, ser_cn)
+ logger.error("Exeption : %s", detail)
return FAIL
creationclassname = inst.keybindings['CreationClassName']
name = inst.keybindings['Name']
- if creationclassname != host_sys.CreationClassName:
+ if creationclassname != service.CreationClassName:
logger.error("CreationClassName doesn't match")
return FAIL
- elif name != host_sys.Name:
- logger.error("Name doesn't match")
- return FAIL
- return PASS
-
-def verify_service(inst_list, ip, virt):
- service = get_typed_class(virt, "VirtualSystemManagementService")
- status, list = filter(inst_list, service, 1)
- if status != PASS:
- return status
-
- inst = list[0]
- try:
- service = vsms.enumerate_instances(ip, virt)[0]
- except Exception:
- logger.error(CIM_ERROR_ENUMERATE,
- 'VirtualSystemManagementService')
- return FAIL
-
- creationclassname = inst.keybindings['CreationClassName']
- name = inst.keybindings['Name']
-
- if creationclassname != service['CreationClassName']:
- logger.error("CreationClassName doesn't match")
- return FAIL
- elif name != service['Name']:
+ if name != service.Name:
logger.error("InstanceID doesn't match")
return FAIL
-
return PASS
@do_main(sup_types)
def main():
options = main.options
-
+
cap_list = {"VirtualSystemManagementCapabilities" : "ManagementCapabilities",
- "VirtualSystemMigrationCapabilities" : "MigrationCapabilities"}
- import pdb
- #pdb.set_trace()
+ "VirtualSystemMigrationCapabilities" : "MigrationCapabilities"}
+
+ status, host_name, host_ccn = get_host_info(options.ip, options.virt)
+ if status != PASS:
+ logger.error("Failed to get host info")
+ return status
+
for k, v in cap_list.iteritems():
- status, ec_ele = call_assoc(options.ip, k, v, options.virt)
+ cn = get_typed_class(options.virt, k)
+ status, ec_ele = call_assoc(options.ip, cn, v, options.virt)
if status != PASS:
- return
-
- status = verify_host(ec_ele, options.ip, options.virt)
+ return FAIL
+
+ status = verify_host(ec_ele, host_name, host_ccn)
if status != PASS:
return status
-
+
if v == 'ManagementCapabilities':
- status = verify_service(ec_ele, options.ip, options.virt)
- if status != PASS:
- return status
+ cn = get_typed_class(options.virt, "VirtualSystemManagementService")
+ status = verify_service(ec_ele, options.ip, options.virt,
+ host_name, host_ccn,
+ name="Management Service", ser_cn=cn)
+ else:
+ cn = get_typed_class(options.virt, "VirtualSystemMigrationService")
+ status = verify_service(ec_ele, options.ip, options.virt,
+ host_name, host_ccn,
+ name="MigrationService", ser_cn=cn)
+ if status != PASS:
+ return status
+
+ virtxml = vxml.get_class(options.virt)
+ cxml = virtxml(test_dom)
+ ret = cxml.cim_define(options.ip)
+ if not ret:
+ logger.error("Failed to define the dom: %s" % test_dom)
+ return FAIL
cs = live.domain_list(options.ip, options.virt)
for system in cs:
- status, elec_cs = call_assoc(options.ip,
- "EnabledLogicalElementCapabilities",
- system,
- options.virt)
+ cn = get_typed_class(options.virt, "EnabledLogicalElementCapabilities")
+ status, elec_cs = call_assoc(options.ip, cn, system, options.virt)
if status != PASS:
- return
+ return FAIL
if len(elec_cs) < 1:
logger.error("No ELEC instances returned")
+ cxml.undefine(options.ip)
return FAIL
- if elec_cs[0].keybindings['CreationClassName'] != get_typed_class(options.virt, "ComputerSystem"):
- logger.error("Excpeted CreationClassName %s, got %s" %
- ("ComputerSystem",
- elec_cs[0].keybindings['CreationClassName']))
- return FAIL
- elif elec_cs[0].keybindings['Name'] != system:
- logger.error("ElementCapabilities association Name error")
+ if elec_cs[0].keybindings['CreationClassName'] != \
+ get_typed_class(options.virt, "ComputerSystem"):
+ logger.error("Excpeted CreationClassName %s, got %s",
+ "ComputerSystem",
+ elec_cs[0].keybindings['CreationClassName'])
+ cxml.undefine(options.ip)
return FAIL
+ if elec_cs[0].keybindings['Name'] != system:
+ logger.error("ElementCapabilities association Name error")
+ cxml.undefine(options.ip)
+ return FAIL
+
+ cxml.undefine(options.ip)
return PASS
if __name__ == "__main__":
diff -r b710ecb26adf -r 13af302129be suites/libvirt-cim/lib/XenKvmLib/enumclass.py
--- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Fri Oct 03 06:34:29 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Mon Oct 06 03:42:28 2008 -0700
@@ -336,6 +336,25 @@
class KVM_DiskResourceAllocationSettingData(CIM_DiskResourceAllocationSettingData):
pass
+class KVM_VirtualSystemMigrationService(CIM_MyClass):
+ pass
+
+class Xen_VirtualSystemMigrationService(CIM_MyClass):
+ pass
+
+class LXC_VirtualSystemMigrationService(CIM_MyClass):
+ pass
+
+class Xen_VirtualSystemManagementService(CIM_MyClass):
+ pass
+
+class KVM_VirtualSystemManagementService(CIM_MyClass):
+ pass
+
+class LXC_VirtualSystemManagementService(CIM_MyClass):
+ pass
+
+
# Generic function which can be used to get the enumerate instances of any
# class when the following fields are specified
# classname = any class for which we want obtain the instances
15 years, 11 months