From: Ian Campbell Subject: Re: [PATCH] Stop QEMU in do_stop() in xencommons script. Date: Wed, 9 Jan 2013 11:28:09 +0000 Message-ID: <1357730889.7989.242.camel@zakaz.uk.xensource.com> References: <1357233158-13847-1-git-send-email-wei.liu2@citrix.com> <1357730538.9068.4.camel@iceland> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1357730538.9068.4.camel@iceland> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: Stefano Stabellini , Ian Jackson , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Wed, 2013-01-09 at 11:22 +0000, Wei Liu wrote: > Ian and Stefano, do you have any input on this? It looks good to me, I'm just behind on going through my queue of patches to consider, sorry. I see you've copied the kill loop from the xenconsoled stuff, but I do wonder if perhaps in both cases there ought to be a sleep between the initial kill and the first kill -9, to give the process a chance to exit gracefully. I don't see this as a blocker for this patch though. > > Wei. > > On Thu, 2013-01-03 at 17:12 +0000, Wei Liu wrote: > > do_stop() is invoked by "restart" action. We can get multiple QEMUs started up > > for Dom0 if we don't kill previous ones. > > > > Signed-off-by: Wei Liu > > --- > > tools/hotplug/Linux/init.d/xencommons | 10 +++++++++- > > 1 file changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/tools/hotplug/Linux/init.d/xencommons b/tools/hotplug/Linux/init.d/xencommons > > index cc8177e..cc5e45c 100644 > > --- a/tools/hotplug/Linux/init.d/xencommons > > +++ b/tools/hotplug/Linux/init.d/xencommons > > @@ -27,6 +27,7 @@ fi > > test -f $xencommons_config/xencommons && . $xencommons_config/xencommons > > > > XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid > > +QEMU_PIDFILE=/var/run/qemu-dom0.pid > > shopt -s extglob > > > > # not running in Xen dom0 or domU > > @@ -116,7 +117,7 @@ do_start () { > > test "`uname`" != "NetBSD" || xenbackendd $XENBACKENDD_ARGS > > echo Starting QEMU as disk backend for dom0 > > test -z "$QEMU_XEN" && QEMU_XEN=/usr/lib/xen/bin/qemu-system-i386 > > - $QEMU_XEN -xen-domid 0 -xen-attach -name dom0 -nographic -M xenpv -daemonize -monitor /dev/null > > + $QEMU_XEN -xen-domid 0 -xen-attach -name dom0 -nographic -M xenpv -daemonize -monitor /dev/null -pidfile $QEMU_PIDFILE > > } > > do_stop () { > > echo Stopping xenconsoled > > @@ -126,6 +127,13 @@ do_stop () { > > rm -f $XENCONSOLED_PIDFILE > > fi > > > > + echo Stopping QEMU > > + if read 2>/dev/null <$QEMU_PIDFILE pid; then > > + kill $pid > > + while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done > > + rm -f $QEMU_PIDFILE > > + fi > > + > > echo WARNING: Not stopping xenstored, as it cannot be restarted. > > } > > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel