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

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



# HG changeset patch
# User Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
# Date 1310750523 -3600
# Node ID 6fe9f26bb9aefa948ee6d3a26582d26465aca770
# Parent  2fab3b0306164a3d341ef1c47c5c64ecb6ba8042
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>
---


diff -r 2fab3b030616 -r 6fe9f26bb9ae tools/hotplug/NetBSD/rc.d/xencommons
--- a/tools/hotplug/NetBSD/rc.d/xencommons      Fri Jul 15 18:13:28 2011 +0100
+++ b/tools/hotplug/NetBSD/rc.d/xencommons      Fri Jul 15 18:22:03 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®.