# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1218175235 25200
# Node ID 38cb7b2def3f81333420a6957d24103c5b55fad9
# Parent 0f568c2c36035da2574e11d128780833392e43af
[TEST] #3 Fix ResourceAllocationFromPool.01 & 02
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 0f568c2c3603 -r 38cb7b2def3f
suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py
--- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py Wed Aug 06
06:08:02 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/01_forward.py Thu Aug 07
23:00:35 2008 -0700
@@ -57,18 +57,21 @@
vsxml = virtxml(test_dom)
else:
vsxml = virtxml(test_dom, mem=test_mem, vcpus = test_vcpus,
- mac = test_mac, disk = test_disk)
+ mac = test_mac, disk = test_disk,
+ ntype='network')
+
+ test_network = vsxml.xml_get_net_network()
try:
ret = vsxml.define(server)
if not ret:
logger.error("Failed to Define the domain: %s", test_dom)
- return FAIL, vsxml, test_disk
+ return FAIL, vsxml, test_disk, test_network
except Exception, details:
logger.error("Exception : %s", details)
- return FAIL, vsxml, test_disk
+ return FAIL, vsxml, test_disk, test_network
- return PASS, vsxml, test_disk
+ return PASS, vsxml, test_disk, test_network
def get_instance(server, pool, list, virt='Xen'):
try:
@@ -111,22 +114,19 @@
status = PASS
- status, vsxml, test_disk = setup_env(options.ip, options.virt)
+ status, vsxml, test_disk, test_network = setup_env(options.ip, options.virt)
if status != PASS:
+ destroy_netpool(options.ip, options.virt, test_network)
+ vsxml.undefine(options.ip)
return status
status, diskid = create_diskpool_conf(options.ip, options.virt)
if status != PASS:
cleanup_restore(options.ip, options.virt)
+ destroy_netpool(options.ip, options.virt, test_network)
vsxml.undefine(options.ip)
return status
- status, test_network = create_netpool_conf(options.ip, options.virt)
- if status != PASS:
- cleanup_restore(options.ip, options.virt)
- vsxml.undefine(options.ip)
- return status
-
if options.virt == 'LXC':
pool = { "MemoryPool" : {'InstanceID' :
"MemoryPool/0"} }
rasd = { "MemoryPool" : "%s/mem" % test_dom }
diff -r 0f568c2c3603 -r 38cb7b2def3f
suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py
--- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py Wed Aug 06
06:08:02 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/02_reverse.py Thu Aug 07
23:00:35 2008 -0700
@@ -56,18 +56,20 @@
vsxml = virtxml(test_dom)
else:
vsxml = virtxml(test_dom, mem=test_mem, vcpus = test_vcpus,
- mac = test_mac, disk = test_disk)
+ mac = test_mac, disk = test_disk,
+ ntype = 'network')
+ test_network = vsxml.xml_get_net_network()
try:
ret = vsxml.define(server)
if not ret:
logger.error("Failed to Define the domain: %s", test_dom)
- return FAIL, vsxml, test_disk
+ return FAIL, vsxml, test_disk, test_network
except Exception, details:
logger.error("Exception : %s", details)
- return FAIL, vsxml, test_disk
+ return FAIL, vsxml, test_disk, test_network
- return PASS, vsxml, test_disk
+ return PASS, vsxml, test_disk, test_network
def init_list(test_disk, diskid, test_network, virt='Xen'):
@@ -163,16 +165,16 @@
server = options.ip
virt = options.virt
- status, vsxml, test_disk = setup_env(server, virt)
+ status, vsxml, test_disk, test_network = setup_env(server, virt)
if status != PASS:
+ destroy_netpool(server, virt, test_network)
+ vsxml.undefine(server)
return status
status, diskid = create_diskpool_conf(server, virt)
if status != PASS:
- return status
-
- status, test_network = create_netpool_conf(server, virt)
- if status != PASS:
+ destroy_netpool(server, virt, test_network)
+ vsxml.undefine(server)
return status
cn_id_list = init_list(test_disk, diskid, test_network, options.virt)