diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-04-15 11:23:02 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-04-15 11:23:02 +0100 |
commit | b158b87dbedc458adade946653aebcda9e99a5af (patch) | |
tree | df266109cd05a0bd81ce8ca190611ee445991eca | |
parent | e2d6c4bd8adb3e8a87590c2815bb3f648af312db (diff) | |
download | xen-b158b87dbedc458adade946653aebcda9e99a5af.tar.gz xen-b158b87dbedc458adade946653aebcda9e99a5af.tar.bz2 xen-b158b87dbedc458adade946653aebcda9e99a5af.zip |
xend: fix avoidance to restart domain on crash
If a qemu-dm dies immediately (probably by wrong setting),
xend repeats to restart a domain so many times.=20
That causes system overload.
There is already a logic to avoid too early restarting, however,
it might not work. Since xenstore entry 'xend/previous_restart_time'
is volatile. XendDomainInfo.destroy() which removes the entry from
xenstore is called in some places.
Also, this patch prevents too early restarting even at the first
domain creation.
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
-rw-r--r-- | tools/python/xen/xend/XendDomainInfo.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 4244a542b8..720a1b7bb1 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -514,7 +514,6 @@ class XendDomainInfo: if reason not in DOMAIN_SHUTDOWN_REASONS.values(): raise XendError('Invalid reason: %s' % reason) - self._removeVm('xend/previous_restart_time') self.storeDom("control/shutdown", reason) # HVM domain shuts itself down only if it has PV drivers @@ -2001,20 +2000,13 @@ class XendDomainInfo: old_domid = self.domid self._writeVm(RESTART_IN_PROGRESS, 'True') - now = time.time() - rst = self._readVm('xend/previous_restart_time') - if rst: - rst = float(rst) - timeout = now - rst - if timeout < MINIMUM_RESTART_TIME: - log.error( - 'VM %s restarting too fast (%f seconds since the last ' - 'restart). Refusing to restart to avoid loops.', - self.info['name_label'], timeout) - self.destroy() - return - - self._writeVm('xend/previous_restart_time', str(now)) + elapse = time.time() - self.info['start_time'] + if elapse < MINIMUM_RESTART_TIME: + log.error('VM %s restarting too fast (Elapsed time: %f seconds). ' + 'Refusing to restart to avoid loops.', + self.info['name_label'], elapse) + self.destroy() + return prev_vm_xend = self._listRecursiveVm('xend') new_dom_info = self.info |