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

[Xen-devel] [PATCH 27 of 29 RFC] init: updated Linux and NetBSD init scripts to launch xldeviced



# HG changeset patch
# User Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
# Date 1328180098 -3600
# Node ID 42bd734ce75d232194372c329a9af9b73e9090fb
# Parent  e904f98a4445fee7489490b5ccc00b7bb62d796d
init: updated Linux and NetBSD init scripts to launch xldeviced

Updated both init scripts to launch xldeviced when starting
xencommons.

Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>

diff -r e904f98a4445 -r 42bd734ce75d tools/hotplug/Linux/init.d/xencommons
--- a/tools/hotplug/Linux/init.d/xencommons     Thu Feb 02 11:51:49 2012 +0100
+++ b/tools/hotplug/Linux/init.d/xencommons     Thu Feb 02 11:54:58 2012 +0100
@@ -27,6 +27,7 @@ fi
 test -f $xencommons_config/xencommons && . $xencommons_config/xencommons
 
 XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
+XLDEVICED_PIDFILE=/var/run/xldeviced.pid
 shopt -s extglob
 
 # not running in Xen dom0 or domU
@@ -95,13 +96,16 @@ do_start () {
 
                echo Setting domain 0 name...
                xenstore-write "/local/domain/0/name" "Domain-0"
+               echo Setting domain 0 id...
+               xenstore-write "/local/domain/0/domid" "0"
        fi
 
        echo Starting xenconsoled...
        test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" 
--log=$XENCONSOLED_TRACE"
        xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS
-       test -z "$XENBACKENDD_DEBUG" || XENBACKENDD_ARGS="-d"
-       test "`uname`" != "NetBSD" || xenbackendd $XENBACKENDD_ARGS
+       echo Starting xldeviced...
+       test -z "$XLDEVICED_DEBUG" || XLDEVICED_ARGS="-vvv"
+       xldeviced -p $XLDEVICED_PIDFILE $XLDEVICED_ARGS
 }
 do_stop () {
         echo Stopping xenconsoled
@@ -110,7 +114,12 @@ do_stop () {
                while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
                rm -f $XENCONSOLED_PIDFILE
        fi
-
+       echo Stopping xldeviced
+       if read 2>/dev/null <$XLDEVICED_PIDFILE pid; then
+               kill $pid
+               while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
+               rm -f $XLDEVICED_PIDFILE
+       fi
        echo WARNING: Not stopping xenstored, as it cannot be restarted.
 }
 
diff -r e904f98a4445 -r 42bd734ce75d tools/hotplug/NetBSD/rc.d/xencommons
--- a/tools/hotplug/NetBSD/rc.d/xencommons      Thu Feb 02 11:51:49 2012 +0100
+++ b/tools/hotplug/NetBSD/rc.d/xencommons      Thu Feb 02 11:54:58 2012 +0100
@@ -22,6 +22,7 @@ required_files="/kern/xen/privcmd"
 
 XENSTORED_PIDFILE="/var/run/xenstored.pid"
 XENCONSOLED_PIDFILE="/var/run/xenconsoled.pid"
+XLDEVICED_PIDFILE="/var/run/xldeviced.pid"
 #XENCONSOLED_TRACE="/var/log/xen/xenconsole-trace.log"
 #XENSTORED_TRACE="/var/log/xen/xenstore-trace.log"
 
@@ -42,7 +43,7 @@ xen_startcmd()
                        XENSTORED_ROOTDIR="/var/lib/xenstored"
                fi
                rm -f ${XENSTORED_ROOTDIR}/tdb* >/dev/null 2>&1
-               printf "Starting xenservices: xenstored, xenconsoled."
+               printf "Starting xenservices: xenstored, xenconsoled, 
xldeviced."
                XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
                if [ -n "${XENSTORED_TRACE}" ]; then
                        XENSTORED_ARGS="${XENSTORED_ARGS} -T 
/var/log/xen/xenstored-trace.log"
@@ -54,7 +55,7 @@ xen_startcmd()
                        sleep 1
                done
        else
-               printf "Starting xenservices: xenconsoled."
+               printf "Starting xenservices: xenconsoled, xldeviced."
        fi
 
        XENCONSOLED_ARGS=""
@@ -63,21 +64,26 @@ xen_startcmd()
        fi
 
        ${SBINDIR}/xenconsoled ${XENCONSOLED_ARGS}
+       ${SBINDIR}/xldeviced -p ${XLDEVICED_PIDFILE}
 
        printf "\n"
 
        printf "Setting domain 0 name.\n"
        ${BINDIR}/xenstore-write "/local/domain/0/name" "Domain-0"
+       printf "Setting domain 0 id.\n"
+       ${BINDIR}/xenstore-write "/local/domain/0/domid" "0"
 }
 
 xen_stop()
 {
        pids=""
-       printf "Stopping xencommons.\n"
+       printf "Stopping xencommons, xldeviced.\n"
        printf "WARNING: Not stopping xenstored, as it cannot be restarted.\n"
 
        rc_pid=$(check_pidfile ${XENCONSOLED_PIDFILE} ${SBINDIR}/xenconsoled)
        pids="$pids $rc_pid"
+       rc_pid=$(check_pidfile ${XLDEVICED_PIDFILE} ${SBINDIR}/xldeviced)
+       pids="$pids $rc_pid"
 
        kill -${sig_stop:-TERM} $pids
        wait_for_pids $pids
@@ -95,12 +101,17 @@ xen_status()
                pids="$pids $xenconsoled_pid"
        fi
 
-       if test -n "$xenconsoled_pid" -a -n "$xenstored_pid";
+       xldeviced_pid=$(check_pidfile ${XLDEVICED_PIDFILE} ${SBINDIR}/xldeviced)
+       if test -n ${xldeviced_pid}; then
+               pids="$pids $xldeviced_pid"
+       fi
+
+       if test -n "$xenconsoled_pid" -a -n "$xenstored_pid" -a -n 
"$xldeviced_pid";
        then
                echo "xencommons are running as pids $pids."
                return 0
        fi
-       if test -z "$xenconsoled_pid" -a -z "$xenstored_pid";
+       if test -z "$xenconsoled_pid" -a -z "$xenstored_pid" -a -z 
"$xldeviced_pid";
        then
                echo "xencommons are not running."
                return 0
@@ -116,6 +127,11 @@ xen_status()
        else
                echo "xenconsoled is not running."
        fi
+       if test -n $xldeviced_pid; then
+               echo "xldeviced is running as pid $xldeviced_pid."
+       else
+               echo "xldeviced is not running."
+       fi
 }
 
 load_rc_config $name

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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