# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1222080479 25200
# Node ID da720533a1b7a63c43f864d8bf1e25f384bd81a4
# Parent 892ce3fce2340df3fb51a1160f510d15838f2d54
[TEST] Fixing the 06_addresource.py tc of VSMS.
The tc was failing with Xen/XenFV since it was trying to start a VS using non-existing
networkpool.
Tested witn Xen, XenFV and KVM(F9 ) with current sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 892ce3fce234 -r da720533a1b7
suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py Fri Sep
12 14:35:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py Mon Sep
22 03:47:59 2008 -0700
@@ -34,6 +34,7 @@ from CimTest.ReturnCodes import FAIL, PA
from CimTest.ReturnCodes import FAIL, PASS
from XenKvmLib import vsms_util
from XenKvmLib.const import default_network_name
+from XenKvmLib.common_util import create_netpool_conf, destroy_netpool
sup_types = ['Xen', 'KVM', 'XenFV']
default_dom = 'rstest_domain'
@@ -41,7 +42,8 @@ ntype = 'network'
ntype = 'network'
npool_name = default_network_name + str(random.randint(1, 100))
-def cleanup_env(ip, virt, cxml):
+def cleanup_env(ip, virt, cxml, net_name):
+ destroy_netpool(ip, virt, net_name)
cxml.destroy(ip)
cxml.undefine(ip)
@@ -68,13 +70,21 @@ def main():
'src_path' : cxml.secondary_disk_path
}
+ status, net_name = create_netpool_conf(options.ip, options.virt,
+ use_existing=False,
+ net_name=npool_name)
+ if status != PASS:
+ logger.error('Unable to create network pool')
+ return FAIL
+
+
nasd = vsms.get_nasd_class(options.virt)(type=ntype,
mac=nmac,
name=default_dom,
- virt_net=npool_name)
+ virt_net=net_name)
net_attr = { 'ntype' : ntype,
- 'net_name' : npool_name,
+ 'net_name' : net_name,
'nmac' : nmac
}
@@ -92,13 +102,13 @@ def main():
ret = cxml.define(options.ip)
if not ret:
logger.error("Failed to define the dom: %s", default_dom)
- cleanup_env(options.ip, options.virt, cxml)
+ cleanup_env(options.ip, options.virt, cxml, net_name)
return FAIL
if case == "start":
ret = cxml.start(options.ip)
if not ret:
logger.error("Failed to start the dom: %s", default_dom)
- cleanup_env(options.ip, options.virt, cxml)
+ cleanup_env(options.ip, options.virt, cxml, net_name)
return FAIL
status = vsms_util.add_disk_res(options.ip, service, cxml, vssd_ref,
@@ -111,7 +121,7 @@ def main():
if status != PASS:
break
- cleanup_env(options.ip, options.virt, cxml)
+ cleanup_env(options.ip, options.virt, cxml, net_name)
return status