From: Wei Liu <wei.liu2@citrix.com>
To: xen-devel@lists.xen.org
Cc: Wei Liu <wei.liu2@citrix.com>
Subject: [PATCH] Stop QEMU in do_stop() in xencommons script.
Date: Thu, 3 Jan 2013 17:12:38 +0000 [thread overview]
Message-ID: <1357233158-13847-1-git-send-email-wei.liu2@citrix.com> (raw)
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@citrix.com>
---
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.
}
--
1.7.10.4
next reply other threads:[~2013-01-03 17:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-03 17:12 Wei Liu [this message]
2013-01-09 11:22 ` [PATCH] Stop QEMU in do_stop() in xencommons script Wei Liu
2013-01-09 11:28 ` Ian Campbell
2013-01-11 12:24 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357233158-13847-1-git-send-email-wei.liu2@citrix.com \
--to=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).