[PATCH 0 of 2] Add KVM CDROM support
by Dan Smith
This set adds some KVM CDROM support to model these device types differently,
using the CIM_CDROMDrive class. Also, support changing the Address property
to eject or uneject the virtual drive as appropriate.
These have been in my queue for a long time, but after finishing up some bits,
they seem to work for me. We'll definitely want some test suite coverage
for this.
16 years, 2 months
[PATCH 0 of 3] Add LXC ProcRASD support
by Dan Smith
This set enables ProcRASD support for LXC domains. It exposes the interfaces
to get/set these values, as well as modifies the domain start logic to enforce
the values, like we do for Xen.
16 years, 2 months
[PATCH] [TEST] Fixing 05_hs_gi_errs.py tc of HostSystem to work with/without sblim-base-provider
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1223989931 25200
# Node ID 7b11fbb20dbfa346f4aa4d2a8fd1731490cd26da
# Parent 3131e7898af7f8c28d18e9c0d92c4855b08c1052
[TEST] Fixing 05_hs_gi_errs.py tc of HostSystem to work with/without sblim-base-provider.
Tested with Xen, XenFV, KVM with current sources, with/without sblim-base-provider.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 3131e7898af7 -r 7b11fbb20dbf suites/libvirt-cim/cimtest/HostSystem/05_hs_gi_errs.py
--- a/suites/libvirt-cim/cimtest/HostSystem/05_hs_gi_errs.py Tue Oct 14 05:39:41 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostSystem/05_hs_gi_errs.py Tue Oct 14 06:12:11 2008 -0700
@@ -29,7 +29,7 @@
# Input:
# ------
# wbemcli gi 'http://localhost:5988/root/virt:Xen_HostSystem.\
-# Wrong="Xen_HostSystem",Name="mx3650a.in.ibm.com"' -nl
+# Wrong="Xen_HostSystem",Name="x3650"' -nl
#
# Output:
# -------
@@ -40,7 +40,7 @@
# Input:
# ------
# wbemcli gi 'http://localhost:5988/root/virt:Xen_HostSystem.\
-# CreationClassName="Wrong",Name="mx3650a.in.ibm.com"' -nl
+# CreationClassName="Wrong",Name="x3650"' -nl
#
# Output:
# -------
@@ -51,7 +51,7 @@
# Input:
# ------
# wbemcli gi 'http://localhost:5988/root/virt:Xen_HostSystem.\
-# CreationClassName="Xen_HostSystem",Wrong="mx3650a.in.ibm.com"' -nl
+# CreationClassName="Xen_HostSystem",Wrong="x3650"' -nl
#
# Output:
# -------
@@ -78,19 +78,21 @@
from XenKvmLib.common_util import get_host_info, try_getinstance
from XenKvmLib.classes import get_typed_class
from optparse import OptionParser
-from CimTest.ReturnCodes import PASS, FAIL
+from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS
from XenKvmLib.const import do_main
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
expr_values = {
- "invalid_ccname" : {'rc' : pywbem.CIM_ERR_NOT_FOUND, \
- 'desc' : "No such instance (CreationClassName)" }, \
- "invalid_name" : {'rc' : pywbem.CIM_ERR_NOT_FOUND, \
- 'desc' : "No such instance (Name)" }
+ "invalid_ccname" : {'rc' : pywbem.CIM_ERR_NOT_FOUND,
+ 'desc' : "No such instance "
+ "(CreationClassName)" },
+ "invalid_name" : {'rc' : pywbem.CIM_ERR_NOT_FOUND,
+ 'desc' : "No such instance (Name)" }
}
+bug_sblim='00007'
@do_main(sup_types)
def main():
@@ -104,45 +106,62 @@
if status != PASS:
return status
- conn = assoc.myWBEMConnection('http://%s' % options.ip, (CIM_USER, CIM_PASS), CIM_NS)
+ conn = assoc.myWBEMConnection('http://%s' % options.ip,
+ (CIM_USER, CIM_PASS), CIM_NS)
# 1) Test by giving Invalid CCName Key Name
field = 'INVALID_CCName_KeyName'
keys = { field : classname, 'Name' : host_name }
- ret_value = try_getinstance(conn, classname, keys, field_name=field, \
- expr_values=expr_values['invalid_ccname'], bug_no="")
+ ret_value = try_getinstance(conn, classname, keys, field_name=field,
+ expr_values=expr_values['invalid_ccname'],
+ bug_no="")
if ret_value != PASS:
- logger.error("------ FAILED: Invalid CCName Key Name.------")
- status = ret_value
+ if classname == 'Linux_ComputerSystem':
+ return XFAIL_RC(bug_sblim)
+ else:
+ logger.error("------ FAILED: Invalid CCName Key Name.------")
+ return ret_value
# 2) Test by passing Invalid CCName Key Value
field = 'INVALID_CCName_KeyValue'
keys = { 'CreationClassName' : field, 'Name' : host_name }
- ret_value = try_getinstance(conn, classname, keys, field_name=field, \
- expr_values=expr_values['invalid_ccname'], bug_no="")
+ ret_value = try_getinstance(conn, classname, keys, field_name=field,
+ expr_values=expr_values['invalid_ccname'],
+ bug_no="")
if ret_value != PASS:
- logger.error("------ FAILED: Invalid CCName Key Value.------")
- status = ret_value
+ if classname == 'Linux_ComputerSystem':
+ return XFAIL_RC(bug_sblim)
+ else:
+ logger.error("------ FAILED: Invalid CCName Key Value.------")
+ return ret_value
# 3) Test by giving Invalid Name Key Name
field = 'INVALID_Name_KeyName'
keys = { 'CreationClassName' : classname, field : host_name}
- ret_value = try_getinstance(conn, classname, keys, field_name=field, \
- expr_values=expr_values['invalid_name'], bug_no="")
+ ret_value = try_getinstance(conn, classname, keys, field_name=field,
+ expr_values=expr_values['invalid_name'],
+ bug_no="")
if ret_value != PASS:
- logger.error("------ FAILED: Invalid Name Key Name.------")
- status = ret_value
+ if classname == 'Linux_ComputerSystem':
+ return XFAIL_RC(bug_sblim)
+ else:
+ logger.error("------ FAILED: Invalid Name Key Name.------")
+ return ret_value
# 4) Test by passing Invalid Name Key Value
field = 'INVALID_Name_KeyValue'
keys = { 'CreationClassName' : classname, 'Name' : field }
- ret_value = try_getinstance(conn, classname, keys, field_name=field, \
- expr_values=expr_values['invalid_name'], bug_no="")
+ ret_value = try_getinstance(conn, classname, keys, field_name=field,
+ expr_values=expr_values['invalid_name'],
+ bug_no="")
if ret_value != PASS:
- logger.error("------ FAILED: Invalid Name Key Value.------")
- status = ret_value
+ if classname == 'Linux_ComputerSystem':
+ return XFAIL_RC(bug_sblim)
+ else:
+ logger.error("------ FAILED: Invalid Name Key Value.------")
+ return ret_value
- return status
+ return PASS
if __name__ == "__main__":
sys.exit(main())
16 years, 2 months
[PATCH] [TEST] Fixing 04_hs_to_EAPF.py tc of HostSystem to work with/without sblim-base-provider
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1223987981 25200
# Node ID 3131e7898af7f8c28d18e9c0d92c4855b08c1052
# Parent c7eaf17bd591f313b93ff2b2087cee11b25789e0
[TEST] Fixing 04_hs_to_EAPF.py tc of HostSystem to work with/without sblim-base-provider.
Tested with Xen, XenFV, KVM with current sources, with/without sblim-base-provider.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r c7eaf17bd591 -r 3131e7898af7 suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py
--- a/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py Tue Oct 14 05:39:41 2008 -0700
@@ -56,7 +56,7 @@
from XenKvmLib.assoc import AssociatorNames, Associators
from XenKvmLib.common_util import get_host_info
from XenKvmLib.classes import get_typed_class
-from CimTest.ReturnCodes import PASS, FAIL, SKIP
+from CimTest.ReturnCodes import PASS, FAIL, SKIP, XFAIL_RC
from XenKvmLib.test_doms import destroy_and_undefine_all
from XenKvmLib.logicaldevices import verify_device_values
@@ -66,6 +66,7 @@
test_mac = "00:11:22:33:44:aa"
test_mem = 128
test_vcpus = 1
+bug_sblim='00007'
def print_err(err, detail, cn):
logger.error(err % cn)
@@ -147,22 +148,23 @@
return dom_list
-def get_assocname_info(server, cn, an, qcn, hostname, virt):
+def get_assocname_info(server, host_cn, an, qcn, hostname):
status = PASS
assoc_info = []
try:
- assoc_info = AssociatorNames(server,
- an,
- cn,
- CreationClassName=cn,
- Name = hostname)
+ assoc_info = AssociatorNames(server, an, host_cn,
+ CreationClassName=host_cn,
+ Name = hostname)
if len(assoc_info) < 1:
- logger.error("%s returned %i %s objects" % (an,
- len(assoc_info), qcn))
- status = FAIL
+ if host_cn == 'Linux_ComputerSystem':
+ return XFAIL_RC(bug_sblim), assoc_info
+ else:
+ logger.error("%s returned %i %s objects",
+ an, len(assoc_info), qcn)
+ return FAIL, assoc_info
except Exception, detail:
- print_err(CIM_ERROR_ASSOCIATORNAMES, detail, cn)
+ print_err(CIM_ERROR_ASSOCIATORNAMES, detail, host_cn)
status = FAIL
return status, assoc_info
@@ -232,10 +234,11 @@
net_name = vsxml.xml_get_net_network()
# Get the hostedResourcePool info first
- cn = classname
+ host_cn = classname
an = get_typed_class(virt, "HostedResourcePool")
qcn = "Device Pool"
- status, pool = get_assocname_info(server, cn, an, qcn, host_name, virt)
+ logger.error("DEBUG host_name is %s", host_name)
+ status, pool = get_assocname_info(server, host_cn, an, qcn, host_name)
if status != PASS:
vsxml.undefine(server)
return status
16 years, 2 months
[PATCH] [TEST] #2 Update ComputerSystem.01, 02, 03 to call new Enum* and GetInstance
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1223964411 25200
# Node ID c64cbf3068d46c66fd9ce425bf4621e67765399b
# Parent c7eaf17bd591f313b93ff2b2087cee11b25789e0
[TEST] #2 Update ComputerSystem.01, 02, 03 to call new Enum* and GetInstance
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r c7eaf17bd591 -r c64cbf3068d4 suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py Mon Oct 13 23:06:51 2008 -0700
@@ -26,6 +26,7 @@ from XenKvmLib.const import do_main
from XenKvmLib.const import do_main
from XenKvmLib import enumclass
from VirtLib import live
+from XenKvmLib.classes import get_typed_class
from VirtLib import utils
from CimTest import Globals
from CimTest.ReturnCodes import PASS, FAIL
@@ -37,9 +38,9 @@ def main():
options = main.options
status = PASS
- keys = ['Name', 'CreationClassName']
+ cs_class = get_typed_class(options.virt, 'ComputerSystem')
try:
- cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
+ cs = enumclass.EnumInstances(options.ip, cs_class)
live_cs = live.domain_list(options.ip, options.virt)
for system in cs:
name = system.name
diff -r c7eaf17bd591 -r c64cbf3068d4 suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py Mon Oct 13 23:06:51 2008 -0700
@@ -27,6 +27,7 @@ from XenKvmLib import enumclass
from XenKvmLib import enumclass
from VirtLib import live
from VirtLib import utils
+from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL, SKIP
@@ -48,11 +49,10 @@ def main():
logger.error("System has defined domains; unable to run")
return SKIP
- cn = "%s_ComputerSystem" % options.virt
+ cn = get_typed_class(options.virt, 'ComputerSystem')
- keys = ['Name', 'CreationClassName']
try:
- cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
+ cs = enumclass.EnumInstances(options.ip, cn)
except Exception, details:
logger.error(CIM_ERROR_ENUMERATE, cn)
diff -r c7eaf17bd591 -r c64cbf3068d4 suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py Mon Oct 13 23:06:51 2008 -0700
@@ -49,9 +49,9 @@ def main():
Globals.logger.error(VIRSH_ERROR_DEFINE % test_dom)
return status
- keys = ['Name', 'CreationClassName']
+ cs_class = get_typed_class(options.virt, 'ComputerSystem')
try:
- cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
+ cs = enumclass.EnumInstances(options.ip, cs_class)
if len(cs) == 0:
raise Exception('No cs instance returned')
for dom in cs:
16 years, 2 months
[PATCH] [TEST] Modify VSSD.01&04 to call new EnumInstances and EnumNames
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1223887006 25200
# Node ID 889637339f4dad55b11e7ee153cd4f1ba89eac85
# Parent c7eaf17bd591f313b93ff2b2087cee11b25789e0
[TEST] Modify VSSD.01&04 to call new EnumInstances and EnumNames
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r c7eaf17bd591 -r 889637339f4d suites/libvirt-cim/cimtest/VSSD/01_enum.py
--- a/suites/libvirt-cim/cimtest/VSSD/01_enum.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VSSD/01_enum.py Mon Oct 13 01:36:46 2008 -0700
@@ -31,6 +31,7 @@
from XenKvmLib import enumclass
from XenKvmLib.test_doms import destroy_and_undefine_all
from XenKvmLib.vxml import get_class
+from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL
@@ -53,9 +54,8 @@
try:
live_cs = live.domain_list(options.ip, options.virt)
- key_list = ["InstanceID"]
- syslst = enumclass.enumerate(options.ip, "VirtualSystemSettingData",
- key_list, options.virt)
+ vssd_class = get_typed_class(options.virt, 'VirtualSystemSettingData')
+ syslst = enumclass.EnumInstances(options.ip, vssd_class)
found = 0
for vssd in syslst :
diff -r c7eaf17bd591 -r 889637339f4d suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py
--- a/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py Mon Oct 13 01:36:46 2008 -0700
@@ -117,7 +117,7 @@
status = PASS
try:
classname = get_typed_class(virt, 'VirtualSystemSettingData')
- vssd = enumclass.enumerate_inst(server, eval('enumclass.' + classname), virt)
+ vssd = enumclass.EnumNames(server, classname)
if len(vssd) < 1 :
logger.error("%s returned %i %s objects, expected atleast 1" % (classname, len(vssd), 'VSSD'))
status = FAIL
16 years, 2 months
[PATCH] [TEST] Update ComputerSystem.01, 02, 03&05 to call new Enum* and GetInstance
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1223887550 25200
# Node ID 6c36af362f520ca37f8440a78f850520d6758dcf
# Parent c7eaf17bd591f313b93ff2b2087cee11b25789e0
[TEST] Update ComputerSystem.01,02,03&05 to call new Enum* and GetInstance
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r c7eaf17bd591 -r 6c36af362f52 suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/01_enum.py Mon Oct 13 01:45:50 2008 -0700
@@ -26,6 +26,7 @@
from XenKvmLib.const import do_main
from XenKvmLib import enumclass
from VirtLib import live
+from XenKvmLib.classes import get_typed_class
from VirtLib import utils
from CimTest import Globals
from CimTest.ReturnCodes import PASS, FAIL
@@ -37,9 +38,9 @@
options = main.options
status = PASS
- keys = ['Name', 'CreationClassName']
+ cs_class = get_typed_class(options.virt, 'ComputerSystem')
try:
- cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
+ cs = enumclass.EnumInstances(options.ip, cs_class)
live_cs = live.domain_list(options.ip, options.virt)
for system in cs:
name = system.name
diff -r c7eaf17bd591 -r 6c36af362f52 suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/02_nosystems.py Mon Oct 13 01:45:50 2008 -0700
@@ -27,6 +27,7 @@
from XenKvmLib import enumclass
from VirtLib import live
from VirtLib import utils
+from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL, SKIP
@@ -48,11 +49,10 @@
logger.error("System has defined domains; unable to run")
return SKIP
- cn = "%s_ComputerSystem" % options.virt
+ cn = get_typed_class(options.virt, 'ComputerSystem')
- keys = ['Name', 'CreationClassName']
try:
- cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
+ cs = enumclass.EnumInstances(options.ip, cn)
except Exception, details:
logger.error(CIM_ERROR_ENUMERATE, cn)
diff -r c7eaf17bd591 -r 6c36af362f52 suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/03_defineVS.py Mon Oct 13 01:45:50 2008 -0700
@@ -49,9 +49,9 @@
Globals.logger.error(VIRSH_ERROR_DEFINE % test_dom)
return status
- keys = ['Name', 'CreationClassName']
+ cs_class = get_typed_class(options.virt, 'ComputerSystem')
try:
- cs = enumclass.enumerate(options.ip, 'ComputerSystem', keys, options.virt)
+ cs = enumclass.EnumInstances(options.ip, cs_class)
if len(cs) == 0:
raise Exception('No cs instance returned')
for dom in cs:
diff -r c7eaf17bd591 -r 6c36af362f52 suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py Mon Oct 13 01:45:50 2008 -0700
@@ -78,7 +78,8 @@
'Name' : test_dom,
'CreationClassName' : get_typed_class(options.virt, 'ComputerSystem')
}
- cs = enumclass.getInstance(options.ip, 'ComputerSystem', keys, options.virt)
+ cs_class = get_typed_class(options.virt, 'ComputerSystem')
+ cs = enumclass.GetInstance(options.ip, cs_class, keys)
if cs.Name == test_dom:
from_State = cs.EnabledState
@@ -101,7 +102,7 @@
#Get the value of the EnabledState property and RequestedState property.
try:
- cs= enumclass.getInstance(options.ip, 'ComputerSystem', keys, options.virt)
+ cs= enumclass.GetInstance(options.ip, cs_class, keys)
if cs.Name == test_dom:
to_RequestedState = cs.RequestedState
enabledState = cs.EnabledState
16 years, 2 months
[PATCH] [TEST] #2 Fixing 01_forward.py tc of HostedResourcePool
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1223963406 25200
# Node ID 036da425d72c339cdd379b18c510f08b5c7918cd
# Parent c7eaf17bd591f313b93ff2b2087cee11b25789e0
[TEST] #2 Fixing 01_forward.py tc of HostedResourcePool.
The tc would fails in case if there is more than one pool for a particular devtype.
Tested with Xen, XenFV, KVM with current sources, with/without sblim-base-provider.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r c7eaf17bd591 -r 036da425d72c suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py
--- a/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostedResourcePool/01_forward.py Mon Oct 13 22:50:06 2008 -0700
@@ -24,6 +24,7 @@
#
import sys
+from sets import Set
from XenKvmLib import assoc
from XenKvmLib import enumclass
from XenKvmLib.common_util import get_host_info
@@ -39,14 +40,14 @@
@do_main(sup_types)
def main():
options = main.options
-
+ virt = options.virt
keys = ['Name', 'CreationClassName']
- status, host_sys, host_cn = get_host_info(options.ip, options.virt)
+ status, host_sys, host_cn = get_host_info(options.ip, virt)
if status != PASS:
logger.error("Error in calling get_host_info function")
return FAIL
try:
- assoc_cn = get_typed_class(options.virt, "HostedResourcePool")
+ assoc_cn = get_typed_class(virt, "HostedResourcePool")
pool = assoc.AssociatorNames(options.ip,
assoc_cn,
host_cn,
@@ -66,26 +67,51 @@
else:
logger.error("No pool returned")
return FAIL
+
+ mpool = get_typed_class(virt, 'MemoryPool')
+ exp_pllist = { mpool : ['MemoryPool/0'] }
+ if virt != 'LXC':
+ npool = get_typed_class(virt, 'NetworkPool')
+ dpool = get_typed_class(virt, 'DiskPool')
+ ppool = get_typed_class(virt, 'ProcessorPool')
+ exp_pllist[dpool] = ['DiskPool/%s' % default_pool_name]
+ exp_pllist[npool] = ['NetworkPool/%s' %default_network_name]
+ exp_pllist[ppool] = ['ProcessorPool/0']
try:
+ res_pllist = {}
for items in pool:
- cname = items.classname
- if cname.find("MemoryPool") >=0 and items['InstanceID'] != \
- "MemoryPool/0":
- raise Exception("%s does not match MemoryPool/0",
- items['InstanceID'])
- elif cname.find("ProcessorPool") >=0 and items['InstanceID'] != \
- "ProcessorPool/0":
- raise Exception("%s does not match ProcessorPool/0",
- items['InstanceID'])
- elif cname.find("NetworkPool") >=0 and items['InstanceID'] != \
- "NetworkPool/%s" %default_network_name:
- raise Exception("%s does not match NetworkPool/%s",
- items['InstanceID'], default_network_name)
- elif cname.find("DiskPool") >=0 and items['InstanceID'] != \
- "DiskPool/%s" % default_pool_name:
- raise Exception("%s does not match DiskPool/%s",
- items['InstanceID'], default_pool_name)
+ # The dict has some elements
+ if len(res_pllist) != 0:
+ # If the dict already has the key we append the new value
+ if items.classname in res_pllist.keys():
+ list = []
+ list = res_pllist[items.classname]
+ list.append(items['InstanceID'])
+ res_pllist[items.classname] = list
+ else:
+ # If the dict is not empty, but does not yet contain
+ # items.classname, we create new item
+ res_pllist[items.classname] = [items['InstanceID']]
+ else:
+ # When the dict is empty
+ res_pllist[items.classname] = [items['InstanceID']]
+
+ #Verifying we get all the expected pool class info
+ if len(Set(exp_pllist.keys()) - Set(res_pllist.keys())) != 0:
+ logger.error("Pool Class mismatch")
+ raise Exception("Expected Pool class list: %s \n \t Got: %s"
+ % (sorted(exp_pllist.keys()),
+ sorted(res_pllist.keys())))
+
+ #Verifying that we get the atleast the expected instanceid
+ #for every pool class
+ for key in exp_pllist.keys():
+ if Set(exp_pllist[key]) != Set(res_pllist[key]):
+ logger.error("InstanceID mismatch")
+ raise Exception("Expected InstanceID: %s \n \t Got: %s"
+ % (sorted(exp_pllist[key]),
+ sorted(res_pllist[key])))
except Exception, details:
logger.error(details)
return FAIL
16 years, 2 months
[PATCH] [TEST] #2 A big patch of update tc to call new EnumInstances
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1223963331 25200
# Node ID 6c71a150e47018258ca2abfa035891717c955995
# Parent c7eaf17bd591f313b93ff2b2087cee11b25789e0
[TEST] #2 A big patch of update tc to call new EnumInstances
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r c7eaf17bd591 -r 6c71a150e470 suites/libvirt-cim/cimtest/EnabledLogicalElementCapabilities/01_enum.py
--- a/suites/libvirt-cim/cimtest/EnabledLogicalElementCapabilities/01_enum.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/EnabledLogicalElementCapabilities/01_enum.py Mon Oct 13 22:48:51 2008 -0700
@@ -36,14 +36,11 @@ def main():
options = main.options
try:
- key_list = ["InstanceID"]
- elec = enumclass.enumerate(options.ip,
- "EnabledLogicalElementCapabilities",
- key_list,
- options.virt)
+ elec_class = get_typed_class(options.virt,
+ "EnabledLogicalElementCapabilities")
+ elec = enumclass.EnumInstances(options.ip, elec_class)
except Exception:
- Globals.logger.error(Globals.CIM_ERROR_ENUMERATE, \
- get_typed_class(options.virt, 'EnabledLogicalElementCapabilities'))
+ Globals.logger.error(Globals.CIM_ERROR_ENUMERATE, elec_class)
return 1
diff -r c7eaf17bd591 -r 6c71a150e470 suites/libvirt-cim/cimtest/HostSystem/01_enum.py
--- a/suites/libvirt-cim/cimtest/HostSystem/01_enum.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostSystem/01_enum.py Mon Oct 13 22:48:51 2008 -0700
@@ -48,7 +48,7 @@ def main():
ret, linux_cs = check_sblim(options.ip, options.virt)
try:
- hs = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)
+ hs = enumclass.EnumInstances(options.ip, name)
except Exception, details:
logger.error("%s %s: %s" % (CIM_ERROR_ENUMERATE, name, details))
status = FAIL
diff -r c7eaf17bd591 -r 6c71a150e470 suites/libvirt-cim/cimtest/ReferencedProfile/01_verify_refprof.py
--- a/suites/libvirt-cim/cimtest/ReferencedProfile/01_verify_refprof.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ReferencedProfile/01_verify_refprof.py Mon Oct 13 22:48:51 2008 -0700
@@ -87,8 +87,7 @@ def get_proflist():
proflist = []
status = PASS
try:
- key_list = ["InstanceID"]
- proflist = enumclass.enumerate(server, reg_classname, key_list, virt)
+ proflist = enumclass.EnumInstances(server, reg_classname)
if len(proflist) < 5:
logger.error("%s returned %i %s objects, expected atleast 5",
reg_classname, len(proflist), 'Profile')
diff -r c7eaf17bd591 -r 6c71a150e470 suites/libvirt-cim/cimtest/ReferencedProfile/02_refprofile_errs.py
--- a/suites/libvirt-cim/cimtest/ReferencedProfile/02_refprofile_errs.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ReferencedProfile/02_refprofile_errs.py Mon Oct 13 22:48:51 2008 -0700
@@ -80,8 +80,7 @@ def get_proflist():
proflist = []
status = PASS
try:
- key_list = ["InstanceID"]
- proflist = enumclass.enumerate(server, reg_classname, key_list, virt)
+ proflist = enumclass.EnumInstances(server, reg_classname)
if len(proflist) < 5 :
logger.error("%s returned %i %s objects, expected atleast 5",
reg_classname, len(proflist), 'Profile')
diff -r c7eaf17bd591 -r 6c71a150e470 suites/libvirt-cim/cimtest/ResourceAllocationFromPool/05_RAPF_err.py
--- a/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/05_RAPF_err.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ResourceAllocationFromPool/05_RAPF_err.py Mon Oct 13 22:48:51 2008 -0700
@@ -111,7 +111,7 @@ def get_netrasd_instid(server, virt, vsx
rasd_list = []
status = PASS
try:
- rasd_list = enumclass.enumerate_inst(server, classname, virt)
+ rasd_list = enumclass.EnumNames(server, classname)
if len(rasd_list) < 1:
logger.error("%s returned %i instances, excepted atleast 1 "
"instance", classname, len(rasd_list))
diff -r c7eaf17bd591 -r 6c71a150e470 suites/libvirt-cim/cimtest/ResourcePool/01_enum.py
--- a/suites/libvirt-cim/cimtest/ResourcePool/01_enum.py Fri Oct 10 03:08:12 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ResourcePool/01_enum.py Mon Oct 13 22:48:51 2008 -0700
@@ -27,7 +27,7 @@ import sys
import sys
import os
from distutils.file_util import move_file
-from XenKvmLib.enumclass import enumerate
+from XenKvmLib.enumclass import EnumInstances
from XenKvmLib.classes import get_typed_class
from XenKvmLib import vxml
from CimTest import Globals
@@ -111,36 +111,39 @@ def main():
logger.error("Failed to initialise the list")
return status
- key_list = ["InstanceID"]
+ mp = get_typed_class(virt, mp_cn)
+ pp = get_typed_class(virt, pp_cn)
+ dp = get_typed_class(virt, dp_cn)
+ np = get_typed_class(virt, np_cn)
+
+ try:
+ mempool = EnumInstances(ip, mp)
+ except Exception:
+ logger.error(Globals.CIM_ERROR_ENUMERATE % mp)
+ return FAIL
+ status = verify_fields(pool_list, mempool, mp)
try:
- mempool = enumerate(ip, mp_cn, key_list, virt)
+ propool = EnumInstances(ip, pp)
except Exception:
- logger.error(Globals.CIM_ERROR_ENUMERATE % mp_cn)
+ logger.error(Globals.CIM_ERROR_ENUMERATE % pp)
return FAIL
- status = verify_fields(pool_list, mempool, get_typed_class(virt, mp_cn))
-
- try:
- propool = enumerate(ip, pp_cn, key_list, virt)
- except Exception:
- logger.error(Globals.CIM_ERROR_ENUMERATE % pp_cn)
- return FAIL
- status = verify_fields(pool_list, propool, get_typed_class(virt, pp_cn))
+ status = verify_fields(pool_list, propool, pp)
if virt != 'LXC':
try:
- diskpool = enumerate(ip, dp_cn, key_list, virt)
+ diskpool = EnumInstances(ip, dp)
except Exception:
- logger.error(Globals.CIM_ERROR_ENUMERATE % dp_cn)
+ logger.error(Globals.CIM_ERROR_ENUMERATE % dp)
return FAIL
- status = verify_fields(pool_list, diskpool, get_typed_class(virt, dp_cn))
+ status = verify_fields(pool_list, diskpool, dp)
try:
- netpool = enumerate(ip, np_cn, key_list, virt)
+ netpool = EnumInstances(ip, np)
except Exception:
- logger.error(Globals.CIM_ERROR_ENUMERATE % np_cn)
+ logger.error(Globals.CIM_ERROR_ENUMERATE % np)
return FAIL
- status = verify_fields(pool_list, netpool, get_typed_class(virt, np_cn))
+ status = verify_fields(pool_list, netpool, np)
return status
16 years, 2 months