
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1216192956 25200 # Node ID 4fab30cea82ff4b689b16594e0db865a5366ec65 # Parent 64abdd1495dc05e69061151baf2ea25a682e8d8d [TEST] 2# Update VirtualSystemSettingDataComponent.01 for LXC support The test defines non-bootloader guests for all platform types, also remove the part of thet test that verifies the bootloader Updates from 1 to 2: Pass test_disk and test_mac as parameters into init_list() function. On the assoc_values(), I will update it to call compare_all_prop() when Kaitlin's patch applied in the tree. diff -r 64abdd1495dc -r 4fab30cea82f suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/01_forward.py --- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/01_forward.py Fri Jul 11 00:42:35 2008 -0700 +++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/01_forward.py Wed Jul 16 00:22:36 2008 -0700 @@ -53,31 +53,29 @@ from XenKvmLib import enumclass from XenKvmLib import enumclass from VirtLib import utils from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all -from XenKvmLib.test_xml import testxml_bl -from XenKvmLib.test_xml import xml_get_dom_bootloader from CimTest import Globals from XenKvmLib import assoc +from XenKvmLib import vxml +from XenKvmLib.classes import get_typed_class from CimTest.Globals import logger, do_main from CimTest.ReturnCodes import FAIL, PASS -sup_types = ['Xen'] +sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] test_dom = "VSSDC_dom" test_vcpus = 2 test_mac = "00:11:22:33:44:aa" test_disk = 'xvda' -status = 0 -VSType = "Xen" - -def init_list(): + +def init_list(test_disk, test_mac, virt='Xen'): """ Creating the lists that will be used for comparisons. """ - rlist = ['Xen_DiskResourceAllocationSettingData', - 'Xen_MemResourceAllocationSettingData', - 'Xen_NetResourceAllocationSettingData', - 'Xen_ProcResourceAllocationSettingData' + rlist = [get_typed_class(virt, 'DiskResourceAllocationSettingData'), + get_typed_class(virt, 'MemResourceAllocationSettingData'), + get_typed_class(virt, 'NetResourceAllocationSettingData'), + get_typed_class(virt, 'ProcResourceAllocationSettingData') ] prop_list = {rlist[0] : "%s/%s" % (test_dom, test_disk), @@ -85,7 +83,10 @@ def init_list(): rlist[2] : "%s/%s" % (test_dom, test_mac), rlist[3] : "%s/%s" % (test_dom, "proc") } - + if virt == 'LXC': + rlist = [get_typed_class(virt, 'MemResourceAllocationSettingData')] + prop_list = {rlist[0] : "%s/%s" % (test_dom, "mem")} + return prop_list def build_vssd_info(ip, vssd): @@ -93,14 +94,14 @@ def build_vssd_info(ip, vssd): Creating the vssd fileds lists that will be used for comparisons. """ - if vssd.Bootloader == "" or vssd.Caption == "" or \ + if vssd.Caption == "" or \ vssd.InstanceID == "" or vssd.ElementName == "" or \ vssd.VirtualSystemIdentifier == "" or vssd.VirtualSystemType == "": logger.error("One of the required VSSD details seems to be empty") test_domain_function(test_dom, ip, "undefine") return FAIL - vssd_vals = {'Bootloader' : vssd.Bootloader, + vssd_vals = { 'Caption' : vssd.Caption, 'InstanceID' : vssd.InstanceID, 'ElementName' : vssd.ElementName, @@ -143,23 +144,33 @@ def main(): status = FAIL destroy_and_undefine_all(options.ip) - test_xml = testxml_bl(test_dom, vcpus = test_vcpus, \ - mac = test_mac, disk = test_disk, \ - server = options.ip,\ - gtype = 0) - ret = test_domain_function(test_xml, options.ip, cmd = "define") + prop_list = init_list(test_disk, test_mac, options.virt) + virt_xml = vxml.get_class(options.virt) + if options.virt == 'LXC': + cxml = virt_xml(test_dom) + else: + cxml = virt_xml(test_dom, vcpus = test_vcpus, \ + mac = test_mac, disk = test_disk) + ret = cxml.define(options.ip) if not ret: logger.error("Failed to define the dom: %s", test_dom) return FAIL - instIdval = "%s:%s" % (VSType, test_dom) + if options.virt == 'XenFV': + instIdval = "Xen:%s" % test_dom + else: + instIdval = "%s:%s" % (options.virt, test_dom) + keyname = "InstanceID" key_list = { 'InstanceID' : instIdval } + vssd_cn = get_typed_class(options.virt, 'VirtualSystemSettingData') + try: vssd = enumclass.getInstance(options.ip, \ - enumclass.Xen_VirtualSystemSettingData, \ - key_list) + 'VirtualSystemSettingData', \ + key_list, + options.virt) if vssd is None: logger.error("VSSD instance for %s not found" % test_dom) test_domain_function(test_dom, options.ip, "undefine") @@ -168,21 +179,19 @@ def main(): vssd_vals = build_vssd_info(options.ip, vssd) except Exception, detail : - logger.error(Globals.CIM_ERROR_GETINSTANCE, \ - 'Xen_VirtualSystemSettingData') + logger.error(Globals.CIM_ERROR_GETINSTANCE, vssd_cn) logger.error("Exception : %s" % detail) - test_domain_function(test_dom, options.ip, "undefine") - return FAIL - - prop_list = init_list() + cxml.undefine(options.ip) + return FAIL + try: # Looping through the RASD_cllist, call association # Xen_VirtualSystemSettingDataComponent with each class in RASD_cllist - an = 'Xen_VirtualSystemSettingDataComponent' + an = get_typed_class(options.virt, 'VirtualSystemSettingDataComponent') for rasd_cname, prop in prop_list.iteritems(): assoc_info = assoc.Associators(options.ip, an, rasd_cname, - InstanceID = prop) + options.virt, InstanceID = prop) # Verify the association fields returned for particular rasd_cname. status = assoc_values(options.ip, assoc_info, rasd_cname, an, vssd_vals) @@ -194,7 +203,7 @@ def main(): logger.error("Exception : %s" % detail) status = FAIL - test_domain_function(test_dom, options.ip, "undefine") + cxml.undefine(options.ip) return status if __name__ == "__main__":