3
3
# Provides: nova-volume
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-volume
9
# Description: provides EBS like storage for your virtual machine instances
8
# Short-Description: Nova Volume
9
# Description: Provides EBS like storage for your
10
# virtual machine instances
13
# Author: Julien Danjou <acid@debian.org>
15
# PATH should only include /usr/* if it runs after the mountnfs.sh script
16
PATH=/sbin:/usr/sbin:/bin:/usr/bin
17
DESC="OpenStack Compute Volume"
14
19
DAEMON=/usr/bin/nova-volume
15
20
DAEMON_ARGS="--flagfile=/etc/nova/nova.conf"
16
PIDFILE=/var/run/nova/nova-volume.pid
20
# Guess the VG by getting the first one we see in "vgdisplay -c -A"
21
# if nothing was set in the default file
22
VGDISPLAY=/sbin/vgdisplay
23
if [ -f /etc/default/nova-volume ] ; then
24
. /etc/default/nova-volume
26
if [ -x "${VGDISPLAY}" -a -z "${nova_volume_group}" ] ; then
27
nova_volume_group=`vgdisplay -c -A | tail -n 1 | cut -d":" -f1 | awk '{print $1}'`
30
mkdir -p /var/run/nova
31
chown nova:root /var/run/nova/
33
mkdir -p /var/lock/nova
34
chown nova:root /var/lock/nova/
36
uid="$(getent passwd nova | cut -f3 -d:)"
37
gid="$(getent passwd nova | cut -f4 -d:)"
39
# Adds what has been configured in /etc/default/nova-volume
40
if [ -n ${nova_volume_group} ] ; then
41
DAEMON_ARGS="${DAEMON_ARGS} --volume_group=${nova_volume_group}"
21
PIDFILE=/var/run/$NAME.pid
22
SCRIPTNAME=/etc/init.d/$NAME
24
LOCK_DIR=/var/lock/nova/
26
# Exit if the package is not installed
27
[ -x $DAEMON ] || exit 0
30
chown ${NOVA_USER} ${LOCK_DIR}
32
# Read configuration variable file if it is present
33
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
44
35
. /lib/lsb/init-functions
46
if ! [ -x ${DAEMON} ] ; then
39
# Guess the VG by getting the first one we see in "vgdisplay -c -A"
40
# if nothing was set in the default file
41
VGDISPLAY=/sbin/vgdisplay
42
if [ -z "${nova_volume_group}" -a -x "$VGDISPLAY" ]
44
nova_volume_group=`$VGDISPLAY -c -A | head -n 1 | cut -d":" -f1 | awk '{print $1}'`
47
# Adds what has been configured in /etc/default/nova-volume
48
if [ -n ${nova_volume_group} ] ; then
49
DAEMON_ARGS="${DAEMON_ARGS} --volume_group=${nova_volume_group}"
52
start-stop-daemon --start --quiet --background --chuid ${NOVA_USER}:nova --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \
54
start-stop-daemon --start --quiet --background --chuid ${NOVA_USER}:nova --make-pidfile --pidfile $PIDFILE --startas $DAEMON -- \
61
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
52
test "$ENABLED" = "true" || exit 0
53
log_daemon_msg "Starting nova volume" "nova-volume"
54
start-stop-daemon --start --chdir /var/run --chuid ${uid}:${gid} -b -m --pidfile ${PIDFILE} --exec ${DAEMON} -- ${DAEMON_ARGS}
69
log_daemon_msg "Starting $DESC " "$NAME"
58
test "$ENABLED" = "true" || exit 0
59
log_daemon_msg "Stopping nova volume" "nova-volume"
60
start-stop-daemon --stop --oknodo --pidfile ${PIDFILE}
77
log_daemon_msg "Stopping $DESC" "$NAME"
85
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
63
87
restart|force-reload)
64
test "$ENABLED" = "true" || exit 1
70
test "$ENABLED" = "true" || exit 0
71
status_of_proc -p $PIDFILE $DAEMON nova-volume && exit 0 || exit $?
88
log_daemon_msg "Restarting $DESC" "$NAME"
95
1) log_end_msg 1 ;; # Old process is still running
96
*) log_end_msg 1 ;; # Failed to start
74
log_action_msg "Usage: /etc/init.d/nova-volume {start|stop|restart|force-reload|status}"
106
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2