[openstack-cinder/f21] Update to Icehouse stable release 2

Haïkel Guémar hguemar at fedoraproject.org
Wed Sep 24 15:33:09 UTC 2014


commit 4e90e1406541c7d803bd40893842a60e3f329622
Author: Haikel Guemar <hguemar at fedoraproject.org>
Date:   Wed Sep 24 17:31:05 2014 +0200

    Update to Icehouse stable release 2

 openstack-cinder-api.init          |  111 ++++++++++++++++++++++++++++++++++++
 openstack-cinder-api.upstart       |    8 +++
 openstack-cinder-backup.init       |  105 ++++++++++++++++++++++++++++++++++
 openstack-cinder-backup.upstart    |    8 +++
 openstack-cinder-scheduler.init    |  103 +++++++++++++++++++++++++++++++++
 openstack-cinder-scheduler.upstart |    8 +++
 openstack-cinder-volume.init       |  111 ++++++++++++++++++++++++++++++++++++
 openstack-cinder-volume.upstart    |    8 +++
 openstack-cinder.spec              |   83 +++++++++++++++++++++++----
 9 files changed, 533 insertions(+), 12 deletions(-)
---
diff --git a/openstack-cinder-api.init b/openstack-cinder-api.init
new file mode 100644
index 0000000..1fb46a7
--- /dev/null
+++ b/openstack-cinder-api.init
@@ -0,0 +1,111 @@
+#!/bin/sh
+#
+# openstack-cinder-api  OpenStack cinder API Server
+#
+# chkconfig:   - 98 02
+# description: At the heart of the cloud framework is an API Server. \
+#              This API Server makes command and control of the      \
+#              hypervisor, storage, and networking programmatically  \
+#              available to users in realization of the definition   \
+#              of cloud computing.
+
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $network $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Stop: 0 1 6
+# Short-Description: OpenStack cinder API Server
+# Description: At the heart of the cloud framework is an API Server.
+#              This API Server makes command and control of the
+#              hypervisor, storage, and networking programmatically
+#              available to users in realization of the definition
+#              of cloud computing.
+### END INIT INFO
+
+. /etc/rc.d/init.d/functions
+
+suffix=api
+prog=openstack-cinder-$suffix
+exec="/usr/bin/cinder-$suffix"
+config="/etc/cinder/cinder.conf"
+distconfig="/usr/share/cinder/cinder-dist.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 $distconfig --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-api.upstart b/openstack-cinder-api.upstart
new file mode 100644
index 0000000..51acbc5
--- /dev/null
+++ b/openstack-cinder-api.upstart
@@ -0,0 +1,8 @@
+description "OpenStack Cinder API Server"
+
+start on stopped rc RUNLEVEL=[2345]
+stop on runlevel [S016]
+
+respawn
+
+exec su -s /bin/sh -c "exec /usr/bin/cinder-api --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf --logfile /var/log/cinder/api.log" cinder
diff --git a/openstack-cinder-backup.init b/openstack-cinder-backup.init
new file mode 100644
index 0000000..ce999f6
--- /dev/null
+++ b/openstack-cinder-backup.init
@@ -0,0 +1,105 @@
+#!/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"
+distconfig="/usr/share/cinder/cinder-dist.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 $distconfig --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..1c23c21
--- /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 /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf --logfile /var/log/cinder/backup.log" cinder
diff --git a/openstack-cinder-scheduler.init b/openstack-cinder-scheduler.init
new file mode 100644
index 0000000..8d1ba8f
--- /dev/null
+++ b/openstack-cinder-scheduler.init
@@ -0,0 +1,103 @@
+#!/bin/sh
+#
+# openstack-cinder-scheduler  OpenStack cinder Scheduler
+#
+# chkconfig:   - 98 02
+# description: Determines which physical hardware to allocate to a virtual resource
+
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $network $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Stop: 0 1 6
+# Short-Description: OpenStack cinder Scheduler
+# Description: Determines which physical hardware to allocate to a virtual resource
+### END INIT INFO
+
+. /etc/rc.d/init.d/functions
+
+suffix=scheduler
+prog=openstack-cinder-$suffix
+exec="/usr/bin/cinder-$suffix"
+config="/etc/cinder/cinder.conf"
+distconfig="/usr/share/cinder/cinder-dist.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 $distconfig --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-scheduler.upstart b/openstack-cinder-scheduler.upstart
new file mode 100644
index 0000000..b152c18
--- /dev/null
+++ b/openstack-cinder-scheduler.upstart
@@ -0,0 +1,8 @@
+description "OpenStack Cinder Scheduler Server"
+
+start on stopped rc RUNLEVEL=[2345]
+stop on runlevel [S016]
+
+respawn
+
+exec su -s /bin/sh -c "exec /usr/bin/cinder-scheduler --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf --logfile /var/log/cinder/scheduler.log" cinder
diff --git a/openstack-cinder-volume.init b/openstack-cinder-volume.init
new file mode 100644
index 0000000..896c6b3
--- /dev/null
+++ b/openstack-cinder-volume.init
@@ -0,0 +1,111 @@
+#!/bin/sh
+#
+# openstack-cinder-volume  OpenStack cinder Volume Worker
+#
+# chkconfig:   - 98 02
+# description:	Volume Workers interact with iSCSI storage to manage    \
+#		LVM-based instance volumes. Specific functions include: \
+#		* Create Volumes                                        \
+#		* Delete 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
+prog=openstack-cinder-$suffix
+exec="/usr/bin/cinder-$suffix"
+config="/etc/cinder/cinder.conf"
+distconfig="/usr/share/cinder/cinder-dist.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 $distconfig --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-volume.upstart b/openstack-cinder-volume.upstart
new file mode 100644
index 0000000..46020f4
--- /dev/null
+++ b/openstack-cinder-volume.upstart
@@ -0,0 +1,8 @@
+description "OpenStack Cinder Volume Server"
+
+start on stopped rc RUNLEVEL=[2345]
+stop on runlevel [S016]
+
+respawn
+
+exec su -s /bin/sh -c "exec /usr/bin/cinder-volume --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf --logfile /var/log/cinder/volume.log" cinder
diff --git a/openstack-cinder.spec b/openstack-cinder.spec
index 2b1960e..ea6bc92 100644
--- a/openstack-cinder.spec
+++ b/openstack-cinder.spec
@@ -2,7 +2,7 @@
 
 Name:             openstack-cinder
 Version:          2014.1.2
-Release:          1%{?dist}
+Release:          2%{?dist}
 Summary:          OpenStack Volume service
 
 Group:            Applications/System
@@ -14,9 +14,17 @@ Source2:          cinder.logrotate
 Source3:          cinder-tgt.conf
 
 Source10:         openstack-cinder-api.service
+Source100:        openstack-cinder-api.init
+Source1000:       openstack-cinder-api.upstart
 Source11:         openstack-cinder-scheduler.service
+Source110:        openstack-cinder-scheduler.init
+Source1100:       openstack-cinder-scheduler.upstart
 Source12:         openstack-cinder-volume.service
+Source120:        openstack-cinder-volume.init
+Source1200:       openstack-cinder-volume.upstart
 Source13:         openstack-cinder-backup.service
+Source130:        openstack-cinder-backup.init
+Source1300:       openstack-cinder-backup.upstart
 
 Source20:         cinder-sudoers
 
@@ -44,11 +52,21 @@ Requires:         python-cinder = %{version}-%{release}
 # as convenience
 Requires:         python-cinderclient
 
-Requires(post):   systemd-units
-Requires(preun):  systemd-units
-Requires(postun): systemd-units
 Requires(pre):    shadow-utils
 
+%if 0%{?rhel} == 6
+Requires(post):   chkconfig
+Requires(postun): initscripts
+Requires(preun):  chkconfig
+Requires(preun):  initscripts
+%else
+BuildRequires:    systemd
+Requires(post):   systemd
+Requires(preun):  systemd
+Requires(postun): systemd
+%endif
+
+
 Requires:         lvm2
 Requires:         targetcli
 Requires:         python-rtslib
@@ -194,6 +212,7 @@ popd
 install -d -m 755 %{buildroot}%{_sharedstatedir}/cinder
 install -d -m 755 %{buildroot}%{_sharedstatedir}/cinder/tmp
 install -d -m 755 %{buildroot}%{_localstatedir}/log/cinder
+install -d -m 755 %{buildroot}%{_datadir}/cinder
 
 # Install config files
 install -d -m 755 %{buildroot}%{_sysconfdir}/cinder
@@ -206,10 +225,22 @@ install -p -D -m 640 etc/cinder/api-paste.ini %{buildroot}%{_sysconfdir}/cinder/
 install -p -D -m 640 etc/cinder/policy.json %{buildroot}%{_sysconfdir}/cinder/policy.json
 
 # Install initscripts for services
+%if 0%{?rhel} == 6
+install -p -D -m 755 %{SOURCE100} %{buildroot}%{_initrddir}/openstack-cinder-api
+install -p -D -m 755 %{SOURCE110} %{buildroot}%{_initrddir}/openstack-cinder-scheduler
+install -p -D -m 755 %{SOURCE120} %{buildroot}%{_initrddir}/openstack-cinder-volume
+install -p -D -m 755 %{SOURCE130} %{buildroot}%{_initrddir}/openstack-cinder-backup
+# Install upstart jobs examples
+install -p -m 644 %{SOURCE1000} %{buildroot}%{_datadir}/cinder/
+install -p -m 644 %{SOURCE1100} %{buildroot}%{_datadir}/cinder/
+install -p -m 644 %{SOURCE1200} %{buildroot}%{_datadir}/cinder/
+install -p -m 644 %{SOURCE1300} %{buildroot}%{_datadir}/cinder/
+%else
 install -p -D -m 644 %{SOURCE10} %{buildroot}%{_unitdir}/openstack-cinder-api.service
 install -p -D -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/openstack-cinder-scheduler.service
 install -p -D -m 644 %{SOURCE12} %{buildroot}%{_unitdir}/openstack-cinder-volume.service
 install -p -D -m 644 %{SOURCE13} %{buildroot}%{_unitdir}/openstack-cinder-backup.service
+%endif
 
 # Install sudoers
 install -p -D -m 440 %{SOURCE20} %{buildroot}%{_sysconfdir}/sudoers.d/cinder
@@ -238,27 +269,47 @@ fi
 exit 0
 
 %post
-if [ $1 -eq 1 ] ; then
-    # Initial installation
-    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
-fi
+%if 0%{?rhel} == 6
+for svc in volume api scheduler backup; do
+    /sbin/chkconfig --add openstack-cinder-$svc
+done
+%else
+%systemd_post openstack-cinder-api.service
+%systemd_post openstack-cinder-scheduler.service
+%systemd_post openstack-cinder-volume.service
+%systemd_post openstack-cinder-backup.service
+%endif
 
 %preun
+%if 0%{?rhel} == 6
 if [ $1 -eq 0 ] ; then
     for svc in volume api scheduler backup; do
-        /bin/systemctl --no-reload disable openstack-cinder-${svc}.service > /dev/null 2>&1 || :
-        /bin/systemctl stop openstack-cinder-${svc}.service > /dev/null 2>&1 || :
+        /sbin/service openstack-cinder-${svc} stop > /dev/null 2>&1
+        /sbin/chkconfig --del openstack-cinder-${svc}
     done
 fi
+%else
+%systemd_preun openstack-cinder-api.service
+%systemd_preun openstack-cinder-scheduler.service
+%systemd_preun openstack-cinder-volume.service
+%systemd_preun openstack-cinder-backup.service
+%endif
 
 %postun
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%if 0%{?rhel} == 6
 if [ $1 -ge 1 ] ; then
     # Package upgrade, not uninstall
     for svc in volume api scheduler backup; do
-        /bin/systemctl try-restart openstack-cinder-${svc}.service >/dev/null 2>&1 || :
+        /sbin/service openstack-cinder-${svc} condrestart > /dev/null 2>&1 || :
     done
 fi
+%else
+%systemd_postun_with_restart openstack-cinder-api.service
+%systemd_postun_with_restart openstack-cinder-scheduler.service
+%systemd_postun_with_restart openstack-cinder-volume.service
+%systemd_postun_with_restart openstack-cinder-backup.service
+%endif
+
 
 %files
 %doc LICENSE
@@ -278,7 +329,11 @@ fi
 %dir %attr(0755, cinder, root) %{_sysconfdir}/cinder/volumes
 
 %{_bindir}/cinder-*
+%if 0%{?rhel} == 6
+%{_initrddir}/openstack-cinder-*
+%else
 %{_unitdir}/*.service
+%endif
 %{_datarootdir}/cinder
 %{_mandir}/man1/cinder*.1.gz
 
@@ -297,6 +352,10 @@ fi
 %endif
 
 %changelog
+* Wed Sep 24 2014 Haïkel Guémar <hguemar at fedoraproject.org> - 2014.1.2-2
+- Macroized systemd scriptlets
+- Add EL6 support for RDO
+
 * Tue Aug 12 2014 Eric Harney <eharney at redhat.com> - 2014.1.2-1
 - Update to Icehouse stable release 2
 


More information about the scm-commits mailing list