# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1216721594 25200
# Node ID 4aecbb8cdaeef5b7c13517a08cd411c27bc429ca
# Parent 3703b7be5a107c67e901546978e974546b3d5562
[TEST] Update VSMigrationS.02 for XenFV support, also convert test_xml call to vxml
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 3703b7be5a10 -r 4aecbb8cdaee
suites/libvirt-cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py Wed
Jul 16 07:23:32 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py Tue
Jul 22 03:13:14 2008 -0700
@@ -25,8 +25,8 @@
import pywbem
from pywbem.cim_obj import CIMInstanceName
from VirtLib import utils
-from XenKvmLib.test_doms import define_test_domain, start_test_domain,
destroy_and_undefine_domain
-from XenKvmLib.test_xml import *
+from XenKvmLib.test_doms import destroy_and_undefine_domain
+from XenKvmLib import vxml
from XenKvmLib import computersystem
from XenKvmLib import vsmigrations
from XenKvmLib.vsmigrations import check_possible_host_migration, migrate_guest_to_host,
check_migration_job
@@ -34,14 +34,15 @@
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, do_main
from CimTest.ReturnCodes import PASS, FAIL, XFAIL
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV']
dom_name = 'dom_migrate'
-def define_guest_get_ref(ip, guest_name):
+def define_guest_get_ref(ip, guest_name, virt='Xen'):
try:
- xmlfile = testxml(guest_name)
- define_test_domain(xmlfile, ip)
+ virt_xml = vxml.get_class(virt)
+ cxml = virt_xml(guest_name)
+ cxml.define(ip)
except Exception:
logger.error("Error define domain %s" % guest_name)
destroy_and_undefine_domain(guest_name, options.ip)
@@ -54,18 +55,18 @@
return PASS, cs_ref
-def setup_env(ip, migration_list, local_migrate):
+def setup_env(ip, migration_list, local_migrate, virt='Xen'):
ref_list = []
if local_migrate == 1:
for i in range(0, len(migration_list)):
guest_name = "%s-%i" % (dom_name, i)
- status, ref = define_guest_get_ref(ip, guest_name)
+ status, ref = define_guest_get_ref(ip, guest_name, virt)
if status != PASS:
return FAIL, None
ref_list.append(ref)
else:
- status, ref = define_guest_get_ref(ip, dom_name)
+ status, ref = define_guest_get_ref(ip, dom_name, virt)
if status != PASS:
return FAIL, None
ref_list.append(ref)
@@ -90,10 +91,13 @@
return migration_list
-def start_guest(ip, guest_name, type):
+def start_guest(ip, guest_name, type, virt='Xen'):
if type != "Offline":
try:
- start_test_domain(guest_name, ip)
+ virt_xml = vxml.get_class(virt)
+ cxml = virt_xml(guest_name)
+ cxml.start(ip)
+
time.sleep(10)
except Exception:
logger.error("Error start domain %s" % guest_name)
@@ -126,7 +130,7 @@
ref_list = []
cs_ref = None
- status, ref_list = setup_env(options.ip, mlist, local_migrate)
+ status, ref_list = setup_env(options.ip, mlist, local_migrate, options.virt)
if status != PASS or len(ref_list) < 1:
return FAIL
@@ -135,7 +139,7 @@
for type, item in mlist.iteritems():
guest_name = cs_ref['Name']
- status = start_guest(options.ip, guest_name, type)
+ status = start_guest(options.ip, guest_name, type, options.virt)
if status != PASS:
break