mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
[XEND] Cleanup HVM image shutdown watch and move readDom call away
from image.py Signed-off-by: Alastair Tse <atse@xensource.com>
This commit is contained in:
1 parent
5061e2c063
commit
2791eeb645
2 files changed
+9
-4
No files matched your search
@@ -797,12 +797,13 @@ 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"""
|
||||
return self.console_port
|
||||
|
||||
@@ -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() )
|
||||
try:
|
||||
vm = xd.domain_lookup( self.vm.getDomid() )
|
||||
except XendError:
|
||||
# domain isn't registered, no need to clean it up.
|
||||
return
|
||||
|
||||
reason = vm._readDom('control/shutdown')
|
||||
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:
|
||||
|
||||