
# HG changeset patch # User Zhengang Li <lizg@cn.ibm.com> # Date 1206974015 -28800 # Node ID 7d806de944b51750ae19b40bb3ec655930a476e3 # Parent 6c8ff6906d1c4d1fd8c6766c5f7b70d7b7beb420 [TEST] SystemDevice.03_fwderrs XenFV & KVM support Signed-off-by: Zhengang Li <lizg@cn.ibm.com> diff -r 6c8ff6906d1c -r 7d806de944b5 suites/libvirt-cim/cimtest/SystemDevice/03_fwderrs.py --- a/suites/libvirt-cim/cimtest/SystemDevice/03_fwderrs.py Mon Mar 31 22:33:05 2008 +0800 +++ b/suites/libvirt-cim/cimtest/SystemDevice/03_fwderrs.py Mon Mar 31 22:33:35 2008 +0800 @@ -32,20 +32,18 @@ import pywbem import pywbem from pywbem.cim_obj import CIMInstanceName from VirtLib import utils -from XenKvmLib.test_xml import testxml +from XenKvmLib import vxml from XenKvmLib import assoc from XenKvmLib import devices -from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all -from XenKvmLib.devices import Xen_NetworkPort, Xen_Memory, Xen_LogicalDisk, Xen_Processor +from XenKvmLib.classes import get_typed_class from CimTest.Globals import log_param, logger, do_main from CimTest import Globals from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC -sup_types = ['Xen'] +sup_types = ['Xen', 'KVM', 'XenFV'] test_dom = "virt1" test_mac = "00:11:22:33:44:55" -test_disk = "xvda" test_cpu = 1 exp_rc1 = 1 #CIM_ERR_FAILED @@ -59,18 +57,25 @@ def main(): def main(): options = main.options + if options.virt == 'Xen': + test_disk = 'xvda' + else: + test_disk = 'hda' + log_param() status = PASS - test_xml = testxml(test_dom, vcpus = test_cpu, mac = test_mac, disk = test_disk) + cxml = vxml.get_class(options.virt)(test_dom, vcpus = test_cpu, + mac = test_mac, disk = test_disk) - test_domain_function(test_dom, options.ip, "destroy") - ret = test_domain_function(test_xml, options.ip, "create") + ret = cxml.create(options.ip) if not ret : logger.info("error while 'create' of VS") return FAIL - devlist = [ "Xen_NetworkPort", "Xen_Memory", - "Xen_LogicalDisk", "Xen_Processor" ] + devlist = [ get_typed_class(options.virt, "NetworkPort"), + get_typed_class(options.virt, "Memory"), + get_typed_class(options.virt, "LogicalDisk"), + get_typed_class(options.virt, "Processor") ] # Building the dict for avoiding the correct key:val pairs # while verifying with the Invalid values for the association @@ -82,7 +87,7 @@ def main(): try: for item in devlist: - devs = devices.enumerate(options.ip, eval(item), key_list) + devs = devices.enumerate(options.ip, item, key_list) for dev in devs: if dev.SystemName != test_dom: @@ -131,9 +136,10 @@ def main(): instanceref = CIMInstanceName(item, keybindings = \ {i : keyval , "CreationClassName" : item}) - try: + try: + sd_classname = get_typed_class(options.virt, 'SystemDevice') conn.AssociatorNames(instanceref, - AssocClass = "Xen_SystemDevice") + AssocClass = sd_classname) rc = 0 except pywbem.CIMError, (rc, desc): @@ -161,7 +167,8 @@ def main(): logger.info("exception" , details) status = FAIL - test_domain_function(test_dom, options.ip, "destroy") + cxml.destroy(options.ip) + cxml.undefine(options.ip) return status if __name__ == "__main__":