[PATCH 0 of 3] [TEST]add ElementAllocatedFromPool for KVM & XenFV support
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1208329373 25200 # Node ID dfe0e517e9903fa49f31ade82117d4341c829e0b # Parent dfa2a9c819bd026cc467fb3bced05211ee4f2ba9 [TEST] update network_by_bridge for KVM & XenFV support Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r dfa2a9c819bd -r dfe0e517e990 lib/VirtLib/live.py --- a/lib/VirtLib/live.py Tue Apr 15 15:00:01 2008 +0800 +++ b/lib/VirtLib/live.py Wed Apr 16 00:02:53 2008 -0700 @@ -301,15 +301,15 @@ def get_bridge_from_network_xml(network, if len(bridge) > 1: return bridge[1] -def network_by_bridge(bridge, server): +def network_by_bridge(bridge, server, virt="Xen"): """Function returns virtual network for a given bridge""" - networks = net_list(server) + networks = net_list(server, virt) if len(networks) == 0: return None for network in networks: - if bridge == get_bridge_from_network_xml(network, server): + if bridge == get_bridge_from_network_xml(network, server, virt): return network return None
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1208329712 25200 # Node ID ac6d65d178a0deec57611e6b0175deac7a7a28cc # Parent dfe0e517e9903fa49f31ade82117d4341c829e0b [TEST] add ElementAllocatedFromPool.01 for KVM & XenFV support Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r dfe0e517e990 -r ac6d65d178a0 suites/libvirt-cim/cimtest/ElementAllocatedFromPool/01_forward.py --- a/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/01_forward.py Wed Apr 16 00:02:53 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/01_forward.py Wed Apr 16 00:08:32 2008 -0700 @@ -4,6 +4,7 @@ # # Authors: # Deepti B. Kalakeri <dkalaker@in.ibm.com> +# Guolian Yun <yunguol@cn.ibm.com> # Kaitlin Rupert <karupert@us.ibm.com> # # This library is free software; you can redistribute it and/or @@ -47,30 +48,31 @@ from XenKvmLib import assoc from XenKvmLib import assoc from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all from XenKvmLib import devices +from XenKvmLib import vxml +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import do_main from VirtLib.live import network_by_bridge from CimTest.ReturnCodes import PASS, FAIL, SKIP -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] test_dom = "hd_domain" test_mac = "00:11:22:33:44:aa" test_vcpus = 1 -test_disk = 'xvda' def print_error(cn, detail): Globals.logger.error(Globals.CIM_ERROR_GETINSTANCE, cn) Globals.logger.error("Exception: %s", detail) -def get_keys(cn, device_id): +def get_keys(cn, device_id, virt='Xen'): id = "%s/%s" % (test_dom, device_id) key_list = { 'DeviceID' : id, 'CreationClassName' : cn, 'SystemName' : test_dom, - 'SystemCreationClassName' : "Xen_ComputerSystem" + 'SystemCreationClassName' : get_typed_class(virt, "ComputerSystem") } return key_list @@ -84,56 +86,58 @@ def main(): # Getting the VS list and deleting the test_dom if it already exists. destroy_and_undefine_all(options.ip) Globals.log_param() - - test_xml, bridge = testxml_bridge(test_dom, vcpus = test_vcpus, \ - mac = test_mac, disk = test_disk, \ - server = options.ip) + + if options.virt == 'Xen': + test_disk = 'xvda' + else: + test_disk = 'hda' + + virt_xml = vxml.get_class(options.virt) + cxml = virt_xml(test_dom, vcpus = test_vcpus, mac = test_mac, disk = test_disk) + bridge = cxml.set_vbridge(options.ip) + if bridge == None: Globals.logger.error("Unable to find virtual bridge") - return SKIP - - if test_xml == None: - Globals.logger.error("Guest xml not created properly") - return FAIL - - virt_network = network_by_bridge(bridge, options.ip) + return SKIP + + virt_network = network_by_bridge(bridge, options.ip, options.virt) if virt_network == None: Globals.logger.error("No virtual network found for bridge %s", bridge) return SKIP - ret = test_domain_function(test_xml, options.ip, cmd = "create") + ret = cxml.create(options.ip) if not ret: - Globals.logger.error("Failed to Create the dom: %s", test_dom) - return FAIL - - try: - cn = "Xen_LogicalDisk" - key_list = get_keys(cn, test_disk) - disk = devices.Xen_LogicalDisk(options.ip, key_list) - except Exception,detail: - print_error(cn, detail) - return FAIL - - try: - cn = "Xen_Memory" - key_list = get_keys(cn, "mem") - mem = devices.Xen_Memory(options.ip, key_list) + logger.error('Unable to create domain %s' % test_dom) + return FAIL + + try: + cn = get_typed_class(options.virt, "LogicalDisk") + key_list = get_keys(cn, test_disk, options.virt) + disk = eval('devices.' + get_typed_class(options.virt, "LogicalDisk"))(options.ip, key_list) + except Exception,detail: + print_error(cn, detail) + return FAIL + + try: + cn = get_typed_class(options.virt, "Memory") + key_list = get_keys(cn, "mem", options.virt) + mem = eval('devices.' + get_typed_class(options.virt, "Memory"))(options.ip, key_list) except Exception,detail: print_error(cn, detail) return FAIL try: - cn = "Xen_NetworkPort" - key_list = get_keys(cn, test_mac) - net = devices.Xen_NetworkPort(options.ip, key_list) - except Exception,detail: - print_error(cn, detail) - return FAIL - - try: - cn = "Xen_Processor" - key_list = get_keys(cn, "0") - proc = devices.Xen_Processor(options.ip, key_list) + cn = get_typed_class(options.virt, "NetworkPort") + key_list = get_keys(cn, test_mac, options.virt) + net = eval('devices.' + get_typed_class(options.virt, "NetworkPort"))(options.ip, key_list) + except Exception,detail: + print_error(cn, detail) + return FAIL + + try: + cn = get_typed_class(options.virt, "Processor") + key_list = get_keys(cn, "0", options.virt) + proc = eval('devices.' + get_typed_class(options.virt, "Processor"))(options.ip, key_list) except Exception,detail: print_error(cn, detail) return FAIL @@ -141,16 +145,16 @@ def main(): netpool_id = "NetworkPool/%s" % virt_network lelist = { - "Xen_LogicalDisk" : disk.DeviceID, \ - "Xen_Memory" : mem.DeviceID, \ - "Xen_NetworkPort" : net.DeviceID, \ - "Xen_Processor" : proc.DeviceID + get_typed_class(options.virt, "LogicalDisk") : disk.DeviceID, \ + get_typed_class(options.virt, "Memory") : mem.DeviceID, \ + get_typed_class(options.virt, "NetworkPort") : net.DeviceID, \ + get_typed_class(options.virt, "Processor") : proc.DeviceID } poollist = [ - "Xen_DiskPool", \ - "Xen_MemoryPool", \ - "Xen_NetworkPool", \ - "Xen_ProcessorPool" + get_typed_class(options.virt, "DiskPool"), \ + get_typed_class(options.virt, "MemoryPool"), \ + get_typed_class(options.virt, "NetworkPool"), \ + get_typed_class(options.virt, "ProcessorPool") ] poolval = [ "DiskPool/foo", \ @@ -158,20 +162,21 @@ def main(): netpool_id, \ "ProcessorPool/0" ] - - sccn = "Xen_ComputerSystem" + + sccn = get_typed_class(options.virt, "ComputerSystem") for cn, devid in sorted(lelist.items()): try: assoc_info = assoc.Associators(options.ip, \ - "Xen_ElementAllocatedFromPool", + "ElementAllocatedFromPool", cn, + options.virt, DeviceID = devid, CreationClassName = cn, SystemName = test_dom, SystemCreationClassName = sccn) if len(assoc_info) != 1: - Globals.logger.error("Xen_ElementAllocatedFromPool returned %i\ - ResourcePool objects for domain '%s'", len(assoc_info), test_dom) + Globals.logger.error("ElementAllocatedFromPool returned %i\ + ResourcePool objects for domain '%s'", len(assoc_info), test_dom) status = FAIL break @@ -196,12 +201,13 @@ def main(): except Exception, detail: Globals.logger.error(Globals.CIM_ERROR_ASSOCIATORS, \ - 'Xen_ElementAllocatedFromPool') + 'ElementAllocatedFromPool') Globals.logger.error("Exception: %s", detail) status = FAIL - ret = test_domain_function(test_dom, options.ip, \ - cmd = "destroy") + cxml.destroy(options.ip) + cxml.undefine(options.ip) + return status if __name__ == "__main__":
diff -r dfe0e517e990 -r ac6d65d178a0 suites/libvirt-cim/cimtest/ElementAllocatedFromPool/01_forward.py
This test doesn't pass for me with KVM on F9 using recent providers. I get the following error: CIM_ERR_FAILED: Unknown pool membership for `hd_domain/hda' I think the issue here is that the guest's devices belong to an appropriate disk pool. You'll need to create a function similar to the network_pool function that ensures the guest's device belongs to the expected pool. Also, it's a good idea to have a negative case that makes sure you get this kind of error when the guest's device doesn't belong to a pool.
-def get_keys(cn, device_id): +def get_keys(cn, device_id, virt='Xen'): id = "%s/%s" % (test_dom, device_id)
key_list = { 'DeviceID' : id, 'CreationClassName' : cn, 'SystemName' : test_dom, - 'SystemCreationClassName' : "Xen_ComputerSystem" + 'SystemCreationClassName' : get_typed_class(virt, "ComputerSystem")
This line spans 80 characters. You could declare a classname variable above and then use classname here.
- try: - cn = "Xen_Memory" - key_list = get_keys(cn, "mem") - mem = devices.Xen_Memory(options.ip, key_list) + logger.error('Unable to create domain %s' % test_dom) + return FAIL + + try: + cn = get_typed_class(options.virt, "LogicalDisk") + key_list = get_keys(cn, test_disk, options.virt) + disk = eval('devices.' + get_typed_class(options.virt, "LogicalDisk"))(options.ip, key_list)
This is long and is tough to read. I'd use a variable for the get_typed_class(options.virt, "LogicalDisk") so that it's clear that this line should be something like: devices.KVM_LogicalDisk devices.Xen_LogicalDisk The same goes for the all devices in this test.
if len(assoc_info) != 1: - Globals.logger.error("Xen_ElementAllocatedFromPool returned %i\ - ResourcePool objects for domain '%s'", len(assoc_info), test_dom) + Globals.logger.error("ElementAllocatedFromPool returned %i\ + ResourcePool objects for domain '%s'", len(assoc_info), test_dom)
This line is long - the string arguments can go on a separate line. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1208329893 25200 # Node ID 2309180af71056a15fd1f14914586b29593a99c7 # Parent ac6d65d178a0deec57611e6b0175deac7a7a28cc [TEST] add ElementAllocatedFromPool.02 for KVM & XenFV support Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r ac6d65d178a0 -r 2309180af710 suites/libvirt-cim/cimtest/ElementAllocatedFromPool/02_reverse.py --- a/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/02_reverse.py Wed Apr 16 00:08:32 2008 -0700 +++ b/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/02_reverse.py Wed Apr 16 00:11:33 2008 -0700 @@ -4,6 +4,7 @@ # # Authors: # Deepti B. Kalakeri <dkalaker@in.ibm.com> +# Guolian Yun <yunguol@cn.ibm.com> # Kaitlin Rupert <karupert@us.ibm.com> # # This library is free software; you can redistribute it and/or @@ -53,6 +54,8 @@ from VirtLib import live from VirtLib import live from XenKvmLib import assoc from XenKvmLib import enumclass +from XenKvmLib import vxml +from XenKvmLib.classes import get_typed_class from CimTest import Globals from CimTest.Globals import do_main from CimTest.ReturnCodes import PASS, FAIL, SKIP @@ -60,14 +63,13 @@ from XenKvmLib.test_doms import test_dom from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all from VirtLib.live import network_by_bridge -sup_types = ['Xen'] +sup_types = ['Xen', 'XenFV', 'KVM'] status = PASS test_dom = "hd_domain" test_mac = "00:11:22:33:44:aa" test_mem = 128 test_vcpus = 4 -test_disk = "xvdb" test_dpath = "foo" disk_file = '/tmp/diskpool.conf' back_disk_file = disk_file + "." + "02_reverse" @@ -105,14 +107,14 @@ def clean_up_restore(ip): sys.exit(status) -def get_or_bail(ip, id, pool_class): +def get_or_bail(ip, id, pool_class, virt="Xen"): """ Getinstance for the CLass and return instance on success, otherwise exit after cleanup_restore and destroying the guest. """ key_list = { 'InstanceID' : id } try: - instance = enumclass.getInstance(ip, pool_class, key_list) + instance = enumclass.getInstance(ip, pool_class, key_list, virt) except Exception, detail: Globals.logger.error(Globals.CIM_ERROR_GETINSTANCE, '%s', pool_class) Globals.logger.error("Exception: %s", detail) @@ -127,22 +129,22 @@ def print_error(field, ret_val, req_val) Globals.logger.error("%s Mismatch", field) Globals.logger.error("Returned %s instead of %s", ret_val, req_val) -def init_list(ip, disk, mem, net, proc): +def init_list(ip, disk, mem, net, proc, virt="Xen"): """ Creating the lists that will be used for comparisons. """ pllist = { - "Xen_DiskPool" : disk.InstanceID, \ - "Xen_MemoryPool" : mem.InstanceID, \ - "Xen_NetworkPool" : net.InstanceID, \ - "Xen_ProcessorPool": proc.InstanceID + get_typed_class(virt, "DiskPool") : disk.InstanceID, \ + get_typed_class(virt, "MemoryPool") : mem.InstanceID, \ + get_typed_class(virt, "NetworkPool") : net.InstanceID, \ + get_typed_class(virt, "ProcessorPool"): proc.InstanceID } cllist = [ - "Xen_LogicalDisk", \ - "Xen_Memory", \ - "Xen_NetworkPort", \ - "Xen_Processor" + get_typed_class(virt, "LogicalDisk"), \ + get_typed_class(virt, "Memory"), \ + get_typed_class(virt, "NetworkPort"), \ + get_typed_class(virt, "Processor") ] prop_list = ["%s/%s" % (test_dom, test_disk), test_disk, \ "%s/%s" % (test_dom, "mem"), test_mem, \ @@ -162,7 +164,7 @@ def get_inst_for_dom(assoc_val): return list -def get_spec_fields_list(inst_list, field_name): +def get_spec_fields_list(inst_list, field_name, virt="Xen"): global status specific_fields = { } if (len(inst_list)) != 1: @@ -172,7 +174,7 @@ 1", len(inst_list)) return # verifying the Name field for LogicalDisk try: - if inst_list[0]['CreationClassName'] != 'Xen_Memory': + if inst_list[0]['CreationClassName'] != get_typed_class(virt, 'Memory'): field_value = inst_list[0][field_name] if field_name == 'NetworkAddresses': # For network we NetworkAddresses is a list of addresses, since we @@ -190,7 +192,7 @@ 1", len(inst_list)) return specific_fields -def assoc_values(assoc_list, field , list, index, specific_fields_list=""): +def assoc_values(assoc_list, field , list, index, specific_fields_list="", virt="Xen"): """ Verifying the records retruned by the associations. """ @@ -203,7 +205,7 @@ def assoc_values(assoc_list, field , li if status != PASS: break elif field == "DeviceID": - if assoc_list[0]['CreationClassName'] == 'Xen_Processor': + if assoc_list[0]['CreationClassName'] == get_typed_class(virt, 'Processor'): # Verifying the list of DeviceId returned by the association # against the list created intially . for i in range(len(list)): @@ -218,7 +220,7 @@ def assoc_values(assoc_list, field , li status = FAIL else: # other specific fields verification - if assoc_list[0]['CreationClassName'] != 'Xen_Processor': + if assoc_list[0]['CreationClassName'] != get_typed_class(virt, 'Processor'): spec_field_name = specific_fields_list['field_name'] spec_field_value = specific_fields_list['field_value'] if spec_field_value != list[index]: @@ -235,24 +237,28 @@ def main(): server = options.ip destroy_and_undefine_all(options.ip) Globals.log_param() - test_xml, bridge = testxml_bridge(test_dom, mem = test_mem, vcpus = test_vcpus, \ - mac = test_mac, disk = test_disk, server = options.ip) + global test_disk + if options.virt == 'Xen': + test_disk = 'xvda' + else: + test_disk = 'hda' + + virt_xml = vxml.get_class(options.virt) + cxml = virt_xml(test_dom, vcpus = test_vcpus, mac = test_mac, disk = test_disk) + bridge = cxml.set_vbridge(options.ip) + if bridge == None: Globals.logger.error("Unable to find virtual bridge") return SKIP - if test_xml == None: - Globals.logger.error("Guest xml was not created properly") - return FAIL - - virt_network = network_by_bridge(bridge, server) + virt_network = network_by_bridge(bridge, options.ip, options.virt) if virt_network == None: Globals.logger.error("No virtual network found for bridge %s", bridge) return SKIP - ret = test_domain_function(test_xml, server, cmd = "create") + ret = cxml.create(options.ip) if not ret: - Globals.logger.error("Failed to Create the dom: %s", test_dom) + logger.error('Unable to create domain %s' % test_dom) return FAIL # Taking care of already existing diskconf file @@ -264,16 +270,17 @@ def main(): else: move_file(disk_file, back_disk_file) conf_file() + + diskpool = eval('enumclass.' + get_typed_class(options.virt, "DiskPool")) + mempool = eval('enumclass.' + get_typed_class(options.virt, "MemoryPool")) + netpool = eval('enumclass.' + get_typed_class(options.virt, "NetworkPool")) + procpool = eval('enumclass.' + get_typed_class(options.virt, "ProcessorPool")) try : - disk = get_or_bail(server, id=diskid, \ - pool_class=enumclass.Xen_DiskPool) - mem = get_or_bail(server, id = memid, \ - pool_class=enumclass.Xen_MemoryPool) + disk = get_or_bail(server, id = diskid, pool_class = diskpool, virt=options.virt) + mem = get_or_bail(server, id = memid, pool_class = mempool, virt=options.virt) netid = "%s/%s" % ("NetworkPool", virt_network) - net = get_or_bail(server, id = netid, \ - pool_class=enumclass.Xen_NetworkPool) - proc = get_or_bail(server, id = procid, \ - pool_class=enumclass.Xen_ProcessorPool) + net = get_or_bail(server, id = netid, pool_class = netpool, virt=options.virt) + proc = get_or_bail(server, id = procid, pool_class = procpool, virt=options.virt) except Exception, detail: Globals.logger.error("Exception: %s", detail) @@ -283,15 +290,16 @@ def main(): cmd = "destroy") return status - pllist, cllist, prop_list, proc_prop = init_list(server, disk, mem, net, proc) + pllist, cllist, prop_list, proc_prop = init_list(server, disk, mem, net, proc, options.virt) # Looping through the pllist to get association for various pools. for cn, instid in sorted(pllist.items()): try: - assoc_info = assoc.Associators(server, \ - "Xen_ElementAllocatedFromPool", \ - cn, \ - InstanceID = instid) + assoc_info = assoc.Associators(server, + "ElementAllocatedFromPool", + cn, + options.virt, + InstanceID = instid) # Verifying the Creation Class name for all the records returned for each # pool class queried inst_list = get_inst_for_dom(assoc_info) @@ -301,43 +309,47 @@ the specified domain: %s", test_dom) status = FAIL break - assoc_values(assoc_list=inst_list, field="CreationClassName", \ - list=cllist, \ - index=loop) + assoc_values(assoc_list=inst_list, field="CreationClassName", list=cllist, \ + index=loop, virt=options.virt) # verifying the DeviceID - if inst_list[0]['CreationClassName'] == 'Xen_Processor': + if inst_list[0]['CreationClassName'] == get_typed_class(options.virt, 'Processor'): # The DeviceID for the processor varies from 0 to (vcpu - 1 ) list_index = 0 assoc_values(assoc_list=inst_list, field="DeviceID", \ list=proc_prop, \ - index=list_index) + index=list_index, \ + virt=options.virt) else: # For LogicalDisk, Memory and NetworkPort - if inst_list[0]['CreationClassName'] == 'Xen_LogicalDisk': + if inst_list[0]['CreationClassName'] == get_typed_class(options.virt, 'LogicalDisk'): list_index = 0 - elif inst_list[0]['CreationClassName'] == 'Xen_Memory': + elif inst_list[0]['CreationClassName'] == get_typed_class(options.virt, 'Memory'): list_index = 2 else: list_index = 4 # NetworkPort assoc_values(assoc_list=inst_list, field="DeviceID", \ list=prop_list, \ - index=list_index) - if inst_list[0]['CreationClassName'] == 'Xen_LogicalDisk': + index=list_index, \ + virt=options.virt) + if inst_list[0]['CreationClassName'] == get_typed_class(options.virt, 'LogicalDisk'): # verifying the Name field for LogicalDisk - specific_fields = get_spec_fields_list(inst_list,field_name="Name") + specific_fields = get_spec_fields_list(inst_list,field_name="Name", virt=options.virt) list_index = 1 - elif inst_list[0]['CreationClassName'] == 'Xen_Memory': + elif inst_list[0]['CreationClassName'] == get_typed_class(options.virt, 'Memory'): # verifying the NumberOfBlocks allocated for Memory - specific_fields = get_spec_fields_list(inst_list,field_name="NumberOfBlocks") + specific_fields = get_spec_fields_list(inst_list,field_name="NumberOfBlocks", \ + virt=options.virt) list_index = 3 else: # verifying the NetworkAddresses for the NetworkPort - specific_fields = get_spec_fields_list(inst_list,field_name="NetworkAddresses") + specific_fields = get_spec_fields_list(inst_list,field_name="NetworkAddresses", \ + virt=options.virt) list_index = 5 # NetworkPort assoc_values(assoc_list=inst_list, field="Other", \ list=prop_list, \ index=list_index, \ - specific_fields_list=specific_fields) + specific_fields_list=specific_fields, \ + virt=options.virt) if status != PASS: break else: @@ -350,8 +362,9 @@ the specified domain: %s", test_dom) clean_up_restore(server) status = FAIL - ret = test_domain_function(test_dom, server, \ - cmd = "destroy") + cxml.destroy(options.ip) + cxml.undefine(options.ip) + clean_up_restore(server) return status if __name__ == "__main__":
+# Guolian Yun <yunguol@cn.ibm.com>
Being as most of the test cases will need to be changed from time to time, we should leave the author's list as is.
test_mem = 128 test_vcpus = 4 -test_disk = "xvdb" test_dpath = "foo" disk_file = '/tmp/diskpool.conf'
This test should use the diskpool support in the provider. This means a diskpool needs to be created if one doesn't exist already. Otherwise, this test fails. For RHEL 5.2 - we'll need to ignore the diskpool stuff and use a file. Since you need to write a function that creates the diskpool, you could have the function check the version of libvirt and then either create a diskpool or create diskpool file accordingly (thanks to Dan for the help with this).
-def assoc_values(assoc_list, field , list, index, specific_fields_list=""): +def assoc_values(assoc_list, field , list, index, specific_fields_list="", virt="Xen"):
This line wraps past 80 characters.
""" Verifying the records retruned by the associations. """ @@ -203,7 +205,7 @@ def assoc_values(assoc_list, field , li if status != PASS: break elif field == "DeviceID": - if assoc_list[0]['CreationClassName'] == 'Xen_Processor': + if assoc_list[0]['CreationClassName'] == get_typed_class(virt, 'Processor'):
This line also wraps.
# Verifying the list of DeviceId returned by the association # against the list created intially . for i in range(len(list)): @@ -218,7 +220,7 @@ def assoc_values(assoc_list, field , li status = FAIL else: # other specific fields verification - if assoc_list[0]['CreationClassName'] != 'Xen_Processor': + if assoc_list[0]['CreationClassName'] != get_typed_class(virt, 'Processor'):
Same here.
+ + diskpool = eval('enumclass.' + get_typed_class(options.virt, "DiskPool")) + mempool = eval('enumclass.' + get_typed_class(options.virt, "MemoryPool")) + netpool = eval('enumclass.' + get_typed_class(options.virt, "NetworkPool")) + procpool = eval('enumclass.' + get_typed_class(options.virt, "ProcessorPool"))
This might be confusing, so it would be better to set the classname to a variable. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
disk_file = '/tmp/diskpool.conf'
KR> This test should use the diskpool support in the provider. Additionally, we should make the standard location for the diskpool.conf file more appropriate. That way, the test suite will work against the development tree in addition to a released version, which would want to put it somewhere other than /tmp, of course. Since we don't have any other configuration files right now, I'm not sure where the best place for this is. Perhaps /etc/libvirt/? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com
Dan Smith wrote:
disk_file = '/tmp/diskpool.conf'
KR> This test should use the diskpool support in the provider.
Additionally, we should make the standard location for the diskpool.conf file more appropriate. That way, the test suite will work against the development tree in addition to a released version, which would want to put it somewhere other than /tmp, of course.
Since we don't have any other configuration files right now, I'm not sure where the best place for this is. Perhaps /etc/libvirt/?
I think using a libvirt dir is less obvious than using a libvirt-cim named one. However, I think it's silly to have a directory with just one file. Do you anticipate the need for other config files? I'm not sure if we'll need a way to persist data in the future (we haven't had such a need so far..). Although using diskpool.conf to configure the diskpool is not obvious in itself. I suspect that's something will need to well documented. At which point, the naming convention becomes less important. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
KR> I think using a libvirt dir is less obvious than using a KR> libvirt-cim named one. However, I think it's silly to have a KR> directory with just one file. Do you anticipate the need for KR> other config files? Well, we don't even need this one, except for libvirt<=0.4.0. Having a config directory all to ourselves for a single config file and only in the legacy support case seems overkill :) KR> I'm not sure if we'll need a way to persist data in the future (we KR> haven't had such a need so far..). Well, we will for some of the processor scheduling stuff, but that should probably be in /var/lib somewhere (although I guess the qemu driver puts its configs in /etc). -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com
Dan Smith wrote:
KR> I think using a libvirt dir is less obvious than using a KR> libvirt-cim named one. However, I think it's silly to have a KR> directory with just one file. Do you anticipate the need for KR> other config files?
Well, we don't even need this one, except for libvirt<=0.4.0. Having a config directory all to ourselves for a single config file and only in the legacy support case seems overkill :)
Yeah, I agree with you there. I was just thinking that if we'd need a place to hold files in the future, we could use the same location. But you make a good point that there's a difference between a config file and a data file.
KR> I'm not sure if we'll need a way to persist data in the future (we KR> haven't had such a need so far..).
Well, we will for some of the processor scheduling stuff, but that should probably be in /var/lib somewhere (although I guess the qemu driver puts its configs in /etc).
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
libvirt-cim-bounces@redhat.com wrote on 2008-04-17 05:37:38:
+# Guolian Yun <yunguol@cn.ibm.com>
Being as most of the test cases will need to be changed from time to time, we should leave the author's list as is.
test_mem = 128 test_vcpus = 4 -test_disk = "xvdb" test_dpath = "foo" disk_file = '/tmp/diskpool.conf'
This test should use the diskpool support in the provider. This means a diskpool needs to be created if one doesn't exist already. Otherwise, this test fails.
For RHEL 5.2 - we'll need to ignore the diskpool stuff and use a file. Since you need to write a function that creates the diskpool, you could have the function check the version of libvirt and then either create a diskpool or create diskpool file accordingly (thanks to Dan for the help with this).
I've just add a function that creates the diskpool now, on the next plan, the general diskpool config function will be moved to a library, I will update all related test. Also, I will create a diskpool file in lib using for RHEL 5.2, then ElementAllocatedFromPool will changed accordingly. Thanks!
-def assoc_values(assoc_list, field , list, index,
specific_fields_list=""):
+def assoc_values(assoc_list, field , list, index, specific_fields_list="", virt="Xen"):
This line wraps past 80 characters.
""" Verifying the records retruned by the associations. """ @@ -203,7 +205,7 @@ def assoc_values(assoc_list, field , li if status != PASS: break elif field == "DeviceID": - if assoc_list[0]['CreationClassName'] == 'Xen_Processor': + if assoc_list[0]['CreationClassName'] ==
get_typed_class(virt, 'Processor'):
This line also wraps.
# Verifying the list of DeviceId returned by the association # against the list created intially . for i in range(len(list)): @@ -218,7 +220,7 @@ def assoc_values(assoc_list, field , li status = FAIL else: # other specific fields verification - if assoc_list[0]['CreationClassName'] != 'Xen_Processor': + if assoc_list[0]['CreationClassName'] != get_typed_class(virt, 'Processor'):
Same here.
+ + diskpool = eval('enumclass.' + get_typed_class(options.virt, "DiskPool")) + mempool = eval('enumclass.' + get_typed_class(options.virt, "MemoryPool")) + netpool = eval('enumclass.' + get_typed_class(options.virt, "NetworkPool")) + procpool = eval('enumclass.' + get_typed_class(options.virt, "ProcessorPool"))
This might be confusing, so it would be better to set the classname to a variable.
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
Guo Lian Yun wrote:
libvirt-cim-bounces@redhat.com wrote on 2008-04-17 05:37:38:
+# Guolian Yun <yunguol@cn.ibm.com>
Being as most of the test cases will need to be changed from time to time, we should leave the author's list as is.
test_mem = 128 test_vcpus = 4 -test_disk = "xvdb" test_dpath = "foo" disk_file = '/tmp/diskpool.conf'
This test should use the diskpool support in the provider. This means a diskpool needs to be created if one doesn't exist already. Otherwise, this test fails.
For RHEL 5.2 - we'll need to ignore the diskpool stuff and use a file. Since you need to write a function that creates the diskpool, you could have the function check the version of libvirt and then either create a diskpool or create diskpool file accordingly (thanks to Dan for the help with this).
I've just add a function that creates the diskpool now, on the next plan, the general diskpool config function will be moved to a library, I will update all related test. Also, I will create a diskpool file in lib using for RHEL 5.2, then ElementAllocatedFromPool will changed accordingly.
Thanks!
I don't see the diskpool function in the patches you sent - is this in a separate patch? Here's the patches I see: .3# update network_by_bridge for KVM & XenFV support .3# add ElementAllocatedFromPool.01 for KVM & XenFV support .4# add ElementAllocatedFromPool.02 for KVM & XenFV support Am I missing one? Also, when you send an update, can you add a note to the log that indicates what changed between the two patches? Thanks! -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
Please ignore the bundles of patch, I've resent updated patches. Thanks! Best, Regards Daisy Guo Lian Yun E-mail: yunguol@cn.ibm.com IBM China Development Lab, Shanghai, China TEL: (86)-21-61008057 libvirt-cim-bounces@redhat.com wrote on 2008-04-16 15:11:50:
Signed-off-by: Guolian Yun <yunguol@cn.ibm.com>
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
participants (3)
-
Dan Smith -
Guo Lian Yun -
Kaitlin Rupert