# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1208246719 25200
# Node ID cc0804a7049ccf7cbb2274ec97a82b6c0c0fd9fd
# Parent 4d0718ea831bdca73ff95d4c8fafccc28af3753d
[TEST] Add KVM & XenFV support for VirtualSystemMigrationService.02
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 4d0718ea831b -r cc0804a7049c
suites/libvirt-cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py Tue
Apr 15 01:02:17 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py Tue
Apr 15 01:05:19 2008 -0700
@@ -29,32 +29,35 @@ from XenKvmLib.test_xml import *
from XenKvmLib.test_xml import *
from XenKvmLib import computersystem
from XenKvmLib import vsmigrations
+from XenKvmLib import vxml
+from XenKvmLib.classes import get_typed_class
from XenKvmLib.vsmigrations import check_possible_host_migration, migrate_guest_to_host,
check_migration_job
from XenKvmLib import enumclass
from CimTest.Globals import log_param, logger, CIM_ERROR_ENUMERATE, do_main
from CimTest.ReturnCodes import PASS, FAIL, XFAIL
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV', 'KVM']
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)
+ ret = cxml.define(ip)
except Exception:
logger.error("Error define domain %s" % guest_name)
destroy_and_undefine_domain(guest_name, options.ip)
return FAIL, None
- classname = 'Xen_ComputerSystem'
+ classname = get_typed_class(virt, 'ComputerSystem')
cs_ref = CIMInstanceName(classname, keybindings = {
'Name':guest_name,
'CreationClassName':classname})
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:
@@ -65,7 +68,7 @@ def setup_env(ip, migration_list, local_
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)
@@ -107,11 +110,11 @@ def main():
log_param()
status = PASS
rc = -1
-
+
try:
- service = vsmigrations.Xen_VirtualSystemMigrationService(options.ip)
+ service = eval('vsmigrations.' + get_typed_class(options.virt,
"VirtualSystemMigrationService"))(options.ip)
except Exception:
- logger.error("Error getting inst of
Xen_VirtualSystemMigrationService")
+ logger.error("Error getting inst of VirtualSystemMigrationService")
return FAIL
#This value can be changed to a different target host.
@@ -127,7 +130,7 @@ def main():
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