[PATCH] [TEST] Fix HostedService.01~04 with sblim base provider installed

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1222239007 25200 # Node ID f09ea1ef1bf1c4c830985078b53e50a103635ae2 # Parent d2ae228a60c34b78c3dd1e4f43f6a5413898980d [TEST] Fix HostedService.01~04 with sblim base provider installed suites/libvirt-cim/cimtest/HostedService/cimtest.log diff -r d2ae228a60c3 -r f09ea1ef1bf1 suites/libvirt-cim/cimtest/HostedService/01_forward.py --- a/suites/libvirt-cim/cimtest/HostedService/01_forward.py Mon Sep 22 11:28:02 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/01_forward.py Tue Sep 23 23:50:07 2008 -0700 @@ -24,6 +24,7 @@ import sys import sys from VirtLib import utils from XenKvmLib import assoc +from XenKvmLib.common_util import check_sblim from XenKvmLib import enumclass from XenKvmLib.classes import get_typed_class from CimTest import Globals @@ -36,12 +37,17 @@ sup_types = ['Xen', 'XenFV', 'KVM', 'LXC @do_main(sup_types) def main(): options = main.options - keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.name) - return FAIL + + status, linux_cs = check_sblim(options.ip, options.virt) + if status == PASS: + host_sys = linux_cs[0] + else: + keys = ['Name', 'CreationClassName'] + try: + host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] + except Exception: + logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.name) + return FAIL try: service = assoc.AssociatorNames(options.ip, "HostedService", diff -r d2ae228a60c3 -r f09ea1ef1bf1 suites/libvirt-cim/cimtest/HostedService/02_reverse.py --- a/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Mon Sep 22 11:28:02 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Tue Sep 23 23:50:07 2008 -0700 @@ -25,6 +25,7 @@ from VirtLib import utils from VirtLib import utils from XenKvmLib import assoc from XenKvmLib import enumclass +from XenKvmLib.common_util import check_sblim from XenKvmLib.classes import get_typed_class from CimTest import Globals from XenKvmLib.const import do_main @@ -36,12 +37,16 @@ sup_types = ['Xen', 'XenFV', 'KVM', 'LXC @do_main(sup_types) def main(): options = main.options - keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.CreationClassName) - return FAIL + status, linux_cs = check_sblim(options.ip, options.virt) + if status == PASS: + host_sys = linux_cs[0] + else: + keys = ['Name', 'CreationClassName'] + try: + host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] + except Exception: + logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.CreationClassName) + return FAIL servicelist = {"ResourcePoolConfigurationService" : "RPCS", "VirtualSystemManagementService" : "Management Service", "VirtualSystemMigrationService" : "MigrationService"} @@ -67,7 +72,7 @@ def main(): ccn = assoc_host[0].keybindings['CreationClassName'] name = assoc_host[0].keybindings['Name'] - if ccn != get_typed_class(options.virt, "HostSystem"): + if ccn != get_typed_class(options.virt, "HostSystem") and ccn != 'Linux_ComputerSystem' : logger.error("CreationClassName Error") return FAIL elif name != host_sys.Name: diff -r d2ae228a60c3 -r f09ea1ef1bf1 suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py --- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Mon Sep 22 11:28:02 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Tue Sep 23 23:50:07 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 @@ -41,11 +42,15 @@ 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) - return FAIL + status, linux_cs = check_sblim(options.ip, options.virt) + if status == PASS: + host_sys = linux_cs[0] + else: + try: + host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] + except Exception: + logger.error(CIM_ERROR_ENUMERATE % host_sys.name) + return FAIL conn = assoc.myWBEMConnection('http://%s' % options.ip, diff -r d2ae228a60c3 -r f09ea1ef1bf1 suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py --- a/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Mon Sep 22 11:28:02 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Tue Sep 23 23:50:07 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 @@ -41,11 +42,15 @@ 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) - return FAIL + status, linux_cs = check_sblim(options.ip, options.virt) + if status == PASS: + host_sys = linux_cs[0] + else: + 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",

libvirt-cim-bounces@redhat.com wrote on 2008-09-24 14:50:42:
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1222239007 25200 # Node ID f09ea1ef1bf1c4c830985078b53e50a103635ae2 # Parent d2ae228a60c34b78c3dd1e4f43f6a5413898980d [TEST] Fix HostedService.01~04 with sblim base provider installed
Sorry. I forgot to sign on this patch. Signed-off-by: Guolian Yun <yunguol@cn.ibm.com>
suites/libvirt-cim/cimtest/HostedService/cimtest.log
diff -r d2ae228a60c3 -r f09ea1ef1bf1 suites/libvirt- cim/cimtest/HostedService/01_forward.py --- a/suites/libvirt-cim/cimtest/HostedService/01_forward.py Mon Sep 22 11:28:02 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/01_forward.py Tue Sep 23 23:50:07 2008 -0700 @@ -24,6 +24,7 @@ import sys import sys from VirtLib import utils from XenKvmLib import assoc +from XenKvmLib.common_util import check_sblim from XenKvmLib import enumclass from XenKvmLib.classes import get_typed_class from CimTest import Globals @@ -36,12 +37,17 @@ sup_types = ['Xen', 'XenFV', 'KVM', 'LXC @do_main(sup_types) def main(): options = main.options - keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.name) - return FAIL + + status, linux_cs = check_sblim(options.ip, options.virt) + if status == PASS: + host_sys = linux_cs[0] + else: + keys = ['Name', 'CreationClassName'] + try: + host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] + except Exception: + logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.name) + return FAIL try: service = assoc.AssociatorNames(options.ip, "HostedService", diff -r d2ae228a60c3 -r f09ea1ef1bf1 suites/libvirt- cim/cimtest/HostedService/02_reverse.py --- a/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Mon Sep 22 11:28:02 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Tue Sep 23 23:50:07 2008 -0700 @@ -25,6 +25,7 @@ from VirtLib import utils from VirtLib import utils from XenKvmLib import assoc from XenKvmLib import enumclass +from XenKvmLib.common_util import check_sblim from XenKvmLib.classes import get_typed_class from CimTest import Globals from XenKvmLib.const import do_main @@ -36,12 +37,16 @@ sup_types = ['Xen', 'XenFV', 'KVM', 'LXC @do_main(sup_types) def main(): options = main.options - keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys. CreationClassName) - return FAIL + status, linux_cs = check_sblim(options.ip, options.virt) + if status == PASS: + host_sys = linux_cs[0] + else: + keys = ['Name', 'CreationClassName'] + try: + host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] + except Exception: + logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys. CreationClassName) + return FAIL servicelist = {"ResourcePoolConfigurationService" : "RPCS", "VirtualSystemManagementService" : "Management Service", "VirtualSystemMigrationService" : "MigrationService"} @@ -67,7 +72,7 @@ def main(): ccn = assoc_host[0].keybindings['CreationClassName'] name = assoc_host[0].keybindings['Name']
- if ccn != get_typed_class(options.virt, "HostSystem"): + if ccn != get_typed_class(options.virt, "HostSystem") and ccn != 'Linux_ComputerSystem' : logger.error("CreationClassName Error") return FAIL elif name != host_sys.Name: diff -r d2ae228a60c3 -r f09ea1ef1bf1 suites/libvirt- cim/cimtest/HostedService/03_forward_errs.py --- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Mon Sep 22 11:28:02 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Tue Sep 23 23:50:07 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 @@ -41,11 +42,15 @@ 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) - return FAIL + status, linux_cs = check_sblim(options.ip, options.virt) + if status == PASS: + host_sys = linux_cs[0] + else: + try: + host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] + except Exception: + logger.error(CIM_ERROR_ENUMERATE % host_sys.name) + return FAIL
conn = assoc.myWBEMConnection('http://%s' % options.ip, diff -r d2ae228a60c3 -r f09ea1ef1bf1 suites/libvirt- cim/cimtest/HostedService/04_reverse_errs.py --- a/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Mon Sep 22 11:28:02 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Tue Sep 23 23:50:07 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 @@ -41,11 +42,15 @@ 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) - return FAIL + status, linux_cs = check_sblim(options.ip, options.virt) + if status == PASS: + host_sys = linux_cs[0] + else: + 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",
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

yunguol@cn.ibm.com wrote:
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1222239007 25200 # Node ID f09ea1ef1bf1c4c830985078b53e50a103635ae2 # Parent d2ae228a60c34b78c3dd1e4f43f6a5413898980d [TEST] Fix HostedService.01~04 with sblim base provider installed
suites/libvirt-cim/cimtest/HostedService/cimtest.log
diff -r d2ae228a60c3 -r f09ea1ef1bf1 suites/libvirt-cim/cimtest/HostedService/01_forward.py --- a/suites/libvirt-cim/cimtest/HostedService/01_forward.py Mon Sep 22 11:28:02 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/01_forward.py Tue Sep 23 23:50:07 2008 -0700 @@ -24,6 +24,7 @@ import sys import sys from VirtLib import utils from XenKvmLib import assoc +from XenKvmLib.common_util import check_sblim from XenKvmLib import enumclass from XenKvmLib.classes import get_typed_class from CimTest import Globals @@ -36,12 +37,17 @@ sup_types = ['Xen', 'XenFV', 'KVM', 'LXC @do_main(sup_types) def main(): options = main.options - keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.name) - return FAIL + + status, linux_cs = check_sblim(options.ip, options.virt) + if status == PASS: + host_sys = linux_cs[0] + else: + keys = ['Name', 'CreationClassName'] + try: + host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] + except Exception: + logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.name) + return FAIL try: service = assoc.AssociatorNames(options.ip, "HostedService",
I believe we need to do changes to the the way we query assocition. The above existing association is not returning any value and hence the following thing present in the code if service == None: logger.error("No association return") return FAIL does return an empty list and the further verification down in the for loop for item in service: logger.error("DEBUG : %s", item.keybindings["CreationClassName"]) ccn = item.keybindings["CreationClassName"] if ccn not in valid_services: logger.error("HostedService association to associate HostSystem and %s is wrong " % ccn) return FAIL does not get executed and the test returns PASS. I suggest the following: If the above association with HostedService is not supported with Linux_ComputerSystem If the query of the association with the HostSystem does not return an record yet, then we should set XFAIL and not PASS when sblim-base-provider is installed.
diff -r d2ae228a60c3 -r f09ea1ef1bf1 suites/libvirt-cim/cimtest/HostedService/02_reverse.py --- a/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Mon Sep 22 11:28:02 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/02_reverse.py Tue Sep 23 23:50:07 2008 -0700 @@ -25,6 +25,7 @@ from VirtLib import utils from VirtLib import utils from XenKvmLib import assoc from XenKvmLib import enumclass +from XenKvmLib.common_util import check_sblim from XenKvmLib.classes import get_typed_class from CimTest import Globals from XenKvmLib.const import do_main @@ -36,12 +37,16 @@ sup_types = ['Xen', 'XenFV', 'KVM', 'LXC @do_main(sup_types) def main(): options = main.options - keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] - except Exception: - logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.CreationClassName) - return FAIL + status, linux_cs = check_sblim(options.ip, options.virt) + if status == PASS: + host_sys = linux_cs[0] + else: + keys = ['Name', 'CreationClassName'] + try: + host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] + except Exception: + logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.CreationClassName) + return FAIL servicelist = {"ResourcePoolConfigurationService" : "RPCS", "VirtualSystemManagementService" : "Management Service", "VirtualSystemMigrationService" : "MigrationService"} @@ -67,7 +72,7 @@ def main(): ccn = assoc_host[0].keybindings['CreationClassName'] name = assoc_host[0].keybindings['Name']
- if ccn != get_typed_class(options.virt, "HostSystem"): + if ccn != get_typed_class(options.virt, "HostSystem") and ccn != 'Linux_ComputerSystem' : logger.error("CreationClassName Error") return FAIL elif name != host_sys.Name: diff -r d2ae228a60c3 -r f09ea1ef1bf1 suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py --- a/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Mon Sep 22 11:28:02 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/03_forward_errs.py Tue Sep 23 23:50:07 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 @@ -41,11 +42,15 @@ 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) - return FAIL + status, linux_cs = check_sblim(options.ip, options.virt) + if status == PASS: + host_sys = linux_cs[0] + else: + try: + host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] + except Exception: + logger.error(CIM_ERROR_ENUMERATE % host_sys.name) + return FAIL
I know you have not made these changes, but can you restrict the lines further in the down after the changes you have made to 80 columns.
conn = assoc.myWBEMConnection('http://%s' % options.ip, diff -r d2ae228a60c3 -r f09ea1ef1bf1 suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py --- a/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Mon Sep 22 11:28:02 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedService/04_reverse_errs.py Tue Sep 23 23:50:07 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 @@ -41,11 +42,15 @@ 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) - return FAIL + status, linux_cs = check_sblim(options.ip, options.virt) + if status == PASS: + host_sys = linux_cs[0] + else: + 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",
same as above can you restrict the lines further in the down after the changes you have made to 80 columns.
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

+ else: + keys = ['Name', 'CreationClassName'] + try: + host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0] + except Exception: + logger.error(Globals.CIM_ERROR_ENUMERATE % host_sys.name) + return FAIL try: service = assoc.AssociatorNames(options.ip, "HostedService",
I believe we need to do changes to the the way we query assocition. The above existing association is not returning any value and hence the following thing present in the code if service == None: logger.error("No association return") return FAIL does return an empty list and the further verification down in the for loop
for item in service: logger.error("DEBUG : %s", item.keybindings["CreationClassName"]) ccn = item.keybindings["CreationClassName"] if ccn not in valid_services: logger.error("HostedService association to associate HostSystem and %s is wrong " % ccn) return FAIL does not get executed and the test returns PASS. I suggest the following: If the above association with HostedService is not supported with Linux_ComputerSystem If the query of the association with the HostSystem does not return an record yet, then we should set XFAIL and not PASS when sblim-base-provider is installed.
Yep, I agree here. Instead of service == None, it should be len(service) < 1. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (4)
-
Deepti B Kalakeri
-
Guo Lian Yun
-
Kaitlin Rupert
-
yunguol@cn.ibm.com