[PATCH 0 of 5] [TEST] Update RAFP 01 and 02.

RAFP 01 and 02 are older tests that needed to be updated. Instead of building keys lists and calling GetInstance(), EnumerateInstances() is called to get the list of instances for both sides of the association. This enables the test to behave more like a real CIM client.

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1228774860 28800 # Node ID 625cd6182f62b05bf0292d4174ec13a6682eef3b # Parent 766607a007ebed33d006e950556c8d745fd0b58d [TEST] Add function to parse InstanceIDs Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 766607a007eb -r 625cd6182f62 suites/libvirt-cim/lib/XenKvmLib/common_util.py --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Tue Dec 02 21:29:39 2008 -0800 +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Mon Dec 08 14:21:00 2008 -0800 @@ -498,3 +498,15 @@ Globals.CIM_NS = prev_namespace return status, linux_cs + +def parse_instance_id(instid): + str_arr = instid.split("/") + if len(str_arr) < 2: + return None, None, FAIL + + guest_name = str_arr[0] + + devid = instid.lstrip("%s/" % guest_name) + + return guest_name, devid, PASS +

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1228774860 28800 # Node ID 82da8f8250975568ee7030bd7ae1f6298b72ca20 # Parent 625cd6182f62b05bf0292d4174ec13a6682eef3b [TEST] Add rasd_cn_to_pool_cn() & pool_cn_to_rasd_cn() Returns the appropriate ResourcePool classname for a given RASD classname. Add functions to return the enum of RASD and pool classes. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 625cd6182f62 -r 82da8f825097 suites/libvirt-cim/lib/XenKvmLib/pool.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py Mon Dec 08 14:21:00 2008 -0800 @@ -0,0 +1,80 @@ +#!/usr/bin/python +# +# Copyright 2008 IBM Corp. +# +# Authors: +# Kaitlin Rupert <karupert@us.ibm.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +import sys +from CimTest.Globals import logger +from CimTest.ReturnCodes import PASS, FAIL +from XenKvmLib.classes import get_typed_class +from XenKvmLib.const import get_provider_version +from XenKvmLib.enumclass import EnumInstances + +input_graphics_pool_rev = 757 + +def pool_cn_to_rasd_cn(pool_cn, virt): + if pool_cn.find('ProcessorPool') >= 0: + return get_typed_class(virt, "ProcResourceAllocationSettingData") + elif pool_cn.find('NetworkPool') >= 0: + return get_typed_class(virt, "NetResourceAllocationSettingData") + elif pool_cn.find('DiskPool') >= 0: + return get_typed_class(virt, "DiskResourceAllocationSettingData") + elif pool_cn.find('MemoryPool') >= 0: + return get_typed_class(virt, "MemResourceAllocationSettingData") + elif pool_cn.find('GraphicsPool') >= 0: + return get_typed_class(virt, "GraphicsResourceAllocationSettingData") + elif pool_cn.find('InputPool') >= 0: + return get_typed_class(virt, "InputResourceAllocationSettingData") + else: + return None + +def enum_pools(virt, ip): + pool_list = ['ProcessorPool', 'MemoryPool', 'NetworkPool', 'DiskPool'] + + curr_cim_rev, changeset = get_provider_version(virt, ip) + if curr_cim_rev >= input_graphics_pool_rev: + pool_list.append('GraphicsPool') + pool_list.append('InputPool') + + pool_insts = {} + + try: + for pool in pool_list: + pool_cn = get_typed_class(virt, pool) + list = EnumInstances(ip, pool_cn) + + if len(list) < 1: + raise Exception("%s did not return any instances" % pool_cn) + + for pool in list: + if pool.Classname not in pool_insts.keys(): + pool_insts[pool.Classname] = [] + pool_insts[pool.Classname].append(pool) + + if len(pool_insts) != len(pool_list): + raise Exception("Got %d pool insts, exp %d" % (len(pool_insts), + len(pool_list))) + + except Exception, details: + logger.error(details) + return pool_insts, FAIL + + return pool_insts, PASS + diff -r 625cd6182f62 -r 82da8f825097 suites/libvirt-cim/lib/XenKvmLib/rasd.py --- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py Mon Dec 08 14:21:00 2008 -0800 +++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py Mon Dec 08 14:21:00 2008 -0800 @@ -26,7 +26,7 @@ from XenKvmLib import vxml from XenKvmLib import const from XenKvmLib.classes import get_typed_class, get_class_type -from XenKvmLib.enumclass import GetInstance +from XenKvmLib.enumclass import GetInstance, EnumInstances from XenKvmLib.assoc import Associators from XenKvmLib.const import default_pool_name, default_network_name @@ -264,3 +264,41 @@ return rasd_mofs +def rasd_cn_to_pool_cn(rasd_cn, virt): + if rasd_cn.find('ProcResourceAllocationSettingData') >= 0: + return get_typed_class(virt, "ProcessorPool") + elif rasd_cn.find('NetResourceAllocationSettingData') >= 0: + return get_typed_class(virt, "NetworkPool") + elif rasd_cn.find('DiskResourceAllocationSettingData') >= 0: + return get_typed_class(virt, "DiskPool") + elif rasd_cn.find('MemResourceAllocationSettingData') >= 0: + return get_typed_class(virt, "MemoryPool") + elif rasd_cn.find('GraphicsResourceAllocationSettingData') >= 0: + return get_typed_class(virt, "GraphicsPool") + elif rasd_cn.find('InputResourceAllocationSettingData') >= 0: + return get_typed_class(virt, "InputPool") + else: + return None + +def enum_rasds(virt, ip): + rasd_insts = {} + + try: + rasd_cn = get_typed_class(virt, 'ResourceAllocationSettingData') + enum_list = EnumInstances(ip, rasd_cn) + + if enum_list < 1: + logger.error("No RASD instances returned") + return rasd_insts, FAIL + + for rasd in enum_list: + if rasd.Classname not in rasd_insts.keys(): + rasd_insts[rasd.Classname] = [] + rasd_insts[rasd.Classname].append(rasd) + + except Exception, details: + logger.error(details) + return rasd_insts, FAIL + + return rasd_insts, PASS +

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1228774860 28800 # Node ID 46a85b43eafd05357c90b8112007c75fd317b163 # Parent 82da8f8250975568ee7030bd7ae1f6298b72ca20 [TEST] Add support for Classname attribute to CimtestClass objects Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 82da8f825097 -r 46a85b43eafd suites/libvirt-cim/lib/XenKvmLib/enumclass.py --- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Mon Dec 08 14:21:00 2008 -0800 +++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Mon Dec 08 14:21:00 2008 -0800 @@ -67,6 +67,8 @@ raise def __getattr__(self, attr): + if attr == 'Classname': + return self.inst.classname if self.inst.has_key(attr): return self.inst[attr] else:

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1228854256 28800 # Node ID 1ac4ff9815d6812c7418f3de789eb818f23d8dc8 # Parent 46a85b43eafd05357c90b8112007c75fd317b163 [TEST] Fix RAFP 01_forward.py to work when multiple diskpools are defined. Also update testcase to test GraphicsPool and InputPool. As this is an almost complete re-write of this test, it's probably easier to apply the patch and read the source file to review. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 46a85b43eafd -r 1ac4ff9815d6 suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py --- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py Mon Dec 08 14:21:00 2008 -0800 +++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py Tue Dec 09 12:24:16 2008 -0800 @@ -23,27 +23,22 @@ # import sys -from VirtLib import utils -from XenKvmLib import assoc -from XenKvmLib import enumclass +from CimTest.Globals import logger +from CimTest.ReturnCodes import PASS, FAIL +from XenKvmLib.assoc import AssociatorNames from XenKvmLib.classes import get_typed_class -from XenKvmLib.test_doms import destroy_and_undefine_all -from XenKvmLib.vxml import get_class -from CimTest import Globals -from CimTest.Globals import logger -from XenKvmLib.const import do_main, default_pool_name, default_network_name -from CimTest.ReturnCodes import PASS, FAIL, XFAIL +from XenKvmLib.vxml import get_class +from XenKvmLib.const import do_main, default_pool_name, default_network_name, \ + LXC_netns_support +from XenKvmLib.pool import pool_cn_to_rasd_cn, enum_pools +from XenKvmLib.rasd import enum_rasds +from XenKvmLib.common_util import parse_instance_id sup_types = ['Xen', 'XenFV', 'KVM', 'LXC'] test_dom = "RAFP_dom" -test_vcpus = 1 -test_mem = 128 -test_mac = "00:11:22:33:44:aa" -test_npool = default_network_name def setup_env(server, virt): - destroy_and_undefine_all(server) vsxml = None if virt == "Xen": test_disk = "xvda" @@ -56,9 +51,7 @@ if virt == 'LXC': vsxml = virtxml(test_dom) else: - vsxml = virtxml(test_dom, mem=test_mem, vcpus = test_vcpus, - mac = test_mac, disk = test_disk, - ntype='network', net_name = test_npool) + vsxml = virtxml(test_dom, disk=test_disk) try: ret = vsxml.cim_define(server) @@ -72,75 +65,161 @@ return PASS, vsxml, test_disk -def get_instance(server, pool, list, virt='Xen'): - pool_cn = get_typed_class(virt, pool) - try: - inst = enumclass.GetInstance(server, pool_cn, list) - except Exception: - logger.error(Globals.CIM_ERROR_GETINSTANCE % pool_cn) - return FAIL, inst - - return PASS, inst +def init_rasd_list(virt, ip, guest_name): + disk_rasd_cn = get_typed_class(virt, "DiskResourceAllocationSettingData") -def verify_rasd(server, assoc_cn, cn, virt, list, rasd): - try: - assoc_cn = get_typed_class(virt, assoc_cn) - data = assoc.AssociatorNames(server, - assoc_cn, - get_typed_class(virt, cn), - InstanceID=list) - except Exception: - logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES % cn) + rasd_insts = {} + + rasds, status = enum_rasds(virt, ip) + if status != PASS: + logger.error("Enum RASDs failed") + return rasd_insts, status + + for rasd_cn, rasd_list in rasds.iteritems(): + if virt == "LXC" and rasd_cn == disk_rasd_cn: + continue + + for rasd in rasd_list: + guest, dev, status = parse_instance_id(rasd.InstanceID) + if status != PASS: + logger.error("Unable to parse InstanceID: %s" % rasd.InstanceID) + return rasd_insts, FAIL + + if guest == guest_name: + rasd_insts[rasd.Classname] = rasd + + return rasd_insts, PASS + +def filter_pool_list(virt, list, cn): + diskp_cn = get_typed_class(virt, "DiskPool") + netp_cn = get_typed_class(virt, "NetworkPool") + + if cn == diskp_cn: + exp_id = default_pool_name + elif cn == netp_cn: + exp_id = default_network_name + else: + return None, PASS + + if len(list) < 1: + logger.error("%s did not return any instances", cn) + return None, FAIL + + for inst in list: + guest, id, status = parse_instance_id(inst.InstanceID) + if status != PASS: + logger.error("Unable to parse InstanceID: %s" % inst.InstanceID) + return None, FAIL + + if id == exp_id: + return inst, PASS + + return None, FAIL + + +def init_pool_list(virt, ip): + pool_insts = {} + + pools, status = enum_pools(virt, ip) + if status != PASS: + return pool_insts, status + + for pool_cn, pool_list in pools.iteritems(): + inst, status = filter_pool_list(virt, pool_list, pool_cn) + if status != PASS: + logger.error("Unable to find exp %s inst", pool_cn) + return pool_insts, FAIL + + if inst is None: + if len(pool_list) != 1: + logger.error("Got %d %s, exp 1", len(pool_list), pool_cn) + return pool_insts, FAIL + inst = pool_list[0] + + pool_insts[pool_cn] = inst + + if len(pool_insts) != len(pools): + logger.error("Got %d pool insts, exp %d", len(pool_insts), len(pools)) + return pool_insts, FAIL + + if virt == "LXC": + diskp_cn = get_typed_class(virt, "DiskPool") + del pool_insts[diskp_cn] + + if LXC_netns_support is False: + netp_cn = get_typed_class(virt, "NetworkPool") + del pool_insts[netp_cn] + + return pool_insts, PASS + +def verify_rasd(enum_list, rasds, rasd_cn, guest_name): + status = FAIL + + for rasd in enum_list: + guest, dev, status = parse_instance_id(rasd['InstanceID']) + if status != PASS: + logger.error("Unable to parse InstanceID: %s", rasd['InstanceID']) + return status + + if guest != guest_name: + continue + + exp_rasd = rasds[rasd_cn] + + if rasd['InstanceID'] == exp_rasd.InstanceID: + status = PASS + else: + logger.info("Got %s instead of %s" % (rasd['InstanceID'], + exp_rasd.InstanceID)) + status = FAIL + + if status != PASS: + logger.error("RASD with id %s not returned", exp_rasd.InstanceID) return FAIL - if len(data) < 1: - logger.error("Return NULL, expect at least one instance") - return FAIL - - for item in data: - if item['InstanceID'] == rasd[cn]: - logger.info("%s InstanceID match - expect %s, got %s" \ - % (cn, rasd[cn], item['InstanceID'])) - return PASS - logger.error("RASD instance with InstanceID %s not found" % rasd[cn]) - return FAIL - + return PASS + @do_main(sup_types) def main(): options = main.options status = PASS - status, vsxml, test_disk = setup_env(options.ip, options.virt) if status != PASS: vsxml.undefine(options.ip) return status - - diskp_id = "DiskPool/%s" % default_pool_name - if options.virt == 'LXC': - pool = { "MemoryPool" : {'InstanceID' : "MemoryPool/0"} } - rasd = { "MemoryPool" : "%s/mem" % test_dom } - else: - pool = { "MemoryPool" : {'InstanceID' : "MemoryPool/0"}, - "ProcessorPool" : {'InstanceID' : "ProcessorPool/0"}, - "DiskPool" : {'InstanceID' : diskp_id}, - "NetworkPool" : {'InstanceID' : "NetworkPool/%s" \ - % test_npool }} - rasd = { "MemoryPool" : "%s/mem" % test_dom, - "ProcessorPool" : "%s/proc" % test_dom, - "DiskPool" : "%s/%s" %(test_dom, test_disk), - "NetworkPool" : "%s/%s" % (test_dom, test_mac) } + try: + rasds, status = init_rasd_list(options.virt, options.ip, test_dom) + if status != PASS: + raise Exception("Unable to build rasd instance list") - for k, v in pool.iteritems(): - status, inst = get_instance(options.ip, k, v, options.virt) + pools, status = init_pool_list(options.virt, options.ip) if status != PASS: - break - status = verify_rasd(options.ip, "ResourceAllocationFromPool", - k, options.virt, inst.InstanceID, - rasd) - if status != PASS: - break + raise Exception("Unable to build pool instance list") + + if len(rasds) != len(pools): + raise Exception("%d RASD insts != %d pool insts" % (len(rasds), + len(pools))) + + assoc_cn = get_typed_class(options.virt, "ResourceAllocationFromPool") + for pool_cn, pool in pools.iteritems(): + data = AssociatorNames(options.ip, + assoc_cn, + pool_cn, + InstanceID=pool.InstanceID) + + if len(data) < 1: + raise Exception("No RASD associated with %s" % pool.InstanceID) + + rasd_cn = pool_cn_to_rasd_cn(pool_cn, options.virt) + status = verify_rasd(data, rasds, rasd_cn, test_dom) + if status != PASS: + raise Exception("Failed to verify RASDs") + + except Exception, details: + logger.error(details) + status = FAIL vsxml.undefine(options.ip) return status

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1228774860 28800 # Node ID f72029b3c3e50bbadeabb9023ae8dd2175f7e89b # Parent 1ac4ff9815d6812c7418f3de789eb818f23d8dc8 [TEST] Fix RAFP 02_reverse.py to work when multiple diskpools are defined. Also update testcase to test GraphicsPool and InputPool. As this is an also complete re-write of this test, it's probably easier to apply the patch and read the source file to review. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 1ac4ff9815d6 -r f72029b3c3e5 suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py --- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py Tue Dec 09 12:24:16 2008 -0800 +++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py Mon Dec 08 14:21:00 2008 -0800 @@ -24,26 +24,22 @@ # import sys -from VirtLib import utils -from XenKvmLib import assoc -from XenKvmLib.test_doms import destroy_and_undefine_all +from CimTest.Globals import logger +from CimTest.ReturnCodes import PASS, FAIL +from XenKvmLib.assoc import AssociatorNames from XenKvmLib.vxml import get_class from XenKvmLib.classes import get_typed_class -from CimTest import Globals -from CimTest.Globals import logger -from XenKvmLib.const import do_main, default_pool_name, default_network_name -from CimTest.ReturnCodes import PASS, FAIL -from XenKvmLib import enumclass +from XenKvmLib.const import do_main, default_pool_name, default_network_name, \ + LXC_netns_support +from XenKvmLib.rasd import rasd_cn_to_pool_cn, enum_rasds +from XenKvmLib.pool import enum_pools +from XenKvmLib.common_util import parse_instance_id sup_types = ['Xen', 'XenFV', 'KVM', 'LXC'] + test_dom = "RAFP_dom" -test_vcpus = 1 -test_mem = 128 -test_mac = "00:11:22:33:44:aa" -test_npool = default_network_name def setup_env(server, virt): - destroy_and_undefine_all(server) vsxml = None if virt == "Xen": test_disk = "xvda" @@ -54,9 +50,8 @@ if virt == 'LXC': vsxml = virtxml(test_dom) else: - vsxml = virtxml(test_dom, mem=test_mem, vcpus = test_vcpus, - mac = test_mac, disk = test_disk, - ntype = 'network', net_name = test_npool) + vsxml = virtxml(test_dom, disk=test_disk) + try: ret = vsxml.cim_define(server) if not ret: @@ -69,93 +64,91 @@ return PASS, vsxml, test_disk -def init_list(test_disk, diskid, virt='Xen'): +def init_rasd_list(virt, ip, guest_name): + disk_rasd_cn = get_typed_class(virt, "DiskResourceAllocationSettingData") - proc = { 'rasd_id' : '%s/%s' % (test_dom, 'proc'), - 'pool_id' : 'ProcessorPool/0' - } + rasd_insts = {} - mem = { 'rasd_id' : '%s/%s' % (test_dom,'mem'), - 'pool_id' : 'MemoryPool/0' - } + rasds, status = enum_rasds(virt, ip) + if status != PASS: + logger.error("Enum RASDs failed") + return rasd_insts, status - net = { - 'rasd_id' : '%s/%s' % (test_dom, test_mac), - 'pool_id' : 'NetworkPool/%s' % test_npool - } + for rasd_cn, rasd_list in rasds.iteritems(): + if virt == "LXC" and rasd_cn == disk_rasd_cn: + continue - disk = { 'rasd_id' : '%s/%s' % (test_dom, test_disk), - 'pool_id' : 'DiskPool/%s' % default_pool_name - } + for rasd in rasd_list: + guest, dev, status = parse_instance_id(rasd.InstanceID) + if status != PASS: + logger.error("Unable to parse InstanceID: %s" % rasd.InstanceID) + return rasd_insts, FAIL - if virt == 'LXC': - cn_id_list = { - 'MemResourceAllocationSettingData' : mem, - } + if guest == guest_name: + rasd_insts[rasd.Classname] = rasd + + return rasd_insts, PASS + +def filter_pool_list(virt, list, cn): + diskp_cn = get_typed_class(virt, "DiskPool") + netp_cn = get_typed_class(virt, "NetworkPool") + + if cn == diskp_cn: + exp_id = default_pool_name + elif cn == netp_cn: + exp_id = default_network_name else: - cn_id_list = { - 'MemResourceAllocationSettingData' : mem, - 'ProcResourceAllocationSettingData' : proc, - 'NetResourceAllocationSettingData' : net, - 'DiskResourceAllocationSettingData' : disk - } + return None, PASS - return cn_id_list + if len(list) < 1: + logger.error("%s did not return any instances", cn) + return None, FAIL -def get_rasd_instance(server, virt, key_list, cn): - inst = None - try: - inst = enumclass.GetInstance(server, cn, key_list) - except Exception, details: - logger.error(Globals.CIM_ERROR_GETINSTANCE, cn) - logger.error("Exception details: %s", details) - return inst, FAIL + for inst in list: + guest, id, status = parse_instance_id(inst.InstanceID) + if status != PASS: + logger.error("Unable to parse InstanceID: %s" % inst.InstanceID) + return None, FAIL - return inst, PASS + if id == exp_id: + return inst, PASS -def verify_pool_from_RAFP(server, virt, inst, pool_id, cn): - pool = [] - try: - an = get_typed_class(virt, "ResourceAllocationFromPool") - cn = get_typed_class(virt, cn) - pool = assoc.AssociatorNames(server, an, cn, InstanceID=inst.InstanceID) - except Exception: - logger.error(Globals.CIM_ERROR_ASSOCIATORNAMES, inst.InstanceID) - return FAIL + return None, FAIL - if len(pool) != 1: - logger.error("No associated pool for %s", inst.InstanceID) - return FAIL +def init_pool_list(virt, ip): + pool_insts = {} - if pool[0]['InstanceID'] != pool_id: - logger.error("InstanceID Mismatch") - logger.error("Returned %s instead of %s", pool[0]['InstanceID'] , - pool_id) - return FAIL + pools, status = enum_pools(virt, ip) + if status != PASS: + return pool_insts, status - return PASS + for pool_cn, pool_list in pools.iteritems(): + inst, status = filter_pool_list(virt, pool_list, pool_cn) + if status != PASS: + logger.error("Unable to find exp %s inst", pool_cn) + return pool_insts, FAIL -def get_rasdinst_verify_pool_from_RAFP(server, virt, vsxml, cn, id_info): - try: - key_list = { 'InstanceID' : id_info['rasd_id'] } - rasd_cn = get_typed_class(virt, cn) - rasdinst, status = get_rasd_instance(server, virt, key_list, rasd_cn) - if status != PASS or rasdinst.InstanceID == None: - vsxml.undefine(server) - return status + if inst is None: + if len(pool_list) != 1: + logger.error("Got %d %s, exp 1", len(pool_list), pool_cn) + return pool_insts, FAIL + inst = pool_list[0] - status = verify_pool_from_RAFP(server, virt, rasdinst, - id_info['pool_id'], cn) - except Exception, details: - logger.error("Exception in get_rasdinst_verify_pool_from_RAFP() fn") - logger.error("Exception Details %s", details) - status = FAIL + pool_insts[pool_cn] = inst - if status != PASS: - vsxml.undefine(server) + if len(pool_insts) != len(pools): + logger.error("Got %d pool insts, exp %d", len(pool_insts), len(pools)) + return pool_insts, FAIL - return status - + if virt == "LXC": + diskp_cn = get_typed_class(virt, "DiskPool") + del pool_insts[diskp_cn] + + if LXC_netns_support is False: + netp_cn = get_typed_class(virt, "NetworkPool") + del pool_insts[netp_cn] + + return pool_insts, PASS @do_main(sup_types) def main(): @@ -169,13 +162,41 @@ vsxml.undefine(server) return status - cn_id_list = init_list(test_disk, default_pool_name, options.virt) + try: + rasds, status = init_rasd_list(virt, options.ip, test_dom) + if status != PASS: + raise Exception("Unable to build rasd instance list") - for rasd_cn, id_info in cn_id_list.iteritems(): - status = get_rasdinst_verify_pool_from_RAFP(server, virt, vsxml, - rasd_cn, id_info) + pools, status = init_pool_list(virt, options.ip) if status != PASS: - return status + raise Exception("Unable to build pool instance list") + + if len(rasds) != len(pools): + raise Exception("%d RASD insts != %d pool insts" % (len(rasds), + len(pools))) + + an = get_typed_class(virt, "ResourceAllocationFromPool") + for rasd_cn, rasd in rasds.iteritems(): + pool = AssociatorNames(server, + an, + rasd_cn, + InstanceID=rasd.InstanceID) + + if len(pool) != 1: + raise Exception("No associated pool with %s" % rasd.InstanceID) + + pool = pool[0] + pool_cn = rasd_cn_to_pool_cn(rasd_cn, virt) + exp_pool = pools[pool_cn] + + if pool['InstanceID'] != exp_pool.InstanceID: + logger.error("InstanceID Mismatch") + raise Exception("Got %s instead of %s" % (pool['InstanceID'], + exp_pool.InstanceID)) + + except Exception, details: + logger.error(details) + status = FAIL vsxml.undefine(server) return status

+1 from me for this big patch set. Thanks! Best, Regards Daisy (运国莲) VSM Team, China Systems & Technology Labs (CSTL) E-mail: yunguol@cn.ibm.com TEL: (86)-21-60922403 Building 10, 399 Ke Yuan Rd, Pudong Shanghai, 201203 libvirt-cim-bounces@redhat.com wrote on 2008-12-10 04:24:45:
RAFP 01 and 02 are older tests that needed to be updated. Instead of building keys lists and calling GetInstance(), EnumerateInstances() is called to get the list of instances for both sides of the association.
This enables the test to behave more like a real CIM client.
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
participants (2)
-
Guo Lian Yun
-
Kaitlin Rupert