
# HG changeset patch # User Zhengang Li <lizg@cn.ibm.com> # Date 1206973949 -28800 # Node ID 05259e63c37a2d496411b6b473c0f107fbceb652 # Parent c67d4960d4073c641beeb1fe5180862001c247ae [TEST] SystemDevice.01_forward XenFV & KVM support Signed-off-by: Zhengang Li <lizg@cn.ibm.com> diff -r c67d4960d407 -r 05259e63c37a suites/libvirt-cim/cimtest/SystemDevice/01_forward.py --- a/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py Fri Mar 28 21:46:53 2008 +0800 +++ b/suites/libvirt-cim/cimtest/SystemDevice/01_forward.py Mon Mar 31 22:32:29 2008 +0800 @@ -25,19 +25,18 @@ # import sys -from XenKvmLib.test_xml import testxml from VirtLib import utils from XenKvmLib import assoc -from XenKvmLib.test_doms import test_domain_function +from XenKvmLib import vxml from XenKvmLib import devices +from XenKvmLib.classes import get_typed_class from CimTest.Globals import log_param, logger, do_main from CimTest.ReturnCodes import PASS, FAIL -sup_types = ['Xen'] +sup_types = ['Xen', 'KVM', 'XenFV'] test_dom = "test_domain" test_mac = "00:11:22:33:44:55" -test_disk = "xvdb" test_cpu = 1 @do_main(sup_types) @@ -45,17 +44,26 @@ def main(): options= main.options log_param() + if options.virt == 'Xen': + test_disk = 'xvdb' + else: + test_disk = 'hdb' + 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) + cxml.destroy(options.ip) + ret = cxml.create(options.ip) + if not ret: + logger.error('Unable to create domain %s' % test_dom) + return FAIL - test_domain_function(test_xml, options.ip, "destroy") - test_domain_function(test_xml, options.ip, "create") + sd_classname = get_typed_class(options.virt, 'SystemDevice') + cs_classname = get_typed_class(options.virt, 'ComputerSystem') - devs = assoc.AssociatorNames(options.ip, "Xen_SystemDevice", - "Xen_ComputerSystem", - Name=test_dom, - CreationClassName="Xen_ComputerSystem") + devs = assoc.AssociatorNames(options.ip, sd_classname, cs_classname, + virt=options.virt, + Name=test_dom, CreationClassName=cs_classname) if devs == None: logger.error("System association failed") return FAIL @@ -63,13 +71,15 @@ def main(): logger.error("No devices returned") 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")] key_list = {'DeviceID' : '', 'CreationClassName' : '', 'SystemName' : test_dom, - 'SystemCreationClassname' : "Xen_ComputerSystem" + 'SystemCreationClassname' : cs_classname } for items in devlist: @@ -81,14 +91,14 @@ def main(): continue devid = device.DeviceID - if items == "Xen_NetworkPort": + if items == devlist[0]: _devid = "%s/%s" % (test_dom, test_mac) - elif items == "Xen_LogicalDisk": + elif items == devlist[1]: + _devid = "%s/mem" % test_dom + elif items == devlist[2]: _devid = "%s/%s" % (test_dom, test_disk) - elif items == "Xen_Processor": + elif items == devlist[3]: _devid = "%s/%d" % (test_dom, test_cpu-1) - elif items == "Xen_Memory": - _devid = "%s/mem" % test_dom if devid != _devid: logger.error("DeviceID `%s` != `%s'" % (devid, _devid)) @@ -96,7 +106,8 @@ def main(): else: logger.info("Examined %s" % _devid) - test_domain_function(test_xml, options.ip, "destroy") + cxml.destroy(options.ip) + cxml.undefine(options.ip) return status