[PATCH] [TEST] Fix HostedService-04_reverse_errs.py with sblim base provider installed

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1222423490 25200 # Node ID 44dca82a22ed59b8ad1c9f7ea81b918306efc755 # Parent 61a90c7c9141a64af825e6d4e5645723879df078 [TEST] Fix HostedService-04_reverse_errs.py with sblim base provider installed Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r 61a90c7c9141 -r 44dca82a22ed suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py --- a/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Wed Sep 24 20:27:48 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Fri Sep 26 03:04:50 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 check_sblim from XenKvmLib.classes import get_typed_class from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_USER, \ CIM_PASS, CIM_NS @@ -40,12 +41,16 @@ 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) - return FAIL + ret, linux_cs = check_sblim(options.ip, options.virt) + if ret == PASS: + host_sys = linux_cs + else: + 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) + return FAIL servicelist = {get_typed_class(options.virt, "ResourcePoolConfigurationService") : "RPCS", @@ -65,7 +70,8 @@ def main(): names = [] try: - names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService")) + 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: @@ -78,7 +84,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

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) - return FAIL + ret, linux_cs = check_sblim(options.ip, options.virt) + if ret == PASS: + host_sys = linux_cs + else: + 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) + return FAIL
You can use get_host_info() instead.
servicelist = {get_typed_class(options.virt, "ResourcePoolConfigurationService") : "RPCS", @@ -65,7 +70,8 @@ def main(): names = []
try: - names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService")) + names = conn.AssociatorNames(instanceref, AssocClass = \ + get_typed_class(options.virt, "HostedService"))
The alignment here is a little strange. Usually, you align like the following: names = conn.AssociatorNames(instanceref, AssocClass=\ get_typed_class(options.virt, "HostedService")) But instead, I'd suggest doing something like: hostedserv_cn = get_typed_class(options.virt, "HostedService")) names = conn.AssociatorNames(instanceref, AssocClass=hostedserv_cn) -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

libvirt-cim-bounces@redhat.com wrote on 2008-09-27 05:57:48:
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) - return FAIL + ret, linux_cs = check_sblim(options.ip, options.virt) + if ret == PASS: + host_sys = linux_cs + else: + 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) + return FAIL
You can use get_host_info() instead.
servicelist = {get_typed_class(options.virt,
"ResourcePoolConfigurationService") : "RPCS",
@@ -65,7 +70,8 @@ def main(): names = []
try: - names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService")) + names = conn.AssociatorNames(instanceref, AssocClass = \ + get_typed_class(options.virt, "HostedService"))
The alignment here is a little strange. Usually, you align like the following:
names = conn.AssociatorNames(instanceref, AssocClass=\ get_typed_class(options.virt, "HostedService"))
But instead, I'd suggest doing something like:
hostedserv_cn = get_typed_class(options.virt, "HostedService")) names = conn.AssociatorNames(instanceref, AssocClass=hostedserv_cn)
#3 patch on the way. Thanks!
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
participants (3)
-
Guo Lian Yun
-
Kaitlin Rupert
-
yunguol@cn.ibm.com