xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xen.org
Cc: Christoph Egger <Christoph.Egger@amd.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH 9/9] init/NetBSD: move xenbackendd to xend init script
Date: Wed, 11 Jul 2012 11:23:52 +0100	[thread overview]
Message-ID: <1342002232-75531-10-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <1342002232-75531-1-git-send-email-roger.pau@citrix.com>

xenbackendd is not needed by the xl toolstack, so move it's launch to
the xend script.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
---
 tools/hotplug/NetBSD/rc.d/xencommons |   29 ++---------------
 tools/hotplug/NetBSD/rc.d/xend       |   57 +++++++++++++++++++++++++++++++--
 2 files changed, 57 insertions(+), 29 deletions(-)

diff --git a/tools/hotplug/NetBSD/rc.d/xencommons b/tools/hotplug/NetBSD/rc.d/xencommons
index c0d87bf..fe4c9ac 100644
--- a/tools/hotplug/NetBSD/rc.d/xencommons
+++ b/tools/hotplug/NetBSD/rc.d/xencommons
@@ -29,8 +29,6 @@ XENBACKENDD_PIDFILE="/var/run/xenbackendd.pid"
 
 xen_precmd()
 {
-	mkdir -p /var/run/xend || exit 1
-	mkdir -p /var/run/xend/boot || exit 1
 	mkdir -p /var/run/xenstored || exit 1
 }
 
@@ -46,7 +44,7 @@ xen_startcmd()
 			XENSTORED_ROOTDIR="/var/lib/xenstored"
 		fi
 		rm -f ${XENSTORED_ROOTDIR}/tdb* >/dev/null 2>&1
-		printf "Starting xenservices: xenstored, xenconsoled, xenbackendd."
+		printf "Starting xenservices: xenstored, xenconsoled."
 		XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
 		if [ -n "${XENSTORED_TRACE}" ]; then
 			XENSTORED_ARGS="${XENSTORED_ARGS} -T /var/log/xen/xenstored-trace.log"
@@ -58,7 +56,7 @@ xen_startcmd()
 			sleep 1
 		done
 	else
-		printf "Starting xenservices: xenconsoled, xenbackendd."
+		printf "Starting xenservices: xenconsoled."
 	fi
 
 	XENCONSOLED_ARGS=""
@@ -68,13 +66,6 @@ xen_startcmd()
 
 	${SBINDIR}/xenconsoled ${XENCONSOLED_ARGS}
 
-	XENBACKENDD_ARGS=""
-	if [ -n "${XENBACKENDD_DEBUG}" ]; then
-		XENBACKENDD_ARGS="${XENBACKENDD_ARGS} -d"
-	fi
-
-	${SBINDIR}/xenbackendd ${XENBACKENDD_ARGS}
-
 	printf "\n"
 
 	printf "Setting domain 0 name.\n"
@@ -87,8 +78,6 @@ xen_stop()
 	printf "Stopping xencommons.\n"
 	printf "WARNING: Not stopping xenstored, as it cannot be restarted.\n"
 
-	rc_pid=$(check_pidfile ${XENBACKENDD_PIDFILE} ${SBINDIR}/xenbackendd)
-	pids="$pids $rc_pid"
 	rc_pid=$(check_pidfile ${XENCONSOLED_PIDFILE} ${SBINDIR}/xenconsoled)
 	pids="$pids $rc_pid"
 
@@ -108,17 +97,12 @@ xen_status()
 		pids="$pids $xenconsoled_pid"
 	fi
 
-	xenbackend_pid=$(check_pidfile ${XENBACKENDD_PIDFILE} ${SBINDIR}/xenbackendd)
-	if test -n ${xenbackend_pid}; then
-		pids="$pids $xenbackend_pid"
-	fi
-
-	if test -n "$xenbackend_pid" -a -n "$xenconsoled_pid" -a -n "$xenstored_pid";
+	if test -n "$xenconsoled_pid" -a -n "$xenstored_pid";
 	then
 		echo "xencommons are running as pids $pids."
 		return 0
 	fi
-	if test -z "$xenbackend_pid" -a -z "$xenconsoled_pid" -a -z "$xenstored_pid";
+	if test -z "$xenconsoled_pid" -a -z "$xenstored_pid";
 	then
 		echo "xencommons are not running."
 		return 0
@@ -134,11 +118,6 @@ xen_status()
 	else
 		echo "xenconsoled is not running."
 	fi
-	if test -n $xenbackend_pid; then
-		echo "xenbackendd is running as pid $xenbackend_pid."
-	else
-		echo "xenbackendd is not running."
-	fi
 }
 
 load_rc_config $name
diff --git a/tools/hotplug/NetBSD/rc.d/xend b/tools/hotplug/NetBSD/rc.d/xend
index ead9ee0..7fd9bc0 100644
--- a/tools/hotplug/NetBSD/rc.d/xend
+++ b/tools/hotplug/NetBSD/rc.d/xend
@@ -15,10 +15,59 @@ export PATH
 
 name="xend"
 rcvar=$name
-command="${SBINDIR}/xend"
-command_args="start"
-command_interpreter=`head -n 1 ${command} | awk '{ print substr($0,3) }'`
-sig_stop="SIGKILL"
+start_precmd="xend_precmd"
+start_cmd="xend_startcmd"
+stop_cmd="xend_stop"
+status_cmd="xend_status"
+extra_commands="status"
+required_files="/kern/xen/privcmd"
+
+XENBACKENDD_PIDFILE="/var/run/xenbackendd.pid"
+#XENBACKENDD_DEBUG=1
+
+xend_precmd()
+{
+	mkdir -p /var/run/xend || exit 1
+	mkdir -p /var/run/xend/boot || exit 1
+}
+
+xend_startcmd()
+{
+	printf "Starting xenbackendd.\n"
+
+	XENBACKENDD_ARGS=""
+	if [ -n "${XENBACKENDD_DEBUG}" ]; then
+		XENBACKENDD_ARGS="${XENBACKENDD_ARGS} -d"
+	fi
+
+	${SBINDIR}/xenbackendd ${XENBACKENDD_ARGS}
+
+	printf "Starting xend.\n"
+	${SBINDIR}/xend start
+}
+
+xend_stop()
+{
+	printf "Stopping xenbackendd, xend\n"
+	xb_pid=$(check_pidfile ${XENBACKENDD_PIDFILE} ${SBINDIR}/xenbackendd)
+	xend_pid=`ps x -o pid,command|grep ${SBINDIR}/xend|awk '{ print $1 }'`
+	if test -n "$xb_pid";
+	then
+		kill -${sig_stop:-TERM} $xb_pid
+	fi
+	if test -n "$xend_pid";
+	then
+		kill -${sig_stop:-KILL} $xend_pid
+	fi
+	wait_for_pids $xb_pid $xend_pid
+	rm -f /var/lock/subsys/xend /var/lock/xend /var/run/xenbackendd.pid
+}
+
+xend_status()
+{
+	${SBINDIR}/xend status
+}
 
 load_rc_config $name
 run_rc_command "$1"
+
-- 
1.7.7.5 (Apple Git-26)

  parent reply	other threads:[~2012-07-11 10:23 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11 10:23 [PATCH 0/9] NetBSD: minor fixes and hotplug execution Roger Pau Monne
2012-07-11 10:23 ` [PATCH 1/9] xenstore: don't print an error when gntdev cannot be opened Roger Pau Monne
2012-07-23 11:42   ` Ian Campbell
2012-07-11 10:23 ` [PATCH 2/9] tools/build: fix pygrub linking Roger Pau Monne
2012-07-11 11:00   ` Christoph Egger
2012-07-12 16:30     ` Roger Pau Monne
2012-07-17 16:22       ` Ian Jackson
2012-07-17 16:34         ` Roger Pau Monne
2012-07-17 18:17           ` Ian Jackson
2012-07-18  8:26             ` Roger Pau Monne
2012-07-18 10:48               ` Ian Jackson
2012-07-18 13:55                 ` Roger Pau Monne
2012-07-19 14:48                   ` Ian Jackson
2012-07-19 15:00                     ` Roger Pau Monne
2012-07-19 15:03                       ` Ian Jackson
2012-07-11 10:23 ` [PATCH 3/9] pygrub: don't leave fds open Roger Pau Monne
2012-07-11 11:02   ` Christoph Egger
2012-07-17 16:01   ` Ian Jackson
2012-07-11 10:23 ` [PATCH 4/9] build: include Tools.mk first in tools/Rules.mk Roger Pau Monne
2012-07-11 11:52   ` Christoph Egger
2012-07-23 11:34   ` Ian Campbell
2012-07-23 12:19     ` Christoph Egger
2012-07-25  9:32     ` Roger Pau Monne
2012-07-25 10:39       ` Ian Campbell
2012-07-25 10:56         ` Roger Pau Monne
2012-07-25 16:43           ` Ian Campbell
2012-07-11 10:23 ` [PATCH 5/9] libxl: react correctly to POLLHUP Roger Pau Monne
2012-07-17 16:01   ` Ian Jackson
2012-07-11 10:23 ` [PATCH 6/9] libxl: check backend state before setting it to "closing" Roger Pau Monne
2012-07-17 16:05   ` Ian Jackson
2012-07-11 10:23 ` [PATCH 7/9] hotplug/NetBSD: check type of file to attach from params Roger Pau Monne
2012-07-11 11:54   ` Christoph Egger
2012-07-17 16:06   ` Ian Jackson
2012-07-17 16:35     ` Roger Pau Monne
2012-07-11 10:23 ` [PATCH 8/9] libxl: call hotplug scripts from xl for NetBSD Roger Pau Monne
2012-07-17 16:07   ` Ian Jackson
2012-07-11 10:23 ` Roger Pau Monne [this message]
2012-07-11 12:02   ` [PATCH 9/9] init/NetBSD: move xenbackendd to xend init script Christoph Egger
2012-07-17 16:08   ` Ian Jackson
2012-07-17 16:23     ` Roger Pau Monne
2012-07-18  9:04       ` Christoph Egger
2012-07-18  9:43         ` Roger Pau Monne
2012-07-18  9:46           ` Christoph Egger
2012-07-18  9:46           ` Roger Pau Monne
2012-07-18 10:50         ` Ian Jackson
2012-07-18 11:02           ` Roger Pau Monne
2012-07-18  9:02     ` Christoph Egger
2012-07-23 12:20 ` [PATCH 0/9] NetBSD: minor fixes and hotplug execution 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=1342002232-75531-10-git-send-email-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=Christoph.Egger@amd.com \
    --cc=ian.jackson@eu.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).