[PATCH] [TEST] #3 Add -d to duplicate error output to stderr
by zli@linux.vnet.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1208313255 -28800
# Node ID e252990b0c7e4fe0cfdb3e43c035f56d52548dbe
# Parent 137e5079c73fcbfc70e6654cee0b3c3eb3c6acd2
[TEST] #3 Add -d to duplicate error output to stderr
This gives us the capability to output the error messages to screen.
.#3:
- Fix the bug that ignore bugs if no -d is specified.
.#2:
- Added a temp work around to avoid duplicated logging to file.
- Update some indent (8 spaces -> 4 spaces, line cut, commenting)
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r 137e5079c73f -r e252990b0c7e lib/CimTest/Globals.py
--- a/lib/CimTest/Globals.py Fri Apr 11 16:58:23 2008 +0530
+++ b/lib/CimTest/Globals.py Wed Apr 16 10:34:15 2008 +0800
@@ -68,6 +68,8 @@ parser.add_option("-v", "--virt", dest="
parser.add_option("-v", "--virt", dest="virt", type="choice",
choices=platform_sup, default="Xen",
help="Virt type, select from: 'Xen' & 'KVM' & 'XenFV', default: Xen")
+parser.add_option("-d", "--debug-output", action="store_true", dest="debug",
+ help="Duplicate the output to stderr")
if not CIM_NS:
CIM_NS = "root/cimv2"
@@ -85,29 +87,42 @@ if not CIM_IP:
if not CIM_IP:
CIM_IP = "localhost"
-def log_param():
+def log_param(debug=None):
+ #FIXME debug=None is a temporary work around to avoid duplicate
+ # logging in vsmtest.log because we have log_param in both the
+ # do_main decorator and the test case's main function.
+ # We can safely delete the if branch here after all test cases
+ # have removed the log_param invoke.
+ if debug == None:
+ return
+ else:
logger.setLevel(logging.DEBUG)
-#create console handler and set level to debug
+ #create console handler and set level to debug
ch = logging.StreamHandler()
- ch.setLevel(int(CIM_LEVEL))
-#create file handler and set level to debug
+ if debug:
+ ch.setLevel(logging.ERROR)
+ else:
+ ch.setLevel(int(CIM_LEVEL))
+ #create file handler and set level to debug
fh = logging.FileHandler("vsmtest.log")
fh.setLevel(logging.DEBUG)
-#create formatter
- formatter = logging.Formatter("%(asctime)s:%(name)s:%(levelname)s \
-\t- %(message)s", datefmt="%a, %d %b %Y %H:%M:%S")
-#add formatter to handlers
+ #create formatter
+ formatter = logging.Formatter(\
+ "%(asctime)s:%(name)s:%(levelname)s \t- %(message)s",
+ datefmt="%a, %d %b %Y %H:%M:%S")
+ #add formatter to handlers
fh.setFormatter(formatter)
+ formatter = logging.Formatter("%(levelname)s \t- %(message)s")
ch.setFormatter(formatter)
-#add handlers to logger
+ #add handlers to logger
logger.addHandler(fh)
logger.addHandler(ch)
-#Print header
+ #Print header
logger.info("====%s Log====", CIM_TC)
def log_bug(bug_num):
- logger.info("Known Bug:%s" % bug_num)
- print "Bug:<%s>" % bug_num
+ logger.info("Known Bug:%s" % bug_num)
+ print "Bug:<%s>" % bug_num
def do_main(types=['Xen'], p=parser):
def do_type(f):
@@ -119,6 +134,7 @@ def do_main(types=['Xen'], p=parser):
else:
def do_try():
try:
+ log_param(options.debug==True)
from VirtLib.utils import setup_ssh_key
from XenKvmLib.test_doms import destroy_and_undefine_all
setup_ssh_key()
diff -r 137e5079c73f -r e252990b0c7e suites/libvirt-cim/main.py
--- a/suites/libvirt-cim/main.py Fri Apr 11 16:58:23 2008 +0530
+++ b/suites/libvirt-cim/main.py Wed Apr 16 10:34:15 2008 +0800
@@ -49,6 +49,8 @@ parser.add_option("-v", "--virt", dest="
parser.add_option("-v", "--virt", dest="virt", type="choice",
choices=platform_sup, default="Xen",
help="Virt type, select from 'Xen' & 'KVM' & 'XenFV'(default: Xen). ")
+parser.add_option("-d", "--debug-output", action="store_true", dest="debug",
+ help="Duplicate the output to stderr")
TEST_SUITE = 'cimtest'
@@ -110,14 +112,19 @@ def main():
if options.clean:
remove_old_logs(options.group)
+ if options.debug:
+ dbg = "-d"
+ else:
+ dbg = ""
+
print "Testing " + options.virt + " hypervisor"
for test in test_list:
t_path = os.path.join(TEST_SUITE, test['group'])
os.environ['CIM_TC'] = test['test']
- cmd = "cd %s && python %s -i %s -v %s" % \
- (t_path, test['test'], options.ip, options.virt)
+ cmd = "cd %s && python %s -i %s -v %s %s" % \
+ (t_path, test['test'], options.ip, options.virt, dbg)
status, output = commands.getstatusoutput(cmd)
os_status = os.WEXITSTATUS(status)
16 years, 8 months
[PATCH] Make the new default_device_pool() function tolerate the absence of a pool
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1208357956 25200
# Node ID 19860c6372c818cc8fa44f2d4ca12424e16ab3ac
# Parent 40f221d14476a2817a1e80a34b5c56189500db6c
Make the new default_device_pool() function tolerate the absence of a pool
and set a status message if that situation exists.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 40f221d14476 -r 19860c6372c8 src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c Tue Apr 15 14:33:50 2008 -0400
+++ b/src/Virt_DevicePool.c Wed Apr 16 07:59:16 2008 -0700
@@ -1017,11 +1017,11 @@ CMPIInstance *default_device_pool(const
*s = get_pool_by_name(broker, reference, "ProcessorPool/0", &inst);
} else if (type == CIM_RES_TYPE_DISK) {
*s = enum_pools(broker, reference, type, &list);
- if (s->rc == CMPI_RC_OK)
+ if ((s->rc == CMPI_RC_OK) && (list.cur > 0))
inst = list.list[0];
} else if (type == CIM_RES_TYPE_NET) {
*s = enum_pools(broker, reference, type, &list);
- if (s->rc == CMPI_RC_OK)
+ if ((s->rc == CMPI_RC_OK) && (list.cur > 0))
inst = list.list[0];
} else {
cu_statusf(broker, s,
@@ -1030,6 +1030,12 @@ CMPIInstance *default_device_pool(const
}
inst_list_free(&list);
+
+ if (inst == NULL) {
+ cu_statusf(broker, s,
+ CMPI_RC_ERR_FAILED,
+ "No default pool found for type %hi", type);
+ }
return inst;
}
16 years, 8 months
[PATCH] [TEST] #2 Add -d to duplicate error output to stderr
by zli@linux.vnet.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1208226308 -28800
# Node ID a22ea10d1e46adfcd2e878328c1746b5c618230b
# Parent 137e5079c73fcbfc70e6654cee0b3c3eb3c6acd2
[TEST] #2 Add -d to duplicate error output to stderr
This gives us the capability to output the error messages to screen.
.#2:
- Added a temp work around to avoid duplicated logging to file.
- Update some indent (8 spaces -> 4 spaces, line cut, commenting)
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r 137e5079c73f -r a22ea10d1e46 lib/CimTest/Globals.py
--- a/lib/CimTest/Globals.py Fri Apr 11 16:58:23 2008 +0530
+++ b/lib/CimTest/Globals.py Tue Apr 15 10:25:08 2008 +0800
@@ -68,6 +68,8 @@ parser.add_option("-v", "--virt", dest="
parser.add_option("-v", "--virt", dest="virt", type="choice",
choices=platform_sup, default="Xen",
help="Virt type, select from: 'Xen' & 'KVM' & 'XenFV', default: Xen")
+parser.add_option("-d", "--debug-output", action="store_true", dest="debug",
+ help="Duplicate the output to stderr")
if not CIM_NS:
CIM_NS = "root/cimv2"
@@ -85,29 +87,42 @@ if not CIM_IP:
if not CIM_IP:
CIM_IP = "localhost"
-def log_param():
+def log_param(debug=None):
+ #FIXME debug=None is a temporary work around to avoid duplicate
+ # logging in vsmtest.log because we have log_param in both the
+ # do_main decorator and the test case's main function.
+ # We can safely delete the if branch here after all test cases
+ # have removed the log_param invoke.
+ if debug == None:
+ return
+ else:
logger.setLevel(logging.DEBUG)
-#create console handler and set level to debug
+ #create console handler and set level to debug
ch = logging.StreamHandler()
- ch.setLevel(int(CIM_LEVEL))
-#create file handler and set level to debug
+ if debug:
+ ch.setLevel(logging.ERROR)
+ else:
+ ch.setLevel(int(CIM_LEVEL))
+ #create file handler and set level to debug
fh = logging.FileHandler("vsmtest.log")
fh.setLevel(logging.DEBUG)
-#create formatter
- formatter = logging.Formatter("%(asctime)s:%(name)s:%(levelname)s \
-\t- %(message)s", datefmt="%a, %d %b %Y %H:%M:%S")
-#add formatter to handlers
+ #create formatter
+ formatter = logging.Formatter(\
+ "%(asctime)s:%(name)s:%(levelname)s \t- %(message)s",
+ datefmt="%a, %d %b %Y %H:%M:%S")
+ #add formatter to handlers
fh.setFormatter(formatter)
+ formatter = logging.Formatter("%(levelname)s \t- %(message)s")
ch.setFormatter(formatter)
-#add handlers to logger
+ #add handlers to logger
logger.addHandler(fh)
logger.addHandler(ch)
-#Print header
+ #Print header
logger.info("====%s Log====", CIM_TC)
def log_bug(bug_num):
- logger.info("Known Bug:%s" % bug_num)
- print "Bug:<%s>" % bug_num
+ logger.info("Known Bug:%s" % bug_num)
+ print "Bug:<%s>" % bug_num
def do_main(types=['Xen'], p=parser):
def do_type(f):
@@ -119,6 +134,7 @@ def do_main(types=['Xen'], p=parser):
else:
def do_try():
try:
+ log_param(options.debug)
from VirtLib.utils import setup_ssh_key
from XenKvmLib.test_doms import destroy_and_undefine_all
setup_ssh_key()
diff -r 137e5079c73f -r a22ea10d1e46 suites/libvirt-cim/main.py
--- a/suites/libvirt-cim/main.py Fri Apr 11 16:58:23 2008 +0530
+++ b/suites/libvirt-cim/main.py Tue Apr 15 10:25:08 2008 +0800
@@ -49,6 +49,8 @@ parser.add_option("-v", "--virt", dest="
parser.add_option("-v", "--virt", dest="virt", type="choice",
choices=platform_sup, default="Xen",
help="Virt type, select from 'Xen' & 'KVM' & 'XenFV'(default: Xen). ")
+parser.add_option("-d", "--debug-output", action="store_true", dest="debug",
+ help="Duplicate the output to stderr")
TEST_SUITE = 'cimtest'
@@ -110,14 +112,19 @@ def main():
if options.clean:
remove_old_logs(options.group)
+ if options.debug:
+ dbg = "-d"
+ else:
+ dbg = ""
+
print "Testing " + options.virt + " hypervisor"
for test in test_list:
t_path = os.path.join(TEST_SUITE, test['group'])
os.environ['CIM_TC'] = test['test']
- cmd = "cd %s && python %s -i %s -v %s" % \
- (t_path, test['test'], options.ip, options.virt)
+ cmd = "cd %s && python %s -i %s -v %s %s" % \
+ (t_path, test['test'], options.ip, options.virt, dbg)
status, output = commands.getstatusoutput(cmd)
os_status = os.WEXITSTATUS(status)
16 years, 8 months
[PATCH] [TEST] update processor id in Processor01~03
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1208140185 25200
# Node ID fa24152bf20383e0ae5104fa3e81687aab8c1c91
# Parent 137e5079c73fcbfc70e6654cee0b3c3eb3c6acd2
[TEST] update processor id in Processor01~03
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 137e5079c73f -r fa24152bf203 suites/libvirt-cim/cimtest/Processor/01_processor.py
--- a/suites/libvirt-cim/cimtest/Processor/01_processor.py Fri Apr 11 16:58:23 2008 +0530
+++ b/suites/libvirt-cim/cimtest/Processor/01_processor.py Sun Apr 13 19:29:45 2008 -0700
@@ -32,6 +32,7 @@ from XenKvmLib.vxml import XenXML, KVMXM
from XenKvmLib.vxml import XenXML, KVMXML, get_class
from CimTest.Globals import log_param, logger
from CimTest.Globals import do_main
+from CimTest.ReturnCodes import PASS, FAIL
SUPPORTED_TYPES = ['Xen', 'KVM', 'XenFV']
@@ -42,7 +43,7 @@ def main():
def main():
options = main.options
log_param()
- status = 0
+ status = PASS
vsxml = get_class(options.virt)(test_dom, vcpus=test_vcpus)
vsxml.define(options.ip)
vsxml.start(options.ip)
@@ -50,22 +51,26 @@ def main():
# Processor instance enumerate need the domain to be active
domlist = live.active_domain_list(options.ip, options.virt)
if test_dom not in domlist:
- status = 1
+ status = FAIL
logger.error("Domain not started, we're not able to check vcpu")
else:
- for i in range(0, test_vcpus):
- devid = "%s/%s" % (test_dom, i)
- key_list = { 'DeviceID' : devid,
- 'CreationClassName' : get_typed_class(options.virt, "Processor"),
- 'SystemName' : test_dom,
- 'SystemCreationClassName' : get_typed_class(options.virt, "ComputerSystem")
- }
- try:
- dev = eval(('devices.' + get_typed_class(options.virt, 'Processor')))(options.ip, key_list)
+ devid = "%s/%s" % (test_dom, "proc")
+ key_list = { 'DeviceID' : devid,
+ 'CreationClassName' : get_typed_class(options.virt, "Processor"),
+ 'SystemName' : test_dom,
+ 'SystemCreationClassName' : get_typed_class(options.virt, "ComputerSystem")
+ }
+ try:
+ dev = eval(('devices.' + get_typed_class(options.virt, 'Processor')))(options.ip, key_list)
+ if dev.DeviceID == devid:
logger.info("Checked device %s" % devid)
- except Exception, details:
- logger.error("Error check device %s: %s" % (devid, details))
- status = 1
+ else:
+ logger.error("Mismatching device, returned %s instead %s" %
+ (dev.DeviceID, devid))
+ status = FAIL
+ except Exception, details:
+ logger.error("Error check device %s: %s" % (devid, details))
+ status = FAIL
vsxml.stop(options.ip)
vsxml.undefine(options.ip)
diff -r 137e5079c73f -r fa24152bf203 suites/libvirt-cim/cimtest/Processor/02_definesys_get_procs.py
--- a/suites/libvirt-cim/cimtest/Processor/02_definesys_get_procs.py Fri Apr 11 16:58:23 2008 +0530
+++ b/suites/libvirt-cim/cimtest/Processor/02_definesys_get_procs.py Sun Apr 13 19:29:45 2008 -0700
@@ -39,6 +39,7 @@ from XenKvmLib.common_util import create
from XenKvmLib.common_util import create_using_definesystem
from XenKvmLib.devices import get_dom_proc_insts
from CimTest.Globals import log_param, logger, do_main
+from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'KVM', 'XenFV']
@@ -49,28 +50,28 @@ def check_processors(procs):
if len(procs) != test_vcpus:
logger.error("%d vcpu instances were returned. %d expected",
len(procs), test_vcpus)
- return 1
+ return FAIL
for proc in procs:
if proc['SystemName'] != default_dom:
logger.error("Inst returned is for guesst %s, expected guest %s.",
procs['SystemName'], default_dom)
- return 1
+ return FAIL
- devid = "%s/%s" % (default_dom, test_vcpus - 1)
+ devid = "%s/%s" % (default_dom, "proc")
if proc['DeviceID'] != devid:
logger.error("DeviceID %s does not match expected %s.",
procs['DeviceID'], devid)
- return 1
+ return FAIL
- return 0
+ return PASS
@do_main(sup_types)
def main():
options = main.options
log_param()
- status = 0
+ status = PASS
undefine_test_domain(default_dom, options.ip)
@@ -94,7 +95,7 @@ def main():
except Exception, detail:
logger.error("Exception: %s" % detail)
- status = 1
+ status = FAIL
finally:
undefine_test_domain(default_dom, options.ip)
diff -r 137e5079c73f -r fa24152bf203 suites/libvirt-cim/cimtest/Processor/03_proc_gi_errs.py
--- a/suites/libvirt-cim/cimtest/Processor/03_proc_gi_errs.py Fri Apr 11 16:58:23 2008 +0530
+++ b/suites/libvirt-cim/cimtest/Processor/03_proc_gi_errs.py Sun Apr 13 19:29:45 2008 -0700
@@ -174,7 +174,7 @@ def main():
options = main.options
log_param()
- devid = "%s/%s" % (test_dom, "0")
+ devid = "%s/%s" % (test_dom, "proc")
status = PASS
# Getting the VS list and deleting the test_dom if it already exists.
16 years, 8 months
[PATCH] [TEST].2# add more verification and update status description in Processor tc
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1208311225 25200
# Node ID e4907400a5165206046e4d4733d905c067772bf2
# Parent b9ce0dcc277e51d5865b611ebd092874e856bbe2
[TEST].2# add more verification and update status description in Processor tc
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r b9ce0dcc277e -r e4907400a516 suites/libvirt-cim/cimtest/Processor/01_processor.py
--- a/suites/libvirt-cim/cimtest/Processor/01_processor.py Mon Apr 14 01:16:57 2008 -0700
+++ b/suites/libvirt-cim/cimtest/Processor/01_processor.py Tue Apr 15 19:00:25 2008 -0700
@@ -32,6 +32,7 @@ from XenKvmLib.vxml import XenXML, KVMXM
from XenKvmLib.vxml import XenXML, KVMXML, get_class
from CimTest.Globals import log_param, logger
from CimTest.Globals import do_main
+from CimTest.ReturnCodes import PASS, FAIL
SUPPORTED_TYPES = ['Xen', 'KVM', 'XenFV']
@@ -42,7 +43,7 @@ def main():
def main():
options = main.options
log_param()
- status = 0
+ status = PASS
vsxml = get_class(options.virt)(test_dom, vcpus=test_vcpus)
vsxml.define(options.ip)
vsxml.start(options.ip)
@@ -50,7 +51,7 @@ def main():
# Processor instance enumerate need the domain to be active
domlist = live.active_domain_list(options.ip, options.virt)
if test_dom not in domlist:
- status = 1
+ status = FAIL
logger.error("Domain not started, we're not able to check vcpu")
else:
for i in range(0, test_vcpus):
@@ -62,7 +63,10 @@ def main():
}
try:
dev = eval(('devices.' + get_typed_class(options.virt, 'Processor')))(options.ip, key_list)
- logger.info("Checked device %s" % devid)
+ if dev.DeviceID == devid:
+ logger.info("Checked device %s" % devid)
+ else:
+ logger.error("Mismatching device, returned %s instead %s" % (dev.DeviceID, devid))
except Exception, details:
logger.error("Error check device %s: %s" % (devid, details))
status = 1
diff -r b9ce0dcc277e -r e4907400a516 suites/libvirt-cim/cimtest/Processor/02_definesys_get_procs.py
--- a/suites/libvirt-cim/cimtest/Processor/02_definesys_get_procs.py Mon Apr 14 01:16:57 2008 -0700
+++ b/suites/libvirt-cim/cimtest/Processor/02_definesys_get_procs.py Tue Apr 15 19:00:25 2008 -0700
@@ -39,6 +39,7 @@ from XenKvmLib.common_util import create
from XenKvmLib.common_util import create_using_definesystem
from XenKvmLib.devices import get_dom_proc_insts
from CimTest.Globals import log_param, logger, do_main
+from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'KVM', 'XenFV']
@@ -49,28 +50,28 @@ def check_processors(procs):
if len(procs) != test_vcpus:
logger.error("%d vcpu instances were returned. %d expected",
len(procs), test_vcpus)
- return 1
+ return FAIL
for proc in procs:
if proc['SystemName'] != default_dom:
logger.error("Inst returned is for guesst %s, expected guest %s.",
procs['SystemName'], default_dom)
- return 1
+ return FAIL
devid = "%s/%s" % (default_dom, test_vcpus - 1)
if proc['DeviceID'] != devid:
logger.error("DeviceID %s does not match expected %s.",
procs['DeviceID'], devid)
- return 1
+ return FAIL
- return 0
+ return PASS
@do_main(sup_types)
def main():
options = main.options
log_param()
- status = 0
+ status = PASS
undefine_test_domain(default_dom, options.ip)
@@ -94,7 +95,7 @@ def main():
except Exception, detail:
logger.error("Exception: %s" % detail)
- status = 1
+ status = FAIL
finally:
undefine_test_domain(default_dom, options.ip)
16 years, 8 months
[PATCH] [TEST] update processor id in ElementAllocatedFromPool.04
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1207880122 25200
# Node ID 9682464811b73b7cb48dfb0a6c6f3e984da78d6a
# Parent 19ff9c851ed8cb76b74d158a4c439dfa5f4ccb50
[TEST] update processor id in ElementAllocatedFromPool.04
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 19ff9c851ed8 -r 9682464811b7 suites/libvirt-cim/cimtest/ElementAllocatedFromPool/04_forward_errs.py
--- a/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/04_forward_errs.py Wed Apr 09 18:00:14 2008 +0530
+++ b/suites/libvirt-cim/cimtest/ElementAllocatedFromPool/04_forward_errs.py Thu Apr 10 19:15:22 2008 -0700
@@ -99,7 +99,7 @@ def try_assoc(conn, exp_ret, dev_dom_nam
diskid = "%s/%s" % (dev_dom_name, test_disk)
memid = "%s/mem" % dev_dom_name
netid = "%s/%s" % (dev_dom_name, test_mac)
- procid = "%s/%s" % (dev_dom_name, 0)
+ procid = "%s/proc" % dev_dom_name
lelist = {
get_typed_class(virt, "LogicalDisk") : diskid, \
16 years, 8 months
[PATCH] [TEST] fix the tc 05_destroysystem_neg.py failure
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1208141230 25200
# Node ID 167489e6f009e6208c119baca9a64efee7881475
# Parent 137e5079c73fcbfc70e6654cee0b3c3eb3c6acd2
[TEST] fix the tc 05_destroysystem_neg.py failure
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 137e5079c73f -r 167489e6f009 suites/libvirt-cim/cimtest/VirtualSystemManagementService/05_destroysystem_neg.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/05_destroysystem_neg.py Fri Apr 11 16:58:23 2008 +0530
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/05_destroysystem_neg.py Sun Apr 13 19:47:10 2008 -0700
@@ -44,7 +44,7 @@ def destroysystem_fail(tc, options):
cs_ref = CIMInstanceName(classname,
keybindings = {'CreationClassName':classname})
elif tc == 'nonexistent':
- exp_rc = 4 #IM_RC_SYS_NOT_FOUND
+ exp_rc = 2 #IM_RC_FAILED
cs_ref = CIMInstanceName(classname,keybindings = {
'Name':'##@@!!cimtest_domain',
'CreationClassName':classname})
16 years, 8 months
[PATCH] Make sure to create a default emulator device for XenFV domains
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1208274284 25200
# Node ID 2651b1fdeefc1e12108cd1634075da0bc506cd16
# Parent 01b0a24fc16f9daff19f3733552f223ddf6d7a18
Make sure to create a default emulator device for XenFV domains
This adds the emulator device in once we go to create the actual domain
object (and thus determine if the type necessitates an <emulator>.
This should fix definesystem on XenFV, although some other things
surrounding the NetRASD stuff in progress now may prevent regular testing
of it.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 01b0a24fc16f -r 2651b1fdeefc configure.ac
--- a/configure.ac Mon Apr 14 15:17:08 2008 -0700
+++ b/configure.ac Tue Apr 15 08:44:44 2008 -0700
@@ -87,6 +87,13 @@ AC_SUBST(MIG_CHECKS_DIR)
AC_SUBST(MIG_CHECKS_DIR)
AC_DEFINE_UNQUOTED(MIG_CHECKS_DIR, "$MIG_CHECKS_DIR", [External migration check timeout])
+AC_ARG_WITH([xen_emulator],
+ [ --with-xen_emulator=emu Location of Xen FullVirt emulator],
+ [test "x$withval" != "x" && XEN_EMULATOR="$withval"],
+ [XEN_EMULATOR=/usr/lib/xen/bin/qemu-dm])
+AC_SUBST(XEN_EMULATOR)
+AC_DEFINE_UNQUOTED(XEN_EMULATOR, "$XEN_EMULATOR", [Location of Xen FullVirt emulator])
+
# Autogenerate the autoconf header file to store build settings
AC_CONFIG_HEADER([config.h])
diff -r 01b0a24fc16f -r 2651b1fdeefc src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Mon Apr 14 15:17:08 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Tue Apr 15 08:44:44 2008 -0700
@@ -49,6 +49,8 @@
#include "Virt_HostSystem.h"
#include "svpc_types.h"
+#include "config.h"
+
const static CMPIBroker *_BROKER;
enum ResourceAction {
@@ -121,6 +123,25 @@ static int xenpv_vssd_to_domain(CMPIInst
return 1;
}
+static bool fv_default_emulator(struct domain *domain)
+{
+ const char *emul = XEN_EMULATOR;
+
+ cleanup_virt_device(domain->dev_emu);
+
+ domain->dev_emu = calloc(1, sizeof(*domain->dev_emu));
+ if (domain->dev_emu == NULL) {
+ CU_DEBUG("Failed to allocate default emulator device");
+ return 0;
+ }
+
+ domain->dev_emu->type = CIM_RES_TYPE_EMU;
+ domain->dev_emu->dev.emu.path = strdup(emul);
+ domain->dev_emu->id = strdup("emulator");
+
+ return 1;
+}
+
static int fv_vssd_to_domain(CMPIInstance *inst,
struct domain *domain,
const char *pfx)
@@ -128,11 +149,13 @@ static int fv_vssd_to_domain(CMPIInstanc
int ret;
const char *val;
- if (STREQC(pfx, "KVM"))
+ if (STREQC(pfx, "KVM")) {
domain->type = DOMAIN_KVM;
- else if (STREQC(pfx, "Xen"))
+ } else if (STREQC(pfx, "Xen")) {
domain->type = DOMAIN_XENFV;
- else {
+ if (!fv_default_emulator(domain))
+ return 0;
+ } else {
CU_DEBUG("Unknown fullvirt domain type: %s", pfx);
return 0;
}
16 years, 8 months