[Libvirt-cim] [PATCH 4 of 6] [TEST] Make network related changes to VSMS tests

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Mon Aug 25 14:22:37 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1219433898 25200
# Node ID 055021cae0200442791afada78d07ff3309a791c
# Parent  1c707cb7dff491a986f74157d1ab698032e32975
[TEST] Make network related changes to VSMS tests

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 1c707cb7dff4 -r 055021cae020 suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py	Fri Aug 22 12:38:18 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/06_addresource.py	Fri Aug 22 12:38:18 2008 -0700
@@ -22,6 +22,7 @@
 #
 
 import sys
+import random
 import pywbem
 from pywbem.cim_obj import CIMInstanceName
 from VirtLib import utils
@@ -32,15 +33,15 @@
 from CimTest.Globals import do_main
 from CimTest.ReturnCodes import FAIL, PASS
 from XenKvmLib import vsms_util
-from XenKvmLib.common_util import create_netpool_conf, destroy_netpool
+from XenKvmLib.const import default_network_name 
 
 sup_types = ['Xen', 'KVM', 'XenFV']
 default_dom = 'rstest_domain'
 nmac = '99:aa:bb:cc:ee:ff'
 ntype = 'network'
+npool_name = default_network_name + str(random.randint(1, 100)) 
 
-def cleanup_env(ip, virt, cxml, net_name):
-    destroy_netpool(ip, virt, net_name)
+def cleanup_env(ip, virt, cxml):
     cxml.destroy(ip)
     cxml.undefine(ip)
 
@@ -67,19 +68,13 @@
                   'src_path' : cxml.secondary_disk_path
                 }
 
-    status, net_name = create_netpool_conf(options.ip, options.virt,
-                                           use_existing=False)
-    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=net_name)
+                                             virt_net=npool_name)
 
     net_attr = { 'ntype' : ntype,
-                 'net_name' : net_name,
+                 'net_name' : npool_name,
                  'nmac' : nmac
                }
 
@@ -97,13 +92,13 @@
         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, net_name)
+            cleanup_env(options.ip, options.virt, cxml)
             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, net_name)
+                cleanup_env(options.ip, options.virt, cxml)
                 return FAIL
 
         status = vsms_util.add_disk_res(options.ip, service, cxml, vssd_ref,
@@ -116,7 +111,7 @@
         if status != PASS:
             break
 
-    cleanup_env(options.ip, options.virt, cxml, net_name)
+    cleanup_env(options.ip, options.virt, cxml)
 
     return status
 
diff -r 1c707cb7dff4 -r 055021cae020 suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py	Fri Aug 22 12:38:18 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py	Fri Aug 22 12:38:18 2008 -0700
@@ -32,8 +32,8 @@
 from CimTest.Globals import logger
 from CimTest.Globals import do_main
 from CimTest.ReturnCodes import PASS, FAIL
-from XenKvmLib.common_util import create_netpool_conf, destroy_netpool
 from XenKvmLib import vsms_util
+from XenKvmLib.const import default_network_name
 
 sup_types = ['Xen', 'KVM', 'XenFV']
 default_dom = 'rstest_domain'
@@ -42,8 +42,7 @@
 ncpu = 1
 nmem = 256 
 
-def cleanup_env(ip, virt, cxml, net_name):
-    destroy_netpool(ip, virt, net_name)
+def cleanup_env(ip, virt, cxml):
     cxml.destroy(ip)
     cxml.undefine(ip)
 
@@ -58,16 +57,10 @@
                                              source=ndpath, 
                                              name=default_dom)
     
-    status, net_name = create_netpool_conf(options.ip, options.virt, 
-                                           use_existing=False)
-    if status != PASS:
-        logger.error('Unable to find a network pool')
-        return FAIL 
-
     nasd = vsms.get_nasd_class(options.virt)(type=ntype, 
                                              mac=cxml.xml_get_net_mac(),
                                              name=default_dom,
-                                             virt_net=net_name)
+                                             virt_net=default_network_name)
     masd = vsms.get_masd_class(options.virt)(megabytes=nmem, name=default_dom)
     pasd = vsms.get_pasd_class(options.virt)(vcpu=ncpu, name=default_dom)
 
@@ -85,13 +78,13 @@
         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, net_name)
+            cleanup_env(options.ip, options.virt, cxml)
             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, net_name)
+                cleanup_env(options.ip, options.virt, cxml)
                 return FAIL
 
         status = vsms_util.mod_vcpu_res(options.ip, service, cxml, pasd, ncpu,
@@ -112,11 +105,11 @@
             break
 
         status = vsms_util.mod_net_res(options.ip, service, options.virt, cxml,
-                                       nasd, ntype, net_name)
+                                       nasd, ntype, default_network_name)
         if status != PASS:
             break
 
-    cleanup_env(options.ip, options.virt, cxml, net_name)
+    cleanup_env(options.ip, options.virt, cxml)
 
     return status
 
diff -r 1c707cb7dff4 -r 055021cae020 suites/libvirt-cim/cimtest/VirtualSystemManagementService/09_procrasd_persist.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/09_procrasd_persist.py	Fri Aug 22 12:38:18 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/09_procrasd_persist.py	Fri Aug 22 12:38:18 2008 -0700
@@ -30,7 +30,6 @@
 from CimTest.Globals import do_main
 from CimTest.ReturnCodes import FAIL, PASS
 from XenKvmLib.test_doms import destroy_and_undefine_domain 
-from XenKvmLib.common_util import create_netpool_conf, destroy_netpool
 
 sup_types = ['Xen', 'XenFV', 'KVM']
 default_dom = 'rstest_domain'
@@ -95,11 +94,6 @@
 def main():
     options = main.options
 
-    status, test_network = create_netpool_conf(options.ip, options.virt, False)
-    if status != PASS:
-        return FAIL
-
-
     status, vssd, rasd = setup_rasd_mof(options.ip, options.virt)
     if status != PASS:
         return status
@@ -134,7 +128,6 @@
         logger.error(details)
         status = FAIL
 
-    destroy_netpool(options.ip, options.virt, test_network)
     destroy_and_undefine_domain(default_dom, options.ip, options.virt)
 
     return status 
diff -r 1c707cb7dff4 -r 055021cae020 suites/libvirt-cim/cimtest/VirtualSystemManagementService/12_referenced_config.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/12_referenced_config.py	Fri Aug 22 12:38:18 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/12_referenced_config.py	Fri Aug 22 12:38:18 2008 -0700
@@ -24,8 +24,7 @@
 import pywbem
 from XenKvmLib.common_util import create_using_definesystem, \
                                   call_request_state_change, \
-                                  poll_for_state_change, get_cs_instance, \
-                                  create_netpool_conf, destroy_netpool
+                                  poll_for_state_change, get_cs_instance
 from XenKvmLib import vsms
 from VirtLib import utils 
 from CimTest.Globals import logger, do_main
@@ -119,11 +118,6 @@
     options = main.options
 
     try:
-        status, net_name = create_netpool_conf(options.ip, options.virt, False)
-        if status != PASS:
-            logger.error('Unable to find a network pool')
-            return FAIL
-
         status = setup_first_guest(options.ip, options.virt)
         if status != PASS:
             raise Exception("Unable to start %s" % test_dom)
@@ -164,7 +158,6 @@
         logger.error(details)
         status = FAIL
 
-    destroy_netpool(options.ip, options.virt, net_name)
     destroy_and_undefine_domain(test_dom, options.ip, options.virt)
     destroy_and_undefine_domain(test_dom2, options.ip, options.virt)
 




More information about the Libvirt-cim mailing list