[PATCH] [TEST] Update VirtualSystemSettingDataComponent.01 for KVM/XenFV/LXC support

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1216097308 25200 # Node ID c8a06679508f8aca9e64f911864bad3c71f4cf6b # Parent 64abdd1495dc05e69061151baf2ea25a682e8d8d [TEST] Update VirtualSystemSettingDataComponent.01 for KVM/XenFV/LXC support The test defines non-bootloader guests for all platform types, also remove the part of thet test that verifies the bootloader Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r 64abdd1495dc -r c8a06679508f 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 Mon Jul 14 21:48:28 2008 -0700 @@ -53,32 +53,36 @@ 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(): +status = PASS + +def init_list(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') ] + + if virt == 'Xen' or virt == 'XenFV': + test_disk = 'xvda' + test_mac = "00:11:22:33:44:aa" + else: + test_disk = 'hda' + test_mac = '11:22:33:aa:bb:cc' prop_list = {rlist[0] : "%s/%s" % (test_dom, test_disk), rlist[1] : "%s/%s" % (test_dom, "mem"), @@ -86,21 +90,25 @@ def init_list(): rlist[3] : "%s/%s" % (test_dom, "proc") } - return prop_list + if virt == 'LXC': + rlist = [get_typed_class(virt, 'MemResourceAllocationSettingData')] + prop_list = {rlist[0] : "%s/%s" % (test_dom, "mem")} + + return prop_list, test_disk, test_mac def build_vssd_info(ip, vssd): """ Creating the vssd fileds lists that will be used for comparisons. """ - if vssd.Bootloader == "" or vssd.Caption == "" or \ - vssd.InstanceID == "" or vssd.ElementName == "" or \ - vssd.VirtualSystemIdentifier == "" or vssd.VirtualSystemType == "": + 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,46 +151,53 @@ 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, test_disk, test_mac = init_list(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) + logger.error('Unable to define domain %s' % test_dom) + return FAIL + + 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") + cxml.undefine(options.ip) return FAIL 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") + cxml.undefine(options.ip) return FAIL - prop_list = init_list() 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 +209,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__":

- -def init_list(): +status = PASS
No need to define status here - define it as needed in main().
+ +def init_list(virt='Xen'):
+ + if virt == 'Xen' or virt == 'XenFV': + test_disk = 'xvda' + test_mac = "00:11:22:33:44:aa" + else: + test_disk = 'hda' + test_mac = '11:22:33:aa:bb:cc'
Are different values for test_mac needed? It seems like you can use the same value for all virtualization types. You could then define test_mac in main() and pass test_mac as a parameter into this function. I'd do the same with test_disk. Define it in main() and pass it into this function. This helps reduce the number of values the function returns.
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") + cxml.undefine(options.ip) return FAIL
vssd_vals = build_vssd_info(options.ip, vssd)
I'd remove this function all together. In assoc_values(), you can call compare_all_prop(). See the ESD patch I recently sent. This patch isn't in the tree yet, but should be soon. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Guo Lian Yun
-
Kaitlin Rupert