# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1208246537 25200
# Node ID 4d0718ea831bdca73ff95d4c8fafccc28af3753d
# Parent b5fadaed5253eded648bec77627a9024184381c4
[TEST] Add KVM & XenFV support for VirtualSystemMigrationService.01
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r b5fadaed5253 -r 4d0718ea831b
suites/libvirt-cim/cimtest/VirtualSystemMigrationService/01_migratable_host.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/01_migratable_host.py Tue
Apr 15 00:55:16 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/01_migratable_host.py Tue
Apr 15 01:02:17 2008 -0700
@@ -31,27 +31,28 @@ 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 start_guest_get_ref(ip, guest_name):
+def start_guest_get_ref(ip, guest_name, virt='Xen'):
try:
- xmlfile = testxml(guest_name)
- define_test_domain(xmlfile, ip)
-
- start_test_domain(guest_name, ip)
+ virt_xml = vxml.get_class(virt)
+ cxml = virt_xml(guest_name)
+ ret = cxml.create(ip)
time.sleep(10)
except Exception:
logger.error("Error creating 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})
@@ -66,9 +67,9 @@ def main():
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.
@@ -79,7 +80,7 @@ def main():
else:
local_migrate = 0
- status, cs_ref = start_guest_get_ref(options.ip, dom_name)
+ status, cs_ref = start_guest_get_ref(options.ip, dom_name, options.virt)
if status != PASS:
return FAIL
@@ -102,9 +103,7 @@ def main():
status = check_migration_job(options.ip, id, target_ip,
guest_name, local_migrate)
-
- destroy_and_undefine_domain(dom_name, options.ip)
-
+ destroy_and_undefine_domain(dom_name, options.ip)
return status
if __name__ == "__main__":