[PATCH 0 of 4] Fixing couple of test cases

# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1251890125 25200 # Node ID 94551c9ef9b0fa53cb2ff04a5af16c8504a1da0b # Parent 4ccfbf5da9c6a03d994246d415c4ada5484594bc [TEST] Moving the check for cimom to function. Tested with F11/SLES11 with and w/o sblim-cmpi-base and KVM with current sources. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r 4ccfbf5da9c6 -r 94551c9ef9b0 suites/libvirt-cim/lib/XenKvmLib/common_util.py --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Tue Sep 01 00:21:50 2009 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Wed Sep 02 04:15:25 2009 -0700 @@ -230,6 +230,19 @@ profiles[key]['InstanceID'] = 'CIM:' + key return profiles +def check_cimom(ip): + cmd = "ps -ef | grep -v grep | grep cimserver" + rc, out = utils.run_remote(ip, cmd) + if rc != 0: + cmd = "ps -ef | grep -v grep | grep sfcbd" + rc, out = utils.run_remote(ip, cmd) + + if rc == 0 : + cmd = "%s | awk '{ print \$8 }' | uniq" % cmd + rc, out = utils.run_remote(ip, cmd) + + return rc, out + def pre_check(ip, virt): cmd = "virsh -c %s list --all" % virt2uri(virt) ret, out = utils.run_remote(ip, cmd) @@ -250,13 +263,9 @@ if ret != 0: return "Encountered an error querying for qemu-kvm and qemu " - cmd = "ps -ef | grep -v grep | grep cimserver" - rc, out = utils.run_remote(ip, cmd) + rc, out = check_cimom(ip) if rc != 0: - cmd = "ps -ef | grep -v grep | grep sfcbd" - rc, out = utils.run_remote(ip, cmd) - if rc != 0: - return "A supported CIMOM is not running" + return "A supported CIMOM is not running" cmd = "ps -ef | grep -v grep | grep libvirtd" rc, out = utils.run_remote(ip, cmd)

# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1251891184 25200 # Node ID 850e4a3c0275e31ca9a036c7743dee763d3ab870 # Parent 94551c9ef9b0fa53cb2ff04a5af16c8504a1da0b [TEST] Fixing HostedDependency/04_reverse_errs.py Tested with F11/SLES11 with and w/o sblim-cmpi-base and KVM with current sources. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r 94551c9ef9b0 -r 850e4a3c0275 suites/libvirt-cim/cimtest/HostedDependency/04_reverse_errs.py --- a/suites/libvirt-cim/cimtest/HostedDependency/04_reverse_errs.py Wed Sep 02 04:15:25 2009 -0700 +++ b/suites/libvirt-cim/cimtest/HostedDependency/04_reverse_errs.py Wed Sep 02 04:33:04 2009 -0700 @@ -36,7 +36,7 @@ from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS from XenKvmLib.const import do_main from XenKvmLib.classes import get_typed_class -from XenKvmLib.common_util import get_host_info, try_assoc +from XenKvmLib.common_util import get_host_info, try_assoc, check_cimom from CimTest.ReturnCodes import PASS, FAIL sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] @@ -44,10 +44,19 @@ test_dom = "hd_domain1" test_mac = "00:11:22:33:44:55" -def set_expr_values(host_ccn): - exp_rc = pywbem.CIM_ERR_NOT_FOUND - exp_d1 = "No such instance (Name)" - exp_d2 = "No such instance (CreationClassName)" +def set_expr_values(host_ccn, server): + rc, out = check_cimom(server) + if rc != PASS: + return None + + if (host_ccn == "Linux_ComputerSystem") and "cimserver" in out: + exp_rc = pywbem.CIM_ERR_INVALID_PARAMETER + exp_d1 = "INVALID" + exp_d2 = "INVALID" + else: + exp_rc = pywbem.CIM_ERR_NOT_FOUND + exp_d1 = "No such instance (Name)" + exp_d2 = "No such instance (CreationClassName)" expr_values = { "INVALID_NameValue" : { 'rc' : exp_rc, 'desc' : exp_d1 }, @@ -93,7 +102,9 @@ classname = host_inst.CreationClassName host_name = host_inst.Name - expr_values = set_expr_values(classname) + expr_values = set_expr_values(classname, server) + if expr_values == None: + raise Exception("Failed to initialise the error values") msg = 'Invalid Name Key Value' field='INVALID_NameValue' @@ -113,6 +124,7 @@ except Exception, details: logger.error(details) + status=FAIL cxml.cim_destroy(server) cxml.undefine(server)

# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1251892871 25200 # Node ID faa43f693e4d2df9cf3d7a9cd91d477ef37b0b10 # Parent 850e4a3c0275e31ca9a036c7743dee763d3ab870 [TEST] Fixing HostedResourcePool/03_forward_errs.py Tested with F11/SLES11 with and w/o sblim-cmpi-base and KVM with current sources. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r 850e4a3c0275 -r faa43f693e4d suites/libvirt-cim/cimtest/HostedResourcePool/03_forward_errs.py --- a/suites/libvirt-cim/cimtest/HostedResourcePool/03_forward_errs.py Wed Sep 02 04:33:04 2009 -0700 +++ b/suites/libvirt-cim/cimtest/HostedResourcePool/03_forward_errs.py Wed Sep 02 05:01:11 2009 -0700 @@ -26,7 +26,7 @@ from XenKvmLib import assoc from XenKvmLib import enumclass from XenKvmLib.common_util import get_host_info -from XenKvmLib.common_util import try_assoc +from XenKvmLib.common_util import try_assoc, check_cimom from CimTest import Globals from CimTest.Globals import logger from CimTest.ReturnCodes import PASS, FAIL @@ -55,8 +55,13 @@ Globals.CIM_NS) host_cn = host_inst.CreationClassName host_sys = host_inst.Name + + rc, out = check_cimom(options.ip) + if rc != PASS: + logger.error("Failed to get the cimom information") + return FAIL - if (host_cn == "Linux_ComputerSystem"): + if (host_cn == "Linux_ComputerSystem") and "cimserver" in out: sblim_rc = pywbem.CIM_ERR_INVALID_PARAMETER expr_values['invalid_ccname'] = {"rc" : sblim_rc, "desc" : "wrong"} expr_values['invalid_name'] = {"rc" : sblim_rc, "desc" : "wrong"}

# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1251893476 25200 # Node ID 8bb902c189fbfe8cd71fb68c4523733703966047 # Parent faa43f693e4d2df9cf3d7a9cd91d477ef37b0b10 [TEST] Fixing HostedService/03_forward_errs.py Tested with F11/SLES11 with and w/o sblim-cmpi-base and KVM with current sources. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r faa43f693e4d -r 8bb902c189fb suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py --- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Wed Sep 02 05:01:11 2009 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Wed Sep 02 05:11:16 2009 -0700 @@ -25,7 +25,7 @@ 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.common_util import get_host_info, try_assoc, check_cimom from XenKvmLib.classes import get_typed_class from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \ CIM_PASS, CIM_NS @@ -54,8 +54,12 @@ host_ccn = host_inst.CreationClassName host_name = host_inst.Name - - if (host_ccn == "Linux_ComputerSystem"): + rc, out = check_cimom(options.ip) + if rc != PASS: + logger.error("Failed to get the cimom information") + return FAIL + + if (host_ccn == "Linux_ComputerSystem") and "cimserver" in out: exp_values['invalid_ccname'] = {"rc" : pywbem.CIM_ERR_INVALID_PARAMETER, "desc" : "Linux_ComputerSystem" }
participants (1)
-
Deepti B. Kalakeri