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

[Xen-changelog] [xen-unstable] [XEND] Cleanup HVM image shutdown watch and move readDom call away



# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID 3a0116aa7ff56573342078e8123bd7398b61755b
# Parent  b5c50a603044be3b2cd5081ac0a8a7c109469640
[XEND] Cleanup HVM image shutdown watch and move readDom call away
from image.py

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomainInfo.py |    3 ++-
 tools/python/xen/xend/image.py          |   12 ++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff -r b5c50a603044 -r 3a0116aa7ff5 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Fri Nov 03 15:17:00 2006 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Nov 03 15:47:05 2006 +0000
@@ -797,11 +797,12 @@ class XendDomainInfo:
     def getDomainPath(self):
         return self.dompath
 
+    def getShutdownReason(self):
+        return self._readDom('control/shutdown')
 
     def getStorePort(self):
         """For use only by image.py and XendCheckpoint.py."""
         return self.store_port
-
 
     def getConsolePort(self):
         """For use only by image.py and XendCheckpoint.py"""
diff -r b5c50a603044 -r 3a0116aa7ff5 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Fri Nov 03 15:17:00 2006 +0000
+++ b/tools/python/xen/xend/image.py    Fri Nov 03 15:47:05 2006 +0000
@@ -24,7 +24,7 @@ import signal
 
 import xen.lowlevel.xc
 from xen.xend import sxp
-from xen.xend.XendError import VmError
+from xen.xend.XendError import VmError, XendError
 from xen.xend.XendLogging import log
 from xen.xend.server.netif import randomMAC
 from xen.xend.xenstore.xswatch import xswatch
@@ -456,9 +456,13 @@ class HVMImageHandler(ImageHandler):
         """
         from xen.xend.XendConstants import DOMAIN_SHUTDOWN_REASONS
         xd = xen.xend.XendDomain.instance()
-        vm = xd.domain_lookup( self.vm.getDomid() )
-
-        reason = vm._readDom('control/shutdown')
+        try:
+            vm = xd.domain_lookup( self.vm.getDomid() )
+        except XendError:
+            # domain isn't registered, no need to clean it up.
+            return
+
+        reason = vm.getShutdownReason()
         log.debug("hvm_shutdown fired, shutdown reason=%s", reason)
         for x in DOMAIN_SHUTDOWN_REASONS.keys():
             if DOMAIN_SHUTDOWN_REASONS[x] == reason:

_______________________________________________
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®.