From: shawn Subject: Re: [patch]Make xend to take care of dead qemu-dm process Date: Mon, 26 May 2008 15:48:43 +0800 Message-ID: <1211788123.31313.17.camel@redfuture-desktop.cn.oracle.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-hBoPx043zWDY80Z2tQBb" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org --=-hBoPx043zWDY80Z2tQBb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by agminet01.oracle.com id m4Q7n5Ue018115 =EF=BB=BFHi, This patch fix xend as when fatal error happened (e.g. qemu-dm process was killed) log error meesge then marked that domain as crashed ,do what specified on crashed in the domain config file.Added some code in xend to check those crashed hvm DM status each 30 seconds.=20 =EF=BB=BFSigned-off-by: Xiaowei Hu Best regards. Xiaowei --=-hBoPx043zWDY80Z2tQBb Content-Disposition: attachment; filename=take_care_qemu-dm.patch Content-Type: text/x-patch; name=take_care_qemu-dm.patch; charset=GB2312 Content-Transfer-Encoding: 7bit --- ./tools/python/xen/xend/server/SrvServer.py.org 2008-05-21 13:53:08.000000000 +0800 +++ ./tools/python/xen/xend/server/SrvServer.py 2008-05-26 15:16:39.000000000 +0800 @@ -44,6 +44,7 @@ import re import time import signal +import os from threading import Thread from xen.web.httpserver import HttpServer, UnixHttpServer @@ -148,14 +149,27 @@ # Reaching this point means we can auto start domains try: - xenddomain().autostart_domains() + dom = xenddomain() + dom.autostart_domains() except Exception, e: log.exception("Failed while autostarting domains") # loop to keep main thread alive until it receives a SIGTERM self.running = True while self.running: - time.sleep(100000000) + # loop to destroy those hvm domain that whoes DM has dead unexpectedly. + for item in dom.domains.values(): + if item.info.is_hvm(): + device_model_pid = item.gatherDom(('image/device-model-pid', str)) + dm_stat_cmd = "ps -o stat --no-headers -p"+device_model_pid + dm_stat = os.popen(dm_stat_cmd).readline().rstrip() + if dm_stat == 'Z': + log.warn("Devices Model for domain " + str(item.domid) + "was killed unexpectedly") + item.info['crashed'] = 1 + item.refreshShutdown(item.info) + else: + continue + time.sleep(30) if self.reloadingConfig: log.info("Restarting all XML-RPC and Xen-API servers...") --=-hBoPx043zWDY80Z2tQBb 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 --=-hBoPx043zWDY80Z2tQBb--