# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1216010940 25200
# Node ID 472b025c9fb6b5f59302ce36d95d5f930b1f4ebb
# Parent 64abdd1495dc05e69061151baf2ea25a682e8d8d
[TEST] Update Profile.02 for KVM/XenFV/LXC support
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 64abdd1495dc -r 472b025c9fb6
suites/libvirt-cim/cimtest/Profile/02_profile_to_elec.py
--- a/suites/libvirt-cim/cimtest/Profile/02_profile_to_elec.py Fri Jul 11 00:42:35 2008
-0700
+++ b/suites/libvirt-cim/cimtest/Profile/02_profile_to_elec.py Sun Jul 13 21:49:00 2008
-0700
@@ -42,16 +42,17 @@ from XenKvmLib.assoc import Associators
from XenKvmLib.assoc import Associators
from XenKvmLib.vxml import get_class
from XenKvmLib.test_doms import destroy_and_undefine_all
+from XenKvmLib.classes import get_typed_class
from CimTest import Globals
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, CIM_ERROR_ASSOCIATORNAMES
from CimTest.Globals import do_main
from CimTest.ReturnCodes import PASS, FAIL
-sup_types = ['Xen']
+sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
test_dom = "domguest"
-def setup_env(server):
+def setup_env(server, virt='Xen'):
rc = -1
status = PASS
csxml_info = None
@@ -59,10 +60,10 @@ def setup_env(server):
destroy_and_undefine_all(server)
virt_xml = get_class(virt)
csxml_info = virt_xml(test_dom)
- rc = csxml_info.cim_define(server)
+ rc = csxml_info.define(server)
if not rc:
- logger.error("Unable define domain %s using DefineSystem() " %
test_dom)
+ logger.error("Unable define domain %s" % test_dom)
status = FAIL
except Exception, detail:
@@ -96,15 +97,16 @@ def get_inst_from_list(server, cn, qcn,
return PASS, inst
-def get_profile(server):
+def get_profile(server, virt='Xen'):
registeredname = 'Virtual System Profile'
- cn = 'Xen_RegisteredProfile'
+ cn = get_typed_class(virt, 'RegisteredProfile')
status = PASS
profile = None
try:
proflist = enumclass.enumerate_inst(server,
- enumclass.Xen_RegisteredProfile)
+ 'RegisteredProfile',
+ virt)
filter = {"key" : "RegisteredName"}
status, profile = get_inst_from_list(server,
@@ -120,9 +122,9 @@ def get_profile(server):
return status, profile
-def get_cs(server, profile):
- cn = 'Xen_RegisteredProfile'
- an = 'Xen_ElementConformsToProfile'
+def get_cs(server, profile, virt='Xen'):
+ cn = get_typed_class(virt, 'RegisteredProfile')
+ an = get_typed_class(virt, 'ElementConformsToProfile')
status = PASS
cs = None
@@ -130,9 +132,10 @@ def get_cs(server, profile):
assoc_info = Associators(server,
an,
cn,
+ virt,
InstanceID = profile['InstanceID'])
- cn = 'Xen_ComputerSystem'
+ cn = get_typed_class(virt, 'ComputerSystem')
filter = {"key" : "Name"}
status, cs = get_inst_from_list(server,
cn,
@@ -147,9 +150,9 @@ def get_cs(server, profile):
return status, cs
-def get_elec(server, cs):
- cn = 'Xen_ComputerSystem'
- an = 'Xen_ElementCapabilities'
+def get_elec(server, cs, virt='Xen'):
+ cn = get_typed_class(virt, 'ComputerSystem')
+ an = get_typed_class(virt, 'ElementCapabilities')
status = FAIL
elec = None
@@ -158,10 +161,11 @@ def get_elec(server, cs):
assoc_info = Associators(server,
an,
cn,
+ virt,
Name = cs['Name'],
CreationClassName = ccn)
- cn = 'Xen_EnabledLogicalElementCapabilities'
+ cn = get_typed_class(virt, 'EnabledLogicalElementCapabilities')
filter = {"key" : "InstanceID"}
status, elec = get_inst_from_list(server,
cn,
@@ -185,27 +189,27 @@ def main():
server = options.ip
status = PASS
-
- status, csxml = setup_env(server)
+
+ status, csxml = setup_env(server, virt)
if status != PASS:
return status
prev_namespace = Globals.CIM_NS
Globals.CIM_NS = 'root/interop'
- status, prof = get_profile(server)
+ status, prof = get_profile(server, virt)
if status != PASS or prof == None:
csxml.undefine(server)
return status
- status, cs = get_cs(server, prof)
+ status, cs = get_cs(server, prof, virt)
if status != PASS or cs == None:
csxml.undefine(server)
return status
Globals.CIM_NS = prev_namespace
- status, elec = get_elec(server, cs)
+ status, elec = get_elec(server, cs, virt)
if status != PASS or elec == None:
return status