[PATCH 0 of 2] [TEST] Association parameter changes and fixing ElementCapabilities tc to work with sblim-base-providers

# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1222853363 25200 # Node ID 530d3dab93cd36a2b68e1fb42c71c9a1cfe755fc # Parent fb10c72ed404aa96715e2d013b0ee3502046496f [TEST] Fixing and updating 01_forward.py of ElementCapabilities to work with and without sblim-base-provider. 1) 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) Used get_host_info() for getting the host information. 5) Updated the tc to use cim.undefine(). Tested with Xen, XenFV, KVM on current sources and with/without sblim-base-provider installed. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r fb10c72ed404 -r 530d3dab93cd suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py --- a/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py Wed Oct 01 02:22:53 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py Wed Oct 01 02:29:23 2008 -0700 @@ -23,16 +23,19 @@ import sys 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'] @@ -61,21 +64,21 @@ def main(): server = options.ip virt = options.virt keys = ['Name', 'CreationClassName'] - try: - host_sys = enumclass.enumerate(server, 'HostSystem', keys, virt)[0] - except Exception: - logger.error(CIM_ERROR_ENUMERATE, get_typed_class(virt, 'HostSystem')) - return FAIL + + + status, host_name, host_ccn = get_host_info(server, virt) + if status != PASS: + logger.error("Failed to get host info") + return status + + assoc_cn = get_typed_class(virt, "ElementCapabilities") try: - elc = assoc.AssociatorNames(server, - "ElementCapabilities", - "HostSystem", - virt, - Name = host_sys.Name, - CreationClassName = host_sys.CreationClassName) + elc = assoc.AssociatorNames(server, assoc_cn, host_ccn, + Name = host_name, + CreationClassName = host_ccn) except Exception: - logger.error(CIM_ERROR_ASSOCIATORNAMES % host_sys.Name) + logger.error(CIM_ERROR_ASSOCIATORNAMES, assoc_cn) return FAIL @@ -91,38 +94,52 @@ def main(): 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", + assoc_cn) + 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", assoc_cn) return FAIL if i['InstanceID'] not in valid_elc_id: - logger.error("ElementCapabilities association InstanceID error ") + logger.error("'%s' association InstanceID error ", assoc_cn) 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, - "ElementCapabilities", - "ComputerSystem", - virt, + elec = assoc.AssociatorNames(server, assoc_cn, ccn, Name = system, CreationClassName = ccn) - except Exception: + 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", assoc_cn) return FAIL elif elec[0].keybindings['InstanceID'] != system: - logger.error("ElementCapabilities association InstanceID error") + cxml.undefine(server) + logger.error("'%s' association InstanceID error", assoc_cn) return FAIL + cxml.undefine(server) return PASS if __name__ == "__main__":

Deepti B. Kalakeri wrote:
# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1222853363 25200 # Node ID 530d3dab93cd36a2b68e1fb42c71c9a1cfe755fc # Parent fb10c72ed404aa96715e2d013b0ee3502046496f [TEST] Fixing and updating 01_forward.py of ElementCapabilities to work with and without sblim-base-provider.
1) 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) Used get_host_info() for getting the host information. 5) Updated the tc to use cim.undefine().
Tested with Xen, XenFV, KVM on current sources and with/without sblim-base-provider installed.
Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com>
diff -r fb10c72ed404 -r 530d3dab93cd suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py
This patch no longer applies for me. Can you rebase this set on the updated tree and resend? Thanks! -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Kaitlin Rupert wrote:
Deepti B. Kalakeri wrote:
# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1222853363 25200 # Node ID 530d3dab93cd36a2b68e1fb42c71c9a1cfe755fc # Parent fb10c72ed404aa96715e2d013b0ee3502046496f [TEST] Fixing and updating 01_forward.py of ElementCapabilities to work with and without sblim-base-provider.
1) 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) Used get_host_info() for getting the host information. 5) Updated the tc to use cim.undefine().
Tested with Xen, XenFV, KVM on current sources and with/without sblim-base-provider installed.
Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com>
diff -r fb10c72ed404 -r 530d3dab93cd suites/libvirt-cim/cimtest/ElementCapabilities/01_forward.py
This patch no longer applies for me. Can you rebase this set on the updated tree and resend?
Thanks!
I have rebased this patch set and resubmitted it again. Regards, Deepti.

# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1222880651 25200 # Node ID 1da63a856b8307cf4479da63ff4ed5ec5b666d2b # Parent 530d3dab93cd36a2b68e1fb42c71c9a1cfe755fc [TEST] Fixing and updating 02_reverse.py of ElementCapabilities to work with and without sblim-base-provider. 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) Used get_host_info() for getting the host information. 5) Updated the tc to use cim.undefine(). 6) Added verification of the VirtualSystemMigrationService service. 7) Updated enumclas to support VirtualSystemMigrationService and VirtualSystemManagementService. 8) 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@linux.vnet.ibm.com> diff -r 530d3dab93cd -r 1da63a856b83 suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py --- a/suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py Wed Oct 01 02:29:23 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementCapabilities/02_reverse.py Wed Oct 01 10:04:11 2008 -0700 @@ -26,26 +26,30 @@ from VirtLib import live 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 @@ def filter(list, cn, exp_result): 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 530d3dab93cd -r 1da63a856b83 suites/libvirt-cim/lib/XenKvmLib/enumclass.py --- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Wed Oct 01 02:29:23 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Wed Oct 01 10:04:11 2008 -0700 @@ -336,6 +336,25 @@ class KVM_DiskResourceAllocationSettingD 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
participants (3)
-
Deepti B Kalakeri
-
Deepti B. Kalakeri
-
Kaitlin Rupert