[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xencommons: Stop QEMU in do_stop()


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Wed, 16 Jan 2013 08:22:20 +0000
  • Delivery-date: Wed, 16 Jan 2013 08:22:28 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Wei Liu <wei.liu2@xxxxxxxxxx>
# Date 1357906948 0
# Node ID 9a1610c1e564cdc49b8bf628694632a63c6f6b63
# Parent  2ad5792b4274d76ced39515cbd3f84898b181768
xencommons: Stop QEMU in do_stop()

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 <wei.liu2@xxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r 2ad5792b4274 -r 9a1610c1e564 tools/hotplug/Linux/init.d/xencommons
--- a/tools/hotplug/Linux/init.d/xencommons     Fri Jan 11 12:22:28 2013 +0000
+++ b/tools/hotplug/Linux/init.d/xencommons     Fri Jan 11 12:22:28 2013 +0000
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.