From: Keir Fraser Subject: Re: [patch]Make xend to take care of dead qemu-dm process Date: Mon, 26 May 2008 08:35:26 +0100 Message-ID: References: <1211786904.31313.10.camel@redfuture-desktop.cn.oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1211786904.31313.10.camel@redfuture-desktop.cn.oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: shawn , xen-devel List-Id: xen-devel@lists.xenproject.org Please re-send with a changeset comment and a signed-off-by line. -- Keir On 26/5/08 08:28, "shawn" wrote: > Hi all, >=20 > I changed this patch ,put the domain into crashed domains,the called > refreshShutdown immediately. > Yes,this works fine now ,could do what specified =EF=BB=BFon crashed in the > domain config file. >=20 > Resending this patch ,Please review it again! >=20 > Thanks Keir for your suggestion:) >=20 > Thanks all. >=20 > Regards, > xiaowei >=20 >=20 > --- ./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 > =20 > from xen.web.httpserver import HttpServer, UnixHttpServer > @@ -148,14 +149,27 @@ > =20 > # Reaching this point means we can auto start domains > try: > - xenddomain().autostart_domains() > + dom =3D xenddomain() > + dom.autostart_domains() > except Exception, e: > log.exception("Failed while autostarting domains") > =20 > # loop to keep main thread alive until it receives a > SIGTERM > self.running =3D 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 =3D > item.gatherDom(('image/device-model-pid', str)) > + dm_stat_cmd =3D "ps -o stat --no-headers > -p"+device_model_pid > + dm_stat =3D > os.popen(dm_stat_cmd).readline().rstrip() > + if dm_stat =3D=3D 'Z': > + log.warn("Devices Model for domain " + > str(item.domid) + "was killed unexpectedly") > + item.info['crashed'] =3D 1 > + item.refreshShutdown(item.info) > + else: > + continue > + time.sleep(30) > =20 > if self.reloadingConfig: > log.info("Restarting all XML-RPC and Xen-API > servers...") >=20