~ubuntu-branches/ubuntu/precise/xen-common/precise

« back to all changes in this revision

Viewing changes to tools/hotplug/NetBSD/rc.d/xencommons

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-02-06 10:49:43 UTC
  • mfrom: (10.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20120206104943-fo54o8stjp2ikglj
Tags: 4.1.2-1ubuntu1
* Merge from Debian testing.  Remaining changes:
  - Upate maintainer according to spec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
XENSTORED_PIDFILE="/var/run/xenstored.pid"
24
24
XENCONSOLED_PIDFILE="/var/run/xenconsoled.pid"
25
25
XENBACKENDD_PIDFILE="/var/run/xenbackendd.pid"
 
26
#XENBACKENDD_DEBUG=1
 
27
#XENCONSOLED_TRACE="/var/log/xen/xenconsole-trace.log"
 
28
#XENSTORED_TRACE="/var/log/xen/xenstore-trace.log"
26
29
 
27
30
xen_precmd()
28
31
{
33
36
 
34
37
xen_startcmd()
35
38
{
36
 
        printf "Starting xenservices: xenstored, xenconsoled, xenbackendd.\n"
37
 
        XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
38
 
        if [ -n "${XENSTORED_TRACE}" ]; then
39
 
                XENSTORED_ARGS="${XENSTORED_ARGS} -T /var/log/xen/xenstored-trace.log"
 
39
        local time=0
 
40
        local timeout=30
 
41
 
 
42
        xenstored_pid=$(check_pidfile ${XENSTORED_PIDFILE} ${SBINDIR}/xenstored)
 
43
        if test -z "$xenstored_pid"; then
 
44
                printf "Cleaning xenstore database.\n"
 
45
                if [ -z "${XENSTORED_ROOTDIR}" ]; then
 
46
                        XENSTORED_ROOTDIR="/var/lib/xenstored"
 
47
                fi
 
48
                rm -f ${XENSTORED_ROOTDIR}/tdb* >/dev/null 2>&1
 
49
                printf "Starting xenservices: xenstored, xenconsoled, xenbackendd."
 
50
                XENSTORED_ARGS=" --pid-file ${XENSTORED_PIDFILE}"
 
51
                if [ -n "${XENSTORED_TRACE}" ]; then
 
52
                        XENSTORED_ARGS="${XENSTORED_ARGS} -T /var/log/xen/xenstored-trace.log"
 
53
                fi
 
54
                ${SBINDIR}/xenstored ${XENSTORED_ARGS}
 
55
                while [ $time -lt $timeout ] && ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1` ; do
 
56
                        printf "."
 
57
                        time=$(($time+1))
 
58
                        sleep 1
 
59
                done
 
60
        else
 
61
                printf "Starting xenservices: xenconsoled, xenbackendd."
40
62
        fi
41
63
 
42
 
        ${SBINDIR}/xenstored ${XENSTORED_ARGS}
43
 
        sleep 5
44
 
 
45
64
        XENCONSOLED_ARGS=""
46
65
        if [ -n "${XENCONSOLED_TRACE}" ]; then
47
66
                XENCONSOLED_ARGS="${XENCONSOLED_ARGS} --log=${XENCONSOLED_TRACE}"
55
74
        fi
56
75
 
57
76
        ${SBINDIR}/xenbackendd ${XENBACKENDD_ARGS}
 
77
 
 
78
        printf "\n"
 
79
 
 
80
        printf "Setting domain 0 name.\n"
 
81
        ${BINDIR}/xenstore-write "/local/domain/0/name" "Domain-0"
58
82
}
59
83
 
60
84
xen_stop()
61
85
{
62
86
        pids=""
63
 
        printf "Stopping xencommons"
 
87
        printf "Stopping xencommons.\n"
 
88
        printf "WARNING: Not stopping xenstored, as it cannot be restarted.\n"
64
89
 
65
90
        rc_pid=$(check_pidfile ${XENBACKENDD_PIDFILE} ${SBINDIR}/xenbackendd)
66
91
        pids="$pids $rc_pid"
67
92
        rc_pid=$(check_pidfile ${XENCONSOLED_PIDFILE} ${SBINDIR}/xenconsoled)
68
93
        pids="$pids $rc_pid"
69
 
        rc_pid=$(check_pidfile ${XENSTORED_PIDFILE} ${SBINDIR}/xenstored)
70
 
        pids="$pids $rc_pid"
71
94
 
72
95
        kill -${sig_stop:-TERM} $pids
73
96
        wait_for_pids $pids
74
 
 
75
 
        printf ".\n"
76
97
}
77
98
 
78
99
xen_status()