[PATCH] [TEST] updating 03_reverse_errs.py, 04_forward_errs.py
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1209473865 25200
# Node ID 5bcadaf4ab9957800fce7a564ef4f13851fcf5c8
# Parent 2b83c1992dfc44573ba0c00729e36311355807ad
[TEST] updating 03_reverse_errs.py, 04_forward_errs.py
1) To use lib fn conf_file(), cleanup_restore() and create_diskpool_file()
2) Addressed Indentation.
3) Tested on latest source for Xen, XenFV, KVM.
4) Need to test with binary rpm on F9 and include the revision string for 04_forward_errs.py.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 2b83c1992dfc -r 5bcadaf4ab99 suites/libvirt-cim/cimtest/ElementAllocatedFromPool/03_reverse_errs.py
--- a/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/03_reverse_errs.py Sun Apr 27 19:22:03 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/03_reverse_errs.py Tue Apr 29 05:57:45 2008 -0700
@@ -29,29 +29,26 @@
# Date : 30-12-2007
import sys
-import os
-from distutils.file_util import move_file
import pywbem
from XenKvmLib import assoc
from CimTest import Globals
from XenKvmLib.test_doms import destroy_and_undefine_all
from XenKvmLib.common_util import try_assoc
from CimTest.ReturnCodes import PASS, FAIL
-from CimTest.Globals import do_main, platform_sup
+from CimTest.Globals import do_main, platform_sup, logger
from XenKvmLib.vxml import get_class
from XenKvmLib.classes import get_typed_class
+from XenKvmLib.common_util import cleanup_restore, test_dpath, \
+create_diskpool_file
bug_no = "88651"
test_dom = "hd_domain"
test_mac = "00:11:22:33:44:aa"
test_vcpus = 1
-id1 = "DiskPool/foo"
+id1 = "DiskPool/%s" %test_dpath
id2 = "MemoryPool/0"
id3 = "NetworkPool/xenbr0"
id4 = "ProcessorPool/0"
-test_dpath = "foo"
-disk_file = '/tmp/diskpool.conf'
-back_disk_file = disk_file + "." + "02_reverse"
expr_values = {
"invalid_keyname" : {
'rc' : pywbem.CIM_ERR_FAILED, \
@@ -62,34 +59,6 @@ expr_values = {
'desc' : 'No such instance'
}
}
-
-def conf_file():
- """
- Creating diskpool.conf file.
- """
- try:
- f = open(disk_file, 'w')
- f.write('%s %s' % (test_dpath, '/'))
- f.close()
- except Exception,detail:
- Globals.logger.error("Exception: %s", detail)
- status = FAIL
- sys.exit(status)
-
-def clean_up_restore(ip):
- """
- Restoring back the original diskpool.conf
- file.
- """
- try:
- if os.path.exists(back_disk_file):
- os.remove(disk_file)
- move_file(back_disk_file, disk_file)
- except Exception, detail:
- Globals.logger.error("Exception: %s", detail)
- status = FAIL
- vsxml.undefine(ip)
- sys.exit(status)
def err_invalid_ccname():
# This is used to verify the that the
@@ -119,8 +88,8 @@ def err_invalid_ccname():
for classname, instdid in sorted(lelist.items()):
keys = { "InstanceID" : instdid}
field = "ClassName"
- status = try_assoc(conn, classname, assoc_classname, keys, field_name=field, \
- expr_values=expr_values['invalid_keyvalue'], bug_no="")
+ status = try_assoc(conn, classname, assoc_classname, keys, field_name=field,
+ expr_values=expr_values['invalid_keyvalue'], bug_no="")
if status != PASS:
break
return status
@@ -153,8 +122,8 @@ def err_invalid_keyname():
for classname, instdid in sorted(lelist.items()):
keys = { "InvalidID" : instdid }
field = "InstanceID_KeyName"
- status = try_assoc(conn, classname, assoc_classname, keys, field_name=field, \
- expr_values=expr_values['invalid_keyname'], bug_no="")
+ status = try_assoc(conn, classname, assoc_classname, keys, field_name=field,
+ expr_values=expr_values['invalid_keyname'], bug_no="")
if status != PASS:
break
return status
@@ -189,8 +158,8 @@ def err_invalid_keyvalue():
for classname in sorted(lelist):
keys = { "InstanceID" : "InvalidKeyValue" }
field = "InstanceID_KeyValue"
- status = try_assoc(conn, classname, assoc_classname, keys, field_name=field, \
- expr_values=expr_values['invalid_keyvalue'], bug_no="")
+ status = try_assoc(conn, classname, assoc_classname, keys, field_name=field,
+ expr_values=expr_values['invalid_keyvalue'], bug_no="")
if status != PASS:
break
return status
@@ -209,38 +178,36 @@ def main():
test_disk = "xvda"
else:
test_disk = "hda"
+ virt_type = get_class(virt)
+ vsxml = virt_type (test_dom, vcpus = test_vcpus, mac = test_mac,
+ disk = test_disk)
- vsxml = get_class(virt)(test_dom, vcpus = test_vcpus, mac = test_mac, \
- disk = test_disk)
- if (os.path.exists(back_disk_file)):
- os.unlink(back_disk_file)
+ # Verify DiskPool on machine
+ status = create_diskpool_file()
+ if status != PASS:
+ return status
- if not (os.path.exists(disk_file)):
- conf_file()
- else:
- move_file(disk_file, back_disk_file)
- conf_file()
ret = vsxml.define(options.ip)
if not ret:
- Globals.logger.error("Failed to define the dom: %s", test_dom)
+ logger.error("Failed to define the dom: %s", test_dom)
return FAIL
conn = assoc.myWBEMConnection('http://%s' % options.ip,
- (Globals.CIM_USER, Globals.CIM_PASS),
- Globals.CIM_NS)
+ (Globals.CIM_USER, Globals.CIM_PASS),
+ Globals.CIM_NS)
assoc_classname = get_typed_class(virt, "ElementAllocatedFromPool")
ret = err_invalid_keyname()
if ret:
- Globals.logger.error("------FAILED: Invalid KeyName.------")
+ logger.error("------FAILED: Invalid KeyName.------")
return ret
ret = err_invalid_keyvalue()
if ret:
- Globals.logger.error("------FAILED: Invalid KeyValue.------")
+ logger.error("------FAILED: Invalid KeyValue.------")
return ret
ret = err_invalid_ccname()
if ret:
- Globals.logger.error("------FAILED: Invalid CCName.------")
+ logger.error("------FAILED: Invalid CCName.------")
return ret
- clean_up_restore(options.ip)
+ cleanup_restore()
vsxml.undefine(options.ip)
return PASS
if __name__ == "__main__":
diff -r 2b83c1992dfc -r 5bcadaf4ab99 suites/libvirt-cim/cimtest/ElementAllocatedFromPool/04_forward_errs.py
--- a/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/04_forward_errs.py Sun Apr 27 19:22:03 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/04_forward_errs.py Tue Apr 29 05:57:45 2008 -0700
@@ -29,8 +29,6 @@
#
import sys
-import os
-from distutils.file_util import move_file
import pywbem
from pywbem.cim_obj import CIMInstanceName
from XenKvmLib import assoc
@@ -41,6 +39,8 @@ from CimTest.Globals import do_main, pla
from CimTest.Globals import do_main, platform_sup
from XenKvmLib.vxml import get_class
from XenKvmLib.classes import get_typed_class
+from XenKvmLib.common_util import cleanup_restore, test_dpath, \
+create_diskpool_file
sup_types = ['Xen', 'KVM', 'XenFV']
bug_no = "88651"
@@ -49,49 +49,16 @@ test_mac = "00:11:22:33:44:aa"
test_mac = "00:11:22:33:44:aa"
test_vcpus = 1
exp_list = [
- {'desc' : "No such instance (SystemName)", 'rc' : pywbem.CIM_ERR_NOT_FOUND}, \
- {'desc' : "No DeviceID specified", 'rc' : pywbem.CIM_ERR_FAILED}, \
- {'desc' : "No such instance", 'rc' : pywbem.CIM_ERR_NOT_FOUND}, \
- {'desc' : "One or more parameter values passed to the method were invalid", \
- 'rc' : pywbem.CIM_ERR_INVALID_PARAMETER}, \
- {'desc' : "No such instance (CreationClassName)", 'rc' : pywbem.CIM_ERR_NOT_FOUND }, \
- {'desc' : "No such instance (SystemCreationClassName)", 'rc' : \
- pywbem.CIM_ERR_NOT_FOUND },
+ {'desc' : "No such instance (SystemName)", 'rc' : pywbem.CIM_ERR_NOT_FOUND},
+ {'desc' : "No DeviceID specified", 'rc' : pywbem.CIM_ERR_FAILED},
+ {'desc' : "No such instance", 'rc' : pywbem.CIM_ERR_NOT_FOUND},
+ {'desc' : "CIM_ERR_INVALID_PARAMETER",
+ 'rc' : pywbem.CIM_ERR_INVALID_PARAMETER},
+ {'desc' : "No such instance (CreationClassName)",
+ 'rc' : pywbem.CIM_ERR_NOT_FOUND },
+ {'desc' : "No such instance (SystemCreationClassName)",
+ 'rc' : pywbem.CIM_ERR_NOT_FOUND },
]
-
-
-test_dpath = "foo"
-disk_file = '/tmp/diskpool.conf'
-back_disk_file = disk_file + "." + "02_reverse"
-
-
-def conf_file():
- """
- Creating diskpool.conf file.
- """
- try:
- f = open(disk_file, 'w')
- f.write('%s %s' % (test_dpath, '/'))
- f.close()
- except Exception,detail:
- Globals.logger.error("Exception: %s", detail)
- status = FAIL
- sys.exit(status)
-
-def clean_up_restore(ip):
- """
- Restoring back the original diskpool.conf
- file.
- """
- try:
- if os.path.exists(back_disk_file):
- os.remove(disk_file)
- move_file(back_disk_file, disk_file)
- except Exception, detail:
- Globals.logger.error("Exception: %s", detail)
- status = FAIL
- vsxml.undefine(ip)
- sys.exit(status)
def try_assoc(conn, exp_ret, dev_dom_name, invalid_keyname_list, test_vals, log_msg):
@@ -102,9 +69,9 @@ def try_assoc(conn, exp_ret, dev_dom_nam
procid = "%s/%s" % (dev_dom_name, 0)
lelist = {
- get_typed_class(virt, "LogicalDisk") : diskid, \
- get_typed_class(virt, "NetworkPort") : netid, \
- get_typed_class(virt, "Memory" ) : memid, \
+ get_typed_class(virt, "LogicalDisk") : diskid,
+ get_typed_class(virt, "NetworkPort") : netid,
+ get_typed_class(virt, "Memory" ) : memid,
get_typed_class(virt, "Processor" ) : procid
}
@@ -125,9 +92,9 @@ def try_assoc(conn, exp_ret, dev_dom_nam
else:
snkeyname = "SystemName"
- test_keys = { devkeyname : devkeyname, \
- ccnkeyname : ccnkeyname, \
- sccnkeyname : sccnkeyname, \
+ test_keys = { devkeyname : devkeyname,
+ ccnkeyname : ccnkeyname,
+ sccnkeyname : sccnkeyname,
snkeyname : snkeyname
}
for cn, devid in sorted(lelist.items()):
@@ -142,20 +109,20 @@ def try_assoc(conn, exp_ret, dev_dom_nam
else:
ccn = cn
- keys = { test_keys[devkeyname] : dev_id, \
- test_keys[ccnkeyname] : ccn, \
- test_keys[sccnkeyname] : test_vals['sccn'], \
- test_keys[snkeyname] : test_vals['sn']
+ keys = { test_keys[devkeyname] : dev_id,
+ test_keys[ccnkeyname] : ccn,
+ test_keys[sccnkeyname] : test_vals['sccn'],
+ test_keys[snkeyname] : test_vals['sn']
}
-
+ print "test_keys", keys
if test_vals['cn'] != "valid":
inst_cn = "InvalidClassName"
else:
inst_cn = cn
instanceref = CIMInstanceName(inst_cn, keybindings=keys)
try:
- assoc_info = conn.AssociatorNames(instanceref, \
- AssocClass=assoc_classname)
+ assoc_info = conn.AssociatorNames(instanceref,
+ AssocClass=assoc_classname)
except pywbem.CIMError, (err_no, desc):
if err_no == exp_ret['rc'] and desc.find(exp_ret['desc']) >= 0:
logger.info("Got expected exception where ")
@@ -165,6 +132,7 @@ def try_assoc(conn, exp_ret, dev_dom_nam
logger.error("Unexpected rc code %s and description \
%s\n" %(err_no, desc))
status = FAIL
+ print "assos", assoc_info
if len(assoc_info) != 0:
logger.error("%s association \
should NOT have returned records. '%s'", assoc_classname, log_msg)
@@ -196,22 +164,21 @@ def err_invalid_sysname_keyname(conn, ex
#
#
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "invalid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "invalid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Invalid SystemName Key Name was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_sysname_keyvalue(conn, exp_ret):
@@ -232,22 +199,21 @@ def err_invalid_sysname_keyvalue(conn, e
#
# Similarly we check for Memory,Network,Processor.
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : "invalid", \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : "invalid",
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Non-existing SystemName was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_devid_keyname(conn, exp_ret):
# This is used to verify the that the
@@ -271,22 +237,21 @@ def err_invalid_devid_keyname(conn, exp_
#
#
- test_keys = { 'DeviceID' : "invalid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "invalid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Invalid deviceid keyname was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_devid_keyvalue(conn, exp_ret):
@@ -309,22 +274,22 @@ def err_invalid_devid_keyvalue(conn, exp
# Similarly we check for Network.
#
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "invalid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "invalid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Invalid deviceid keyvalue was supplied."
- return try_assoc(conn, exp_ret, test_dom_invalid, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom_invalid, test_keys, test_vals,
+ log_msg)
def err_invalid_classname(conn, exp_ret):
@@ -348,22 +313,21 @@ def err_invalid_classname(conn, exp_ret)
# Similarly we check for Memory,Network,Processor.
#
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "invalid"
}
log_msg = "Invalid classname value was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_creationclassname_keyname(conn, exp_ret):
@@ -388,22 +352,21 @@ def err_invalid_creationclassname_keynam
# Similarly we check for Memory,Network,Processor.
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "invalid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "invalid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Invalid creationclassname keyname was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_creationclassname_keyvalue(conn, exp_ret):
@@ -426,22 +389,21 @@ def err_invalid_creationclassname_keyval
# Similarly we check for Memory,Network,Processor.
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "invalid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "invalid",
'cn' : "valid"
}
log_msg = "Invalid creatioclassname keyvalue was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_syscreationclassname_keyname(conn, exp_ret):
@@ -464,22 +426,21 @@ def err_invalid_syscreationclassname_key
# Similarly we check for Memory,Network,Processor.
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "invalid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "invalid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Invalid system creatioclassname keyvalue was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_syscreationclassname_keyvalue(conn, exp_ret):
@@ -502,22 +463,21 @@ def err_invalid_syscreationclassname_key
# Similarly we check for Memory,Network,Processor.
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : "invalid", \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : "invalid",
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Invalid system creatioclassname keyvalue was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
@do_main(platform_sup)
def main():
@@ -539,18 +499,15 @@ def main():
destroy_and_undefine_all(options.ip)
vsxml = get_class(virt)(test_dom, vcpus = test_vcpus, mac = test_mac, \
disk = test_disk)
- if (os.path.exists(back_disk_file)):
- os.unlink(back_disk_file)
+ # Verify DiskPool on machine
+ status = create_diskpool_file()
+ if status != PASS:
+ return status
- if not (os.path.exists(disk_file)):
- conf_file()
- else:
- move_file(disk_file, back_disk_file)
- conf_file()
bridge = vsxml.set_vbridge(options.ip)
ret = vsxml.define(options.ip)
if not ret:
- Globals.logger.error("Failed to define the dom: %s", test_dom)
+ logger.error("Failed to define the dom: %s", test_dom)
return FAIL
conn = assoc.myWBEMConnection('http://%s' % options.ip,
(Globals.CIM_USER, Globals.CIM_PASS),
@@ -558,48 +515,48 @@ def main():
assoc_classname = get_typed_class(virt, "ElementAllocatedFromPool")
ret = err_invalid_sysname_keyname(conn, exp_list[0])
if ret:
- Globals.logger.error("------FAILED: Invalid SystemName Key Name.------")
+ logger.error("------FAILED: Invalid SystemName Key Name.------")
return ret
ret = err_invalid_sysname_keyvalue(conn, exp_list[0])
if ret:
- Globals.logger.error("------FAILED: Invalid SystemName Key Value.------")
+ logger.error("------FAILED: Invalid SystemName Key Value.------")
return ret
ret = err_invalid_devid_keyname(conn, exp_list[1])
if ret:
- Globals.logger.error("------FAILED: Invalid DeviceID \
+ logger.error("------FAILED: Invalid DeviceID \
Keyname.------")
return ret
ret = err_invalid_devid_keyvalue(conn, exp_list[2])
if ret:
- Globals.logger.error("------FAILED: Invalid DeviceID \
+ logger.error("------FAILED: Invalid DeviceID \
Keyvalue.------")
return ret
ret = err_invalid_classname(conn, exp_list[3])
if ret:
- Globals.logger.error("------FAILED: Invalid classname\
+ logger.error("------FAILED: Invalid classname\
Keyname.------")
return ret
ret = err_invalid_creationclassname_keyname(conn, exp_list[4])
if ret:
- Globals.logger.error("------FAILED: Invalid creationclassname\
+ logger.error("------FAILED: Invalid creationclassname\
Keyname.------")
return ret
ret = err_invalid_creationclassname_keyvalue(conn, exp_list[4])
if ret:
- Globals.logger.error("------FAILED: Invalid creationclassname\
+ logger.error("------FAILED: Invalid creationclassname\
Keyvalue.------")
return ret
ret = err_invalid_syscreationclassname_keyname(conn, exp_list[5])
if ret:
- Globals.logger.error("------FAILED: Invalid System creationclassname\
+ logger.error("------FAILED: Invalid System creationclassname\
Keyname.------")
return ret
ret = err_invalid_syscreationclassname_keyvalue(conn, exp_list[5])
if ret:
- Globals.logger.error("------FAILED: Invalid System creationclassname\
+ logger.error("------FAILED: Invalid System creationclassname\
Keyvalue.------")
return ret
- clean_up_restore(options.ip)
+ cleanup_restore()
vsxml.undefine(options.ip)
return PASS
if __name__ == "__main__":
16 years, 7 months
[PATCH] [TEST] create a virtual storage pool in vxml.py
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1209458122 25200
# Node ID 144b49e7504511817693b3f3e78c7905e8aed140
# Parent 2b83c1992dfc44573ba0c00729e36311355807ad
[TEST] create a virtual storage pool in vxml.py
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 2b83c1992dfc -r 144b49e75045 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Sun Apr 27 19:22:03 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue Apr 29 01:35:22 2008 -0700
@@ -44,6 +44,7 @@ from CimTest.Globals import logger, CIM_
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, get_typed_class
+from XenKvmLib.const import CIM_REV
class XMLClass:
xml_string = ""
@@ -536,6 +537,15 @@ class KVMXML(VirtXML):
self.add_sub_node(interface, 'mac', address=net_mac)
if net_type == 'bridge':
self.set_vbridge(CIM_IP)
+
+ if CIM_REV > 496:
+ pool = self.add_sub_node(devices, 'pool', type='disk')
+ self.add_sub_node(pool, 'name', 'test')
+ source = self.add_sub_node(pool, 'source')
+ self.add_sub_node(source, 'device', path='/dev/sda')
+ self.add_sub_node(source, 'dir', path='/dev')
+ target = self.add_sub_node(pool, 'target')
+ self.add_sub_node(target, 'path', '/dev')
def set_emulator(self, emu):
return self._set_emulator(emu)
16 years, 7 months
[PATCH] Make TimeoutPeriod optional in RSC method
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1209492001 25200
# Node ID 907f388e3a0a456e2a94043556ace4b11589b6cd
# Parent a6ad7167443f326ec96e2161127024a86259e4fb
Make TimeoutPeriod optional in RSC method
Apparently the CIMOM is allowed to ignore NULL paramters as missing, which
means we can't tell if it's missing or NULL. Since NULL is a valid value
for this parameter, making it optional seems like the only logical choice.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r a6ad7167443f -r 907f388e3a0a src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Tue Apr 29 07:05:34 2008 -0700
+++ b/src/Virt_ComputerSystem.c Tue Apr 29 11:00:01 2008 -0700
@@ -862,7 +862,7 @@ static struct method_handler RequestStat
.name = "RequestStateChange",
.handler = state_change,
.args = {{"RequestedState", CMPI_uint16, false},
- {"TimeoutPeriod", CMPI_dateTime, false},
+ {"TimeoutPeriod", CMPI_dateTime, true},
ARG_END
}
};
16 years, 7 months
[PATCH] [TEST] add a patch for indication_tester.py to reflect the recent changes of libcmpiutil vesion
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1209435109 25200
# Node ID bfa5d79bbd137cea523c577d879d43dd8cba3734
# Parent 2b83c1992dfc44573ba0c00729e36311355807ad
[TEST] add a patch for indication_tester.py to reflect the recent changes of libcmpiutil vesion
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 2b83c1992dfc -r bfa5d79bbd13 suites/libvirt-cim/lib/XenKvmLib/indication_tester.py
--- a/suites/libvirt-cim/lib/XenKvmLib/indication_tester.py Sun Apr 27 19:22:03 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/indication_tester.py Mon Apr 28 19:11:49 2008 -0700
@@ -395,9 +395,9 @@ def main():
action="store_true",
help="Print received indications to stdout.")
parser.add_option("-U", "--user", dest="username", default=None,
- help="HTTP Auth username", dest="username")
+ help="HTTP Auth username")
parser.add_option("-P", "--pass", dest="password", default=None,
- help="HTTP Auth password", dest="password")
+ help="HTTP Auth password")
(options, args) = parser.parse_args()
16 years, 7 months
[PATCH] [TEST] modified the revision number and resent the patch of VSSDC.03
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1209433604 25200
# Node ID 99ff1eb252d20b3954a1ad4e6788f1ca1341a800
# Parent 2b83c1992dfc44573ba0c00729e36311355807ad
[TEST] modified the revision number and resent the patch of VSSDC.03
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 2b83c1992dfc -r 99ff1eb252d2 suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/03_vssdc_fwd_errs.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/03_vssdc_fwd_errs.py Sun Apr 27 19:22:03 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/03_vssdc_fwd_errs.py Mon Apr 28 18:46:44 2008 -0700
@@ -62,12 +62,14 @@ from CimTest.ReturnCodes import PASS, FA
from CimTest.ReturnCodes import PASS, FAIL
from CimTest.Globals import do_main, logger
from CimTest.Globals import CIM_USER, CIM_PASS, CIM_NS
+from XenKvmLib.const import CIM_REV
sup_types = ['Xen', 'XenFV', 'KVM']
test_dom = "domu1"
test_mac = "00:11:22:33:44:aa"
test_vcpus = 1
+rev = 393
expr_values = {
"INVALID_InstID_Keyname" : { 'rc' : pywbem.CIM_ERR_FAILED, \
@@ -75,6 +77,10 @@ expr_values = {
"INVALID_InstID_Keyval" : { 'rc' : pywbem.CIM_ERR_NOT_FOUND, \
'desc' : 'No such instance (INVALID_InstID_Keyval)'}
}
+
+if CIM_REV < rev:
+ expr_values['INVALID_InstID_Keyval'] = {'rc' : pywbem.CIM_ERR_FAILED, \
+ 'desc' : 'Invalid InstanceID'}
def try_invalid_assoc(classname, name_val, i, field, virt="Xen"):
ac_classname = get_typed_class(virt, "VirtualSystemSettingDataComponent")
16 years, 7 months
[PATCH] [TEST] updating ib fn conf_file(), cleanup_restore() and create_diskpool_file()
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1209473087 25200
# Node ID 2b787019d54fc8c02ab7e69729e0c1920696419b
# Parent 2b83c1992dfc44573ba0c00729e36311355807ad
[TEST] updating ib fn conf_file(), cleanup_restore() and create_diskpool_file()
diff -r 2b83c1992dfc -r 2b787019d54f suites/libvirt-cim/cimtest/ElementAllocatedFromPool/03_reverse_errs.py
--- a/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/03_reverse_errs.py Sun Apr 27 19:22:03 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/03_reverse_errs.py Tue Apr 29 05:44:47 2008 -0700
@@ -29,29 +29,26 @@
# Date : 30-12-2007
import sys
-import os
-from distutils.file_util import move_file
import pywbem
from XenKvmLib import assoc
from CimTest import Globals
from XenKvmLib.test_doms import destroy_and_undefine_all
from XenKvmLib.common_util import try_assoc
from CimTest.ReturnCodes import PASS, FAIL
-from CimTest.Globals import do_main, platform_sup
+from CimTest.Globals import do_main, platform_sup, logger
from XenKvmLib.vxml import get_class
from XenKvmLib.classes import get_typed_class
+from XenKvmLib.common_util import cleanup_restore, test_dpath, \
+create_diskpool_file
bug_no = "88651"
test_dom = "hd_domain"
test_mac = "00:11:22:33:44:aa"
test_vcpus = 1
-id1 = "DiskPool/foo"
+id1 = "DiskPool/%s" %test_dpath
id2 = "MemoryPool/0"
id3 = "NetworkPool/xenbr0"
id4 = "ProcessorPool/0"
-test_dpath = "foo"
-disk_file = '/tmp/diskpool.conf'
-back_disk_file = disk_file + "." + "02_reverse"
expr_values = {
"invalid_keyname" : {
'rc' : pywbem.CIM_ERR_FAILED, \
@@ -62,34 +59,6 @@ expr_values = {
'desc' : 'No such instance'
}
}
-
-def conf_file():
- """
- Creating diskpool.conf file.
- """
- try:
- f = open(disk_file, 'w')
- f.write('%s %s' % (test_dpath, '/'))
- f.close()
- except Exception,detail:
- Globals.logger.error("Exception: %s", detail)
- status = FAIL
- sys.exit(status)
-
-def clean_up_restore(ip):
- """
- Restoring back the original diskpool.conf
- file.
- """
- try:
- if os.path.exists(back_disk_file):
- os.remove(disk_file)
- move_file(back_disk_file, disk_file)
- except Exception, detail:
- Globals.logger.error("Exception: %s", detail)
- status = FAIL
- vsxml.undefine(ip)
- sys.exit(status)
def err_invalid_ccname():
# This is used to verify the that the
@@ -119,8 +88,8 @@ def err_invalid_ccname():
for classname, instdid in sorted(lelist.items()):
keys = { "InstanceID" : instdid}
field = "ClassName"
- status = try_assoc(conn, classname, assoc_classname, keys, field_name=field, \
- expr_values=expr_values['invalid_keyvalue'], bug_no="")
+ status = try_assoc(conn, classname, assoc_classname, keys, field_name=field,
+ expr_values=expr_values['invalid_keyvalue'], bug_no="")
if status != PASS:
break
return status
@@ -153,8 +122,8 @@ def err_invalid_keyname():
for classname, instdid in sorted(lelist.items()):
keys = { "InvalidID" : instdid }
field = "InstanceID_KeyName"
- status = try_assoc(conn, classname, assoc_classname, keys, field_name=field, \
- expr_values=expr_values['invalid_keyname'], bug_no="")
+ status = try_assoc(conn, classname, assoc_classname, keys, field_name=field,
+ expr_values=expr_values['invalid_keyname'], bug_no="")
if status != PASS:
break
return status
@@ -189,8 +158,8 @@ def err_invalid_keyvalue():
for classname in sorted(lelist):
keys = { "InstanceID" : "InvalidKeyValue" }
field = "InstanceID_KeyValue"
- status = try_assoc(conn, classname, assoc_classname, keys, field_name=field, \
- expr_values=expr_values['invalid_keyvalue'], bug_no="")
+ status = try_assoc(conn, classname, assoc_classname, keys, field_name=field,
+ expr_values=expr_values['invalid_keyvalue'], bug_no="")
if status != PASS:
break
return status
@@ -209,38 +178,36 @@ def main():
test_disk = "xvda"
else:
test_disk = "hda"
+ virt_type = get_class(virt)
+ vsxml = virt_type (test_dom, vcpus = test_vcpus, mac = test_mac,
+ disk = test_disk)
- vsxml = get_class(virt)(test_dom, vcpus = test_vcpus, mac = test_mac, \
- disk = test_disk)
- if (os.path.exists(back_disk_file)):
- os.unlink(back_disk_file)
+ # Verify DiskPool on machine
+ status = create_diskpool_file()
+ if status != PASS:
+ return status
- if not (os.path.exists(disk_file)):
- conf_file()
- else:
- move_file(disk_file, back_disk_file)
- conf_file()
ret = vsxml.define(options.ip)
if not ret:
- Globals.logger.error("Failed to define the dom: %s", test_dom)
+ logger.error("Failed to define the dom: %s", test_dom)
return FAIL
conn = assoc.myWBEMConnection('http://%s' % options.ip,
- (Globals.CIM_USER, Globals.CIM_PASS),
- Globals.CIM_NS)
+ (Globals.CIM_USER, Globals.CIM_PASS),
+ Globals.CIM_NS)
assoc_classname = get_typed_class(virt, "ElementAllocatedFromPool")
ret = err_invalid_keyname()
if ret:
- Globals.logger.error("------FAILED: Invalid KeyName.------")
+ logger.error("------FAILED: Invalid KeyName.------")
return ret
ret = err_invalid_keyvalue()
if ret:
- Globals.logger.error("------FAILED: Invalid KeyValue.------")
+ logger.error("------FAILED: Invalid KeyValue.------")
return ret
ret = err_invalid_ccname()
if ret:
- Globals.logger.error("------FAILED: Invalid CCName.------")
+ logger.error("------FAILED: Invalid CCName.------")
return ret
- clean_up_restore(options.ip)
+ cleanup_restore()
vsxml.undefine(options.ip)
return PASS
if __name__ == "__main__":
diff -r 2b83c1992dfc -r 2b787019d54f suites/libvirt-cim/cimtest/ElementAllocatedFromPool/04_forward_errs.py
--- a/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/04_forward_errs.py Sun Apr 27 19:22:03 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/04_forward_errs.py Tue Apr 29 05:44:47 2008 -0700
@@ -29,8 +29,6 @@
#
import sys
-import os
-from distutils.file_util import move_file
import pywbem
from pywbem.cim_obj import CIMInstanceName
from XenKvmLib import assoc
@@ -41,6 +39,8 @@ from CimTest.Globals import do_main, pla
from CimTest.Globals import do_main, platform_sup
from XenKvmLib.vxml import get_class
from XenKvmLib.classes import get_typed_class
+from XenKvmLib.common_util import cleanup_restore, test_dpath, \
+create_diskpool_file
sup_types = ['Xen', 'KVM', 'XenFV']
bug_no = "88651"
@@ -49,49 +49,16 @@ test_mac = "00:11:22:33:44:aa"
test_mac = "00:11:22:33:44:aa"
test_vcpus = 1
exp_list = [
- {'desc' : "No such instance (SystemName)", 'rc' : pywbem.CIM_ERR_NOT_FOUND}, \
- {'desc' : "No DeviceID specified", 'rc' : pywbem.CIM_ERR_FAILED}, \
- {'desc' : "No such instance", 'rc' : pywbem.CIM_ERR_NOT_FOUND}, \
- {'desc' : "One or more parameter values passed to the method were invalid", \
- 'rc' : pywbem.CIM_ERR_INVALID_PARAMETER}, \
- {'desc' : "No such instance (CreationClassName)", 'rc' : pywbem.CIM_ERR_NOT_FOUND }, \
- {'desc' : "No such instance (SystemCreationClassName)", 'rc' : \
- pywbem.CIM_ERR_NOT_FOUND },
+ {'desc' : "No such instance (SystemName)", 'rc' : pywbem.CIM_ERR_NOT_FOUND},
+ {'desc' : "No DeviceID specified", 'rc' : pywbem.CIM_ERR_FAILED},
+ {'desc' : "No such instance", 'rc' : pywbem.CIM_ERR_NOT_FOUND},
+ {'desc' : "CIM_ERR_INVALID_PARAMETER",
+ 'rc' : pywbem.CIM_ERR_INVALID_PARAMETER},
+ {'desc' : "No such instance (CreationClassName)",
+ 'rc' : pywbem.CIM_ERR_NOT_FOUND },
+ {'desc' : "No such instance (SystemCreationClassName)",
+ 'rc' : pywbem.CIM_ERR_NOT_FOUND },
]
-
-
-test_dpath = "foo"
-disk_file = '/tmp/diskpool.conf'
-back_disk_file = disk_file + "." + "02_reverse"
-
-
-def conf_file():
- """
- Creating diskpool.conf file.
- """
- try:
- f = open(disk_file, 'w')
- f.write('%s %s' % (test_dpath, '/'))
- f.close()
- except Exception,detail:
- Globals.logger.error("Exception: %s", detail)
- status = FAIL
- sys.exit(status)
-
-def clean_up_restore(ip):
- """
- Restoring back the original diskpool.conf
- file.
- """
- try:
- if os.path.exists(back_disk_file):
- os.remove(disk_file)
- move_file(back_disk_file, disk_file)
- except Exception, detail:
- Globals.logger.error("Exception: %s", detail)
- status = FAIL
- vsxml.undefine(ip)
- sys.exit(status)
def try_assoc(conn, exp_ret, dev_dom_name, invalid_keyname_list, test_vals, log_msg):
@@ -102,9 +69,9 @@ def try_assoc(conn, exp_ret, dev_dom_nam
procid = "%s/%s" % (dev_dom_name, 0)
lelist = {
- get_typed_class(virt, "LogicalDisk") : diskid, \
- get_typed_class(virt, "NetworkPort") : netid, \
- get_typed_class(virt, "Memory" ) : memid, \
+ get_typed_class(virt, "LogicalDisk") : diskid,
+ get_typed_class(virt, "NetworkPort") : netid,
+ get_typed_class(virt, "Memory" ) : memid,
get_typed_class(virt, "Processor" ) : procid
}
@@ -125,9 +92,9 @@ def try_assoc(conn, exp_ret, dev_dom_nam
else:
snkeyname = "SystemName"
- test_keys = { devkeyname : devkeyname, \
- ccnkeyname : ccnkeyname, \
- sccnkeyname : sccnkeyname, \
+ test_keys = { devkeyname : devkeyname,
+ ccnkeyname : ccnkeyname,
+ sccnkeyname : sccnkeyname,
snkeyname : snkeyname
}
for cn, devid in sorted(lelist.items()):
@@ -142,20 +109,20 @@ def try_assoc(conn, exp_ret, dev_dom_nam
else:
ccn = cn
- keys = { test_keys[devkeyname] : dev_id, \
- test_keys[ccnkeyname] : ccn, \
- test_keys[sccnkeyname] : test_vals['sccn'], \
- test_keys[snkeyname] : test_vals['sn']
+ keys = { test_keys[devkeyname] : dev_id,
+ test_keys[ccnkeyname] : ccn,
+ test_keys[sccnkeyname] : test_vals['sccn'],
+ test_keys[snkeyname] : test_vals['sn']
}
-
+ print "test_keys", keys
if test_vals['cn'] != "valid":
inst_cn = "InvalidClassName"
else:
inst_cn = cn
instanceref = CIMInstanceName(inst_cn, keybindings=keys)
try:
- assoc_info = conn.AssociatorNames(instanceref, \
- AssocClass=assoc_classname)
+ assoc_info = conn.AssociatorNames(instanceref,
+ AssocClass=assoc_classname)
except pywbem.CIMError, (err_no, desc):
if err_no == exp_ret['rc'] and desc.find(exp_ret['desc']) >= 0:
logger.info("Got expected exception where ")
@@ -165,6 +132,7 @@ def try_assoc(conn, exp_ret, dev_dom_nam
logger.error("Unexpected rc code %s and description \
%s\n" %(err_no, desc))
status = FAIL
+ print "assos", assoc_info
if len(assoc_info) != 0:
logger.error("%s association \
should NOT have returned records. '%s'", assoc_classname, log_msg)
@@ -196,22 +164,21 @@ def err_invalid_sysname_keyname(conn, ex
#
#
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "invalid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "invalid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Invalid SystemName Key Name was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_sysname_keyvalue(conn, exp_ret):
@@ -232,22 +199,21 @@ def err_invalid_sysname_keyvalue(conn, e
#
# Similarly we check for Memory,Network,Processor.
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : "invalid", \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : "invalid",
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Non-existing SystemName was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_devid_keyname(conn, exp_ret):
# This is used to verify the that the
@@ -271,22 +237,21 @@ def err_invalid_devid_keyname(conn, exp_
#
#
- test_keys = { 'DeviceID' : "invalid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "invalid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Invalid deviceid keyname was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_devid_keyvalue(conn, exp_ret):
@@ -309,22 +274,22 @@ def err_invalid_devid_keyvalue(conn, exp
# Similarly we check for Network.
#
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "invalid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "invalid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Invalid deviceid keyvalue was supplied."
- return try_assoc(conn, exp_ret, test_dom_invalid, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom_invalid, test_keys, test_vals,
+ log_msg)
def err_invalid_classname(conn, exp_ret):
@@ -348,22 +313,21 @@ def err_invalid_classname(conn, exp_ret)
# Similarly we check for Memory,Network,Processor.
#
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "invalid"
}
log_msg = "Invalid classname value was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_creationclassname_keyname(conn, exp_ret):
@@ -388,22 +352,21 @@ def err_invalid_creationclassname_keynam
# Similarly we check for Memory,Network,Processor.
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "invalid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "invalid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Invalid creationclassname keyname was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_creationclassname_keyvalue(conn, exp_ret):
@@ -426,22 +389,21 @@ def err_invalid_creationclassname_keyval
# Similarly we check for Memory,Network,Processor.
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "invalid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "invalid",
'cn' : "valid"
}
log_msg = "Invalid creatioclassname keyvalue was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_syscreationclassname_keyname(conn, exp_ret):
@@ -464,22 +426,21 @@ def err_invalid_syscreationclassname_key
# Similarly we check for Memory,Network,Processor.
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "invalid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "invalid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : get_typed_class(virt, "ComputerSystem"), \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : get_typed_class(virt, "ComputerSystem"),
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Invalid system creatioclassname keyvalue was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
def err_invalid_syscreationclassname_keyvalue(conn, exp_ret):
@@ -502,22 +463,21 @@ def err_invalid_syscreationclassname_key
# Similarly we check for Memory,Network,Processor.
#
- test_keys = { 'DeviceID' : "valid", \
- 'CreationClassName' : "valid", \
- 'SystemCreationClassName' : "valid", \
- 'SystemName' : "valid" \
+ test_keys = { 'DeviceID' : "valid",
+ 'CreationClassName' : "valid",
+ 'SystemCreationClassName' : "valid",
+ 'SystemName' : "valid"
}
- test_vals = { 'devid' : "valid", \
- 'sccn' : "invalid", \
- 'sn' : test_dom, \
- 'ccn' : "valid", \
+ test_vals = { 'devid' : "valid",
+ 'sccn' : "invalid",
+ 'sn' : test_dom,
+ 'ccn' : "valid",
'cn' : "valid"
}
log_msg = "Invalid system creatioclassname keyvalue was supplied."
- return try_assoc(conn, exp_ret, test_dom, test_keys, \
- test_vals, log_msg)
+ return try_assoc(conn, exp_ret, test_dom, test_keys, test_vals, log_msg)
@do_main(platform_sup)
def main():
@@ -539,18 +499,15 @@ def main():
destroy_and_undefine_all(options.ip)
vsxml = get_class(virt)(test_dom, vcpus = test_vcpus, mac = test_mac, \
disk = test_disk)
- if (os.path.exists(back_disk_file)):
- os.unlink(back_disk_file)
+ # Verify DiskPool on machine
+ status = create_diskpool_file()
+ if status != PASS:
+ return status
- if not (os.path.exists(disk_file)):
- conf_file()
- else:
- move_file(disk_file, back_disk_file)
- conf_file()
bridge = vsxml.set_vbridge(options.ip)
ret = vsxml.define(options.ip)
if not ret:
- Globals.logger.error("Failed to define the dom: %s", test_dom)
+ logger.error("Failed to define the dom: %s", test_dom)
return FAIL
conn = assoc.myWBEMConnection('http://%s' % options.ip,
(Globals.CIM_USER, Globals.CIM_PASS),
@@ -558,48 +515,48 @@ def main():
assoc_classname = get_typed_class(virt, "ElementAllocatedFromPool")
ret = err_invalid_sysname_keyname(conn, exp_list[0])
if ret:
- Globals.logger.error("------FAILED: Invalid SystemName Key Name.------")
+ logger.error("------FAILED: Invalid SystemName Key Name.------")
return ret
ret = err_invalid_sysname_keyvalue(conn, exp_list[0])
if ret:
- Globals.logger.error("------FAILED: Invalid SystemName Key Value.------")
+ logger.error("------FAILED: Invalid SystemName Key Value.------")
return ret
ret = err_invalid_devid_keyname(conn, exp_list[1])
if ret:
- Globals.logger.error("------FAILED: Invalid DeviceID \
+ logger.error("------FAILED: Invalid DeviceID \
Keyname.------")
return ret
ret = err_invalid_devid_keyvalue(conn, exp_list[2])
if ret:
- Globals.logger.error("------FAILED: Invalid DeviceID \
+ logger.error("------FAILED: Invalid DeviceID \
Keyvalue.------")
return ret
ret = err_invalid_classname(conn, exp_list[3])
if ret:
- Globals.logger.error("------FAILED: Invalid classname\
+ logger.error("------FAILED: Invalid classname\
Keyname.------")
return ret
ret = err_invalid_creationclassname_keyname(conn, exp_list[4])
if ret:
- Globals.logger.error("------FAILED: Invalid creationclassname\
+ logger.error("------FAILED: Invalid creationclassname\
Keyname.------")
return ret
ret = err_invalid_creationclassname_keyvalue(conn, exp_list[4])
if ret:
- Globals.logger.error("------FAILED: Invalid creationclassname\
+ logger.error("------FAILED: Invalid creationclassname\
Keyvalue.------")
return ret
ret = err_invalid_syscreationclassname_keyname(conn, exp_list[5])
if ret:
- Globals.logger.error("------FAILED: Invalid System creationclassname\
+ logger.error("------FAILED: Invalid System creationclassname\
Keyname.------")
return ret
ret = err_invalid_syscreationclassname_keyvalue(conn, exp_list[5])
if ret:
- Globals.logger.error("------FAILED: Invalid System creationclassname\
+ logger.error("------FAILED: Invalid System creationclassname\
Keyvalue.------")
return ret
- clean_up_restore(options.ip)
+ cleanup_restore()
vsxml.undefine(options.ip)
return PASS
if __name__ == "__main__":
16 years, 7 months
[PATCH] Remove extra cu_statusf() call from VSMigrationService.c
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1209426269 25200
# Node ID 92702225dbafa13d2f7201b3fe5baeaebd07100d
# Parent a9f38d1726784a85db09602c53ad990819047690
Remove extra cu_statusf() call from VSMigrationService.c
Unfortunately, the patch doesn't include the appropriate context (see below). The issue here is that the if/else blocks call cu_statusf() to set the status. There's no goto in the else block, so this extra cu_statusf() is called - even when we've encountered an error.
if (remote >= local) {
/* Success */
} else {
/* Failure */
}
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r a9f38d172678 -r 92702225dbaf src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c Fri Apr 25 16:10:31 2008 -0700
+++ b/src/Virt_VSMigrationService.c Mon Apr 28 16:44:29 2008 -0700
@@ -267,9 +267,6 @@ static CMPIStatus check_hver(virConnectP
remote, local);
}
- cu_statusf(_BROKER, &s,
- CMPI_RC_OK,
- "");
out:
return s;
}
16 years, 7 months
[PATCH] [TEST] create a virtual storage pool in vxml.py
by zli@linux.vnet.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1209458574 25200
# Node ID a5411ba6b4b3b92c2a447f575e895ebf6ea6fccc
# Parent 2b83c1992dfc44573ba0c00729e36311355807ad
[TEST] create a virtual storage pool in vxml.py
libvirt-cim(a)redhat.com
diff -r 2b83c1992dfc -r a5411ba6b4b3 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Sun Apr 27 19:22:03 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue Apr 29 01:42:54 2008 -0700
@@ -44,6 +44,7 @@
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, get_typed_class
+from XenKvmLib.const import CIM_REV
class XMLClass:
xml_string = ""
@@ -536,6 +537,15 @@
self.add_sub_node(interface, 'mac', address=net_mac)
if net_type == 'bridge':
self.set_vbridge(CIM_IP)
+
+ if CIM_REV > 496:
+ pool = self.add_sub_node(devices, 'pool', type='disk')
+ self.add_sub_node(pool, 'name', 'test')
+ source = self.add_sub_node(pool, 'source')
+ self.add_sub_node(source, 'device', path='/dev/sda')
+ self.add_sub_node(source, 'dir', path='/dev')
+ target = self.add_sub_node(pool, 'target')
+ self.add_sub_node(target, 'path', '/dev')
def set_emulator(self, emu):
return self._set_emulator(emu)
16 years, 7 months
[PATCH] [TEST] add virt option in network_by_bridge function
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1209458658 25200
# Node ID ce8e273d35c82934f64f1e53db5f9eab916c9edf
# Parent 2b83c1992dfc44573ba0c00729e36311355807ad
[TEST] add virt option in network_by_bridge function
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 2b83c1992dfc -r ce8e273d35c8 lib/VirtLib/live.py
--- a/lib/VirtLib/live.py Sun Apr 27 19:22:03 2008 -0700
+++ b/lib/VirtLib/live.py Tue Apr 29 01:44:18 2008 -0700
@@ -301,15 +301,15 @@ def get_bridge_from_network_xml(network,
if len(bridge) > 1:
return bridge[1]
-def network_by_bridge(bridge, server):
+def network_by_bridge(bridge, server, virt="Xen"):
"""Function returns virtual network for a given bridge"""
- networks = net_list(server)
+ networks = net_list(server, virt)
if len(networks) == 0:
return None
for network in networks:
- if bridge == get_bridge_from_network_xml(network, server):
+ if bridge == get_bridge_from_network_xml(network, server, virt):
return network
return None
16 years, 7 months
[PATCH] [TEST] undefine domain in ElementConforms.04
by zli@linux.vnet.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1209437915 -28800
# Node ID eed8980e5dd7bfe8ebfffe891b4fc779a6028ce8
# Parent 45c4fad193746d9d971389758851d4858a5049d3
[TEST] undefine domain in ElementConforms.04
This is the reason to ElementSettingData.03 failure in bulk run.
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r 45c4fad19374 -r eed8980e5dd7 suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py
--- a/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py Tue Apr 29 09:42:19 2008 +0800
+++ b/suites/libvirt-cim/cimtest/ElementConforms/04_ectp_rev_errs.py Tue Apr 29 10:58:35 2008 +0800
@@ -173,6 +173,8 @@ def main():
retval = try_invalid_assoc(cs, comp_name_val, i, tc_scen[i], options.virt)
if retval != PASS:
status = retval
+
+ cxml.undefine(options.ip)
return status
if __name__ == "__main__":
16 years, 7 months