fuel-library/deployment/puppet/vmware/files/openstack-cinder-volume-vmware
Alexander Arzhanov 5473fb6c33 Refactor cinder-vmware role
Change-Id: Ibe86b7794d347e11d0465b927502bd58e2356b1a
Implements: blueprint refactor-cinder-vmware-role
2015-12-02 21:54:50 +03:00

115 lines
2.6 KiB
Bash

#!/bin/sh
#
# openstack-cinder-volume OpenStack Cinder Volume Services
#
# chkconfig: - 98 02
# description: Volume Workers interact with iSCSI storage to manage \
# LVM-based instance volumes. Specific functions include: \
# * Create Volumes \
# * Establish Compute volumes
## BEGIN INIT INFO
# Provides:
# Required-Start: $remote_fs $network $syslog
# Required-Stop: $remote_fs $syslog
# Default-Stop: 0 1 6
# Short-Description: OpenStack cinder Volume Worker
# Description: Volume Workers interact with iSCSI storage to manage
# LVM-based instance volumes. Specific functions include:
# * Create Volumes
# * Delete Volumes
# * Establish Compute volumes
### END INIT INFO
. /etc/rc.d/init.d/functions
suffix=volume
cluster=${0##*-} # s/cluster/index/
prog=openstack-cinder-$suffix-vmware-$cluster
exec="/usr/bin/cinder-$suffix"
config="/etc/cinder/cinder.conf"
pidfile="/var/run/cinder/cinder-$suffix.$cluster.pid"
logfile="/var/log/cinder/$suffix-$cluster.log"
[ -r /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
lockfile=/var/lock/subsys/$prog
start() {
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
echo -n $"Starting $prog: "
daemon --user cinder --pidfile $pidfile "$exec --logfile $logfile --config-file=$config ${OPTIONS} &>/dev/null & echo \$! > $pidfile"
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $pidfile ${prog%%.*}
if pgrep -f "cinder-$suffix.*$cluster\.conf" &>/dev/null ; then
sleep 2
pgrep -f "cinder-$suffix.*$cluster\.conf" &>/dev/null && \
pkill -f "$cluster.conf"
fi
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
status -p $pidfile $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?