
# HG changeset patch # User Guolian Yun <yunguol@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@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