[PATCH] [TEST] Moving the print_error field from tc to lib
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1208942359 -19800
# Node ID a291c9b8bc028f1c60dc6c2c78f0b8a31814b38c
# Parent 185f354355a16b74c2db57d18f6ef28c7ae2802c
[TEST] Moving the print_error field from tc to lib.
There are lot of tc which make use of the print_error function to
print the field error. Hence moved it to the lib .
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 185f354355a1 -r a291c9b8bc02 suites/libvirt-cim/lib/XenKvmLib/common_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Wed Apr 23 14:05:09 2008 +0530
+++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Wed Apr 23 14:49:19 2008 +0530
@@ -31,6 +31,10 @@ from XenKvmLib.classes import get_typed_
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import logger, log_param, CIM_ERROR_ENUMERATE
from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+
+def print_field_error(fieldname, ret_value, exp_value):
+ logger.error("%s Mismatch", fieldname)
+ logger.error("Returned %s instead of %s", ret_value, exp_value)
def get_cs_instance(domain_name, ip, virt='Xen'):
try:
16 years, 8 months
[PATCH] [TEST] #2 Adding XenFV and KVM support to 03_vssd_gi_errs of VSSD
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1208944733 -19800
# Node ID 254b9bf3dacaf1dc3b89a08069cad74ee1b3122f
# Parent 90724cb71f59f6a40db54ba57e279bfea3eb4f03
[TEST] #2 Adding XenFV and KVM support to 03_vssd_gi_errs of VSSD
1) Removed the newly added author name
2) Removed the log_param()
3) Addressed indentation comment
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 90724cb71f59 -r 254b9bf3daca suites/libvirt-cim/cimtest/VSSD/03_vssd_gi_errs.py
--- a/suites/libvirt-cim/cimtest/VSSD/03_vssd_gi_errs.py Wed Apr 23 15:17:18 2008 +0530
+++ b/suites/libvirt-cim/cimtest/VSSD/03_vssd_gi_errs.py Wed Apr 23 15:28:53 2008 +0530
@@ -50,20 +50,15 @@
import sys
import pywbem
-from VirtLib import utils
from CimTest.ReturnCodes import PASS, FAIL
-from CimTest.Globals import logger, do_main
+from CimTest.Globals import logger, do_main, platform_sup
from CimTest.Globals import CIM_PASS, CIM_NS, CIM_USER
from XenKvmLib import assoc
-from XenKvmLib.test_xml import testxml
+from XenKvmLib.vxml import get_class
from XenKvmLib.common_util import try_getinstance
-from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all
+from XenKvmLib.test_doms import destroy_and_undefine_all
-sup_types = ['Xen']
-
-VSType = "Xen"
-test_dom = "new"
-classname = "Xen_VirtualSystemSettingData"
+test_dom = "VSSD_domain"
expr_values = {
"INVALID_InstID_Keyname" : { 'rc' : pywbem.CIM_ERR_NOT_FOUND, \
@@ -72,7 +67,8 @@ expr_values = {
'desc' : 'No such instance (InstanceID)'}
}
-def try_invalid_gi(name_val, i, field):
+def try_invalid_gi(VSType, name_val, i, field):
+ classname = "%s_VirtualSystemSettingData" % VSType
keys = {}
temp = name_val[i]
name_val[i] = field
@@ -86,37 +82,33 @@ def try_invalid_gi(name_val, i, field):
name_val[i] = temp
return ret_val
-@do_main(sup_types)
+@do_main(platform_sup)
def main():
options = main.options
- if not options.ip:
- parser.print_help()
- return FAIL
-
status = PASS
-
- destroy_and_undefine_all(options.ip)
- xmlfile = testxml(test_dom )
-
- ret = test_domain_function(xmlfile, options.ip, "define")
+ if options.virt == 'XenFV':
+ VSType = 'Xen'
+ else:
+ VSType = options.virt
+ vsxml = get_class(options.virt)(test_dom)
+ ret = vsxml.define(options.ip)
if not ret :
logger.error("error while define of VS")
return FAIL
global conn
- 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)
inst_id = "%s:%s" % (VSType, test_dom)
name_val = ['InstanceID', inst_id]
tc_scen = ['INVALID_InstID_Keyname', 'INVALID_InstID_Keyval']
for i in range(len(tc_scen)):
- retval = try_invalid_gi(name_val, i, tc_scen[i])
+ retval = try_invalid_gi(VSType, name_val, i, tc_scen[i])
if retval != PASS:
status = retval
- test_domain_function(test_dom, options.ip, "undefine")
+ vsxml.undefine(options.ip)
return status
if __name__ == "__main__":
16 years, 8 months
[PATCH] [TEST] #2 Adding XenFV and KVM support to 01_enum of VSSD
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1208944038 -19800
# Node ID 90724cb71f59f6a40db54ba57e279bfea3eb4f03
# Parent fbfc25a9d75ee86589d4829a08148c32032ea5c3
[TEST] #2 Adding XenFV and KVM support to 01_enum of VSSD
1) Removed the log_param().
2) Addressed the indentation comment.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r fbfc25a9d75e -r 90724cb71f59 suites/libvirt-cim/cimtest/VSSD/01_enum.py
--- a/suites/libvirt-cim/cimtest/VSSD/01_enum.py Wed Apr 23 15:01:42 2008 +0530
+++ b/suites/libvirt-cim/cimtest/VSSD/01_enum.py Wed Apr 23 15:17:18 2008 +0530
@@ -28,40 +28,38 @@
import sys
from VirtLib import live
-from VirtLib import utils
from XenKvmLib import enumclass
from XenKvmLib.test_doms import destroy_and_undefine_all
-from XenKvmLib.vxml import XenXML, KVMXML, get_class
-from CimTest.Globals import do_main
-from CimTest.Globals import logger
+from XenKvmLib.vxml import get_class
+from CimTest.Globals import do_main, platform_sup, logger
+from CimTest.ReturnCodes import PASS, FAIL
-sup_types = ['Xen', 'KVM']
+test_dom = "VSSD_dom"
-test_dom = "new"
-
-@do_main(sup_types)
+@do_main(platform_sup)
def main():
options = main.options
- status = 0
+ status = PASS
destroy_and_undefine_all(options.ip)
vsxml = get_class(options.virt)(test_dom)
ret = vsxml.define(options.ip)
if not ret :
logger.error("error while create of VS")
- status = 1
+ status = FAIL
try:
live_cs = live.domain_list(options.ip, options.virt)
key_list = ["InstanceID"]
- syslst = enumclass.enumerate(options.ip, \
- "VirtualSystemSettingData", \
- key_list, \
- options.virt)
+ syslst = enumclass.enumerate(options.ip, "VirtualSystemSettingData",
+ key_list, options.virt)
found = 0
for vssd in syslst :
- instid = "%s:%s" % (options.virt, test_dom)
+ if options.virt == 'XenFV':
+ instid = "%s:%s" % ('Xen', test_dom)
+ else:
+ instid = "%s:%s" % (options.virt, test_dom)
if vssd.InstanceID == instid:
found = 1
break
@@ -69,8 +67,8 @@ def main():
if vssd.ElementName != test_dom:
logger.error("Invalid ElementName- expecting %s, go %s" %
test_dom, vssd.ElementName)
- test_domain_function(test_dom, options.ip, "undefine")
- return 1
+ vsxml.undefine(options.ip)
+ return FAIL
logger.info("Examining VSSD class for the Guest %s" % test_dom)
try:
@@ -81,15 +79,15 @@ def main():
logger.error("Exception %s" % details)
logger.error("Provider reports VSSD `%s', but xm does not" %
vssd.ElementName)
- status = 1
+ status = FAIL
else:
logger.error("Missing VSSD instance for the system %s " % test_dom)
- status = 1
+ status = FAIL
except BaseException, details:
logger.error("Exception %s" % details)
- status = 1
+ status = FAIL
vsxml.undefine(options.ip)
16 years, 8 months
[PATCH] [TEST] #2 Updating 04_forward_vsmsdata.py tc in SettingsDefineCapabilities
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1208939709 -19800
# Node ID 185f354355a16b74c2db57d18f6ef28c7ae2802c
# Parent 113ac4b0bb4b7b1e29f3aae585ecf7b89958f60e
[TEST] #2 Updating 04_forward_vsmsdata.py tc in SettingsDefineCapabilities
1) To support KVM and XenFV.
2) To adapt to the new infrastructure changes.
3) Rebased with the latest test source.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 113ac4b0bb4b -r 185f354355a1 suites/libvirt-cim/cimtest/SettingsDefineCapabilities/04_forward_vsmsdata.py
--- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/04_forward_vsmsdata.py Tue Apr 22 15:16:28 2008 +0530
+++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/04_forward_vsmsdata.py Wed Apr 23 14:05:09 2008 +0530
@@ -20,7 +20,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# This tc is used to verify the Classname and InstanceID of
-# Xen_SettingsDefineCapabilities association with Xen_VirtualSystemMigrationSettingData
+# Xen_SettingsDefineCapabilities association with
+# Xen_VirtualSystemMigrationSettingData
# Command
# -------
# wbemcli ai -ac Xen_SettingsDefineCapabilities \
@@ -35,35 +36,30 @@
# Date : 05-03-2008
import sys
-from VirtLib import utils
from XenKvmLib import assoc
-from CimTest.Globals import CIM_ERROR_ASSOCIATORS, logger, do_main
+from CimTest.Globals import CIM_ERROR_ASSOCIATORS, logger
from CimTest.ReturnCodes import PASS, FAIL
-
-sup_types = ['Xen']
+from CimTest.Globals import do_main, platform_sup
+from XenKvmLib.classes import get_typed_class
def print_error(fieldname, ret_value, exp_value):
logger.error("%s Mismatch", fieldname)
logger.error("Returned %s instead of %s", ret_value, exp_value)
-@do_main(sup_types)
+@do_main(platform_sup)
def main():
- (options, args) = parser.parse_args()
- if not options.ip:
- parser.print_help()
- return 1
+ options = main.options
status = PASS
server = options.ip
- an = 'Xen_SettingsDefineCapabilities'
- cn = 'Xen_VirtualSystemMigrationSettingData'
- qcn = 'Xen_VirtualSystemMigrationCapabilities'
+
+ an = get_typed_class(options.virt, 'SettingsDefineCapabilities')
+ cn = get_typed_class(options.virt, 'VirtualSystemMigrationSettingData')
+ qcn = get_typed_class(options.virt, 'VirtualSystemMigrationCapabilities')
instid = 'MigrationSettingData'
try:
- assoc_info = assoc.Associators(server, \
- an, \
- cn, \
- InstanceID = instid)
+ assoc_info = assoc.Associators(server, an, cn, InstanceID = instid,
+ virt=options.virt)
if len(assoc_info) != 1:
logger.error("%s returned %i %s objects", an, len(assoc_info), qcn)
return FAIL
@@ -72,7 +68,8 @@ def main():
print_error('Classname', verify_assoc.classname, qcn)
status = FAIL
if verify_assoc['InstanceID'] != 'MigrationCapabilities':
- print_error('InstanceID', verify_assoc['InstanceID'], 'MigrationCapabilities')
+ print_error('InstanceID', verify_assoc['InstanceID'],
+ 'MigrationCapabilities')
status = FAIL
except Exception, detail:
logger.error(CIM_ERROR_ASSOCIATORS, an)
16 years, 8 months
[PATCH] [TEST] #2 Updating 05_reverse_vsmcap.py tc in SettingsDefineCapabilities
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1208943102 -19800
# Node ID fbfc25a9d75ee86589d4829a08148c32032ea5c3
# Parent 064614c4b678b5d38e831548154cdf6b3234b19b
[TEST] #2 Updating 05_reverse_vsmcap.py tc in SettingsDefineCapabilities
1) To support KVM and XenFV
2) To adapt to the new infrastructure changes
3) Moved the print_error from tc to common_util.py and imported the same in the tc.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 064614c4b678 -r fbfc25a9d75e suites/libvirt-cim/cimtest/SettingsDefineCapabilities/05_reverse_vsmcap.py
--- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/05_reverse_vsmcap.py Wed Apr 23 15:00:21 2008 +0530
+++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/05_reverse_vsmcap.py Wed Apr 23 15:01:42 2008 +0530
@@ -20,12 +20,14 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# This tc is used to verify the Classname and InstanceID of
-# Xen_SettingsDefineCapabilities association with Xen_VirtualSystemMigrationCapabilities
+# Xen_SettingsDefineCapabilities association with
+# Xen_VirtualSystemMigrationCapabilities
# Command
# -------
# wbemcli ai -ac Xen_SettingsDefineCapabilities \
# 'http://localhost:5988/root/virt:\
-# Xen_VirtualSystemMigrationCapabilities.InstanceID="MigrationCapabilities"' -nl
+# Xen_VirtualSystemMigrationCapabilities.InstanceID=\
+# "MigrationCapabilities"' -nl
#
#
# Output
@@ -36,41 +38,35 @@
# Date : 05-03-2008
import sys
-from VirtLib import utils
from XenKvmLib import assoc
-from CimTest.Globals import CIM_ERROR_ASSOCIATORS, logger, do_main
+from CimTest.Globals import CIM_ERROR_ASSOCIATORS, logger
from CimTest.ReturnCodes import PASS, FAIL
+from CimTest.Globals import do_main, platform_sup
+from XenKvmLib.classes import get_typed_class
+from XenKvmLib.common_util import print_field_error
-sup_types = ['Xen']
-
-def print_error(fieldname, ret_value, exp_value):
- logger.error("%s Mismatch", fieldname)
- logger.error("Returned %s instead of %s", ret_value, exp_value)
-
-@do_main(sup_types)
+@do_main(platform_sup)
def main():
options = main.options
status = PASS
server = options.ip
- an = 'Xen_SettingsDefineCapabilities'
- cn = 'Xen_VirtualSystemMigrationCapabilities'
- qcn = 'Xen_VirtualSystemMigrationSettingData'
+ an = get_typed_class(options.virt, 'SettingsDefineCapabilities')
+ cn = get_typed_class(options.virt, 'VirtualSystemMigrationCapabilities')
+ qcn = get_typed_class(options.virt, 'VirtualSystemMigrationSettingData')
instid = 'MigrationCapabilities'
-
try:
- assoc_info = assoc.Associators(server, \
- an, \
- cn, \
- InstanceID = instid)
+ assoc_info = assoc.Associators(server, an, cn, InstanceID = instid,
+ virt = options.virt)
if len(assoc_info) != 1:
logger.error("%s returned %i %s objects", an, len(assoc_info), qcn)
return FAIL
verify_assoc = assoc_info[0]
if verify_assoc.classname != qcn:
- print_error('Classname', verify_assoc.classname, qcn)
+ print_field_error('Classname', verify_assoc.classname, qcn)
status = FAIL
if verify_assoc['InstanceID'] != 'MigrationSettingData':
- print_error('InstanceID', verify_assoc['InstanceID'], 'MigrationCapabilities')
+ print_field_error('InstanceID', verify_assoc['InstanceID'],
+ 'MigrationCapabilities')
status = FAIL
except Exception, detail:
logger.error(CIM_ERROR_ASSOCIATORS, an)
16 years, 8 months
[PATCH] [TEST] Updating 04_forward_vsmsdata.py tc in SettingsDefineCapabilities
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1208857706 -19800
# Node ID cc4b76d02e85e970d3df8c837dbe5722132b568d
# Parent dcfad1d986ec429fd63475ecd53382117e55ad72
[TEST] Updating 04_forward_vsmsdata.py tc in SettingsDefineCapabilities
1) To support KVM and XenFV
2) To adapt to the new infrastructure changes
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r dcfad1d986ec -r cc4b76d02e85 suites/libvirt-cim/cimtest/SettingsDefineCapabilities/04_forward_vsmsdata.py
--- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/04_forward_vsmsdata.py Tue Apr 22 15:16:28 2008 +0530
+++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/04_forward_vsmsdata.py Tue Apr 22 15:18:26 2008 +0530
@@ -20,7 +20,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# This tc is used to verify the Classname and InstanceID of
-# Xen_SettingsDefineCapabilities association with Xen_VirtualSystemMigrationSettingData
+# Xen_SettingsDefineCapabilities association with
+# Xen_VirtualSystemMigrationSettingData
# Command
# -------
# wbemcli ai -ac Xen_SettingsDefineCapabilities \
@@ -35,35 +36,33 @@
# Date : 05-03-2008
import sys
-from VirtLib import utils
from XenKvmLib import assoc
-from CimTest.Globals import CIM_ERROR_ASSOCIATORS, logger, do_main
+from CimTest.Globals import CIM_ERROR_ASSOCIATORS, logger
from CimTest.ReturnCodes import PASS, FAIL
-
-sup_types = ['Xen']
+from CimTest.Globals import do_main, platform_sup
+from XenKvmLib.classes import get_typed_class
def print_error(fieldname, ret_value, exp_value):
logger.error("%s Mismatch", fieldname)
logger.error("Returned %s instead of %s", ret_value, exp_value)
-@do_main(sup_types)
+@do_main(platform_sup)
def main():
- (options, args) = parser.parse_args()
- if not options.ip:
- parser.print_help()
- return 1
+ options = main.options
status = PASS
server = options.ip
- an = 'Xen_SettingsDefineCapabilities'
- cn = 'Xen_VirtualSystemMigrationSettingData'
- qcn = 'Xen_VirtualSystemMigrationCapabilities'
+
+ an = get_typed_class(options.virt, 'SettingsDefineCapabilities')
+ cn = get_typed_class(options.virt, 'VirtualSystemMigrationSettingData')
+ qcn = get_typed_class(options.virt, 'VirtualSystemMigrationCapabilities')
instid = 'MigrationSettingData'
try:
assoc_info = assoc.Associators(server, \
an, \
cn, \
- InstanceID = instid)
+ InstanceID = instid, \
+ virt=options.virt)
if len(assoc_info) != 1:
logger.error("%s returned %i %s objects", an, len(assoc_info), qcn)
return FAIL
@@ -72,7 +71,8 @@ def main():
print_error('Classname', verify_assoc.classname, qcn)
status = FAIL
if verify_assoc['InstanceID'] != 'MigrationCapabilities':
- print_error('InstanceID', verify_assoc['InstanceID'], 'MigrationCapabilities')
+ print_error('InstanceID', verify_assoc['InstanceID'],
+ 'MigrationCapabilities')
status = FAIL
except Exception, detail:
logger.error(CIM_ERROR_ASSOCIATORS, an)
16 years, 8 months
[PATCH] [TEST] Add revision branch to AllocationCapabilities.02
by zli@linux.vnet.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1208936520 -28800
# Node ID 6880e25483e5af261ea7de0f9294537f415026f0
# Parent a5300b54fbbbbf6c8e7500a5cd6c8e3cc1d25296
[TEST] Add revision branch to AllocationCapabilities.02
The new error message is added on revision 463.
Also updated some format issues.
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r a5300b54fbbb -r 6880e25483e5 suites/libvirt-cim/cimtest/AllocationCapabilities/02_alloccap_gi_errs.py
--- a/suites/libvirt-cim/cimtest/AllocationCapabilities/02_alloccap_gi_errs.py Wed Apr 23 15:25:44 2008 +0800
+++ b/suites/libvirt-cim/cimtest/AllocationCapabilities/02_alloccap_gi_errs.py Wed Apr 23 15:42:00 2008 +0800
@@ -62,6 +62,7 @@ from XenKvmLib.test_doms import create_v
from XenKvmLib.test_doms import create_vnet
from CimTest.Globals import do_main, platform_sup
from XenKvmLib.classes import get_typed_class
+from XenKvmLib.const import CIM_REV
test_dpath = "foo"
disk_file = '/tmp/diskpool.conf'
@@ -69,12 +70,8 @@ diskid = "%s/%s" % ("DiskPool", test_dpa
diskid = "%s/%s" % ("DiskPool", test_dpath)
memid = "%s/%s" % ("MemoryPool", 0)
procid = "%s/%s" % ("ProcessorPool", 0)
-expr_values = {
- "invalid_instid_keyname" : { 'rc' : pywbem.CIM_ERR_FAILED, \
- 'desc' : 'No InstanceID specified' }, \
- "invalid_instid_keyvalue" : { 'rc' : pywbem.CIM_ERR_NOT_FOUND, \
- 'desc' : 'Instance not found' }
- }
+rev = 463
+
def conf_file():
"""
Creating diskpool.conf file.
@@ -124,19 +121,29 @@ def main():
net_xml, bridge = netxml(server, bridgename, test_network)
ret = create_vnet(server, net_xml)
if not ret:
- logger.error("Failed to create the Virtual Network '%s'", \
- test_network)
+ logger.error("Failed to create the Virtual Network '%s'",
+ test_network)
return SKIP
net_instid = 'NetworkPool/%s' %test_network
- instid_list = ['ProcessorPool/0', 'MemoryPool/0', 'DiskPool/foo', net_instid]
- conn = assoc.myWBEMConnection('http://%s' % options.ip, (CIM_USER, CIM_PASS), CIM_NS)
+ instid_list = ['ProcessorPool/0', 'MemoryPool/0',
+ 'DiskPool/foo', net_instid]
+ conn = assoc.myWBEMConnection('http://%s' % options.ip,
+ (CIM_USER, CIM_PASS), CIM_NS)
classname = get_typed_class(options.virt, "AllocationCapabilities")
field = 'INVALID_Instid_KeyValue'
keys = { 'InstanceID' : field }
- ret_value = try_getinstance(conn, classname, keys, field_name=field, \
- expr_values=expr_values['invalid_instid_keyvalue'], bug_no="")
+ exp = {
+ "invalid_keyname" : { 'rc' : pywbem.CIM_ERR_FAILED,
+ 'desc' : 'No InstanceID specified' },
+ "invalid_keyvalue" : { 'rc' : pywbem.CIM_ERR_NOT_FOUND,
+ 'desc' : 'Instance not found' }}
+ if CIM_REV < rev:
+ exp['invalid_keyvalue']['desc'] = 'Object could not be found'
+
+ ret_value = try_getinstance(conn, classname, keys, field_name=field,
+ expr_values=exp['invalid_keyvalue'], bug_no="")
if ret_value != PASS:
logger.error("------ FAILED: Invalid InstanceID Key Value.------")
status = ret_value
@@ -144,8 +151,9 @@ def main():
field = 'INVALID_Instid_KeyName'
for i in range(len(instid_list)):
keys = { field : instid_list[i] }
- ret_value = try_getinstance(conn, classname, keys, field_name=field, \
- expr_values=expr_values['invalid_instid_keyname'], bug_no="")
+ ret_value = try_getinstance(conn, classname, keys, field_name=field,
+ expr_values=exp['invalid_keyname'],
+ bug_no="")
if ret_value != PASS:
logger.error("------ FAILED: Invalid InstanceID Key Name.------")
status = ret_value
16 years, 8 months
[PATCH] [TEST] .2# Rebased VirtualSystemSettingDataComponent.02 for XenFV & KVM support
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1208919991 -28800
# Node ID 76484c1df952d4e40741ef8b9eb7082e0a5d7a89
# Parent 113ac4b0bb4b7b1e29f3aae585ecf7b89958f60e
[TEST] .2# Rebased VirtualSystemSettingDataComponent.02 for XenFV & KVM support
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 113ac4b0bb4b -r 76484c1df952 suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py Tue Apr 22 15:16:28 2008 +0530
+++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py Wed Apr 23 11:06:31 2008 +0800
@@ -47,23 +47,21 @@
import sys
from XenKvmLib import enumclass
from VirtLib import utils
-from XenKvmLib.test_doms import test_domain_function, destroy_and_undefine_all
-from XenKvmLib import test_xml
-from XenKvmLib.test_xml import testxml
from CimTest import Globals
from XenKvmLib import assoc
+from XenKvmLib.test_doms import destroy_and_undefine_all
+from XenKvmLib import vxml
+from XenKvmLib.classes import get_typed_class
from XenKvmLib.rasd import InstId_err
from CimTest.Globals import logger, do_main
from CimTest.ReturnCodes import PASS, FAIL
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV', 'KVM']
test_dom = "VSSDC_dom"
test_vcpus = 1
test_mem = 128
test_mac = "00:11:22:33:44:aa"
-test_disk = 'xvdb'
-VSType = "Xen"
def check_rasd_values(id, exp_id):
try:
@@ -77,7 +75,7 @@
return PASS
-def assoc_values(ip, assoc_info):
+def assoc_values(ip, assoc_info, virt="Xen"):
"""
The association info of
Xen_VirtualSystemSettingDataComponent is
@@ -95,17 +93,22 @@
logger.error("No RASD instances returned")
return FAIL
+ proc_cn = get_typed_class(virt, 'ProcResourceAllocationSettingData')
+ net_cn = get_typed_class(virt, 'NetResourceAllocationSettingData')
+ disk_cn = get_typed_class(virt, 'DiskResourceAllocationSettingData')
+ mem_cn = get_typed_class(virt, 'MemResourceAllocationSettingData')
+
for inst in assoc_info:
- if inst.classname == 'Xen_ProcResourceAllocationSettingData':
+ if inst.classname == proc_cn:
status = check_rasd_values(inst['InstanceID'],
rasd_list['proc_rasd'])
- elif inst.classname == 'Xen_NetResourceAllocationSettingData':
+ elif inst.classname == net_cn:
status = check_rasd_values(inst['InstanceID'],
rasd_list['net_rasd'])
- elif inst.classname == 'Xen_DiskResourceAllocationSettingData':
+ elif inst.classname == disk_cn:
status = check_rasd_values(inst['InstanceID'],
rasd_list['disk_rasd'])
- elif inst.classname == 'Xen_MemResourceAllocationSettingData':
+ elif inst.classname == mem_cn:
status = check_rasd_values(inst['InstanceID'],
rasd_list['mem_rasd'])
else:
@@ -128,32 +131,40 @@
status = PASS
destroy_and_undefine_all(options.ip)
- test_xml1 = testxml(test_dom, mem = test_mem, \
- vcpus = test_vcpus, \
- mac = test_mac, \
- disk = test_disk)
- ret = test_domain_function(test_xml1, options.ip, cmd = "create")
+ global test_disk
+ if options.virt == "Xen":
+ test_disk = "xvdb"
+ else:
+ test_disk = "hdb"
+ virt_xml = vxml.get_class(options.virt)
+ cxml = virt_xml(test_dom, vcpus = test_vcpus, mac = test_mac, disk = test_disk)
+ ret = cxml.create(options.ip)
if not ret:
logger.error("Failed to create the dom: %s", test_dom)
status = FAIL
return status
-
- instIdval = "%s:%s" % (VSType, test_dom)
+ if options.virt == "Xen" or options.virt == "XenFV":
+ instIdval = "Xen:%s" % test_dom
+ else:
+ instIdval = "KVM:%s" % test_dom
+
try:
assoc_info = assoc.AssociatorNames(options.ip,
- 'Xen_VirtualSystemSettingDataComponent',
- 'Xen_VirtualSystemSettingData',
- InstanceID = instIdval)
- status = assoc_values(options.ip, assoc_info)
+ 'VirtualSystemSettingDataComponent',
+ 'VirtualSystemSettingData',
+ options.virt,
+ InstanceID = instIdval)
+ status = assoc_values(options.ip, assoc_info, options.virt)
except Exception, detail :
logger.error(Globals.CIM_ERROR_ASSOCIATORS,
- 'Xen_VirtualSystemSettingDataComponent')
+ 'VirtualSystemSettingDataComponent')
logger.error("Exception : %s" % detail)
status = FAIL
- test_domain_function(test_dom, options.ip, "destroy")
+ cxml.destroy(options.ip)
+ cxml.undefine(options.ip)
return status
if __name__ == "__main__":
16 years, 8 months
[PATCH] [TEST] Misc fix typo in vxml
by zli@linux.vnet.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1208917069 -28800
# Node ID a20a76b510101a4ea56501b02315dc5e0bcb18e5
# Parent 84009d4d2ed87240fd82c694d398df3b6bf91bed
[TEST] Misc fix typo in vxml
- typo: loggerr -> logger
- missing import sys
- remove unnecessary backslashes
- 80-column formatting
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r 84009d4d2ed8 -r a20a76b51010 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue Apr 22 15:21:09 2008 +0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Apr 23 10:17:49 2008 +0800
@@ -31,6 +31,7 @@
# The VirtXML should not be used directly, it only defines common XML nodes
# shared by XenXML & KVMXML.
import os
+import sys
import platform
import tempfile
import pywbem
@@ -176,7 +177,8 @@ class NetXML(Virsh, XMLClass):
import random
vbr = bridgename + str(random.randint(1, 100))
if vbr in bridge_list:
- logger.error('Need to give different bridge name since it already exists')
+ logger.error('Need to give different bridge name '
+ 'since it already exists')
return None
else:
vbr = bridgename
@@ -259,7 +261,8 @@ class VirtXML(Virsh, XMLClass):
self.set_attributes('/domain/devices/interface/mac', address=mac)
def set_bridge_name(self, bridgename):
- self.set_attributes('/domain/devices/interface/source', bridge=bridgename)
+ self.set_attributes('/domain/devices/interface/source',
+ bridge=bridgename)
def set_diskimg(self, diskimg):
self.set_attributes('/domain/devices/disk/source', file=diskimg)
@@ -344,7 +347,8 @@ class VirtXML(Virsh, XMLClass):
pass
def xml_get_net_bridge(self):
- bridgeStr = self.get_value_xpath('/domain/devices/interface/source/@bridge')
+ bridgeStr = self.get_value_xpath(
+ '/domain/devices/interface/source/@bridge')
return bridgeStr
def dumpxml(self, ip):
@@ -360,7 +364,7 @@ class VirtXML(Virsh, XMLClass):
def _set_bridge(self, ip):
br_list = live.available_virt_bridge(ip)
if len(br_list) == 0:
- loggerr.error('No virtual bridges found')
+ logger.error('No virtual bridges found')
return None
# pick the 1st virtual bridge
@@ -382,7 +386,8 @@ class VirtXML(Virsh, XMLClass):
netxml = NetXML(ip, virt=virt_type)
ret = netxml.create_vnet()
if not ret:
- logger.error('Failed to create the virtual network "%s"', netxml.net_name)
+ logger.error('Failed to create the virtual network "%s"',
+ netxml.net_name)
sys.exit(SKIP)
vbr = netxml.vbr
@@ -411,7 +416,8 @@ class VirtCIM:
def cim_define(self, ip):
service = vsms.get_vsms_class(self.virt)(ip)
sys_settings = str(self.vssd)
- res_settings = [str(self.dasd), str(self.nasd), str(self.pasd), str(self.masd)]
+ res_settings = [str(self.dasd), str(self.nasd),
+ str(self.pasd), str(self.masd)]
try:
service.DefineSystem(SystemSettings=sys_settings,
ResourceSettings=res_settings,
@@ -421,7 +427,8 @@ class VirtCIM:
return False
except Exception, details:
- loggerr.error('Got error %s with exception %s' % (details, details.__class__.__name__))
+ logger.error('Got error %s with exception %s' \
+ % (details, details.__class__.__name__))
return False
set_uuid(viruuid(self.domain_name, ip, self.virt))
@@ -432,15 +439,16 @@ class XenXML(VirtXML, VirtCIM):
secondary_disk_path = const.Xen_secondary_disk_path
- def __init__(self, test_dom=const.default_domname, \
- mem=const.default_memory, \
- vcpus=const.default_vcpus, \
- mac=const.Xen_default_mac, \
- disk_file_path=const.Xen_disk_path, \
+ def __init__(self, test_dom=const.default_domname,
+ mem=const.default_memory,
+ vcpus=const.default_vcpus,
+ mac=const.Xen_default_mac,
+ disk_file_path=const.Xen_disk_path,
disk=const.Xen_default_disk_dev):
- if not (os.path.exists(const.Xen_kernel_path) and os.path.exists(const.Xen_init_path)):
- logger.error('ERROR: ' + \
- 'Either the kernel image or the init_path does not exist')
+ if not (os.path.exists(const.Xen_kernel_path) \
+ and os.path.exists(const.Xen_init_path)):
+ logger.error('ERROR: Either the kernel image '
+ 'or the init_path does not exist')
sys.exit(1)
VirtXML.__init__(self, 'xen', test_dom, set_uuid(), mem, vcpus)
self._os(const.Xen_kernel_path, const.Xen_init_path)
@@ -486,18 +494,19 @@ class KVMXML(VirtXML):
secondary_disk_path = const.KVM_secondary_disk_path
- def __init__(self, test_dom=const.default_domname, \
- mem=const.default_memory, \
- vcpus=const.default_vcpus, \
- mac=const.KVM_default_mac, \
- disk_file_path=const.KVM_disk_path, \
+ def __init__(self, test_dom=const.default_domname,
+ mem=const.default_memory,
+ vcpus=const.default_vcpus,
+ mac=const.KVM_default_mac,
+ disk_file_path=const.KVM_disk_path,
disk=const.KVM_default_disk_dev):
if not os.path.exists(disk_file_path):
logger.error('Error: Disk image does not exist')
sys.exit(1)
VirtXML.__init__(self, 'kvm', test_dom, set_uuid(), mem, vcpus)
self._os()
- self._devices(const.KVM_default_emulator, const.KVM_default_net_type, disk_file_path, disk, mac)
+ self._devices(const.KVM_default_emulator, const.KVM_default_net_type,
+ disk_file_path, disk, mac)
def _os(self):
self.add_sub_node('/domain/os', 'type', 'hvm')
@@ -529,18 +538,19 @@ class XenFVXML(VirtXML):
secondary_disk_path = const.XenFV_secondary_disk_path
- def __init__(self, test_dom=const.default_domname, \
- mem=const.default_memory, \
- vcpus=const.default_vcpus, \
- mac=const.XenFV_default_mac, \
- disk_file_path=const.XenFV_disk_path, \
+ def __init__(self, test_dom=const.default_domname,
+ mem=const.default_memory,
+ vcpus=const.default_vcpus,
+ mac=const.XenFV_default_mac,
+ disk_file_path=const.XenFV_disk_path,
disk=const.XenFV_default_disk_dev):
if not os.path.exists(disk_file_path):
logger.error('Error: Disk image does not exist')
sys.exit(1)
VirtXML.__init__(self, 'xen', test_dom, set_uuid(), mem, vcpus)
self._os(const.XenFV_default_loader)
- self._devices(const.XenFV_default_emulator, const.XenFV_default_net_type, mac, disk_file_path, disk)
+ self._devices(const.XenFV_default_emulator,
+ const.XenFV_default_net_type, mac, disk_file_path, disk)
def _os(self, os_loader):
os = self.get_node('/domain/os')
@@ -579,7 +589,8 @@ def set_default(server):
dict = {}
dict['default_sysname'] = live.full_hostname(server)
dict['default_port'] = CIM_PORT
- dict['default_url'] = "%s:%s" % (dict['default_sysname'], dict['default_port'])
+ dict['default_url'] = "%s:%s" % (dict['default_sysname'],
+ dict['default_port'])
dict['default_ns'] = CIM_NS
dict['default_name'] = "Test"
dict['default_dump'] = False
16 years, 8 months
[PATCH] [TEST] .2# Add cim_destroy to VirtCIM class
by zli@linux.vnet.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1208917403 -28800
# Node ID 3257a3ddfc06a5a209eca97fbae3d540f58fc45a
# Parent a20a76b510101a4ea56501b02315dc5e0bcb18e5
[TEST] .2# Add cim_destroy to VirtCIM class
- updated to comply with 80 column line max length.
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r a20a76b51010 -r 3257a3ddfc06 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Apr 23 10:17:49 2008 +0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Apr 23 10:23:23 2008 +0800
@@ -43,7 +43,7 @@ from XenKvmLib import const
from XenKvmLib import const
from CimTest.Globals import logger, CIM_IP, CIM_PORT, CIM_NS, CIM_USER, CIM_PASS
from CimTest.ReturnCodes import SKIP
-from XenKvmLib.classes import virt_types
+from XenKvmLib.classes import virt_types, get_typed_class
class XMLClass:
xml_string = ""
@@ -434,6 +434,19 @@ class VirtCIM:
set_uuid(viruuid(self.domain_name, ip, self.virt))
return True
+ def cim_destroy(self, ip):
+ service = vsms.get_vsms_class(self.virt)(ip)
+ cs_cn = get_typed_class(self.virt, 'ComputerSystem')
+ keys = { 'Name' : self.domain_name, 'CreationClassName' : cs_cn}
+ target = pywbem.cim_obj.CIMInstanceName(cs_cn, keybindings = keys)
+ try:
+ ret = service.DestroySystem(AffectedSystem=target)
+ except Exception, details:
+ logger.error('Error invoking DestroySystem')
+ logger.error('Got error %s with exception %s' \
+ % (details, details.__class__.__name__))
+ return False
+ return ret[0] == 0
class XenXML(VirtXML, VirtCIM):
16 years, 8 months