~gandelman-a/nova/libvirt_refresh_2

« back to all changes in this revision

Viewing changes to debian/nova-objectstore.init

  • Committer: Chuck Short
  • Date: 2012-02-29 20:08:26 UTC
  • mfrom: (312.1.5 debian-merge)
  • Revision ID: zulcss@ubuntu.com-20120229200826-3s2nektpbonk1dfs
* debain/control: Fix nova-compute-$flavor Depends
* debian/rules: Fix FTBFS.
* Merge Ubuntu/Debian packaging:
  - Thanks to Julien Danjou, Ghe Rivero, and Thomas Goirand
  - debian/copyright: Update copyright file.
  - debian/nova-api.init, debian/nova-compute.init,
    debian/nova-network.init, debian/nova-objectstore,
    debian/nova-scheduler, debian/nova-volume.init:
    Synchronize init scripts.
  - nova-common.install, debian/rules: Install policy.json
  - debian/rules, debian/nova-xcp-network.install,
    debian/nova-xcp-plugins.install, nova-xcp-plugins.postrm,
    debian/nova-xcp-plugins.doc, debian/nova-xcp-plugins.postinst,
    debian/README.xcp_and_openstack, debian/control,
    debian/ubuntu_xen-openvswitch-nova.rules,
    debian/patches/path-to-the-xenhost.conf-fixup.patch:
    Add Xen XCP support.
  - debian/control,
    debian/nova-compute-{kvm,lxc,qemu,xen,uml}.postinst: Make
    nova-compute a virtual package.
  - Dropped ubuntu_ubuntu_control_vars: We dont use it
* New upstream release.
* Dropped python-babel, it will be handled by langpacks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
 
1
#!/bin/sh
2
2
### BEGIN INIT INFO
3
3
# Provides:          nova-objectstore
4
 
# Required-Start:    $remote_fs $syslog
5
 
# Required-Stop:     $remote_fs $syslog
 
4
# Required-Start:    $network $local_fs $remote_fs $syslog
 
5
# Required-Stop:     $remote_fs
6
6
# Default-Start:     2 3 4 5
7
7
# Default-Stop:      0 1 6
8
 
# Short-Description: nova-objectstore
9
 
# Description:       provides virtual machine storage functionalities
 
8
# Short-Description: Nova Objectstore
 
9
# Description:       Provides virtual machine storage functionalities
10
10
### END INIT INFO
11
11
 
12
 
 
13
 
set -e
14
 
 
 
12
# Author: Julien Danjou <acid@debian.org>
 
13
 
 
14
# PATH should only include /usr/* if it runs after the mountnfs.sh script
 
15
PATH=/sbin:/usr/sbin:/bin:/usr/bin
 
16
DESC="OpenStack Compute Objectstore"
 
17
NAME=nova-objectstore
15
18
DAEMON=/usr/bin/nova-objectstore
16
19
DAEMON_ARGS="--flagfile=/etc/nova/nova.conf"
17
 
PIDFILE=/var/run/nova/nova-objectstore.pid
18
 
 
19
 
ENABLED=true
20
 
 
21
 
if test -f /etc/default/nova-objectstore; then
22
 
  . /etc/default/nova-objectstore
23
 
fi
24
 
 
25
 
mkdir -p /var/run/nova
26
 
chown nova:root /var/run/nova/
27
 
 
28
 
mkdir -p /var/lock/nova
29
 
chown nova:root /var/lock/nova/
30
 
 
31
 
uid="$(getent passwd nova | cut -f3 -d:)"
32
 
gid="$(getent passwd nova | cut -f4 -d:)"
 
20
PIDFILE=/var/run/$NAME.pid
 
21
SCRIPTNAME=/etc/init.d/$NAME
 
22
NOVA_USER=nova
 
23
LOCK_DIR=/var/lock/nova/
 
24
 
 
25
# Exit if the package is not installed
 
26
[ -x $DAEMON ] || exit 0
 
27
 
 
28
mkdir -p ${LOCK_DIR}
 
29
chown ${NOVA_USER} ${LOCK_DIR}
 
30
 
 
31
# Read configuration variable file if it is present
 
32
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
33
33
 
34
34
. /lib/lsb/init-functions
35
35
 
36
 
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
 
36
do_start()
 
37
{
 
38
        start-stop-daemon --start --quiet --background --chuid ${NOVA_USER}:nova --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \
 
39
                || return 1
 
40
        start-stop-daemon --start --quiet --background --chuid ${NOVA_USER}:nova --make-pidfile --pidfile $PIDFILE --startas $DAEMON -- \
 
41
                $DAEMON_ARGS \
 
42
                || return 2
 
43
}
37
44
 
38
 
if ! [ -x ${DAEMON} ] ; then
39
 
        exit 0
40
 
fi
 
45
do_stop()
 
46
{
 
47
        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
 
48
        RETVAL="$?"
 
49
        rm -f $PIDFILE
 
50
        return "$RETVAL"
 
51
}
41
52
 
42
53
case "$1" in
43
54
  start)
44
 
    test "$ENABLED" = "true" || exit 0
45
 
    log_daemon_msg "Starting nova objectstore" "nova-objectstore"
46
 
    start-stop-daemon --start --chdir /var/run --chuid ${uid}:${gid} -b -m --pidfile ${PIDFILE} --exec ${DAEMON} -- ${DAEMON_ARGS}
47
 
    log_end_msg $?
48
 
    ;;
 
55
    log_daemon_msg "Starting $DESC " "$NAME"
 
56
    do_start
 
57
    case "$?" in
 
58
                0|1) log_end_msg 0 ;;
 
59
                2) log_end_msg 1 ;;
 
60
        esac
 
61
  ;;
49
62
  stop)
50
 
    test "$ENABLED" = "true" || exit 0
51
 
    log_daemon_msg "Stopping nova objectstore" "nova-objectstore"
52
 
    start-stop-daemon --stop --oknodo --pidfile ${PIDFILE}
53
 
    log_end_msg $?
54
 
    ;;
 
63
        log_daemon_msg "Stopping $DESC" "$NAME"
 
64
        do_stop
 
65
        case "$?" in
 
66
                0|1) log_end_msg 0 ;;
 
67
                2) log_end_msg 1 ;;
 
68
        esac
 
69
        ;;
 
70
  status)
 
71
       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
 
72
       ;;
55
73
  restart|force-reload)
56
 
    test "$ENABLED" = "true" || exit 1
57
 
    $0 stop
58
 
    sleep 1
59
 
    $0 start
60
 
    ;;
61
 
  status)
62
 
    test "$ENABLED" = "true" || exit 0
63
 
    status_of_proc -p $PIDFILE $DAEMON nova-objectstore && exit 0 || exit $?
64
 
    ;;
 
74
        log_daemon_msg "Restarting $DESC" "$NAME"
 
75
        do_stop
 
76
        case "$?" in
 
77
          0|1)
 
78
                do_start
 
79
                case "$?" in
 
80
                        0) log_end_msg 0 ;;
 
81
                        1) log_end_msg 1 ;; # Old process is still running
 
82
                        *) log_end_msg 1 ;; # Failed to start
 
83
                esac
 
84
                ;;
 
85
          *)
 
86
                # Failed to stop
 
87
                log_end_msg 1
 
88
                ;;
 
89
        esac
 
90
        ;;
65
91
  *)
66
 
    log_action_msg "Usage: /etc/init.d/nova-objectstore {start|stop|restart|force-reload|status}"
67
 
    exit 1
68
 
    ;;
 
92
        echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
 
93
        exit 3
 
94
        ;;
69
95
esac
70
96
 
71
 
exit 0
 
97
: