[PATCH] [TEST] Add HRP.01~04 to support disk and net pool

# HG changeset patch # User Guolian Yun <yunguol@cn.ibm.com> # Date 1219819585 25200 # Node ID e981649cf307110ea3045b2aa114bf187566a126 # Parent 6995ae30dc81d2c8cbd78f0b669244d28116dbc2 [TEST] Add HRP.01~04 to support disk and net pool Signed-off-by: Guolian Yun <yunguol@cn.ibm.com> diff -r 6995ae30dc81 -r e981649cf307 suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py --- a/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py Mon Aug 25 17:15:19 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py Tue Aug 26 23:46:25 2008 -0700 @@ -31,12 +31,19 @@ from CimTest.ReturnCodes import PASS, FA from CimTest.ReturnCodes import PASS, FAIL from CimTest.Globals import do_main from XenKvmLib.classes import get_typed_class +from XenKvmLib.common_util import cleanup_restore, create_diskpool_conf sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] @do_main(sup_types) def main(): options = main.options status = FAIL + + status, dpool_name = create_diskpool_conf(options.ip, options.virt) + if status != PASS: + logger.error("Failed to create diskpool") + return FAIL + try: host_sys = hostsystem.enumerate(options.ip, options.virt)[0] except Exception: @@ -69,7 +76,12 @@ def main(): status = PASS if cname.find("ProcessorPool") >=0 and items['InstanceID'] == "ProcessorPool/0": status = PASS - + if cname.find("NetworkPool") >=0 and items['InstanceID'] == "NetworkPool/cimtest-networkpool": + status = PASS + if cname.find("DiskPool") >=0 and items['InstanceID'] == "DiskPool/foo": + status = PASS + + cleanup_restore(options.ip, options.virt) return status if __name__ == "__main__": sys.exit(main()) diff -r 6995ae30dc81 -r e981649cf307 suites/libvirt-cim/cimtest/HostedResourcePool/02_reverse.py --- a/suites/libvirt-cim/cimtest/HostedResourcePool/02_reverse.py Mon Aug 25 17:15:19 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedResourcePool/02_reverse.py Tue Aug 26 23:46:25 2008 -0700 @@ -30,6 +30,7 @@ from CimTest.ReturnCodes import PASS, FA from CimTest.ReturnCodes import PASS, FAIL from CimTest.Globals import do_main from XenKvmLib.classes import get_typed_class +from XenKvmLib.common_util import cleanup_restore, create_diskpool_conf sup_types=['Xen', 'KVM', 'XenFV', 'LXC'] @do_main(sup_types) @@ -42,10 +43,23 @@ def main(): host_cn = get_typed_class(options.virt, "HostSystem") logger.error(Globals.CIM_ERROR_ENUMERATE % host_cn) return FAIL + + status, dpool_name = create_diskpool_conf(options.ip, options.virt) + if status != PASS: + logger.error("Failed to create diskpool") + return FAIL + assoc_cn = get_typed_class(options.virt, "HostedResourcePool") proc_cn = get_typed_class(options.virt, "ProcessorPool") mem_cn = get_typed_class(options.virt, "MemoryPool") - poollist = { mem_cn : "MemoryPool/0", proc_cn : "ProcessorPool/0"} + net_cn = get_typed_class(options.virt, "NetworkPool") + disk_cn = get_typed_class(options.virt, "DiskPool") + poollist = { + mem_cn : "MemoryPool/0", + proc_cn : "ProcessorPool/0", + net_cn : "NetworkPool/cimtest-networkpool", + disk_cn : "DiskPool/foo" + } for k, v in poollist.items(): try: @@ -62,7 +76,8 @@ def main(): logger.error("Pool association returned wrong CreationClassName") status = FAIL if status != PASS: - break + break + cleanup_restore(options.ip, options.virt) return status if __name__ == "__main__": sys.exit(main()) diff -r 6995ae30dc81 -r e981649cf307 suites/libvirt-cim/cimtest/HostedResourcePool/04_reverse_errs.py --- a/suites/libvirt-cim/cimtest/HostedResourcePool/04_reverse_errs.py Mon Aug 25 17:15:19 2008 -0700 +++ b/suites/libvirt-cim/cimtest/HostedResourcePool/04_reverse_errs.py Tue Aug 26 23:46:25 2008 -0700 @@ -30,6 +30,7 @@ from CimTest.ReturnCodes import PASS from CimTest.ReturnCodes import PASS from CimTest.Globals import do_main from XenKvmLib.classes import get_typed_class +from XenKvmLib.common_util import cleanup_restore, create_diskpool_conf sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] expr_values = { @@ -48,14 +49,27 @@ def main(): options = main.options status = PASS + status, dpool_name = create_diskpool_conf(options.ip, options.virt) + if status != PASS: + logger.error("Failed to create diskpool") + return FAIL + assoc_classname = get_typed_class(options.virt, "HostedResourcePool") proc_cn = get_typed_class(options.virt, "ProcessorPool") mem_cn = get_typed_class(options.virt, "MemoryPool") + net_cn = get_typed_class(options.virt, "NetworkPool") + disk_cn = get_typed_class(options.virt, "DiskPool") + conn = assoc.myWBEMConnection('http://%s' % options.ip, (Globals.CIM_USER, Globals.CIM_PASS), Globals.CIM_NS) - poollist = {mem_cn : "MemoryPool/0", proc_cn : "ProcessorPool/0"} + poollist = { + mem_cn : "MemoryPool/0", + proc_cn : "ProcessorPool/0", + net_cn : "NetworkPool/cimtest-networkpool", + disk_cn : "DiskPool/foo" + } for k, v in poollist.items(): keys = { "Wrong" : v} ret = try_assoc(conn, k, assoc_classname, keys, "InstanceID", \ @@ -73,6 +87,7 @@ def main(): logger.error("------ FAILED: Invalid Name Key Value.------") status = ret + cleanup_restore(options.ip, options.virt) return status if __name__ == "__main__": sys.exit(main())

+ + status, dpool_name = create_diskpool_conf(options.ip, options.virt) + if status != PASS: + logger.error("Failed to create diskpool") + return FAIL + try: host_sys = hostsystem.enumerate(options.ip, options.virt)[0] except Exception: @@ -69,7 +76,12 @@ def main(): status = PASS if cname.find("ProcessorPool") >=0 and items['InstanceID'] == "ProcessorPool/0": status = PASS - + if cname.find("NetworkPool") >=0 and items['InstanceID'] == "NetworkPool/cimtest-networkpool":
Instead of hard coding the name of the network pool, it'd be a good idea to use default_network_name from const.py. That way, if the network pool name changes, we don't have to modify the individual tests.
+ status = PASS + if cname.find("DiskPool") >=0 and items['InstanceID'] == "DiskPool/foo":
Instead of hard coding this value, use the value returned by dpool_name. For version of libvirt that don't have disk pool support, we use "foo" as the InstanceID. But for versions of libvirt that support storage pools, the name of the pool is different.
+ status = PASS + + cleanup_restore(options.ip, options.virt) return status if __name__ == "__main__": sys.exit(main()) diff -r 6995ae30dc81 -r e981649cf307 suites/libvirt-cim/cimtest/HostedResourcePool/02_reverse.py
diff -r 6995ae30dc81 -r e981649cf307 suites/libvirt-cim/cimtest/HostedResourcePool/04_reverse_errs.py
The same comment for these two tests. Thanks! -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Kaitlin Rupert
-
yunguol@cn.ibm.com