# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1219395625 25200
# Node ID 9685653189eb23d669cd25de192b6cb80308439a
# Parent a2d99551422607e336428ea36d23e5336042a847
[TEST] Fixed enumclass.py and vsmigration.py to work with different Virt MigrationJob.
Remove hardcoded Virt prefix from VSMigrationJob and used the virt param.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r a2d995514226 -r 9685653189eb suites/libvirt-cim/lib/XenKvmLib/enumclass.py
--- a/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Wed Aug 20 14:30:36 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/enumclass.py Fri Aug 22 02:00:25 2008 -0700
@@ -90,9 +90,13 @@ class CIM_DiskResourceAllocationSettingD
class CIM_DiskResourceAllocationSettingData(CIM_MyClass):
pass
+class Xen_MigrationJob(CIM_MyClass):
+ pass
+class KVM_MigrationJob(CIM_MyClass):
+ pass
-class Virt_MigrationJob(CIM_MyClass):
+class XenFV_MigrationJob(CIM_MyClass):
pass
class Xen_RegisteredProfile(CIM_RegisteredProfile):
diff -r a2d995514226 -r 9685653189eb suites/libvirt-cim/lib/XenKvmLib/vsmigrations.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsmigrations.py Wed Aug 20 14:30:36 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsmigrations.py Fri Aug 22 02:00:25 2008 -0700
@@ -26,6 +26,7 @@ from XenKvmLib.test_doms import destroy_
from XenKvmLib.test_doms import destroy_and_undefine_domain
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE
from XenKvmLib import enumclass
+from XenKvmLib.classes import get_typed_class
from VirtLib.live import domain_list
class CIM_VirtualSystemMigrationService(CIMMethodClass):
@@ -100,22 +101,19 @@ def migrate_guest_to_host(service, ref,
if len(ret) == 0:
logger.error("MigrateVirtualSystemToHost returns an empty list")
return FAIL, ret
-
return PASS, ret
-def get_migration_job_instance(ip, id):
+def get_migration_job_instance(ip, virt, id):
job = []
key_list = ["instanceid"]
-
+ mig_job_cn = get_typed_class(virt, 'MigrationJob')
try:
- #virt='Virt' is odd here. However, for MigrationJob, the
- #provider is virtualization neutral.
job = enumclass.enumerate(ip,
- enumclass.Virt_MigrationJob,
+ mig_job_cn,
key_list,
- virt='Virt')
+ virt=virt)
except Exception, details:
- logger.error(CIM_ERROR_ENUMERATE, 'Virt_MigrationJob')
+ logger.error(CIM_ERROR_ENUMERATE, mig_job_cn)
logger.error(details)
return FAIL, None
@@ -126,7 +124,7 @@ def get_migration_job_instance(ip, id):
if job[i].InstanceID == id:
break
elif i == len(job)-1 and job[i].InstanceID != id:
- logger.error("Virt_MigrationJob err: can't find expected job
inst")
+ logger.error("%s err: can't find expected job inst",
mig_job_cn)
return FAIL, None
return PASS, job[i]
@@ -144,8 +142,8 @@ def verify_domain_list(list, local_migra
return PASS
-def check_migration_job(ip, id, target_ip, test_dom, local_migrate):
- status, job_inst = get_migration_job_instance(ip, id)
+def check_migration_job(ip, id, target_ip, test_dom, local_migrate, virt='Xen'):
+ status, job_inst = get_migration_job_instance(ip, virt, id)
if status != PASS:
return FAIL
@@ -159,7 +157,7 @@ def check_migration_job(ip, id, target_i
break
elif job_inst.JobState == 4 and i < 49:
time.sleep(3)
- status, job_inst = get_migration_job_instance(ip, id)
+ status, job_inst = get_migration_job_instance(ip, virt, id)
if status != PASS:
return FAIL
else: