[PATCH] [TEST] #2 Update libraries present to follow the new coding style
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1234415960 28800
# Node ID ca6b0e4648f7441ffb96ab3f767094338572dba0
# Parent 0daae14ce5848711408fdd465fd2c03f20314466
[TEST] #2 Update libraries present to follow the new coding style
Updates from 1 to 2:
Fixed logger info description to avoid extra whitespace
1) Use commas instead of percent signs when passing parameters to logger.error() and logger.info()
2) Split lines to 80-char width limit
Tested for KVM/LXC with current sources
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r 0daae14ce584 -r ca6b0e4648f7 suites/libvirt-cim/lib/XenKvmLib/assoc.py
--- a/suites/libvirt-cim/lib/XenKvmLib/assoc.py Wed Feb 11 21:00:52 2009 -0200
+++ b/suites/libvirt-cim/lib/XenKvmLib/assoc.py Wed Feb 11 21:19:20 2009 -0800
@@ -139,8 +139,8 @@
val = eval('exp_inst.' + key)
if prop_vals[i][1] != val:
- logger.error("%s val mismatch: got %s, expected %s" % (key,
- prop_vals[i][1], val))
+ logger.error("%s val mismatch: got %s, expected %s", key,
+ prop_vals[i][1], val)
return FAIL
return PASS
diff -r 0daae14ce584 -r ca6b0e4648f7 suites/libvirt-cim/lib/XenKvmLib/common_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Wed Feb 11 21:00:52 2009 -0200
+++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Wed Feb 11 21:19:20 2009 -0800
@@ -60,7 +60,7 @@
cs = enumclass.GetInstance(ip, cs_class, keys)
if cs.Name != domain_name:
- logger.error("VS %s is not found" % domain_name)
+ logger.error("VS %s is not found", domain_name)
return (1, cs)
except Exception, detail:
@@ -104,11 +104,11 @@
return PASS
return FAIL
- logger.error('Unexpected rc code %s and description:\n %s' % (rc, desc))
+ logger.error('Unexpected rc code %s and description:\n %s', rc, desc)
return FAIL
except Exception, details:
- logger.error('Error invoke method `DefineSystem\'. %s' % details)
+ logger.error('Error invoke method `DefineSystem\'. %s', details)
return FAIL
if exp_err != None:
@@ -150,7 +150,7 @@
TimeoutPeriod=pywbem.cim_types.CIMDateTime(time))
except Exception, detail:
- logger.error("Exception: %s" % detail)
+ logger.error("Exception: %s", detail)
return FAIL
return PASS
@@ -189,16 +189,16 @@
break
except Exception, detail:
- logger.error("Exception: %s" % detail)
+ logger.error("Exception: %s", detail)
return FAIL, dom_cs
if dom_cs is None or dom_cs.Name != dom:
- logger.error("CS instance not returned for %s." % dom)
+ logger.error("CS instance not returned for %s.", dom)
return FAIL, dom_cs
if dom_cs.EnabledState != exp_state:
- logger.error("EnabledState is %i instead of %i." % (dom_cs.EnabledState,
- exp_state))
+ logger.error("EnabledState is %i instead of %i.", dom_cs.EnabledState,
+ exp_state)
logger.error("Try to increase the timeout and run the test again")
return FAIL, dom_cs
diff -r 0daae14ce584 -r ca6b0e4648f7 suites/libvirt-cim/lib/XenKvmLib/const.py
--- a/suites/libvirt-cim/lib/XenKvmLib/const.py Wed Feb 11 21:00:52 2009 -0200
+++ b/suites/libvirt-cim/lib/XenKvmLib/const.py Wed Feb 11 21:19:20 2009 -0800
@@ -140,8 +140,8 @@
destroy_and_undefine_all(options.ip, options.virt)
rc = f()
except Exception, e:
- logger.error('%s : %s' % (e.__class__.__name__, e))
- logger.error("%s" % traceback.print_exc())
+ logger.error('%s : %s', e.__class__.__name__, e)
+ logger.error("%s", traceback.print_exc())
rc = FAIL
return rc
setattr(do_try, 'options', options)
diff -r 0daae14ce584 -r ca6b0e4648f7 suites/libvirt-cim/lib/XenKvmLib/test_xml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/test_xml.py Wed Feb 11 21:00:52 2009 -0200
+++ b/suites/libvirt-cim/lib/XenKvmLib/test_xml.py Wed Feb 11 21:19:20 2009 -0800
@@ -45,10 +45,11 @@
default_mac = '11:22:33:aa:bb:cc'
-def testxml(test_dom="domU1", mem = 128, vcpus = 1, mac = default_mac, \
- disk_file_path = disk_path, disk = "xvda"):
+def testxml(test_dom="domU1", mem = 128, vcpus = 1, mac = default_mac,
+ disk_file_path = disk_path, disk = "xvda"):
if not (os.path.exists(kernel_path) and os.path.exists(init_path)) :
- logger.error("ERROR: Either the kernel image or the init_path does not exist")
+ logger.error("ERROR: Either the kernel image or the"
+ "init_path does not exist")
sys.exit(SKIP)
test_xml = """
<domain type='xen' id='23'>
@@ -76,19 +77,20 @@
</disk>
</devices>
</domain>
- """ % ( test_dom, set_uuid(), kernel_path, init_path, mem*1024, vcpus, mac, \
- disk_file_path, disk )
+ """ % ( test_dom, set_uuid(), kernel_path, init_path, mem*1024, vcpus,
+ mac, disk_file_path, disk )
return test_xml
-def testxml_bl(test_dom="domU1", mem = 128, vcpus = 1, mac = default_mac, \
- disk_file_path = disk_path, disk = "xvda", server = "", \
+def testxml_bl(test_dom="domU1", mem = 128, vcpus = 1, mac = default_mac,
+ disk_file_path = disk_path, disk = "xvda", server = "",
gtype = 0):
if server == "":
- logger.error("ERROR: Server info cannot be empty \
-specify either localhost or remote machine ip/name " )
+ logger.error("ERROR: Server info cannot be empty"
+ "specify either localhost or remote machine ip/name ")
sys.exit(SKIP)
if not (os.path.exists(kernel_path) and os.path.exists(init_path)) :
- logger.error("ERROR: Either the kernel image or the init_path does not exist")
+ logger.error("ERROR: Either the kernel image or the"
+ "init_path does not exist")
sys.exit(SKIP)
test_xml = """
<domain type='xen' id='23'>
@@ -117,15 +119,16 @@
</disk>
</devices>
</domain>
- """ % ( test_dom, set_uuid(), bootloader(server, gtype), \
+ """ % ( test_dom, set_uuid(), bootloader(server, gtype),
kernel_path, init_path, mem*1024, vcpus, mac, disk_file_path, disk )
return test_xml
-def testxml_bridge(test_dom="domU1", mem = 128, vcpus = 1, \
- mac = default_mac, disk_file_path = disk_path,
- disk = "xvda", server = ""):
+def testxml_bridge(test_dom="domU1", mem = 128, vcpus = 1,
+ mac = default_mac, disk_file_path = disk_path,
+ disk = "xvda", server = ""):
if not (os.path.exists(kernel_path) and os.path.exists(init_path)) :
- logger.error("ERROR: Either the kernel image or the init_path does not exist")
+ logger.error("ERROR: Either the kernel image or the"
+ "init_path does not exist")
sys.exit(SKIP)
vir_network = net_list(server)
if len(vir_network) > 0 :
@@ -140,7 +143,8 @@
net_xml, bridge = netxml(server, bridgename, networkname)
ret = create_vnet(server, net_xml)
if not ret:
- logger.error("Failed to create the Virtual Network '%s'", networkname)
+ logger.error("Failed to create the Virtual Network '%s'",
+ networkname)
sys.exit(SKIP)
test_xml = """
@@ -179,7 +183,8 @@
if bridgename in bridges:
bridge_name = bridgename + str(random.randint(1, 100))
if bridge_name in bridges:
- logger.error("Need to give different bridge name since it alreay exists")
+ logger.error("Need to give different bridge name since"
+ "it alreay exists")
sys.exit(SKIP)
else:
bridge_name = bridgename
diff -r 0daae14ce584 -r ca6b0e4648f7 suites/libvirt-cim/lib/XenKvmLib/vsmigrations.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsmigrations.py Wed Feb 11 21:00:52 2009 -0200
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsmigrations.py Wed Feb 11 21:19:20 2009 -0800
@@ -78,7 +78,7 @@
DestinationHost=ip)
except Exception, details:
logger.error("Error invoke 'CheckVirtualSystemIsMigratableToHost\'.")
- logger.error("%s" % details)
+ logger.error("%s", details)
return FAIL
if rc == None or rc[1]['IsMigratable'] != True:
@@ -142,7 +142,7 @@
status = FAIL
if status != PASS:
- logger.error("%s migrate failed" % test_dom)
+ logger.error("%s migrate failed", test_dom)
return FAIL
return PASS
@@ -155,7 +155,7 @@
for i in range(0, 50):
if job_inst.JobState == 7:
if job_inst.Status != "Completed":
- logger.error("%s migrate failed" % test_dom)
+ logger.error("%s migrate failed", test_dom)
return FAIL
list_after = domain_list(ip)
status = verify_domain_list(list_after, local_migrate, test_dom)
diff -r 0daae14ce584 -r ca6b0e4648f7 suites/libvirt-cim/lib/XenKvmLib/vsms_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py Wed Feb 11 21:00:52 2009 -0200
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py Wed Feb 11 21:19:20 2009 -0800
@@ -28,7 +28,7 @@
get_bridge_from_network_xml
def print_mod_err_msg(func_str, details):
- logger.error('Error invoking ModifyRS: %s' % func_str)
+ logger.error('Error invoking ModifyRS: %s', func_str)
logger.error(details)
def mod_disk_res(server, service, cxml, dasd, ndpath):
@@ -37,7 +37,7 @@
cxml.dumpxml(server)
dpath = cxml.xml_get_disk_source()
if dpath != ndpath:
- logger.error("Got %s, exp %s." % (dpath, ndpath))
+ logger.error("Got %s, exp %s.", dpath, ndpath)
raise Exception('Error changing rs for disk path')
logger.info('good status for disk path')
except Exception, details:
@@ -61,8 +61,8 @@
name = network_by_bridge(br_name, server, virt)
if type != ntype or name != net_name:
- logger.error('Got %s, exp %s. Got %s, exp %s' %
- (type, ntype, name, net_name))
+ logger.error('Got %s, exp %s. Got %s, exp %s',
+ type, ntype, name, net_name)
raise Exception('Error changing rs for net mac')
logger.info('good status for net mac')
except Exception, details:
@@ -77,7 +77,7 @@
cxml.dumpxml(server)
mem = cxml.xml_get_mem()
if int(mem) != int(nmem) * 1024:
- logger.error("Got %d, exp %d." % (int(mem), (int(nmem) * 1024)))
+ logger.error("Got %d, exp %d.", int(mem), (int(nmem) * 1024))
raise Exception('Error changing rs for mem')
logger.info('good status for mem')
except Exception, details:
@@ -96,7 +96,7 @@
logger.info("Unable to get vcpuinfo from virsh, using XML values")
cpu = cxml.xml_get_vcpu()
if int(cpu) != int(ncpu):
- logger.error("Got %d, exp %d." % (int(cpu), int(ncpu)))
+ logger.error("Got %d, exp %d.", int(cpu), int(ncpu))
raise Exception('Error changing rs for vcpu')
logger.info('good status for vcpu')
except Exception, details:
@@ -106,7 +106,7 @@
return PASS
def print_add_err_msg(func_str, details):
- logger.error('Error invoking AddRS: %s' % func_str)
+ logger.error('Error invoking AddRS: %s', func_str)
logger.error(details)
def add_disk_res(server, service, cxml, vssd_ref, dasd, attr):
@@ -119,8 +119,8 @@
dpath = cxml.get_value_xpath(
'/domain/devices/disk/source/@file[. = "%s"]' % attr['src_path'])
if disk_dev != attr['nddev'] or dpath != attr['src_path']:
- logger.error("Got %s, exp %s. Got %s, exp %s" % (disk_dev,
- attr['nddev'], dpath, attr['src_path']))
+ logger.error("Got %s, exp %s. Got %s, exp %s", disk_dev,
+ attr['nddev'], dpath, attr['src_path'])
raise Exception('Error adding rs for disk_dev')
logger.info('good status for disk path')
except Exception, details:
@@ -154,8 +154,8 @@
name = attr['net_name']
if mac != attr['nmac'] or name != attr['net_name']:
- logger.error("Got %s, exp %s. Got %s, exp %s." % (mac,
- attr['nmac'], name, attr['net_name']))
+ logger.error("Got %s, exp %s. Got %s, exp %s.", mac,
+ attr['nmac'], name, attr['net_name'])
raise Exception('Error adding rs for net mac')
logger.info('good status for net_mac')
diff -r 0daae14ce584 -r ca6b0e4648f7 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Feb 11 21:00:52 2009 -0200
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Feb 11 21:19:20 2009 -0800
@@ -525,14 +525,14 @@
ResourceSettings=res_settings,
ReferenceConfiguration=ref_conf)
except pywbem.CIMError, (rc, desc):
- logger.error('Got CIM error %s with return code %s' % (desc, rc))
+ logger.error('Got CIM error %s with return code %s', desc, rc)
self.err_rc = rc
self.err_desc = desc
return False
except Exception, details:
- logger.error('Got error %s with exception %s' \
- % (details, details.__class__.__name__))
+ logger.error('Got error %s with exception %s',
+ details, details.__class__.__name__)
return False
set_uuid(viruuid(self.domain_name, ip, self.virt))
@@ -546,15 +546,15 @@
try:
ret = service.DestroySystem(AffectedSystem=target)
except pywbem.CIMError, (rc, desc):
- logger.error('Got CIM error %s with return code %s' % (desc, rc))
+ logger.error('Got CIM error %s with return code %s', desc, rc)
self.err_rc = rc
self.err_desc = desc
return False
except Exception, details:
logger.error('Error invoking DestroySystem')
- logger.error('Got error %s with exception %s' \
- % (details, details.__class__.__name__))
+ logger.error('Got error %s with exception %s',
+ details, details.__class__.__name__)
return False
return ret[0] == 0
@@ -580,7 +580,7 @@
except Exception, detail:
logger.error("Unable to check guest state")
- logger.error("Exception: %s" % detail)
+ logger.error("Exception: %s", detail)
return FAIL
return PASS
@@ -604,7 +604,7 @@
TimeoutPeriod=time_period)
except pywbem.CIMError, (rc, desc):
- logger.error('Got CIM error %s with return code %s' % (desc, rc))
+ logger.error('Got CIM error %s with return code %s', desc, rc)
self.err_rc = rc
self.err_desc = desc
return FAIL
15 years, 7 months
[PATCH] [TEST] Use commas when passing parameters to logger.info() in Globals.py
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1234417307 28800
# Node ID 9234ee3665774985ff9292f1a64b0ac69bd9e3f4
# Parent 0daae14ce5848711408fdd465fd2c03f20314466
[TEST] Use commas when passing parameters to logger.info() in Globals.py
Tested for KVM/LXC with current sources
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r 0daae14ce584 -r 9234ee366577 lib/CimTest/Globals.py
--- a/lib/CimTest/Globals.py Wed Feb 11 21:00:52 2009 -0200
+++ b/lib/CimTest/Globals.py Wed Feb 11 21:41:47 2009 -0800
@@ -98,6 +98,6 @@
logger.info("====%s Log====", CIM_TC)
def log_bug(bug_num):
- logger.info("Known Bug:%s" % bug_num)
+ logger.info("Known Bug:%s", bug_num)
print "Bug:<%s>" % bug_num
15 years, 7 months
[PATCH] [TEST] Update libraries present to follow the new coding style
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1234339844 28800
# Node ID dd59a8d6a123417a82434ebfa4f6ed54def5256f
# Parent 1bb347c22e6ed03032f359c8c28e59e94b7316c2
[TEST] Update libraries present to follow the new coding style
1) Use commas instead of percent signs when passing parameters to logger.error() and logger.info()
2) Split lines to 80-char width limit
Tested for KVM/LXC with current sources
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r 1bb347c22e6e -r dd59a8d6a123 suites/libvirt-cim/lib/XenKvmLib/assoc.py
--- a/suites/libvirt-cim/lib/XenKvmLib/assoc.py Mon Feb 09 21:47:35 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/assoc.py Wed Feb 11 00:10:44 2009 -0800
@@ -139,8 +139,8 @@
val = eval('exp_inst.' + key)
if prop_vals[i][1] != val:
- logger.error("%s val mismatch: got %s, expected %s" % (key,
- prop_vals[i][1], val))
+ logger.error("%s val mismatch: got %s, expected %s", key,
+ prop_vals[i][1], val)
return FAIL
return PASS
diff -r 1bb347c22e6e -r dd59a8d6a123 suites/libvirt-cim/lib/XenKvmLib/common_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py Mon Feb 09 21:47:35 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py Wed Feb 11 00:10:44 2009 -0800
@@ -60,7 +60,7 @@
cs = enumclass.GetInstance(ip, cs_class, keys)
if cs.Name != domain_name:
- logger.error("VS %s is not found" % domain_name)
+ logger.error("VS %s is not found", domain_name)
return (1, cs)
except Exception, detail:
@@ -104,11 +104,11 @@
return PASS
return FAIL
- logger.error('Unexpected rc code %s and description:\n %s' % (rc, desc))
+ logger.error('Unexpected rc code %s and description:\n %s', rc, desc)
return FAIL
except Exception, details:
- logger.error('Error invoke method `DefineSystem\'. %s' % details)
+ logger.error('Error invoke method `DefineSystem\'. %s', details)
return FAIL
if exp_err != None:
@@ -150,7 +150,7 @@
TimeoutPeriod=pywbem.cim_types.CIMDateTime(time))
except Exception, detail:
- logger.error("Exception: %s" % detail)
+ logger.error("Exception: %s", detail)
return FAIL
return PASS
@@ -189,16 +189,16 @@
break
except Exception, detail:
- logger.error("Exception: %s" % detail)
+ logger.error("Exception: %s", detail)
return FAIL, dom_cs
if dom_cs is None or dom_cs.Name != dom:
- logger.error("CS instance not returned for %s." % dom)
+ logger.error("CS instance not returned for %s.", dom)
return FAIL, dom_cs
if dom_cs.EnabledState != exp_state:
- logger.error("EnabledState is %i instead of %i." % (dom_cs.EnabledState,
- exp_state))
+ logger.error("EnabledState is %i instead of %i.", dom_cs.EnabledState,
+ exp_state)
logger.error("Try to increase the timeout and run the test again")
return FAIL, dom_cs
diff -r 1bb347c22e6e -r dd59a8d6a123 suites/libvirt-cim/lib/XenKvmLib/const.py
--- a/suites/libvirt-cim/lib/XenKvmLib/const.py Mon Feb 09 21:47:35 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/const.py Wed Feb 11 00:10:44 2009 -0800
@@ -140,8 +140,8 @@
destroy_and_undefine_all(options.ip, options.virt)
rc = f()
except Exception, e:
- logger.error('%s : %s' % (e.__class__.__name__, e))
- logger.error("%s" % traceback.print_exc())
+ logger.error('%s : %s', e.__class__.__name__, e)
+ logger.error("%s", traceback.print_exc())
rc = FAIL
return rc
setattr(do_try, 'options', options)
diff -r 1bb347c22e6e -r dd59a8d6a123 suites/libvirt-cim/lib/XenKvmLib/test_xml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/test_xml.py Mon Feb 09 21:47:35 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/test_xml.py Wed Feb 11 00:10:44 2009 -0800
@@ -48,7 +48,8 @@
def testxml(test_dom="domU1", mem = 128, vcpus = 1, mac = default_mac, \
disk_file_path = disk_path, disk = "xvda"):
if not (os.path.exists(kernel_path) and os.path.exists(init_path)) :
- logger.error("ERROR: Either the kernel image or the init_path does not exist")
+ logger.error("ERROR: Either the kernel image or the \
+ init_path does not exist")
sys.exit(SKIP)
test_xml = """
<domain type='xen' id='23'>
@@ -76,8 +77,8 @@
</disk>
</devices>
</domain>
- """ % ( test_dom, set_uuid(), kernel_path, init_path, mem*1024, vcpus, mac, \
- disk_file_path, disk )
+ """ % ( test_dom, set_uuid(), kernel_path, init_path, mem*1024, vcpus, \
+ mac, disk_file_path, disk )
return test_xml
def testxml_bl(test_dom="domU1", mem = 128, vcpus = 1, mac = default_mac, \
@@ -88,7 +89,8 @@
specify either localhost or remote machine ip/name " )
sys.exit(SKIP)
if not (os.path.exists(kernel_path) and os.path.exists(init_path)) :
- logger.error("ERROR: Either the kernel image or the init_path does not exist")
+ logger.error("ERROR: Either the kernel image or the \
+ init_path does not exist")
sys.exit(SKIP)
test_xml = """
<domain type='xen' id='23'>
@@ -125,7 +127,8 @@
mac = default_mac, disk_file_path = disk_path,
disk = "xvda", server = ""):
if not (os.path.exists(kernel_path) and os.path.exists(init_path)) :
- logger.error("ERROR: Either the kernel image or the init_path does not exist")
+ logger.error("ERROR: Either the kernel image or the \
+ init_path does not exist")
sys.exit(SKIP)
vir_network = net_list(server)
if len(vir_network) > 0 :
@@ -140,7 +143,8 @@
net_xml, bridge = netxml(server, bridgename, networkname)
ret = create_vnet(server, net_xml)
if not ret:
- logger.error("Failed to create the Virtual Network '%s'", networkname)
+ logger.error("Failed to create the Virtual Network '%s'",
+ networkname)
sys.exit(SKIP)
test_xml = """
@@ -179,7 +183,8 @@
if bridgename in bridges:
bridge_name = bridgename + str(random.randint(1, 100))
if bridge_name in bridges:
- logger.error("Need to give different bridge name since it alreay exists")
+ logger.error("Need to give different bridge name since \
+ it alreay exists")
sys.exit(SKIP)
else:
bridge_name = bridgename
diff -r 1bb347c22e6e -r dd59a8d6a123 suites/libvirt-cim/lib/XenKvmLib/vsmigrations.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsmigrations.py Mon Feb 09 21:47:35 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsmigrations.py Wed Feb 11 00:10:44 2009 -0800
@@ -78,7 +78,7 @@
DestinationHost=ip)
except Exception, details:
logger.error("Error invoke 'CheckVirtualSystemIsMigratableToHost\'.")
- logger.error("%s" % details)
+ logger.error("%s", details)
return FAIL
if rc == None or rc[1]['IsMigratable'] != True:
@@ -142,7 +142,7 @@
status = FAIL
if status != PASS:
- logger.error("%s migrate failed" % test_dom)
+ logger.error("%s migrate failed", test_dom)
return FAIL
return PASS
@@ -155,7 +155,7 @@
for i in range(0, 50):
if job_inst.JobState == 7:
if job_inst.Status != "Completed":
- logger.error("%s migrate failed" % test_dom)
+ logger.error("%s migrate failed", test_dom)
return FAIL
list_after = domain_list(ip)
status = verify_domain_list(list_after, local_migrate, test_dom)
diff -r 1bb347c22e6e -r dd59a8d6a123 suites/libvirt-cim/lib/XenKvmLib/vsms_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py Mon Feb 09 21:47:35 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms_util.py Wed Feb 11 00:10:44 2009 -0800
@@ -28,7 +28,7 @@
get_bridge_from_network_xml
def print_mod_err_msg(func_str, details):
- logger.error('Error invoking ModifyRS: %s' % func_str)
+ logger.error('Error invoking ModifyRS: %s', func_str)
logger.error(details)
def mod_disk_res(server, service, cxml, dasd, ndpath):
@@ -37,7 +37,7 @@
cxml.dumpxml(server)
dpath = cxml.xml_get_disk_source()
if dpath != ndpath:
- logger.error("Got %s, exp %s." % (dpath, ndpath))
+ logger.error("Got %s, exp %s.", dpath, ndpath)
raise Exception('Error changing rs for disk path')
logger.info('good status for disk path')
except Exception, details:
@@ -61,8 +61,8 @@
name = network_by_bridge(br_name, server, virt)
if type != ntype or name != net_name:
- logger.error('Got %s, exp %s. Got %s, exp %s' %
- (type, ntype, name, net_name))
+ logger.error('Got %s, exp %s. Got %s, exp %s',
+ type, ntype, name, net_name)
raise Exception('Error changing rs for net mac')
logger.info('good status for net mac')
except Exception, details:
@@ -77,7 +77,7 @@
cxml.dumpxml(server)
mem = cxml.xml_get_mem()
if int(mem) != int(nmem) * 1024:
- logger.error("Got %d, exp %d." % (int(mem), (int(nmem) * 1024)))
+ logger.error("Got %d, exp %d.", int(mem), (int(nmem) * 1024))
raise Exception('Error changing rs for mem')
logger.info('good status for mem')
except Exception, details:
@@ -96,7 +96,7 @@
logger.info("Unable to get vcpuinfo from virsh, using XML values")
cpu = cxml.xml_get_vcpu()
if int(cpu) != int(ncpu):
- logger.error("Got %d, exp %d." % (int(cpu), int(ncpu)))
+ logger.error("Got %d, exp %d.", int(cpu), int(ncpu))
raise Exception('Error changing rs for vcpu')
logger.info('good status for vcpu')
except Exception, details:
@@ -106,7 +106,7 @@
return PASS
def print_add_err_msg(func_str, details):
- logger.error('Error invoking AddRS: %s' % func_str)
+ logger.error('Error invoking AddRS: %s', func_str)
logger.error(details)
def add_disk_res(server, service, cxml, vssd_ref, dasd, attr):
@@ -119,8 +119,8 @@
dpath = cxml.get_value_xpath(
'/domain/devices/disk/source/@file[. = "%s"]' % attr['src_path'])
if disk_dev != attr['nddev'] or dpath != attr['src_path']:
- logger.error("Got %s, exp %s. Got %s, exp %s" % (disk_dev,
- attr['nddev'], dpath, attr['src_path']))
+ logger.error("Got %s, exp %s. Got %s, exp %s", disk_dev,
+ attr['nddev'], dpath, attr['src_path'])
raise Exception('Error adding rs for disk_dev')
logger.info('good status for disk path')
except Exception, details:
@@ -154,8 +154,8 @@
name = attr['net_name']
if mac != attr['nmac'] or name != attr['net_name']:
- logger.error("Got %s, exp %s. Got %s, exp %s." % (mac,
- attr['nmac'], name, attr['net_name']))
+ logger.error("Got %s, exp %s. Got %s, exp %s.", mac,
+ attr['nmac'], name, attr['net_name'])
raise Exception('Error adding rs for net mac')
logger.info('good status for net_mac')
diff -r 1bb347c22e6e -r dd59a8d6a123 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon Feb 09 21:47:35 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Feb 11 00:10:44 2009 -0800
@@ -525,14 +525,14 @@
ResourceSettings=res_settings,
ReferenceConfiguration=ref_conf)
except pywbem.CIMError, (rc, desc):
- logger.error('Got CIM error %s with return code %s' % (desc, rc))
+ logger.error('Got CIM error %s with return code %s', desc, rc)
self.err_rc = rc
self.err_desc = desc
return False
except Exception, details:
- logger.error('Got error %s with exception %s' \
- % (details, details.__class__.__name__))
+ logger.error('Got error %s with exception %s',
+ details, details.__class__.__name__)
return False
set_uuid(viruuid(self.domain_name, ip, self.virt))
@@ -546,15 +546,15 @@
try:
ret = service.DestroySystem(AffectedSystem=target)
except pywbem.CIMError, (rc, desc):
- logger.error('Got CIM error %s with return code %s' % (desc, rc))
+ logger.error('Got CIM error %s with return code %s', desc, rc)
self.err_rc = rc
self.err_desc = desc
return False
except Exception, details:
logger.error('Error invoking DestroySystem')
- logger.error('Got error %s with exception %s' \
- % (details, details.__class__.__name__))
+ logger.error('Got error %s with exception %s',
+ details, details.__class__.__name__)
return False
return ret[0] == 0
@@ -580,7 +580,7 @@
except Exception, detail:
logger.error("Unable to check guest state")
- logger.error("Exception: %s" % detail)
+ logger.error("Exception: %s", detail)
return FAIL
return PASS
@@ -604,7 +604,7 @@
TimeoutPeriod=time_period)
except pywbem.CIMError, (rc, desc):
- logger.error('Got CIM error %s with return code %s' % (desc, rc))
+ logger.error('Got CIM error %s with return code %s', desc, rc)
self.err_rc = rc
self.err_desc = desc
return FAIL
15 years, 7 months
[PATCH] [TEST] #4 Fix SettingsDefineCapabilities/01_forward.py with appropriate RASD objects for different platforms
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1234338509 28800
# Node ID d6a47e2263ee7a15a4214c99b86f23fa22813090
# Parent 1bb347c22e6ed03032f359c8c28e59e94b7316c2
[TEST] #4 Fix SettingsDefineCapabilities/01_forward.py with appropriate RASD objects for different platforms
Updates from 3 to 4:
1) align the if statements
2) set exp_len = 4 before the if statements
Updates form 2 to 3:
Simplify the if statement
Updates form 1 to 2:
Add two branches of returned RASD objects number:
1) The valule to be 8 for Xen when rev >= 707 and rev < 805
2) The value to be 16 for Xen when rev >= 805
3) The value to be 8 for KVM when rev >= 805
Tested for KVM/Xen/LXC with current sources, KVM with F9 rpm.
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r 1bb347c22e6e -r d6a47e2263ee suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py
--- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py Mon Feb 09 21:47:35 2009 -0800
+++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py Tue Feb 10 23:48:29 2009 -0800
@@ -67,6 +67,7 @@
platform_sup = ['Xen', 'KVM', 'XenFV', 'LXC']
libvirt_rasd_template_changes = 707
+libvirt_rasd_new_changes = 805
memid = "MemoryPool/0"
procid = "ProcessorPool/0"
@@ -171,14 +172,20 @@
InstanceID = instid)
curr_cim_rev, changeset = get_provider_version(virt, server)
- if 'DiskPool' in instid and (virt =='Xen' or virt == 'XenFV') and \
- curr_cim_rev >= libvirt_rasd_template_changes:
+ exp_len = 4
+ if 'DiskPool' in instid:
# For Diskpool, we have info 1 for each of Min, Max,
# default, Increment and 1 for each of PV and FV
# hence 4 * 2 = 8 records
- exp_len = 8
- else:
- exp_len = 4
+ if virt == 'Xen' or virt == 'XenFV':
+ if curr_cim_rev >= libvirt_rasd_template_changes and \
+ curr_cim_rev < libvirt_rasd_new_changes:
+ exp_len = 8
+ if curr_cim_rev >= libvirt_rasd_new_changes:
+ exp_len = 16
+ if virt == 'KVM':
+ if curr_cim_rev >= libvirt_rasd_new_changes:
+ exp_len = 8
if len(assoc_info) != exp_len:
logger.error("%s returned %i ResourcePool objects instead"
15 years, 7 months
[PATCH] [TEST]#4 Fix HostSystem/03_hs_to_settdefcap.py with appropriate number of RASD objects for different platforms
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1234337820 28800
# Node ID cb915025514d373e89681334db4a4caa3a9f3473
# Parent 1bb347c22e6ed03032f359c8c28e59e94b7316c2
[TEST]#4 Fix HostSystem/03_hs_to_settdefcap.py with appropriate number of RASD objects for different platforms
Updates forms 3 to 4:
1) align the if statements
2) set exp_len = 4 before the if statements
Updates form 2 to 3:
Simplify the if statements
Updates from 1 to 2:
Add two branches of returned RASD objects number:
1) The valule to be 8 for Xen when rev >= 707 and rev < 805
2) The value to be 16 for Xen when rev >= 805
3) The value to be 8 for KVM when rev >= 805
Tested for KVM/Xen/LXC with current sources, KVM with F9 rpm.
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r 1bb347c22e6e -r cb915025514d suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py
--- a/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py Mon Feb 09 21:47:35 2009 -0800
+++ b/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py Tue Feb 10 23:37:00 2009 -0800
@@ -56,6 +56,7 @@
test_dom = "domgst_test"
test_vcpus = 1
libvirt_rasd_template_changes = 707
+libvirt_rasd_new_changes = 805
def setup_env(server, virt="Xen"):
status = PASS
@@ -214,14 +215,20 @@
InstanceID = ap['InstanceID'])
curr_cim_rev, changeset = get_provider_version(virt, server)
- if 'DiskPool' in ap['InstanceID'] and virt =='Xen' and \
- curr_cim_rev >= libvirt_rasd_template_changes:
+ exp_len = 4
+ if 'DiskPool' in ap['InstanceID']:
# For Diskpool, we have info 1 for each of Min, Max,
# default, Increment and 1 for each of PV and FV
# hence 4 * 2 = 8 records
- exp_len = 8
- else:
- exp_len = 4
+ if virt == 'Xen':
+ if curr_cim_rev >= libvirt_rasd_template_changes and \
+ curr_cim_rev < libvirt_read_new_changes:
+ exp_len = 8
+ if curr_cim_rev >= libvirt_read_new_changes:
+ exp_len = 16
+ if virt == 'KVM':
+ if curr_cim_rev >= libvirt_rasd_new_changes:
+ exp_len = 8
if len(assoc_info) != exp_len:
logger.error("'%s' returned %i RASD objects instead of %i",
15 years, 7 months
[PATCH] [TEST] #3 Fix SettingsDefineCapabilities/01_forward.py with appropriate RASD objects for different platforms
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1234256865 28800
# Node ID 0fd388b7d9571ab8c0b96c2190a8b0b91c8a85e1
# Parent 263e285881acde9b99849cd133399298219c9d65
[TEST] #3 Fix SettingsDefineCapabilities/01_forward.py with appropriate RASD objects for different platforms
Updates form 2 to 3:
Simplify the if statement
Updates form 1 to 2:
Add two branches of returned RASD objects number:
1) The valule to be 8 for Xen when rev >= 707 and rev < 805
2) The value to be 16 for Xen when rev >= 805
3) The value to be 8 for KVM when rev >= 805
Tested for KVM/Xen/LXC with current sources, KVM with F9 rpm.
Signed-off-by: Guolian Yun<yunguol(a)cn.ibm.com>
diff -r 263e285881ac -r 0fd388b7d957 suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py
--- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py Fri Feb 06 01:54:39 2009 -0800
+++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py Tue Feb 10 01:07:45 2009 -0800
@@ -67,6 +67,7 @@
platform_sup = ['Xen', 'KVM', 'XenFV', 'LXC']
libvirt_rasd_template_changes = 707
+libvirt_rasd_new_changes = 805
memid = "MemoryPool/0"
procid = "ProcessorPool/0"
@@ -171,12 +172,22 @@
InstanceID = instid)
curr_cim_rev, changeset = get_provider_version(virt, server)
- if 'DiskPool' in instid and (virt =='Xen' or virt == 'XenFV') and \
- curr_cim_rev >= libvirt_rasd_template_changes:
+ if 'DiskPool' in instid:
+ if (virt =='Xen' or virt == 'XenFV') and \
+ curr_cim_rev >= libvirt_rasd_template_changes and \
+ curr_cim_rev < libvirt_rasd_new_changes:
# For Diskpool, we have info 1 for each of Min, Max,
# default, Increment and 1 for each of PV and FV
# hence 4 * 2 = 8 records
- exp_len = 8
+ exp_len = 8
+ elif (virt == 'Xen' or virt == 'XenFV') and \
+ curr_cim_rev >= libvirt_rasd_new_changes:
+ exp_len = 16
+ elif virt == 'KVM' and \
+ curr_cim_rev >= libvirt_rasd_new_changes:
+ exp_len = 8
+ else:
+ exp_len = 4
else:
exp_len = 4
15 years, 7 months