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

[Xen-changelog] [xen-unstable] init/NetBSD: move xenbackendd to xend init script


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Wed, 01 Aug 2012 21:11:09 +0000
  • Delivery-date: Wed, 01 Aug 2012 21:11:19 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Roger Pau Monne <roger.pau@xxxxxxxxxx>
# Date 1343821608 -3600
# Node ID 433624c658af4f3bf21ae53ef090528e870fdf58
# Parent  84a78045e701ad743bcd369acbae6d0fb258a0f8
init/NetBSD: move xenbackendd to xend init script

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

We have to iterate until we are sure there are no xend processes left,
since doing a single pkill usually leaves xend processes running.

Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx>
Acked-by: Christoph Egger <Christoph.Egger@xxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Tested-by: Christoph Egger <Christoph.Egger@xxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r 84a78045e701 -r 433624c658af tools/hotplug/NetBSD/rc.d/xencommons
--- a/tools/hotplug/NetBSD/rc.d/xencommons      Wed Aug 01 12:46:47 2012 +0100
+++ b/tools/hotplug/NetBSD/rc.d/xencommons      Wed Aug 01 12:46:48 2012 +0100
@@ -29,8 +29,6 @@ XENBACKENDD_PIDFILE="/var/run/xenbackend
 
 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 -r 84a78045e701 -r 433624c658af tools/hotplug/NetBSD/rc.d/xend
--- a/tools/hotplug/NetBSD/rc.d/xend    Wed Aug 01 12:46:47 2012 +0100
+++ b/tools/hotplug/NetBSD/rc.d/xend    Wed Aug 01 12:46:48 2012 +0100
@@ -15,10 +15,57 @@ 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 >/dev/null 2>&1
+}
+
+xend_stop()
+{
+       printf "Stopping xenbackendd, xend\n"
+       xb_pid=$(check_pidfile ${XENBACKENDD_PIDFILE} ${SBINDIR}/xenbackendd)
+       if test -n "$xb_pid";
+       then
+               kill -${sig_stop:-TERM} $xb_pid
+       fi
+       while pgrep -f ${SBINDIR}/xend >/dev/null 2>&1; do
+               pkill -${sig_stop:-KILL} -f ${SBINDIR}/xend
+       done
+       wait_for_pids $xb_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"
+

_______________________________________________
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®.