[PATCH] [TEST] fix ProcVirtualSystemSettingDataComponent InstanceID in VirtualSystemSettingDataComponent.02
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1208917544 25200
# Node ID 8dbe1fdef56378d48b230487c096a49c70b49530
# Parent 113ac4b0bb4b7b1e29f3aae585ecf7b89958f60e
[TEST] fix ProcVirtualSystemSettingDataComponent InstanceID in VirtualSystemSettingDataComponent.02
This fix will result in tc fails, actually, the InstancID intends to change to "proc" instance of "0"
in provider, right?
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 113ac4b0bb4b -r 8dbe1fdef563 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 Tue Apr 22 19:25:44 2008 -0700
@@ -85,7 +85,7 @@ def assoc_values(ip, assoc_info):
"""
status = PASS
rasd_list = {
- "proc_rasd" : '%s/%s' %(test_dom,0),
+ "proc_rasd" : '%s/%s' %(test_dom, "proc"),
"net_rasd" : '%s/%s' %(test_dom,test_mac),
"disk_rasd" : '%s/%s' %(test_dom, test_disk),
"mem_rasd" : '%s/%s' %(test_dom, "mem")
16 years, 6 months
[PATCH] [TEST] .3# rebase and fix VirtualSystemSettingDataComponent.02_reverse.py
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1209002106 25200
# Node ID e3aae67974e42599fad5d08eb80f0459e05ad546
# Parent dd59f067c3831b252f30f5e46f8baff5016129a3
[TEST] .3# rebase and fix VirtualSystemSettingDataComponent.02_reverse.py
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r dd59f067c383 -r e3aae67974e4 suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py Wed Apr 23 15:28:53 2008 +0530
+++ b/suites/libvirt-cim/cimtest/VirtualSystemSettingDataComponent/02_reverse.py Wed Apr 23 18:55:06 2008 -0700
@@ -47,23 +47,21 @@ import sys
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 @@ def check_rasd_values(id, exp_id):
return PASS
-def assoc_values(ip, assoc_info):
+def assoc_values(ip, assoc_info, virt="Xen"):
"""
The association info of
Xen_VirtualSystemSettingDataComponent is
@@ -85,7 +83,7 @@ def assoc_values(ip, assoc_info):
"""
status = PASS
rasd_list = {
- "proc_rasd" : '%s/%s' %(test_dom,0),
+ "proc_rasd" : '%s/%s' %(test_dom, "proc"),
"net_rasd" : '%s/%s' %(test_dom,test_mac),
"disk_rasd" : '%s/%s' %(test_dom, test_disk),
"mem_rasd" : '%s/%s' %(test_dom, "mem")
@@ -95,17 +93,22 @@ def assoc_values(ip, assoc_info):
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 @@ def main():
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, 6 months
[PATCH] [TEST] Moving conf_file, clean_up_restore() and print_error to library
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1208959848 -19800
# Node ID 0123ff5809dc099c0b7840fce65eca5bce0921e6
# Parent 254b9bf3dacaf1dc3b89a08069cad74ee1b3122f
[TEST] Moving conf_file, clean_up_restore() and print_error to library.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 254b9bf3daca -r 0123ff5809dc suites/libvirt-cim/lib/XenKvmLib/common_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Wed Apr 23 15:28:53 2008 +0530
+++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Wed Apr 23 19:40:48 2008 +0530
@@ -21,6 +21,7 @@
#
import os
import pywbem
+from distutils.file_util import move_file
from XenKvmLib.test_xml import *
from XenKvmLib.test_doms import *
from XenKvmLib import vsms
@@ -31,6 +32,14 @@ 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
+
+test_dpath = "foo"
+disk_file = '/tmp/diskpool.conf'
+back_disk_file = disk_file + "." + "backup"
+
+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:
@@ -230,3 +239,50 @@ def profile_init_list():
}
return profiles
+
+def conf_file():
+ """
+ Creating diskpool.conf file.
+ """
+ status = PASS
+ try:
+ f = open(disk_file, 'w')
+ f.write('%s %s' % (test_dpath, '/'))
+ f.close()
+ except Exception,detail:
+ logger.error("Exception: %s", detail)
+ status = SKIP
+ if status != PASS:
+ logger.error("Creation of Disk Conf file Failed")
+ return status
+
+
+def cleanup_restore():
+ """
+ Restoring back the original diskpool.conf
+ file.
+ """
+ status = PASS
+ try:
+ if os.path.exists(back_disk_file):
+ os.remove(disk_file)
+ move_file(back_disk_file, disk_file)
+ except Exception, detail:
+ logger.error("Exception: %s", detail)
+ status = SKIP
+ if status != PASS:
+ logger.error("Failed to restore the original Disk Conf file")
+ return status
+
+def create_diskpool_file():
+ # Taking care of already existing diskconf file
+ # Creating diskpool.conf if it does not exist
+ # Otherwise backing up the prev file and create new one.
+ if (os.path.exists(back_disk_file)):
+ os.unlink(back_disk_file)
+ if (os.path.exists(disk_file)):
+ logger.info("Entering .....")
+ move_file(disk_file, back_disk_file)
+
+ return conf_file()
+
16 years, 6 months
[PATCH] [TEST] #3 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 1208943021 -19800
# Node ID 064614c4b678b5d38e831548154cdf6b3234b19b
# Parent 113ac4b0bb4b7b1e29f3aae585ecf7b89958f60e
[TEST] #3 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.
4) 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 113ac4b0bb4b -r 064614c4b678 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 15:00:21 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,44 +36,36 @@
# 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, 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
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'] != 'MigrationCapabilities':
- 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, 6 months
[PATCH] [TEST] Updating the 01_forward.py tc in SettingsDefineCapabilities
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1208857494 -19800
# Node ID 320328bb0f70196ea52e6c0e9e254c681cfb5d60
# Parent 41a6c5cd50733a67d56d6612dad02705377a8b88
[TEST] Updating the 01_forward.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 41a6c5cd5073 -r 320328bb0f70 suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py
--- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py Mon Apr 21 16:55:52 2008 +0800
+++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py Tue Apr 22 15:14:54 2008 +0530
@@ -55,19 +55,17 @@ import sys
import sys
import os
from distutils.file_util import move_file
-from VirtLib import utils
from XenKvmLib import assoc
from XenKvmLib import enumclass
-from CimTest import Globals
-from CimTest.Globals import do_main
from XenKvmLib.test_xml import netxml
from XenKvmLib.test_doms import create_vnet
from VirtLib.live import net_list
from CimTest.ReturnCodes import PASS, FAIL, SKIP
+from CimTest.Globals import do_main, platform_sup, logger, \
+CIM_ERROR_GETINSTANCE, CIM_ERROR_ASSOCIATORS
+from XenKvmLib.classes import get_typed_class
-sup_types = ['Xen']
-status = PASS
test_dpath = "foo"
disk_file = '/tmp/diskpool.conf'
back_disk_file = disk_file + "." + "SSDC_01_forward"
@@ -79,12 +77,13 @@ def conf_file():
"""
Creating diskpool.conf file.
"""
+ status = PASS
try:
f = open(disk_file, 'w')
f.write('%s %s' % (test_dpath, '/'))
f.close()
except Exception,detail:
- Globals.logger.error("Exception: %s", detail)
+ logger.error("Exception: %s", detail)
status = SKIP
sys.exit(status)
@@ -93,80 +92,109 @@ def clean_up_restore():
Restoring back the original diskpool.conf
file.
"""
+ status = PASS
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)
+ logger.error("Exception: %s", detail)
status = SKIP
sys.exit(status)
-def get_or_bail(ip, id, pool_class):
+def get_or_bail(virt, ip, id, pool_class):
"""
Getinstance for the CLass and return instance on success, otherwise
exit after cleanup_restore .
"""
key_list = { 'InstanceID' : id }
-
+ status = PASS
try:
- instance = enumclass.getInstance(ip, pool_class, key_list)
+ instance = enumclass.getInstance(ip, pool_class, key_list, virt)
except Exception, detail:
- Globals.logger.error(Globals.CIM_ERROR_GETINSTANCE, '%s' % pool_class)
- Globals.logger.error("Exception: %s", detail)
+ logger.error(CIM_ERROR_GETINSTANCE, '%s' % pool_class)
+ logger.error("Exception: %s", detail)
clean_up_restore()
status = FAIL
sys.exit(status)
return instance
-def init_list(disk, mem, net, proc):
+def init_list(virt, disk, mem, net, proc):
"""
Creating the lists that will be used for comparisons.
"""
instlist = [
- disk.InstanceID, \
- mem.InstanceID, \
- net.InstanceID, \
- proc.InstanceID
- ]
+ disk.InstanceID,
+ mem.InstanceID,
+ net.InstanceID,
+ proc.InstanceID
+ ]
cllist = [
- "Xen_DiskResourceAllocationSettingData", \
- "Xen_MemResourceAllocationSettingData", \
- "Xen_NetResourceAllocationSettingData", \
- "Xen_ProcResourceAllocationSettingData"
+ get_typed_class(virt, "DiskResourceAllocationSettingData"),
+ get_typed_class(virt, "MemResourceAllocationSettingData"),
+ get_typed_class(virt, "NetResourceAllocationSettingData"),
+ get_typed_class(virt, "ProcResourceAllocationSettingData")
]
rtype = {
- "Xen_DiskResourceAllocationSettingData" : 17, \
- "Xen_MemResourceAllocationSettingData" : 4, \
- "Xen_NetResourceAllocationSettingData" : 10, \
- "Xen_ProcResourceAllocationSettingData" : 3
+ get_typed_class(virt, "DiskResourceAllocationSettingData") : 17,
+ get_typed_class(virt, "MemResourceAllocationSettingData") : 4,
+ get_typed_class(virt, "NetResourceAllocationSettingData") : 10,
+ get_typed_class(virt, "ProcResourceAllocationSettingData") : 3
}
rangelist = {
- "Default" : 0, \
- "Minimum" : 1, \
- "Maximum" : 2, \
+ "Default" : 0,
+ "Minimum" : 1,
+ "Maximum" : 2,
"Increment" : 3
}
return instlist, cllist, rtype, rangelist
-def print_error(index, fieldname, assoc_info, exp_value):
- ret_value = assoc_info[index][fieldname]
- Globals.logger.error("%s Mismatch", fieldname)
- Globals.logger.error("Returned %s instead of %s", ret_value, exp_value)
+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)
+def verify_rasd_fields(loop, assoc_info, cllist, rtype, rangelist):
+ status = PASS
+ for inst in assoc_info:
+ if inst.classname != cllist[loop]:
+ print_error("Classname", inst.classname, cllist[loop])
+ status = FAIL
+ if inst['ResourceType'] != rtype[cllist[loop]]:
+ print_error("ResourceType", inst['ResourceType'],
+ rtype[cllist[loop]])
+ status = FAIL
+ ppolicy = inst['PropertyPolicy']
+ if ppolicy != 0 and ppolicy != 1:
+ print_error("PropertyPolicy", inst['PropertyPolicy'], ppolicy)
+ status = FAIL
+ vrole = inst['ValueRole']
+ if vrole < 0 or vrole > 4:
+ print_error("ValueRole", inst['ValueRole'], vrole)
+ status = FAIL
+ insid = inst['InstanceID']
+ vrange = rangelist[insid]
+ if vrange != inst['ValueRange']:
+ print_error("ValueRange", inst['ValueRange'], vrange)
+ status = FAIL
+ if status != PASS:
+ break
+ return status
+
+
+@do_main(platform_sup)
def main():
options = main.options
- global status
-
- cn = 'Xen_AllocationCapabilities'
+
+ cn = get_typed_class(options.virt, "AllocationCapabilities")
loop = 0
server = options.ip
+ virt = options.virt
+ status = PASS
# Taking care of already existing diskconf file
# Creating diskpool.conf if it does not exist
@@ -179,11 +207,13 @@ def main():
conf_file()
try :
- disk = get_or_bail(server, id=diskid, \
- pool_class=enumclass.Xen_DiskPool)
- mem = get_or_bail(server, id = memid, \
- pool_class=enumclass.Xen_MemoryPool)
- vir_network = net_list(server)
+ disk_cn = eval("enumclass." + get_typed_class(options.virt,
+ "DiskPool"))
+ disk = get_or_bail(virt, server, id=diskid, pool_class=disk_cn)
+ mem_cn = eval("enumclass." + get_typed_class(options.virt,
+ "MemoryPool"))
+ mem = get_or_bail(virt, server, id = memid, pool_class=mem_cn)
+ vir_network = net_list(server, virt)
if len(vir_network) > 0:
test_network = vir_network[0]
else:
@@ -192,64 +222,42 @@ def main():
net_xml, bridge = netxml(server, bridgename, test_network)
ret = create_vnet(server, net_xml)
if not ret:
- Globals.logger.error("Failed to create the Virtual Network '%s'", \
- test_network)
+ logger.error("Failed to create Virtual Network '%s'",
+ test_network)
return SKIP
netid = "%s/%s" % ("NetworkPool", test_network)
- net = get_or_bail(server, id = netid, \
- pool_class=enumclass.Xen_NetworkPool)
- proc = get_or_bail(server, id = procid, \
- pool_class=enumclass.Xen_ProcessorPool)
+ net_cn = eval("enumclass." + get_typed_class(options.virt,
+ "NetworkPool"))
+ net = get_or_bail(virt, server, id = netid, pool_class=net_cn)
+ proc_cn = eval("enumclass." + get_typed_class(options.virt,
+ "ProcessorPool"))
+ proc = get_or_bail(virt, server, id = procid, pool_class=proc_cn)
except Exception, detail:
- Globals.logger.error("Exception: %s", detail)
+ logger.error("Exception: %s", detail)
clean_up_restore()
status = FAIL
return status
- instlist, cllist, rtype, rangelist = init_list(disk, mem, net, proc )
-
+ instlist, cllist, rtype, rangelist = init_list(virt, disk, mem, net, proc )
+ assoc_cname = get_typed_class(virt, "SettingsDefineCapabilities")
for instid in sorted(instlist):
try:
- assoc_info = assoc.Associators(options.ip, \
- "Xen_SettingsDefineCapabilities",
- cn,
- InstanceID = instid)
+ assoc_info = assoc.Associators(options.ip, assoc_cname, cn,
+ InstanceID = instid, virt=virt)
if len(assoc_info) != 4:
- Globals.logger.error("Xen_SettingsDefineCapabilities returned \
-%i ResourcePool objects instead 4", len(assoc_info))
+ logger.error("%s returned \
+%i ResourcePool objects instead 4", assoc_cname, len(assoc_info))
status = FAIL
break
- for i in range(len(assoc_info)):
- if assoc_info[i].classname != cllist[loop]:
- print_error(i, "Classname", assoc_info, cllist[loop])
- status = FAIL
- if assoc_info[i]['ResourceType'] != rtype[cllist[loop]]:
- print_error(i, "ResourceType", assoc_info, rtype[cllist[loop]])
- status = FAIL
- ppolicy = assoc_info[i]['PropertyPolicy']
- if ppolicy != 0 and ppolicy != 1:
- print_error(i, "PropertyPolicy", assoc_info, ppolicy)
- status = FAIL
- vrole = assoc_info[i]['ValueRole']
- if vrole < 0 or vrole > 4:
- print_error(i, "ValueRole", assoc_info, vrole)
- status = FAIL
- insid = assoc_info[i]['InstanceID']
- vrange = rangelist[insid]
- if vrange != assoc_info[i]['ValueRange']:
- print_error(i, "ValueRange", assoc_info, vrange)
- status = FAIL
- if status != 0:
- break
- if status != 0:
+ status = verify_rasd_fields(loop, assoc_info, cllist, rtype, rangelist)
+ if status != PASS:
break
else:
loop = loop + 1
except Exception, detail:
- Globals.logger.error(Globals.CIM_ERROR_ASSOCIATORS, \
- 'Xen_SettingsDefineCapabilities')
- Globals.logger.error("Exception: %s", detail)
+ logger.error(CIM_ERROR_ASSOCIATORS, assoc_cname)
+ logger.error("Exception: %s", detail)
clean_up_restore()
status = FAIL
16 years, 6 months
[PATCH] [TEST] Fix revision int() parsing bug
by zli@linux.vnet.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1208928765 -28800
# Node ID 146fb6c00b996d9207962d35c2cb9dd54254abdd
# Parent 111853e6d4122800167525049c1215df839ef65b
[TEST] Fix revision int() parsing bug
The int(os.getenv('CIM_REV')) will lead to an exception if the revision
is None.
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r 111853e6d412 -r 146fb6c00b99 suites/libvirt-cim/main.py
--- a/suites/libvirt-cim/main.py Wed Apr 23 11:13:59 2008 +0800
+++ b/suites/libvirt-cim/main.py Wed Apr 23 13:32:45 2008 +0800
@@ -93,6 +93,10 @@ def get_version(virt, ip):
changeset = inst[0]['Changeset']
except Exception:
return '0', 'Unknown'
+ if revision is None:
+ revision = '0'
+ if changeset is None:
+ changeset = 'Unknown'
return revision, changeset
def main():
16 years, 6 months
[PATCH] Make ComputerSystem.RequestStateChange return a value, as required
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1208966419 25200
# Node ID cf121ecfb0824a34b42507fa36d06bf4cb45d0bc
# Parent 0721d65ee2fbd36ae46536706f3f6b2aff10392c
Make ComputerSystem.RequestStateChange return a value, as required.
Note: There should absolutely be a test case for this.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 0721d65ee2fb -r cf121ecfb082 src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Wed Apr 23 06:57:25 2008 -0700
+++ b/src/Virt_ComputerSystem.c Wed Apr 23 09:00:19 2008 -0700
@@ -825,6 +825,7 @@ static CMPIStatus state_change(CMPIMetho
uint16_t state;
int ret;
const char *name = NULL;
+ uint32_t rc = 1;
ret = cu_get_u16_arg(argsin, "RequestedState", &state);
if (ret != CMPI_RC_OK) {
@@ -843,7 +844,12 @@ static CMPIStatus state_change(CMPIMetho
s = __state_change(name, state, reference);
+ if (s.rc == CMPI_RC_OK)
+ rc = 0;
+
out:
+ CMReturnData(results, &rc, CMPI_uint32);
+
return s;
}
16 years, 6 months
[PATCH] Make ComputerSystem.RequestStateChange return a value, as required
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1208966419 25200
# Node ID cf121ecfb0824a34b42507fa36d06bf4cb45d0bc
# Parent 0721d65ee2fbd36ae46536706f3f6b2aff10392c
Make ComputerSystem.RequestStateChange return a value, as required.
Note: There should absolutely be a test case for this.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 0721d65ee2fb -r cf121ecfb082 src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Wed Apr 23 06:57:25 2008 -0700
+++ b/src/Virt_ComputerSystem.c Wed Apr 23 09:00:19 2008 -0700
@@ -825,6 +825,7 @@ static CMPIStatus state_change(CMPIMetho
uint16_t state;
int ret;
const char *name = NULL;
+ uint32_t rc = 1;
ret = cu_get_u16_arg(argsin, "RequestedState", &state);
if (ret != CMPI_RC_OK) {
@@ -843,7 +844,12 @@ static CMPIStatus state_change(CMPIMetho
s = __state_change(name, state, reference);
- out:
+ if (s.rc == CMPI_RC_OK)
+ rc = 0;
+
+ out:
+ CMReturnData(results, &rc, CMPI_uint32);
+
return s;
}
16 years, 6 months
[PATCH] [TEST]updating 04_hs_to_EAPF.py to use of the lib 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 1208960819 -19800
# Node ID 413ef6a636d51ab12f16588268c8debe4d952f05
# Parent 3bf33b37a58657888f404b87a1504b0453b7761c
[TEST]updating 04_hs_to_EAPF.py to use of the lib fn conf_file(), cleanup_restore() and create_diskpool_file()
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 3bf33b37a586 -r 413ef6a636d5 suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py
--- a/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py Wed Apr 23 19:54:10 2008 +0530
+++ b/suites/libvirt-cim/cimtest/HostSystem/04_hs_to_EAPF.py Wed Apr 23 19:56:59 2008 +0530
@@ -60,6 +60,8 @@ from VirtLib.live import network_by_brid
from VirtLib.live import network_by_bridge
from XenKvmLib.logicaldevices import verify_proc_values, verify_mem_values, \
verify_net_values, verify_disk_values
+from XenKvmLib.common_util import cleanup_restore, test_dpath, \
+create_diskpool_file
sup_types = ['Xen']
@@ -68,9 +70,6 @@ test_mem = 128
test_mem = 128
test_vcpus = 1
test_disk = "xvdb"
-test_dpath = "foo"
-disk_file = '/tmp/diskpool.conf'
-back_disk_file = disk_file + "." + "ccex4"
diskid = "%s/%s" % ("DiskPool", test_dpath)
memid = "%s/%s" % ("MemoryPool", 0)
procid = "%s/%s" % ("ProcessorPool", 0)
@@ -102,32 +101,6 @@ def print_err(err, detail, cn):
logger.error(err % cn)
logger.error("Exception: %s", detail)
-
-def conf_file():
- """
- Creating diskpool.conf file.
- """
- try:
- f = open(disk_file, 'w')
- f.write('%s %s' % (test_dpath, '/'))
- f.close()
- except Exception,detail:
- logger.error("Exception: %s", detail)
- return SKIP
- return PASS
-
-def clean_up_restore():
- """
- 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:
- logger.error("Exception: %s", detail)
-
def field_err(assoc_info, field_list, fieldname):
logger.error("%s Mismatch", fieldname)
logger.error("Returned %s instead of %s", assoc_info[fieldname], field_list[fieldname])
@@ -149,33 +122,34 @@ def pool_init_list(pool_assoc):
def eapf_list():
disk = {
- 'SystemName' : test_dom, \
- 'CreationClassName' : "Xen_LogicalDisk", \
- 'DeviceID' : "%s/%s" % (test_dom,test_disk), \
+ 'SystemName' : test_dom,
+ 'CreationClassName' : "Xen_LogicalDisk",
+ 'DeviceID' : "%s/%s" % (test_dom,test_disk),
'Name' : test_disk
}
proc = {
- 'SystemName' : test_dom, \
- 'CreationClassName' : "Xen_Processor", \
+ 'SystemName' : test_dom,
+ 'CreationClassName' : "Xen_Processor",
'DeviceID' : "%s/%s" % (test_dom,0)
}
net = {
- 'SystemName' : test_dom, \
- 'CreationClassName' : "Xen_NetworkPort", \
- 'DeviceID' : "%s/%s" % (test_dom, test_mac), \
+ 'SystemName' : test_dom,
+ 'CreationClassName' : "Xen_NetworkPort",
+ 'DeviceID' : "%s/%s" % (test_dom, test_mac),
'NetworkAddresses' : test_mac
}
mem = {
- 'SystemName' : test_dom, \
- 'CreationClassName' : "Xen_Memory", \
- 'DeviceID' : "%s/%s" % (test_dom, "mem"), \
+ 'SystemName' : test_dom,
+ 'CreationClassName' : "Xen_Memory",
+ 'DeviceID' : "%s/%s" % (test_dom, "mem"),
'NumberOfBlocks' : test_mem
}
- eaf_values = { "Xen_Processor" : proc, \
- "Xen_LogicalDisk" : disk, \
- "Xen_NetworkPort" : net, \
+ eaf_values = { "Xen_Processor" : proc,
+ "Xen_LogicalDisk" : disk,
+ "Xen_NetworkPort" : net,
"Xen_Memory" : mem
}
+ print eaf_values
return eaf_values
def get_inst_for_dom(assoc_val):
@@ -205,7 +179,7 @@ def get_assocname_info(server, cn, an, q
status = FAIL
if status != PASS:
- clean_up_restore()
+ cleanup_restore()
test_domain_function(test_dom, server, "destroy")
return status, assoc_info
@@ -225,10 +199,7 @@ def verify_eafp_values(server, in_pllist
eapf_values = eapf_list()
for cn, instid in sorted(in_pllist.items()):
try:
- assoc_info = Associators(server, \
- an, \
- cn, \
- InstanceID = instid)
+ assoc_info = Associators(server, an, cn, InstanceID = instid)
inst_list = get_inst_for_dom(assoc_info)
status = check_len(an, inst_list, qcn, exp_len)
if status != PASS:
@@ -250,7 +221,7 @@ def verify_eafp_values(server, in_pllist
except Exception, detail:
logger.error(CIM_ERROR_ASSOCIATORS, an)
logger.error("Exception: %s", detail)
- clean_up_restore()
+ cleanup_restore()
status = FAIL
return status
@@ -258,42 +229,41 @@ def main():
def main():
options= main.options
server = options.ip
-# Get the host info
+
+ # Get the host info
status, host_name, classname = get_host_info(server)
if status != PASS:
return status
- # Taking care of already existing diskconf file
- # Creating diskpool.conf if it does not exist
- # Otherwise backing up the prev file and create new one.
- os.system("rm -f %s" % back_disk_file )
- if not (os.path.exists(disk_file)):
- status = conf_file()
- else:
- move_file(disk_file, back_disk_file)
- status = conf_file()
+
+ # Verify DiskPool on machine
+ status = create_diskpool_file()
if status != PASS:
return status
-# Get the hostedResourcePool info first
+
+ # Get the hostedResourcePool info first
cn = classname
an = "Xen_HostedResourcePool"
qcn = "Device Pool"
status, pool = get_assocname_info(server, cn, an, qcn, host_name)
if status != PASS:
return status
-# One pool for each Device type, hence len should be 4
+
+ # One pool for each Device type, hence len should be 4
exp_len = 4
status = status = check_len(an, pool, qcn, exp_len)
if status != PASS:
return FAIL
+
status = setup_env(server)
if status != PASS:
- clean_up_restore()
+ cleanup_restore()
test_domain_function(test_dom, server, cmd = "destroy")
return status
+
in_pllist = pool_init_list(pool)
status = verify_eafp_values(server, in_pllist)
ret = test_domain_function(test_dom, server, cmd = "destroy")
- clean_up_restore()
+ cleanup_restore()
return status
if __name__ == "__main__":
sys.exit(main())
16 years, 6 months
[PATCH] [TEST]updating 01_enum.py, 02_rp_gi_errors.py to use of the lib 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 1208960650 -19800
# Node ID 3bf33b37a58657888f404b87a1504b0453b7761c
# Parent 91d726c978e3fcc360774c34293a67166bc3b9e6
[TEST]updating 01_enum.py, 02_rp_gi_errors.py to use of the lib fn conf_file(), cleanup_restore() and create_diskpool_file()
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 91d726c978e3 -r 3bf33b37a586 suites/libvirt-cim/cimtest/ResourcePool/01_enum.py
--- a/suites/libvirt-cim/cimtest/ResourcePool/01_enum.py Wed Apr 23 19:52:12 2008 +0530
+++ b/suites/libvirt-cim/cimtest/ResourcePool/01_enum.py Wed Apr 23 19:54:10 2008 +0530
@@ -36,63 +36,24 @@ from VirtLib.live import net_list
from VirtLib.live import net_list
from XenKvmLib.vsms import RASD_TYPE_PROC, RASD_TYPE_MEM, RASD_TYPE_NET_ETHER, \
RASD_TYPE_DISK
-
+from XenKvmLib.common_util import cleanup_restore, test_dpath, \
+create_diskpool_file
sup_types = ['Xen', 'KVM']
-test_dpath = "foo"
-disk_file = '/tmp/diskpool.conf'
-back_disk_file = disk_file + "." + "resourcepool_enum"
diskid = "%s/%s" % ("DiskPool", test_dpath)
dp_cn = 'DiskPool'
mp_cn = 'MemoryPool'
pp_cn = 'ProcessorPool'
np_cn = 'NetworkPool'
-def conf_file():
- """
- Creating diskpool.conf file.
- """
- status = PASS
- try:
- f = open(disk_file, 'w')
- f.write('%s %s' % (test_dpath, '/'))
- f.close()
- except Exception,detail:
- logger.error("Exception: %s", detail)
- status = SKIP
- if status != PASS:
- logger.error("Creation of Disk Conf file Failed")
- return status
-
-
-def clean_up_restore():
- """
- Restoring back the original diskpool.conf
- file.
- """
- status = PASS
- try:
- if os.path.exists(back_disk_file):
- os.remove(disk_file)
- move_file(back_disk_file, disk_file)
- except Exception, detail:
- logger.error("Exception: %s", detail)
- return SKIP
- if status != PASS:
- logger.error("Failed to Disk Conf file")
- return status
-
def init_list(server, virt):
- status = PASS
- os.system("rm -f %s" % back_disk_file )
- if not (os.path.exists(disk_file)):
- status = conf_file()
- else:
- move_file(disk_file, back_disk_file)
- status = conf_file()
+ # Verify DiskPool on machine
+ status = create_diskpool_file()
if status != PASS:
return status, None
+
+ # Verify the Virtual network on machine
vir_network = net_list(server, virt)
if len(vir_network) > 0:
test_network = vir_network[0]
@@ -105,6 +66,7 @@ def init_list(server, virt):
logger.error("Failed to create the Virtual Network '%s'", \
test_network)
return SKIP, None
+
disk_instid = '%s/%s' % (dp_cn, test_dpath)
net_instid = '%s/%s' % (np_cn, test_network)
mem_instid = '%s/0' % mp_cn
@@ -144,7 +106,6 @@ def main():
def main():
ip = main.options.ip
virt = main.options.virt
-
status, pool_list = init_list(ip, virt)
if status != PASS:
logger.error("Failed to initialise the list")
@@ -180,7 +141,7 @@ def main():
return FAIL
status = verify_fields(pool_list, netpool, get_typed_class(virt, np_cn))
- status = clean_up_restore()
+ cleanup_restore()
return status
if __name__ == "__main__":
diff -r 91d726c978e3 -r 3bf33b37a586 suites/libvirt-cim/cimtest/ResourcePool/02_rp_gi_errors.py
--- a/suites/libvirt-cim/cimtest/ResourcePool/02_rp_gi_errors.py Wed Apr 23 19:52:12 2008 +0530
+++ b/suites/libvirt-cim/cimtest/ResourcePool/02_rp_gi_errors.py Wed Apr 23 19:54:10 2008 +0530
@@ -37,6 +37,8 @@ from CimTest.ReturnCodes import PASS, SK
from CimTest.ReturnCodes import PASS, SKIP
from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS
from CimTest.Globals import do_main
+from XenKvmLib.common_util import cleanup_restore, test_dpath, \
+create_diskpool_file
sup_types = ['Xen', 'KVM']
@@ -47,39 +49,7 @@ expr_values = {
'desc' : 'No such instance (Invalid_Keyvalue)'}
}
-test_dpath = "foo"
-disk_file = '/tmp/diskpool.conf'
-back_disk_file = disk_file + "." + "02_rp_gi_errors"
-
-def conf_file():
- """
- Creating diskpool.conf file.
- """
- try:
- f = open(disk_file, 'w')
- f.write('%s %s' % (test_dpath, '/'))
- f.close()
- except Exception,detail:
- logger.error("Exception: %s", detail)
- status = SKIP
- sys.exit(status)
-
-def clean_up_restore():
- """
- 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:
- logger.error("Exception: %s", detail)
- status = SKIP
- sys.exit(status)
-
-
-def err_invalid_instid_keyname(classname, instid):
+def err_invalid_instid_keyname(conn, classname, instid):
# Input:
# ------
# wbemcli gi '<scheme>://[user:pwd@]<host>:<port>/<namespace:<ClassName>.
@@ -97,7 +67,7 @@ def err_invalid_instid_keyname(classname
bug_no="")
-def err_invalid_instid_keyvalue(classname):
+def err_invalid_instid_keyvalue(conn, classname):
# Input:
# ------
# wbemcli gi '<scheme>://[user:pwd@]<host>:<port>/<namespace:<ClassName>.
@@ -119,21 +89,15 @@ def main():
def main():
ip = main.options.ip
virt = main.options.virt
- status = PASS
+ conn = assoc.myWBEMConnection('http://%s' % ip, (CIM_USER, CIM_PASS),
+ CIM_NS)
- global conn
- conn = assoc.myWBEMConnection('http://%s' % ip, (CIM_USER, CIM_PASS),
- CIM_NS)
+ # Verify DiskPool on machine
+ status = create_diskpool_file()
+ if status != PASS:
+ return status
-
- # Taking care of already existing diskconf file
- # Creating diskpool.conf if it does not exist
- # Otherwise backing up the prev file and create new one.
- os.system("rm -f %s" % back_disk_file )
- if (os.path.exists(disk_file)):
- move_file(disk_file, back_disk_file)
- conf_file()
-
+ # Verify the Virtual Network on the machine.
vir_network = net_list(ip, virt)
if len(vir_network) > 0:
test_network = vir_network[0]
@@ -144,8 +108,8 @@ def main():
ret = netxml.create_vnet()
if not ret:
logger.error("Failed to create the Virtual Network '%s'",
- test_network)
- clean_up_restore()
+ test_network)
+ cleanup_restore()
return SKIP
netid = "%s/%s" % ("NetworkPool", test_network)
@@ -157,18 +121,20 @@ def main():
}
for cn, instid in cn_instid_list.items():
- ret_value = err_invalid_instid_keyname(cn, instid)
+ ret_value = err_invalid_instid_keyname(conn, cn, instid)
if ret_value != PASS:
logger.error("------ FAILED: Invalid InstanceID Key Name.------")
- status = ret_value
+ cleanup_restore()
+ return ret_value
- ret_value = err_invalid_instid_keyvalue(cn)
+ ret_value = err_invalid_instid_keyvalue(conn, cn)
if ret_value != PASS:
logger.error("------ FAILED: Invalid InstanceID Key Value.------")
- status = ret_value
+ cleanup_restore()
+ return ret_value
- clean_up_restore()
- return status
+ cleanup_restore()
+ return PASS
if __name__ == "__main__":
sys.exit(main())
16 years, 6 months