ia64/xen-unstable

changeset 12252:3a0116aa7ff5

[XEND] Cleanup HVM image shutdown watch and move readDom call away
from image.py

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Fri Nov 03 15:47:05 2006 +0000 (2006-11-03)
parents b5c50a603044
children 13ea4bea8237
files tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/image.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Fri Nov 03 15:17:00 2006 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri Nov 03 15:47:05 2006 +0000
     1.3 @@ -797,12 +797,13 @@ class XendDomainInfo:
     1.4      def getDomainPath(self):
     1.5          return self.dompath
     1.6  
     1.7 +    def getShutdownReason(self):
     1.8 +        return self._readDom('control/shutdown')
     1.9  
    1.10      def getStorePort(self):
    1.11          """For use only by image.py and XendCheckpoint.py."""
    1.12          return self.store_port
    1.13  
    1.14 -
    1.15      def getConsolePort(self):
    1.16          """For use only by image.py and XendCheckpoint.py"""
    1.17          return self.console_port
     2.1 --- a/tools/python/xen/xend/image.py	Fri Nov 03 15:17:00 2006 +0000
     2.2 +++ b/tools/python/xen/xend/image.py	Fri Nov 03 15:47:05 2006 +0000
     2.3 @@ -24,7 +24,7 @@ import signal
     2.4  
     2.5  import xen.lowlevel.xc
     2.6  from xen.xend import sxp
     2.7 -from xen.xend.XendError import VmError
     2.8 +from xen.xend.XendError import VmError, XendError
     2.9  from xen.xend.XendLogging import log
    2.10  from xen.xend.server.netif import randomMAC
    2.11  from xen.xend.xenstore.xswatch import xswatch
    2.12 @@ -456,9 +456,13 @@ class HVMImageHandler(ImageHandler):
    2.13          """
    2.14          from xen.xend.XendConstants import DOMAIN_SHUTDOWN_REASONS
    2.15          xd = xen.xend.XendDomain.instance()
    2.16 -        vm = xd.domain_lookup( self.vm.getDomid() )
    2.17 +        try:
    2.18 +            vm = xd.domain_lookup( self.vm.getDomid() )
    2.19 +        except XendError:
    2.20 +            # domain isn't registered, no need to clean it up.
    2.21 +            return
    2.22  
    2.23 -        reason = vm._readDom('control/shutdown')
    2.24 +        reason = vm.getShutdownReason()
    2.25          log.debug("hvm_shutdown fired, shutdown reason=%s", reason)
    2.26          for x in DOMAIN_SHUTDOWN_REASONS.keys():
    2.27              if DOMAIN_SHUTDOWN_REASONS[x] == reason: