ia64/xen-unstable

changeset 7207:81246a2923d2

Fix call to state_set inside preserve (was erroneously calling set_state).
Tidy exception handling, and rename local 'channel' variable which was clashing
with the identical global name.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Tue Oct 04 16:27:16 2005 +0100 (2005-10-04)
parents b4c388a004c0
children 84c585a99a7b
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Oct 04 15:57:12 2005 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Oct 04 16:27:16 2005 +0100
     1.3 @@ -308,7 +308,7 @@ def dom_get(dom):
     1.4              return domlist[0]
     1.5      except Exception, err:
     1.6          # ignore missing domain
     1.7 -        log.exception("domain_getinfo(%d) failed, ignoring", dom)
     1.8 +        log.debug("domain_getinfo(%d) failed, ignoring: %s", dom, str(err))
     1.9      return None
    1.10  
    1.11  class XendDomainInfo:
    1.12 @@ -733,21 +733,21 @@ class XendDomainInfo:
    1.13                                                       self.domid)
    1.14              xc.domain_dumpcore(dom = self.domid, corefile = corefile)
    1.15  
    1.16 -        except Exception, exn:
    1.17 -            log.error("XendDomainInfo.dumpCore failed: id = %s name = %s: %s",
    1.18 -                      self.domid, self.info['name'], str(exn))
    1.19 +        except:
    1.20 +            log.exception("XendDomainInfo.dumpCore failed: id = %s name = %s",
    1.21 +                          self.domid, self.info['name'])
    1.22  
    1.23  
    1.24 -    def closeChannel(self, channel, entry):
    1.25 +    def closeChannel(self, chan, entry):
    1.26          """Close the given channel, if set, and remove the given entry in the
    1.27          store.  Nothrow guarantee."""
    1.28          
    1.29 -        if channel:
    1.30 -            channel.close()
    1.31 +        if chan:
    1.32 +            chan.close()
    1.33          try:
    1.34              self.removeDom(entry)
    1.35 -        except Exception, exn:
    1.36 -            log.exception(exn)
    1.37 +        except:
    1.38 +            log.exception('Removing entry %s failed', entry)
    1.39          
    1.40  
    1.41      def closeStoreChannel(self):
    1.42 @@ -988,7 +988,7 @@ class XendDomainInfo:
    1.43              self.configure()
    1.44              self.storeVmDetails()
    1.45              self.storeDomDetails()
    1.46 -        except Exception:
    1.47 +        except:
    1.48              log.exception('Domain construction failed')
    1.49              self.destroy()
    1.50              raise VmError('Creating domain failed: name=%s' %
    1.51 @@ -1064,7 +1064,7 @@ class XendDomainInfo:
    1.52  
    1.53          try:
    1.54              self.removeDom()
    1.55 -        except Exception:
    1.56 +        except:
    1.57              log.exception("Removing domain path failed.")
    1.58  
    1.59  
    1.60 @@ -1073,7 +1073,7 @@ class XendDomainInfo:
    1.61  
    1.62          try:
    1.63              self.removeVm()
    1.64 -        except Exception:
    1.65 +        except:
    1.66              log.exception("Removing VM path failed.")
    1.67  
    1.68  
    1.69 @@ -1094,7 +1094,7 @@ class XendDomainInfo:
    1.70          try:
    1.71              if self.domid is not None:
    1.72                  xc.domain_destroy(dom=self.domid)
    1.73 -        except Exception:
    1.74 +        except:
    1.75              log.exception("XendDomainInfo.destroy: xc.domain_destroy failed.")
    1.76  
    1.77          self.state_set(STATE_VM_TERMINATED)
    1.78 @@ -1117,7 +1117,7 @@ class XendDomainInfo:
    1.79                  for d in t.list(n):
    1.80                      try:
    1.81                          t.remove(d)
    1.82 -                    except ex:
    1.83 +                    except:
    1.84                          # Log and swallow any exceptions in removal --
    1.85                          # there's nothing more we can do.
    1.86                          log.exception(
    1.87 @@ -1258,7 +1258,7 @@ class XendDomainInfo:
    1.88                  except:
    1.89                      new_dom.destroy()
    1.90                      raise
    1.91 -            except Exception, exn:
    1.92 +            except:
    1.93                  log.exception('Failed to restart domain %d.', self.domid)
    1.94          finally:
    1.95              self.removeVm('xend/restart_in_progress')
    1.96 @@ -1290,7 +1290,7 @@ class XendDomainInfo:
    1.97          log.info("Preserving dead domain %s (%d).", self.info['name'],
    1.98                   self.domid)
    1.99          self.storeDom('xend/shutdown_completed', 'True')
   1.100 -        self.set_state(STATE_VM_TERMINATED)
   1.101 +        self.state_set(STATE_VM_TERMINATED)
   1.102  
   1.103  
   1.104      def generateShutdownName(self):