[Pkg-xen-changes] [xen] 01/01: Start a qemu process in dom0 to service the toolstacks loopback disk attaches.

Ian James Campbell ijc at moszumanska.debian.org
Sat Aug 22 08:10:38 UTC 2015


This is an automated email from the git hooks/post-receive script.

ijc pushed a commit to branch feature/bug770456
in repository xen.

commit fcdd6e3c9596e900748e93ae3be4e6a3dc278f26
Author: Ian Campbell <ijc at debian.org>
Date:   Fri Nov 21 11:27:45 2014 +0000

    Start a qemu process in dom0 to service the toolstacks loopback disk attaches.
    
    This is used to e.g. run pygrub on a VM with a qcow2 disk image.
    
    (Closes: #770456)
    
    Also, remove correct pidfile when stopping xenconsoled.
---
 debian/changelog                 |  9 +++++
 debian/xen-utils-common.xen.init | 75 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 70be498..f2f3f2f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+xen (4.5.1~rc1-1) UNRELEASED; urgency=medium
+
+  [ Ian Campbell ]
+  * Start a qemu process in dom0 to service the toolstacks loopback disk
+    attaches. (Closes: #770456)
+  * Remove correct pidfile when stopping xenconsoled.
+
+ -- Ian Campbell <ijc at debian.org>  Sat, 22 Aug 2015 09:09:52 +0100
+
 xen (4.5.1~rc1-1) experimental; urgency=medium
 
   [ Ian Campbell ]
diff --git a/debian/xen-utils-common.xen.init b/debian/xen-utils-common.xen.init
index fe5d6f3..252ddc0 100644
--- a/debian/xen-utils-common.xen.init
+++ b/debian/xen-utils-common.xen.init
@@ -37,6 +37,9 @@ XENCONSOLED="$ROOT"/bin/xenconsoled
 XENCONSOLED_PIDFILE="/var/run/xenconsoled.pid"
 XENSTORED="$ROOT"/bin/xenstored
 XENSTORED_PIDFILE="/var/run/xenstore.pid"
+QEMU=/usr/bin/qemu-system-i386
+QEMU_PIDFILE="/var/run/qemu-dom0.pid"
+QEMU_ARGS="-xen-domid 0 -xen-attach -name dom0 -nographic -M xenpv -daemonize -monitor /dev/null -serial /dev/null -parallel /dev/null"
 
 modules_setup()
 {
@@ -179,10 +182,65 @@ xenconsoled_stop_real()
 	[ "$RETVAL" = 2 ] && return 2
 	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec "$XENCONSOLED"
 	[ "$?" = 2 ] && return 2
-	rm -f $PIDFILE
+	rm -f $XENCONSOLED_PIDFILE
 	return "$RETVAL"
 }
 
+qemu_start()
+{
+	[ -x $QEMU ] || return 0
+	log_progress_msg "qemu"
+	qemu_start_real
+	return $?
+}
+
+qemu_stop()
+{
+	[ -x $QEMU ] || return 0
+	log_progress_msg "qemu"
+	qemu_stop_real
+	return $?
+}
+
+qemu_restart()
+{
+	[ -x $QEMU ] || return 0
+	log_progress_msg "qemu"
+	qemu_stop_real
+	case "$?" in
+		0|1)
+		qemu_start_real
+		case "$?" in
+			0) ;;
+			*) return 2 ;;
+		esac
+		;;
+		*) return 2 ;;
+	esac
+	return 0
+}
+
+qemu_start_real()
+{
+	start-stop-daemon --start --quiet --pidfile "$QEMU_PIDFILE" --exec "$QEMU" --test > /dev/null \
+		|| return 1
+	start-stop-daemon --start --quiet --pidfile "$QEMU_PIDFILE" --exec "$QEMU" -- \
+		$QEMU_ARGS -pidfile "$QEMU_PIDFILE" \
+		|| return 2
+}
+
+qemu_stop_real()
+{
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile "$QEMU_PIDFILE" --exec "$QEMU"
+	RETVAL="$?"
+	[ "$RETVAL" = 2 ] && return 2
+	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec "$QEMU"
+	[ "$?" = 2 ] && return 2
+	rm -f $QEMU_PIDFILE
+	return "$RETVAL"
+}
+
+
 xenstored_start()
 {
 	log_progress_msg "xenstored"
@@ -241,6 +299,11 @@ case "$1" in
 		0|1) ;;
 		*) log_end_msg 1; exit ;;
 	esac
+	qemu_start
+	case "$?" in
+		0|1) ;;
+		*) log_end_msg 1; exit ;;
+	esac
 	log_end_msg 0
 	;;
   stop)
@@ -251,6 +314,11 @@ case "$1" in
 	esac
 	log_daemon_msg "Stopping $DESC"
 	ret=0
+	qemu_stop
+	case "$?" in
+		0|1) ;;
+		*) ret=1 ;;
+	esac
 	xend_stop
 	case "$?" in
 		0|1) ;;
@@ -271,6 +339,11 @@ case "$1" in
 	esac
 	log_daemon_msg "Restarting $DESC"
 	ret=0
+	qemu_restart
+	case "$?" in
+		0|1) ;;
+		*) ret=1 ;;
+	esac
 	xend_restart
 	case "$?" in
 		0|1) ;;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-xen/xen.git



More information about the Pkg-xen-changes mailing list