Stop QEMU in do_stop() in xencommons script.
PATCH 1/1 Stop QEMU in do_stop() in xencommons script.
do_stop() is invoked by "restart" action. We can get multiple QEMUs started up for Dom0 if we don't kill previous ones.
--- tools/hotplug/Linux/init.d/xencommons | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tools/hotplug/Linux/init.d/xencommons +9 -1
@@ -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. }
Signature · 1 line
1.7.10.4
Ian and Stefano, do you have any input on this?
Wei.
Quoted 43 lines · Wei Liu
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 <[email protected]>--- tools/hotplug/Linux/init.d/xencommons | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)tools/hotplug/Linux/init.d/xencommons +9
-1@@ -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. }
Quoted 1 line · Wei Liu
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.
Quoted 54 lines
Wei.
Quoted 33 lines · Wei Liu
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 <[email protected]>--- tools/hotplug/Linux/init.d/xencommons | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)tools/hotplug/Linux/init.d/xencommons +2
-1@@ -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 fitools/hotplug/Linux/init.d/xencommons do_stop () { · line 139
Quoted 10 lines
tools/hotplug/Linux/init.d/xencommons +7
-0+ 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
[email protected]
http://lists.xen.org/xen-devel
Quoted 4 lines · Wei Liu
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 <[email protected]>
Acked + applied, thanks