[XEND] Fix paused state being overriden by refreshShutdown
authorAlastair Tse <atse@xensource.com>
Thu, 2 Nov 2006 15:48:32 +0000 (15:48 +0000)
committerAlastair Tse <atse@xensource.com>
Thu, 2 Nov 2006 15:48:32 +0000 (15:48 +0000)
Signed-off-by: Alastair Tse <atse@xensource.com>
tools/python/xen/xend/XendConfig.py
tools/python/xen/xend/XendDomainInfo.py

index 6a9473744006b4eee8a6b36aed6682167b64a831..823ffedd73b0618e59999b158e516b575bc96b23 100644 (file)
@@ -608,8 +608,6 @@ class XendConfig(dict):
     def get_sxp(self, domain = None, ignore_devices = False, ignore = []):
         """ Get SXP representation of this config object.
 
-        Incompat: removed store_mfn, console_mfn
-
         @keyword domain: (optional) XendDomainInfo to get extra information
                          from such as domid and running devices.
         @type    domain: XendDomainInfo
@@ -647,13 +645,10 @@ class XendConfig(dict):
             sxpr.append(['up_time', str(uptime)])
             sxpr.append(['start_time', str(self['start_time'])])
 
-        sxpr.append(['on_xend_start', self.get('on_xend_start', 'ignore')])
-        sxpr.append(['on_xend_stop', self.get('on_xend_stop', 'ignore')])
-
         if domain:
-            sxpr.append(['status', domain.state])
+            sxpr.append(['status', str(domain.state)])
         else:
-            sxpr.append(['status', DOM_STATE_HALTED])
+            sxpr.append(['status', str(DOM_STATE_HALTED)])
 
         # For save/restore migration
         if domain:
index 0fa3572587b4b67371f734b59edc45a169fb2f59..af2bd8600b7d4a32090089b824500260cf8e1492 100644 (file)
@@ -843,6 +843,8 @@ class XendDomainInfo:
         return self._readVm('xend/restart_count')
 
     def _refreshShutdown(self, xeninfo = None):
+        """ Checks the domain for whether a shutdown is required. """
+        
         # If set at the end of this method, a restart is required, with the
         # given reason.  This restart has to be done out of the scope of
         # refresh_shutdown_lock.
@@ -926,8 +928,11 @@ class XendDomainInfo:
             else:
                 # Domain is alive.  If we are shutting it down, then check
                 # the timeout on that, and destroy it if necessary.
-                self._stateSet(DOM_STATE_RUNNING)
-                
+                if xeninfo['paused']:
+                    self._stateSet(DOM_STATE_PAUSED)
+                else:
+                    self._stateSet(DOM_STATE_RUNNING)
+                    
                 if self.shutdownStartTime:
                     timeout = (SHUTDOWN_TIMEOUT - time.time() +
                                self.shutdownStartTime)