From: Kouya Shimura Subject: [PATCH] xend: fix avoidance to restart domain on crash Date: Wed, 15 Apr 2009 16:24:12 +0900 Message-ID: <7kljq21isj.fsf@pingu.sky.yk.fujitsu.co.jp> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nLMKakpzGA" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --nLMKakpzGA Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit If a qemu-dm dies immediately (probably by wrong setting), xend repeats to restart a domain so many times. 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 --nLMKakpzGA Content-Type: text/x-patch Content-Disposition: inline; filename="fix_restart_on_crash.patch" Content-Transfer-Encoding: 7bit diff -r 94ffd85005c5 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Tue Apr 14 15:23:53 2009 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Wed Apr 15 13:19:36 2009 +0900 @@ -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 --nLMKakpzGA Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --nLMKakpzGA--