[openstack-cinder/el6-havana] Add init script for backup service

Eric Harney eharney at fedoraproject.org
Mon Aug 26 21:52:06 UTC 2013


commit e38e4586f126f6e60976b8b0df1defa3edcdcfc5
Author: Eric Harney <eharney at redhat.com>
Date:   Mon Aug 26 17:32:21 2013 -0400

    Add init script for backup service

 openstack-cinder-backup.init    |  104 +++++++++++++++++++++++++++++++++++++++
 openstack-cinder-backup.upstart |    8 +++
 openstack-cinder.spec           |    9 +++-
 3 files changed, 120 insertions(+), 1 deletions(-)
---
diff --git a/openstack-cinder-backup.init b/openstack-cinder-backup.init
new file mode 100644
index 0000000..2e9593a
--- /dev/null
+++ b/openstack-cinder-backup.init
@@ -0,0 +1,104 @@
+#!/bin/sh
+#
+# openstack-cinder-backup  OpenStack Cinder Backup Service
+#
+# chkconfig:   - 98 02
+# description:	The backup service provides a way to back up Cinder \
+#               volume data.
+
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $network $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Stop: 0 1 6
+# Short-Description: OpenStack Cinder Backup Service
+# Description:	The backup service provides a way to back up Cinder \
+#		volume data.
+### END INIT INFO
+
+. /etc/rc.d/init.d/functions
+
+suffix=backup
+prog=openstack-cinder-$suffix
+exec="/usr/bin/cinder-$suffix"
+config="/etc/cinder/cinder.conf"
+pidfile="/var/run/cinder/cinder-$suffix.pid"
+logfile="/var/log/cinder/$suffix.log"
+
+[ -e /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 --config-file $config --logfile $logfile &>/dev/null & echo \$! > $pidfile"
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    echo -n $"Stopping $prog: "
+    killproc -p $pidfile $prog
+    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 $?
diff --git a/openstack-cinder-backup.upstart b/openstack-cinder-backup.upstart
new file mode 100644
index 0000000..a90cb67
--- /dev/null
+++ b/openstack-cinder-backup.upstart
@@ -0,0 +1,8 @@
+description "OpenStack Cinder Backup Server"
+
+start on stopped rc RUNLEVEL=[2345]
+stop on runlevel [S016]
+
+respawn
+
+exec su -s /bin/sh -c "exec /usr/bin/cinder-backup --config-file /etc/cinder/cinder.conf --logfile /var/log/cinder/backup.log" cinder
diff --git a/openstack-cinder.spec b/openstack-cinder.spec
index 86de65a..f0b141d 100644
--- a/openstack-cinder.spec
+++ b/openstack-cinder.spec
@@ -2,7 +2,7 @@
 
 Name:             openstack-cinder
 Version:          2013.2
-Release:          0.4.b2%{?dist}
+Release:          0.5.b2%{?dist}
 Summary:          OpenStack Volume service
 
 Group:            Applications/System
@@ -19,6 +19,8 @@ Source11:         openstack-cinder-scheduler.init
 Source110:        openstack-cinder-scheduler.upstart
 Source12:         openstack-cinder-volume.init
 Source120:        openstack-cinder-volume.upstart
+Source13:         openstack-cinder-backup.init
+Source130:        openstack-cinder-backup.upstart
 
 Source20:         cinder-sudoers
 
@@ -211,6 +213,7 @@ install -p -D -m 640 etc/cinder/policy.json %{buildroot}%{_sysconfdir}/cinder/po
 install -p -D -m 755 %{SOURCE10} %{buildroot}%{_initrddir}/openstack-cinder-api
 install -p -D -m 755 %{SOURCE11} %{buildroot}%{_initrddir}/openstack-cinder-scheduler
 install -p -D -m 755 %{SOURCE12} %{buildroot}%{_initrddir}/openstack-cinder-volume
+install -p -D -m 755 %{SOURCE13} %{buildroot}%{_initrddir}/openstack-cinder-backup
 
 # Install sudoers
 install -p -D -m 440 %{SOURCE20} %{buildroot}%{_sysconfdir}/sudoers.d/cinder
@@ -226,6 +229,7 @@ install -d -m 755 %{buildroot}%{_datadir}/cinder
 install -p -m 644 %{SOURCE100} %{buildroot}%{_datadir}/cinder/
 install -p -m 644 %{SOURCE110} %{buildroot}%{_datadir}/cinder/
 install -p -m 644 %{SOURCE120} %{buildroot}%{_datadir}/cinder/
+install -p -m 644 %{SOURCE130} %{buildroot}%{_datadir}/cinder/
 
 # Install rootwrap files in /usr/share/cinder/rootwrap
 mkdir -p %{buildroot}%{_datarootdir}/cinder/rootwrap/
@@ -304,6 +308,9 @@ fi
 %endif
 
 %changelog
+* Mon Aug 26 2013 Eric Harney <eharney at redhat.com> - 2013.2-0.5.b2
+- Add cinder-backup service init script
+
 * Mon Jul 22 2013 Pádraig Brady <pbrady at redhat.com> - 2013.2-0.4.b2
 - Add dependency on python-suds to support the netapp driver
 - Add dependency on python-keystoneclient for auth token middleware


More information about the scm-commits mailing list