[openstack-glance/el6-grizzly] add the scrubber service to support deferred image deletion
Pádraig Brady
pbrady at fedoraproject.org
Mon May 13 14:36:52 UTC 2013
commit 57bb77f7fb4afe0773e3d73fb17d63c2204e3aaf
Author: Pádraig Brady <P at draigBrady.com>
Date: Mon May 13 15:25:42 2013 +0100
add the scrubber service to support deferred image deletion
openstack-glance-scrubber.init | 101 +++++++++++++++++++++++++++++++++++++
openstack-glance-scrubber.upstart | 8 +++
openstack-glance.spec | 20 ++++++--
3 files changed, 125 insertions(+), 4 deletions(-)
---
diff --git a/openstack-glance-scrubber.init b/openstack-glance-scrubber.init
new file mode 100644
index 0000000..09c1e0b
--- /dev/null
+++ b/openstack-glance-scrubber.init
@@ -0,0 +1,101 @@
+#!/bin/sh
+#
+# openstack-glance-scrubber OpenStack Image Service scrubber daemon
+#
+# chkconfig: - 98 02
+# description: OpenStack Image Service (code-named Glance) scrubber daemon
+
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $network $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Stop: 0 1 6
+# Short-Description: Glance scrubber daemon
+# Description: OpenStack Image Service (code-named Glance) scrubber daemon
+### END INIT INFO
+
+. /etc/rc.d/init.d/functions
+
+suffix=scrubber
+prog=openstack-glance-$suffix
+exec="/usr/bin/glance-$suffix"
+user_config="/etc/glance/glance-$suffix.conf"
+pidfile="/var/run/glance/glance-$suffix.pid"
+
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+lockfile=/var/lock/subsys/$prog
+
+start() {
+ [ -x $exec ] || exit 5
+ [ -f $user_config ] || exit 7
+ echo -n $"Starting $prog: "
+ daemon --user glance --pidfile $pidfile "$exec --daemon --config-file $user_config --verbose &>/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-glance-scrubber.upstart b/openstack-glance-scrubber.upstart
new file mode 100644
index 0000000..6c3e29a
--- /dev/null
+++ b/openstack-glance-scrubber.upstart
@@ -0,0 +1,8 @@
+description "OpenStack Image Service (code-named Glance) API server"
+
+start on stopped rc RUNLEVEL=[2345]
+stop on runlevel [S016]
+
+respawn
+
+exec su -s /bin/sh -c "exec /usr/bin/glance-scrubber --daemon --config-file /etc/glance/glance-scrubber.conf" glance
diff --git a/openstack-glance.spec b/openstack-glance.spec
index ebf4ec3..c4cbdec 100644
--- a/openstack-glance.spec
+++ b/openstack-glance.spec
@@ -1,6 +1,6 @@
Name: openstack-glance
Version: 2013.1
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: OpenStack Image Service
Group: Applications/System
@@ -11,7 +11,9 @@ Source1: openstack-glance-api.init
Source100: openstack-glance-api.upstart
Source2: openstack-glance-registry.init
Source200: openstack-glance-registry.upstart
-Source3: openstack-glance.logrotate
+Source3: openstack-glance-scrubber.init
+Source300: openstack-glance-scrubber.upstart
+Source4: openstack-glance.logrotate
#
# patches_base=2013.1
@@ -198,13 +200,15 @@ install -p -D -m 640 etc/schema-image.json %{buildroot}%{_sysconfdir}/glance/sch
# Initscripts
install -p -D -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/openstack-glance-api
install -p -D -m 755 %{SOURCE2} %{buildroot}%{_initrddir}/openstack-glance-registry
+install -p -D -m 755 %{SOURCE3} %{buildroot}%{_initrddir}/openstack-glance-scrubber
# Install upstart jobs examples
install -p -m 644 %{SOURCE100} %{buildroot}%{_datadir}/glance/
install -p -m 644 %{SOURCE200} %{buildroot}%{_datadir}/glance/
+install -p -m 644 %{SOURCE300} %{buildroot}%{_datadir}/glance/
# Logrotate config
-install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-glance
+install -p -D -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-glance
# Install pid directory
install -d -m 755 %{buildroot}%{_localstatedir}/run/glance
@@ -222,6 +226,7 @@ exit 0
%post
/sbin/chkconfig --add openstack-glance-api
/sbin/chkconfig --add openstack-glance-registry
+/sbin/chkconfig --add openstack-glance-scrubber
%preun
if [ $1 = 0 ] ; then
@@ -229,12 +234,14 @@ if [ $1 = 0 ] ; then
/sbin/chkconfig --del openstack-glance-api
/sbin/service openstack-glance-registry stop >/dev/null 2>&1
/sbin/chkconfig --del openstack-glance-registry
+ /sbin/service openstack-glance-scrubber stop >/dev/null 2>&1
+ /sbin/chkconfig --del openstack-glance-scrubber
fi
%postun
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
- for svc in api registry ; do
+ for svc in api registry scrubber; do
/sbin/service openstack-glance-${svc} condrestart > /dev/null 2>&1 || :
done
fi
@@ -253,9 +260,11 @@ fi
%{_bindir}/glance-replicator
%{_initrddir}/openstack-glance-api
%{_initrddir}/openstack-glance-registry
+%{_initrddir}/openstack-glance-scrubber
%dir %{_datadir}/glance
%{_datadir}/glance/openstack-glance-api.upstart
%{_datadir}/glance/openstack-glance-registry.upstart
+%{_datadir}/glance/openstack-glance-scrubber.upstart
%{_mandir}/man1/glance*.1.gz
%dir %{_sysconfdir}/glance
%config(noreplace) %attr(-, root, glance) %{_sysconfdir}/glance/glance-api.conf
@@ -281,6 +290,9 @@ fi
%doc doc/build/html
%changelog
+* Mon May 13 2013 Pádraig Brady <P at draigBrady.com> 2013.1-3
+- Add the scrubber service for deferred image deletion
+
* Mon May 13 2013 Pádraig Brady <P at draigBrady.com> 2013.1-2
- Avoid issue with crypto compat patch (#906051)
More information about the scm-commits
mailing list