Merge lp:~gnuoy/ubuntu/trusty/ceph/1477225 into lp:ubuntu/trusty-proposed/ceph

Proposed by Liam Young
Status: Merged
Merge reported by: James Page
Merged at revision: not available
Proposed branch: lp:~gnuoy/ubuntu/trusty/ceph/1477225
Merge into: lp:ubuntu/trusty-proposed/ceph
Diff against target: 395 lines (+320/-1)
9 files modified
.pc/1cca0c1.patch/src/init-radosgw (+98/-0)
.pc/1cca0c1.patch/src/init-radosgw.sysv (+112/-0)
.pc/applied-patches (+1/-0)
debian/changelog (+7/-0)
debian/patches/1cca0c1.patch (+60/-0)
debian/patches/init-script-stop.patch (+21/-0)
debian/patches/series (+1/-0)
src/init-radosgw (+9/-1)
src/init-radosgw.sysv (+11/-0)
To merge this branch: bzr merge lp:~gnuoy/ubuntu/trusty/ceph/1477225
Reviewer Review Type Date Requested Status
James Page Pending
Review via email: mp+270299@code.launchpad.net
To post a comment you must log in.
lp:~gnuoy/ubuntu/trusty/ceph/1477225 updated
68. By Liam Young

Use git patch for traceablility

69. By Liam Young

Use git patch (not plain diff) for traceablility

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.pc/1cca0c1.patch'
2=== added file '.pc/1cca0c1.patch/.timestamp'
3=== added directory '.pc/1cca0c1.patch/src'
4=== added file '.pc/1cca0c1.patch/src/init-radosgw'
5--- .pc/1cca0c1.patch/src/init-radosgw 1970-01-01 00:00:00 +0000
6+++ .pc/1cca0c1.patch/src/init-radosgw 2015-09-07 14:18:40 +0000
7@@ -0,0 +1,98 @@
8+#! /bin/sh
9+### BEGIN INIT INFO
10+# Provides: radosgw
11+# Required-Start: $remote_fs $named $network $time
12+# Required-Stop: $remote_fs $named $network $time
13+# Default-Start: 2 3 4 5
14+# Default-Stop: 0 1 6
15+# Short-Description: radosgw RESTful rados gateway
16+# Description: radosgw RESTful rados gateway
17+### END INIT INFO
18+
19+PATH=/sbin:/bin:/usr/bin
20+
21+. /lib/lsb/init-functions
22+
23+daemon_is_running() {
24+ daemon=$1
25+ if pidof $daemon >/dev/null; then
26+ echo "$daemon is running."
27+ exit 0
28+ else
29+ echo "$daemon is not running."
30+ exit 1
31+ fi
32+}
33+
34+VERBOSE=0
35+for opt in $*; do
36+ if [ "$opt" = "-v" ] || [ "$opt" = "--verbose" ]; then
37+ VERBOSE=1
38+ fi
39+done
40+
41+# prefix for radosgw instances in ceph.conf
42+PREFIX='client.radosgw.'
43+
44+# user to run radosgw as (it not specified in ceph.conf)
45+DEFAULT_USER='root'
46+
47+RADOSGW=`which radosgw`
48+if [ ! -x "$RADOSGW" ]; then
49+ [ $VERBOSE -eq 1 ] && echo "$RADOSGW could not start, it is not executable."
50+ exit 1
51+fi
52+
53+case "$1" in
54+ start)
55+ for name in `ceph-conf --list-sections $PREFIX`;
56+ do
57+ auto_start=`ceph-conf -n $name 'auto start'`
58+ if [ "$auto_start" = "no" ] || [ "$auto_start" = "false" ] || [ "$auto_start" = "0" ]; then
59+ continue
60+ fi
61+
62+ # mapped to this host?
63+ host=`ceph-conf -n $name host`
64+ hostname=`hostname -s`
65+ if [ "$host" != "$hostname" ]; then
66+ [ $VERBOSE -eq 1 ] && echo "hostname $hostname could not be found in ceph.conf:[$name], not starting."
67+ continue
68+ fi
69+
70+ user=`ceph-conf -n $name user`
71+ if [ -z "$user" ]; then
72+ user="$DEFAULT_USER"
73+ fi
74+
75+ log_file=`$RADOSGW -n $name --show-config-value log_file`
76+ if [ -n "$log_file" ] && [ ! -e "$log_file" ]; then
77+ touch "$log_file"
78+ chown $user $log_file
79+ fi
80+
81+ echo "Starting $name..."
82+ start-stop-daemon --start -u $user -x $RADOSGW -- -n $name
83+ done
84+ daemon_is_running $RADOSGW
85+ ;;
86+ reload)
87+ echo "Reloading $name..."
88+ start-stop-daemon --stop --signal HUP -x $RADOSGW --oknodo
89+ ;;
90+ restart|force-reload)
91+ $0 stop
92+ $0 start
93+ ;;
94+ stop)
95+ start-stop-daemon --stop -x $RADOSGW --oknodo
96+ ;;
97+ status)
98+ daemon_is_running $RADOSGW
99+ ;;
100+ *)
101+ echo "Usage: $0 {start|stop|restart|force-reload|reload|status} [-v|--verbose]" >&2
102+ exit 3
103+ ;;
104+esac
105+
106
107=== added file '.pc/1cca0c1.patch/src/init-radosgw.sysv'
108--- .pc/1cca0c1.patch/src/init-radosgw.sysv 1970-01-01 00:00:00 +0000
109+++ .pc/1cca0c1.patch/src/init-radosgw.sysv 2015-09-07 14:18:40 +0000
110@@ -0,0 +1,112 @@
111+#! /bin/bash
112+### BEGIN INIT INFO
113+# Provides: radosgw
114+# Required-Start: $remote_fs $named $network $time
115+# Required-Stop: $remote_fs $named $network $time
116+# Default-Start: 2 3 4 5
117+# Default-Stop: 0 1 6
118+# Short-Description: radosgw RESTful rados gateway
119+### END INIT INFO
120+
121+PATH=/sbin:/bin:/usr/bin
122+
123+#. /lib/lsb/init-functions
124+. /etc/rc.d/init.d/functions
125+
126+daemon_is_running() {
127+ daemon=$1
128+ sleep 1
129+ if pidof $daemon >/dev/null; then
130+ echo "$daemon is running."
131+ exit 0
132+ else
133+ echo "$daemon is not running."
134+ exit 1
135+ fi
136+}
137+
138+VERBOSE=0
139+for opt in $*; do
140+ if [ "$opt" = "-v" ] || [ "$opt" = "--verbose" ]; then
141+ VERBOSE=1
142+ fi
143+done
144+
145+# prefix for radosgw instances in ceph.conf
146+PREFIX='client.radosgw.'
147+
148+# user to run radosgw as (it not specified in ceph.conf)
149+#DEFAULT_USER='www-data'
150+DEFAULT_USER='root'
151+
152+RADOSGW=`which radosgw`
153+if [ ! -x "$RADOSGW" ]; then
154+ [ $VERBOSE -eq 1 ] && echo "$RADOSGW could not start, it is not executable."
155+ exit 1
156+fi
157+
158+# detect systemd
159+SYSTEMD=0
160+grep -qs systemd /proc/1/comm && SYSTEMD=1
161+
162+case "$1" in
163+ start)
164+ echo "Starting radosgw instance(s)..."
165+ for name in `ceph-conf --list-sections $PREFIX`;
166+ do
167+ auto_start=`ceph-conf -n $name 'auto start'`
168+ if [ "$auto_start" = "no" ] || [ "$auto_start" = "false" ] || [ "$auto_start" = "0" ]; then
169+ continue
170+ fi
171+
172+ # mapped to this host?
173+ host=`ceph-conf -n $name host`
174+ hostname=`hostname -s`
175+ if [ "$host" != "$hostname" ]; then
176+ [ $VERBOSE -eq 1 ] && echo "hostname $hostname could not be found in ceph.conf:[$name], not starting."
177+ continue
178+ fi
179+
180+ user=`ceph-conf -n $name user`
181+ if [ -z "$user" ]; then
182+ user="$DEFAULT_USER"
183+ fi
184+
185+ log_file=`$RADOSGW -n $name --show-config-value log_file`
186+ if [ -n "$log_file" ] && [ ! -e "$log_file" ]; then
187+ touch "$log_file"
188+ chown $user $log_file
189+ fi
190+
191+ if [ $SYSTEMD -eq 1 ]; then
192+ systemd-run -r sudo -u "$user" bash -c "ulimit -n 32768; $RADOSGW -n $name"
193+ else
194+ ulimit -n 32768
195+ daemon --user="$user" "$RADOSGW -n $name"
196+ fi
197+ echo "Starting $name..."
198+ done
199+ daemon_is_running $RADOSGW
200+ ;;
201+ reload)
202+ #start-stop-daemon --signal HUP -x $RADOSGW --oknodo
203+ killproc $RADOSGW -SIGHUP
204+ echo "Reloading radosgw instance(s)..."
205+ ;;
206+ restart|force-reload)
207+ $0 stop
208+ $0 start
209+ ;;
210+ stop)
211+ #start-stop-daemon --stop -x $RADOSGW --oknodo
212+ killproc $RADOSGW
213+ echo "Stopping radosgw instance(s)..."
214+ ;;
215+ status)
216+ daemon_is_running $RADOSGW
217+ ;;
218+ *)
219+ echo "Usage: $0 {start|stop|restart|force-reload|reload|status} [-v|--verbose]" >&2
220+ exit 3
221+ ;;
222+esac
223
224=== modified file '.pc/applied-patches'
225--- .pc/applied-patches 2015-08-10 11:00:44 +0000
226+++ .pc/applied-patches 2015-09-07 14:18:40 +0000
227@@ -2,3 +2,4 @@
228 modules.patch
229 increaseFileLimit.patch
230 zap-in-two-phases.patch
231+1cca0c1.patch
232
233=== added file '.pc/increaseFileLimit.patch/.timestamp'
234=== added file '.pc/modules.patch/.timestamp'
235=== added file '.pc/virtualenv-never-download/.timestamp'
236=== added file '.pc/zap-in-two-phases.patch/.timestamp'
237=== modified file 'debian/changelog'
238--- debian/changelog 2015-08-10 11:00:44 +0000
239+++ debian/changelog 2015-09-07 14:18:40 +0000
240@@ -1,3 +1,10 @@
241+ceph (0.80.10-0ubuntu1.14.04.4) UNRELEASED; urgency=medium
242+
243+ * Fix stop init script target. (LP: #1477225)
244+ - d/p/1cca0c1.patch
245+
246+ -- Liam Young <liam.young@canonical.com> Mon, 07 Sep 2015 15:12:04 +0100
247+
248 ceph (0.80.10-0ubuntu1.14.04.2) trusty; urgency=medium
249
250 * Switch to two step 'zapping' of disks, ensuring that disks with invalid
251
252=== added file 'debian/patches/1cca0c1.patch'
253--- debian/patches/1cca0c1.patch 1970-01-01 00:00:00 +0000
254+++ debian/patches/1cca0c1.patch 2015-09-07 14:18:40 +0000
255@@ -0,0 +1,60 @@
256+From 1cca0c1e91a1e18f82f4d22855e96b2fc947f5ea Mon Sep 17 00:00:00 2001
257+From: Dmitry Yatsushkevich <dyatsushkevich@mirantis.com>
258+Date: Tue, 17 Mar 2015 15:44:52 -0700
259+Subject: [PATCH] rgw: init script waits until the radosgw stops
260+
261+Fixes: #11140
262+Init script waits in stop action until the radowgw daemons stop.
263+
264+Signed-off-by: Dmitry Yatsushkevich <dyatsushkevich@mirantis.com>
265+---
266+ src/init-radosgw | 10 +++++++++-
267+ src/init-radosgw.sysv | 11 +++++++++++
268+ 2 files changed, 20 insertions(+), 1 deletion(-)
269+
270+diff --git a/src/init-radosgw b/src/init-radosgw
271+index 1ef71c4..8c4b6b8 100644
272+--- a/src/init-radosgw
273++++ b/src/init-radosgw
274+@@ -93,7 +93,15 @@ case "$1" in
275+ $0 start
276+ ;;
277+ stop)
278+- start-stop-daemon --stop -x $RADOSGW --oknodo
279++ timeout=0
280++ for name in `ceph-conf --list-sections $PREFIX`;
281++ do
282++ t=`$RADOSGW -n $name --show-config-value rgw_exit_timeout_secs`
283++ if [ $t -gt $timeout ]; then timeout=$t; fi
284++ done
285++
286++ if [ $timeout -gt 0 ]; then TIMEOUT="-R $timeout"; fi
287++ start-stop-daemon --stop -x $RADOSGW --oknodo $TIMEOUT
288+ ;;
289+ status)
290+ daemon_is_running $RADOSGW
291+diff --git a/src/init-radosgw.sysv b/src/init-radosgw.sysv
292+index e210b79..91d994d 100644
293+--- a/src/init-radosgw.sysv
294++++ b/src/init-radosgw.sysv
295+@@ -107,8 +107,19 @@ case "$1" in
296+ ;;
297+ stop)
298+ #start-stop-daemon --stop -x $RADOSGW --oknodo
299++ timeout=0
300++ for name in `ceph-conf --list-sections $PREFIX`;
301++ do
302++ t=`$RADOSGW -n $name --show-config-value rgw_exit_timeout_secs`
303++ if [ $t -gt $timeout ]; then timeout=$t; fi
304++ done
305++
306+ killproc $RADOSGW
307+ echo "Stopping radosgw instance(s)..."
308++ while pidof $RADOSGW >/dev/null && [ $timeout -gt 0 ] ; do
309++ sleep 1
310++ timeout=$(($timeout - 1))
311++ done
312+ ;;
313+ status)
314+ daemon_is_running $RADOSGW
315+
316
317=== added file 'debian/patches/init-script-stop.patch'
318--- debian/patches/init-script-stop.patch 1970-01-01 00:00:00 +0000
319+++ debian/patches/init-script-stop.patch 2015-09-07 14:18:40 +0000
320@@ -0,0 +1,21 @@
321+Index: ceph/src/init-radosgw
322+===================================================================
323+--- ceph.orig/src/init-radosgw
324++++ ceph/src/init-radosgw
325+@@ -85,7 +85,15 @@ case "$1" in
326+ $0 start
327+ ;;
328+ stop)
329+- start-stop-daemon --stop -x $RADOSGW --oknodo
330++ timeout=0
331++ for name in `ceph-conf --list-sections $PREFIX`;
332++ do
333++ t=`$RADOSGW -n $name --show-config-value rgw_exit_timeout_secs`
334++ if [ $t -gt $timeout ]; then timeout=$t; fi
335++ done
336++
337++ if [ $timeout -gt 0 ]; then TIMEOUT="-R $timeout"; fi
338++ start-stop-daemon --stop -x $RADOSGW --oknodo $TIMEOUT
339+ ;;
340+ status)
341+ daemon_is_running $RADOSGW
342
343=== modified file 'debian/patches/series'
344--- debian/patches/series 2015-08-10 11:00:44 +0000
345+++ debian/patches/series 2015-09-07 14:18:40 +0000
346@@ -2,3 +2,4 @@
347 modules.patch
348 increaseFileLimit.patch
349 zap-in-two-phases.patch
350+1cca0c1.patch
351
352=== modified file 'src/init-radosgw'
353--- src/init-radosgw 2015-07-22 17:12:16 +0000
354+++ src/init-radosgw 2015-09-07 14:18:40 +0000
355@@ -85,7 +85,15 @@
356 $0 start
357 ;;
358 stop)
359- start-stop-daemon --stop -x $RADOSGW --oknodo
360+ timeout=0
361+ for name in `ceph-conf --list-sections $PREFIX`;
362+ do
363+ t=`$RADOSGW -n $name --show-config-value rgw_exit_timeout_secs`
364+ if [ $t -gt $timeout ]; then timeout=$t; fi
365+ done
366+
367+ if [ $timeout -gt 0 ]; then TIMEOUT="-R $timeout"; fi
368+ start-stop-daemon --stop -x $RADOSGW --oknodo $TIMEOUT
369 ;;
370 status)
371 daemon_is_running $RADOSGW
372
373=== modified file 'src/init-radosgw.sysv'
374--- src/init-radosgw.sysv 2015-07-22 17:12:16 +0000
375+++ src/init-radosgw.sysv 2015-09-07 14:18:40 +0000
376@@ -99,8 +99,19 @@
377 ;;
378 stop)
379 #start-stop-daemon --stop -x $RADOSGW --oknodo
380+ timeout=0
381+ for name in `ceph-conf --list-sections $PREFIX`;
382+ do
383+ t=`$RADOSGW -n $name --show-config-value rgw_exit_timeout_secs`
384+ if [ $t -gt $timeout ]; then timeout=$t; fi
385+ done
386+
387 killproc $RADOSGW
388 echo "Stopping radosgw instance(s)..."
389+ while pidof $RADOSGW >/dev/null && [ $timeout -gt 0 ] ; do
390+ sleep 1
391+ timeout=$(($timeout - 1))
392+ done
393 ;;
394 status)
395 daemon_is_running $RADOSGW

Subscribers

People subscribed via source and target branches

to all changes: