ia64/xen-unstable

changeset 19547:b2c43b0fba71

xend: serialise domain restart threads

I observed from xend.log that several domain restart threads run
simultaneously. This patch make it singleton.
Without this, several coredump of a domain might be created.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Apr 15 11:25:07 2009 +0100 (2009-04-15)
parents 9e29ba71e169
children 3e64dfebabd7
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed Apr 15 11:23:02 2009 +0100
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Wed Apr 15 11:25:07 2009 +0100
     1.3 @@ -350,6 +350,8 @@ class XendDomainInfo:
     1.4      @type shutdownWatch: xen.xend.xenstore.xswatch
     1.5      @ivar shutdownStartTime: UNIX Time when domain started shutting down.
     1.6      @type shutdownStartTime: float or None
     1.7 +    @ivar restart_in_progress: Is a domain restart thread running?
     1.8 +    @type restart_in_progress: bool
     1.9  #    @ivar state: Domain state
    1.10  #    @type state: enum(DOM_STATE_HALTED, DOM_STATE_RUNNING, ...)
    1.11      @ivar state_updated: lock for self.state
    1.12 @@ -418,6 +420,7 @@ class XendDomainInfo:
    1.13          self.shutdownWatch = None
    1.14          self.shutdownStartTime = None
    1.15          self._resume = resume
    1.16 +        self.restart_in_progress = False
    1.17  
    1.18          self.state_updated = threading.Condition()
    1.19          self.refresh_shutdown_lock = threading.Condition()
    1.20 @@ -1929,7 +1932,8 @@ class XendDomainInfo:
    1.21          finally:
    1.22              self.refresh_shutdown_lock.release()
    1.23  
    1.24 -        if restart_reason:
    1.25 +        if restart_reason and not self.restart_in_progress:
    1.26 +            self.restart_in_progress = True
    1.27              threading.Thread(target = self._maybeRestart,
    1.28                               args = (restart_reason,)).start()
    1.29