Record the last shutdown reason for each VM in the store.
authorEwan Mellor <ewan@xensource.com>
Fri, 5 Jan 2007 15:38:01 +0000 (15:38 +0000)
committerEwan Mellor <ewan@xensource.com>
Fri, 5 Jan 2007 15:38:01 +0000 (15:38 +0000)
Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xend/XendConstants.py
tools/python/xen/xend/XendDomainInfo.py

index e07fa127f16184b358bcd1e1ba8aaecb4411b022..e42216d06b43c9890c6dff5bae4a21d60d9a3ffb 100644 (file)
@@ -80,6 +80,7 @@ ZOMBIE_PREFIX = 'Zombie-'
 MINIMUM_RESTART_TIME = 20
 
 RESTART_IN_PROGRESS = 'xend/restart_in_progress'
+LAST_SHUTDOWN_REASON = 'xend/last_shutdown_reason'
 
 #
 # Device migration stages (eg. XendDomainInfo, XendCheckpoint, server.tpmif)
index 8185d935762cbf0cbd5c6b7b97d4e7befa48c713..b47083a88548dce3458fa6bc232d6e61f322e9ee 100644 (file)
@@ -969,6 +969,7 @@ class XendDomainInfo:
 
                 log.warn('Domain has crashed: name=%s id=%d.',
                          self.info['name_label'], self.domid)
+                self._writeVm(LAST_SHUTDOWN_REASON, 'crash')
 
                 if xroot.get_enable_dump():
                     self.dumpCore()
@@ -988,6 +989,7 @@ class XendDomainInfo:
 
                     log.info('Domain has shutdown: name=%s id=%d reason=%s.',
                              self.info['name_label'], self.domid, reason)
+                    self._writeVm(LAST_SHUTDOWN_REASON, reason)
 
                     self._clearRestart()