# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1219984629 25200
# Node ID 10fde478001991f40209fb6e18aca5231c41cc14
# Parent a9978826a31d881a7fcaa2ca277a44322511a624
[TEST]#2 Add HRP.01~04 to support disk and net pool, user default or return name instead
of hard code
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r a9978826a31d -r 10fde4780019
suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py
--- a/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py Wed Aug 27 01:04:31 2008
-0700
+++ b/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py Thu Aug 28 21:37:09 2008
-0700
@@ -26,17 +26,25 @@
import sys
from XenKvmLib import assoc
from XenKvmLib import enumclass
+from XenKvmLib.const import default_network_name
from CimTest import Globals
from CimTest.Globals import logger
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
+
keys = ['Name', 'CreationClassName']
try:
host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys,
options.virt)[0]
@@ -70,6 +78,13 @@
status = PASS
if cname.find("ProcessorPool") >=0 and items['InstanceID']
== "ProcessorPool/0":
status = PASS
+ if cname.find("NetworkPool") >=0 and \
+ items['InstanceID'] == "NetworkPool/%s"
%default_network_name:
+ status = PASS
+ if cname.find("DiskPool") >=0 and items['InstanceID'] ==
"DiskPool/%s" %dpool_name:
+ status = PASS
+
+ cleanup_restore(options.ip, options.virt)
return status
if __name__ == "__main__":
diff -r a9978826a31d -r 10fde4780019
suites/libvirt-cim/cimtest/HostedResourcePool/02_reverse.py
--- a/suites/libvirt-cim/cimtest/HostedResourcePool/02_reverse.py Wed Aug 27 01:04:31 2008
-0700
+++ b/suites/libvirt-cim/cimtest/HostedResourcePool/02_reverse.py Thu Aug 28 21:37:09 2008
-0700
@@ -25,17 +25,25 @@
import sys
from XenKvmLib import assoc
from XenKvmLib import enumclass
+from XenKvmLib.const import default_network_name
from CimTest import Globals
from CimTest.Globals import logger
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 = PASS
+
+ status, dpool_name = create_diskpool_conf(options.ip, options.virt)
+ if status != PASS:
+ logger.error("Failed to create diskpool")
+ return FAIL
+
keys = ['Name', 'CreationClassName']
try:
host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys,
options.virt)[0]
@@ -46,7 +54,14 @@
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/%s" %default_network_name,
+ disk_cn : "DiskPool/%s" %dpool_name
+ }
for k, v in poollist.items():
try:
@@ -64,6 +79,7 @@
status = FAIL
if status != PASS:
break
+ cleanup_restore(options.ip, options.virt)
return status
if __name__ == "__main__":
sys.exit(main())
diff -r a9978826a31d -r 10fde4780019
suites/libvirt-cim/cimtest/HostedResourcePool/04_reverse_errs.py
--- a/suites/libvirt-cim/cimtest/HostedResourcePool/04_reverse_errs.py Wed Aug 27 01:04:31
2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostedResourcePool/04_reverse_errs.py Thu Aug 28 21:37:09
2008 -0700
@@ -24,12 +24,14 @@
import sys
import pywbem
from XenKvmLib import assoc
+from XenKvmLib.const import default_network_name
from XenKvmLib.common_util import try_assoc
from CimTest import Globals
from CimTest.Globals import logger
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 +50,26 @@
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/%s" %default_network_name,
+ disk_cn : "DiskPool/%s" %dpool_name
+ }
for k, v in poollist.items():
keys = { "Wrong" : v}
ret = try_assoc(conn, k, assoc_classname, keys, "InstanceID", \
@@ -73,6 +87,7 @@
logger.error("------ FAILED: Invalid Name Key Value.------")
status = ret
+ cleanup_restore(options.ip, options.virt)
return status
if __name__ == "__main__":
sys.exit(main())