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

[Xen-devel] [PATCH 9/9] 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.

Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Christoph Egger <Christoph.Egger@xxxxxxx>
Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx>
---
 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)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.