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

[Xen-changelog] [xen-4.1-testing] tools: xencommons NetBSD init script: Multiple bugfixes and improvements



# HG changeset patch
# User Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
# Date 1311255714 -3600
# Node ID 6efaee8812b7f4845f649526aa449d3470819845
# Parent  e164e8d89bb29d65bac2f5bd932a0de29d5422a1
tools: xencommons NetBSD init script: Multiple bugfixes and improvements

Added a cleanup of the xenstore database, to purge old entries,
prevented the restart of xenstore and set Domain-0 name.  Also
replaced the sleep 5 (wait for xenstore to come up) with the method
used in the linux init script.

Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Christoph Egger <Christoph.Egger@xxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
xen-unstable changeset:   23699:6fe9f26bb9ae
xen-unstable date:        Fri Jul 15 18:22:03 2011 +0100
---


diff -r e164e8d89bb2 -r 6efaee8812b7 tools/hotplug/NetBSD/rc.d/xencommons
--- a/tools/hotplug/NetBSD/rc.d/xencommons      Thu Jul 21 14:41:18 2011 +0100
+++ b/tools/hotplug/NetBSD/rc.d/xencommons      Thu Jul 21 14:41:54 2011 +0100
@@ -23,6 +23,9 @@
 XENSTORED_PIDFILE="/var/run/xenstored.pid"
 XENCONSOLED_PIDFILE="/var/run/xenconsoled.pid"
 XENBACKENDD_PIDFILE="/var/run/xenbackendd.pid"
+#XENBACKENDD_DEBUG=1
+#XENCONSOLED_TRACE="/var/log/xen/xenconsole-trace.log"
+#XENSTORED_TRACE="/var/log/xen/xenstore-trace.log"
 
 xen_precmd()
 {
@@ -33,15 +36,31 @@
 
 xen_startcmd()
 {
-       printf "Starting xenservices: xenstored, xenconsoled, xenbackendd.\n"
-       XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
-       if [ -n "${XENSTORED_TRACE}" ]; then
-               XENSTORED_ARGS="${XENSTORED_ARGS} -T 
/var/log/xen/xenstored-trace.log"
+       local time=0
+       local timeout=30
+
+       xenstored_pid=$(check_pidfile ${XENSTORED_PIDFILE} ${SBINDIR}/xenstored)
+       if test -z "$xenstored_pid"; then
+               printf "Cleaning xenstore database.\n"
+               if [ -z "${XENSTORED_ROOTDIR}" ]; then
+                       XENSTORED_ROOTDIR="/var/lib/xenstored"
+               fi
+               rm -f ${XENSTORED_ROOTDIR}/tdb* >/dev/null 2>&1
+               printf "Starting xenservices: xenstored, xenconsoled, 
xenbackendd."
+               XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
+               if [ -n "${XENSTORED_TRACE}" ]; then
+                       XENSTORED_ARGS="${XENSTORED_ARGS} -T 
/var/log/xen/xenstored-trace.log"
+               fi
+               ${SBINDIR}/xenstored ${XENSTORED_ARGS}
+               while [ $time -lt $timeout ] && ! `${BINDIR}/xenstore-read -s / 
>/dev/null 2>&1` ; do
+                       printf "."
+                       time=$(($time+1))
+                       sleep 1
+               done
+       else
+               printf "Starting xenservices: xenconsoled, xenbackendd."
        fi
 
-       ${SBINDIR}/xenstored ${XENSTORED_ARGS}
-       sleep 5
-
        XENCONSOLED_ARGS=""
        if [ -n "${XENCONSOLED_TRACE}" ]; then
                XENCONSOLED_ARGS="${XENCONSOLED_ARGS} 
--log=${XENCONSOLED_TRACE}"
@@ -55,24 +74,26 @@
        fi
 
        ${SBINDIR}/xenbackendd ${XENBACKENDD_ARGS}
+
+       printf "\n"
+
+       printf "Setting domain 0 name.\n"
+       ${BINDIR}/xenstore-write "/local/domain/0/name" "Domain-0"
 }
 
 xen_stop()
 {
        pids=""
-       printf "Stopping xencommons"
+       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"
-       rc_pid=$(check_pidfile ${XENSTORED_PIDFILE} ${SBINDIR}/xenstored)
-       pids="$pids $rc_pid"
 
        kill -${sig_stop:-TERM} $pids
        wait_for_pids $pids
-
-       printf ".\n"
 }
 
 xen_status()

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.