[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Alter logging statements to move the interpolation inside the logging function,



# HG changeset patch
# User emellor@ewan
# Node ID fe4c1d44e8994794fa7377546061a2c37558f79a
# Parent  bb113ea176593824bbec2a344b5781c5737ba2e9
Alter logging statements to move the interpolation inside the logging function,
meaning that it will only occur if the message is to be logged.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r bb113ea17659 -r fe4c1d44e899 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Sun Oct  9 11:16:23 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Sun Oct  9 11:20:12 2005
@@ -254,7 +254,7 @@
             return val
 
 
-    log.debug("parseConfig: config is %s" % str(config))
+    log.debug("parseConfig: config is %s", config)
 
     result = {}
 
@@ -312,7 +312,7 @@
             log.warn("Ignoring malformed and deprecated config option "
                      "restart = %s", restart)
 
-    log.debug("parseConfig: result is %s" % str(result))
+    log.debug("parseConfig: result is %s", result)
     return result
 
 
@@ -526,7 +526,7 @@
 
         except KeyError, exn:
             log.exception(exn)
-            raise VmError('Unspecified domain detail: %s' % str(exn))
+            raise VmError('Unspecified domain detail: %s' % exn)
 
 
     def readVm(self, *args):
@@ -576,7 +576,7 @@
             if self.infoIsSet(k):
                 to_store[k] = str(self.info[k])
 
-        log.debug("Storing VM details: %s" % str(to_store))
+        log.debug("Storing VM details: %s", to_store)
 
         self.writeVm(to_store)
 
@@ -602,7 +602,7 @@
         for v in range(0, self.info['vcpus']):
             to_store["cpu/%d/availability" % v] = availability(v)
 
-        log.debug("Storing domain details: %s" % str(to_store))
+        log.debug("Storing domain details: %s", to_store)
 
         self.writeDom(to_store)
 
@@ -743,7 +743,7 @@
 
     def shutdown(self, reason):
         if not reason in shutdown_reasons.values():
-            raise XendError('invalid reason:' + reason)
+            raise XendError('Invalid reason: %s' % reason)
         self.storeDom("control/shutdown", reason)
         if reason != 'suspend':
             self.storeDom('xend/shutdown_start_time', time.time())
@@ -985,8 +985,8 @@
         """
 
         log.debug('XendDomainInfo.construct: %s %s',
-                  str(self.domid),
-                  str(self.info['ssidref']))
+                  self.domid,
+                  self.info['ssidref'])
 
         self.domid = xc.domain_create(dom = 0, ssidref = self.info['ssidref'])
 
@@ -1003,9 +1003,9 @@
 
     def initDomain(self):
         log.debug('XendDomainInfo.initDomain: %s %s %s',
-                  str(self.domid),
-                  str(self.info['memory_KiB']),
-                  str(self.info['cpu_weight']))
+                  self.domid,
+                  self.info['memory_KiB'],
+                  self.info['cpu_weight'])
 
         if not self.infoIsSet('image'):
             raise VmError('Missing image in configuration')
@@ -1084,14 +1084,14 @@
     def destroy(self):
         """Cleanup VM and destroy domain.  Nothrow guarantee."""
 
-        log.debug("XendDomainInfo.destroy: domid=%s", str(self.domid))
+        log.debug("XendDomainInfo.destroy: domid=%s", self.domid)
 
         self.cleanupVm()
         self.destroyDomain()
 
 
     def destroyDomain(self):
-        log.debug("XendDomainInfo.destroyDomain(%s)", str(self.domid))
+        log.debug("XendDomainInfo.destroyDomain(%s)", self.domid)
 
         try:
             if self.domid is not None:
@@ -1390,18 +1390,18 @@
         dom = 0
         # get max number of vcpus to use for dom0 from config
         target = int(xroot.get_dom0_vcpus())
-        log.debug("number of vcpus to use is %d" % (target))
+        log.debug("number of vcpus to use is %d", target)
    
         # target = 0 means use all processors
         if target > 0:
             # count the number of online vcpus (cpu values in v2c map >= 0)
             vcpu_to_cpu = dom_get(dom)['vcpu_to_cpu']
             vcpus_online = len(filter(lambda x: x >= 0, vcpu_to_cpu))
-            log.debug("found %d vcpus online" % (vcpus_online))
+            log.debug("found %d vcpus online", vcpus_online)
 
             # disable any extra vcpus that are online over the requested target
             for vcpu in range(target, vcpus_online):
-                log.info("enforcement is disabling DOM%d VCPU%d" % (dom, vcpu))
+                log.info("enforcement is disabling DOM%d VCPU%d", dom, vcpu)
                 self.vcpu_hotplug(vcpu, 0)
 
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.