ia64/xen-unstable

changeset 7290:fe4c1d44e899

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@xensource.com>
author emellor@ewan
date Sun Oct 09 12:20:12 2005 +0100 (2005-10-09)
parents bb113ea17659
children 8f7ee9ab31ac 0e7c48861e95
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Sun Oct 09 12:16:23 2005 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Sun Oct 09 12:20:12 2005 +0100
     1.3 @@ -254,7 +254,7 @@ def parseConfig(config):
     1.4              return val
     1.5  
     1.6  
     1.7 -    log.debug("parseConfig: config is %s" % str(config))
     1.8 +    log.debug("parseConfig: config is %s", config)
     1.9  
    1.10      result = {}
    1.11  
    1.12 @@ -312,7 +312,7 @@ def parseConfig(config):
    1.13              log.warn("Ignoring malformed and deprecated config option "
    1.14                       "restart = %s", restart)
    1.15  
    1.16 -    log.debug("parseConfig: result is %s" % str(result))
    1.17 +    log.debug("parseConfig: result is %s", result)
    1.18      return result
    1.19  
    1.20  
    1.21 @@ -526,7 +526,7 @@ class XendDomainInfo:
    1.22  
    1.23          except KeyError, exn:
    1.24              log.exception(exn)
    1.25 -            raise VmError('Unspecified domain detail: %s' % str(exn))
    1.26 +            raise VmError('Unspecified domain detail: %s' % exn)
    1.27  
    1.28  
    1.29      def readVm(self, *args):
    1.30 @@ -576,7 +576,7 @@ class XendDomainInfo:
    1.31              if self.infoIsSet(k):
    1.32                  to_store[k] = str(self.info[k])
    1.33  
    1.34 -        log.debug("Storing VM details: %s" % str(to_store))
    1.35 +        log.debug("Storing VM details: %s", to_store)
    1.36  
    1.37          self.writeVm(to_store)
    1.38  
    1.39 @@ -602,7 +602,7 @@ class XendDomainInfo:
    1.40          for v in range(0, self.info['vcpus']):
    1.41              to_store["cpu/%d/availability" % v] = availability(v)
    1.42  
    1.43 -        log.debug("Storing domain details: %s" % str(to_store))
    1.44 +        log.debug("Storing domain details: %s", to_store)
    1.45  
    1.46          self.writeDom(to_store)
    1.47  
    1.48 @@ -743,7 +743,7 @@ class XendDomainInfo:
    1.49  
    1.50      def shutdown(self, reason):
    1.51          if not reason in shutdown_reasons.values():
    1.52 -            raise XendError('invalid reason:' + reason)
    1.53 +            raise XendError('Invalid reason: %s' % reason)
    1.54          self.storeDom("control/shutdown", reason)
    1.55          if reason != 'suspend':
    1.56              self.storeDom('xend/shutdown_start_time', time.time())
    1.57 @@ -985,8 +985,8 @@ class XendDomainInfo:
    1.58          """
    1.59  
    1.60          log.debug('XendDomainInfo.construct: %s %s',
    1.61 -                  str(self.domid),
    1.62 -                  str(self.info['ssidref']))
    1.63 +                  self.domid,
    1.64 +                  self.info['ssidref'])
    1.65  
    1.66          self.domid = xc.domain_create(dom = 0, ssidref = self.info['ssidref'])
    1.67  
    1.68 @@ -1003,9 +1003,9 @@ class XendDomainInfo:
    1.69  
    1.70      def initDomain(self):
    1.71          log.debug('XendDomainInfo.initDomain: %s %s %s',
    1.72 -                  str(self.domid),
    1.73 -                  str(self.info['memory_KiB']),
    1.74 -                  str(self.info['cpu_weight']))
    1.75 +                  self.domid,
    1.76 +                  self.info['memory_KiB'],
    1.77 +                  self.info['cpu_weight'])
    1.78  
    1.79          if not self.infoIsSet('image'):
    1.80              raise VmError('Missing image in configuration')
    1.81 @@ -1084,14 +1084,14 @@ class XendDomainInfo:
    1.82      def destroy(self):
    1.83          """Cleanup VM and destroy domain.  Nothrow guarantee."""
    1.84  
    1.85 -        log.debug("XendDomainInfo.destroy: domid=%s", str(self.domid))
    1.86 +        log.debug("XendDomainInfo.destroy: domid=%s", self.domid)
    1.87  
    1.88          self.cleanupVm()
    1.89          self.destroyDomain()
    1.90  
    1.91  
    1.92      def destroyDomain(self):
    1.93 -        log.debug("XendDomainInfo.destroyDomain(%s)", str(self.domid))
    1.94 +        log.debug("XendDomainInfo.destroyDomain(%s)", self.domid)
    1.95  
    1.96          try:
    1.97              if self.domid is not None:
    1.98 @@ -1390,18 +1390,18 @@ class XendDomainInfo:
    1.99          dom = 0
   1.100          # get max number of vcpus to use for dom0 from config
   1.101          target = int(xroot.get_dom0_vcpus())
   1.102 -        log.debug("number of vcpus to use is %d" % (target))
   1.103 +        log.debug("number of vcpus to use is %d", target)
   1.104     
   1.105          # target = 0 means use all processors
   1.106          if target > 0:
   1.107              # count the number of online vcpus (cpu values in v2c map >= 0)
   1.108              vcpu_to_cpu = dom_get(dom)['vcpu_to_cpu']
   1.109              vcpus_online = len(filter(lambda x: x >= 0, vcpu_to_cpu))
   1.110 -            log.debug("found %d vcpus online" % (vcpus_online))
   1.111 +            log.debug("found %d vcpus online", vcpus_online)
   1.112  
   1.113              # disable any extra vcpus that are online over the requested target
   1.114              for vcpu in range(target, vcpus_online):
   1.115 -                log.info("enforcement is disabling DOM%d VCPU%d" % (dom, vcpu))
   1.116 +                log.info("enforcement is disabling DOM%d VCPU%d", dom, vcpu)
   1.117                  self.vcpu_hotplug(vcpu, 0)
   1.118  
   1.119