]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: init script waits until the radosgw stops
authorDmitry Yatsushkevich <dyatsushkevich@mirantis.com>
Tue, 17 Mar 2015 22:44:52 +0000 (15:44 -0700)
committerLoic Dachary <ldachary@redhat.com>
Fri, 2 Oct 2015 14:35:49 +0000 (16:35 +0200)
Fixes: #11140
Init script waits in stop action until the radowgw daemons stop.

Signed-off-by: Dmitry Yatsushkevich <dyatsushkevich@mirantis.com>
(cherry picked from commit 1cca0c1e91a1e18f82f4d22855e96b2fc947f5ea)

src/init-radosgw
src/init-radosgw.sysv

index 914d6fddcc1a47a165e6d321a6b5314f74c85215..7af51efd51bf46a86b12b12621137a76bf942e3d 100644 (file)
@@ -87,7 +87,15 @@ case "$1" in
         $0 start
         ;;
     stop)
-        start-stop-daemon --stop -x $RADOSGW --oknodo
+        timeout=0
+        for name in `ceph-conf --list-sections $PREFIX`;
+        do
+          t=`$RADOSGW -n $name --show-config-value rgw_exit_timeout_secs`
+          if [ $t -gt $timeout ]; then timeout=$t; fi
+        done
+
+        if [ $timeout -gt 0 ]; then TIMEOUT="-R $timeout"; fi
+        start-stop-daemon --stop -x $RADOSGW --oknodo $TIMEOUT
         ;;
     status)
         daemon_is_running $RADOSGW
index 4ec891ecdd62cdbbf3e00dfd7c8a0ebc0412830a..5e54c7823bcab0ab474acb5b6a78c5093175d607 100644 (file)
@@ -101,8 +101,19 @@ case "$1" in
         ;;
     stop)
         #start-stop-daemon --stop -x $RADOSGW --oknodo
+        timeout=0
+        for name in `ceph-conf --list-sections $PREFIX`;
+        do
+          t=`$RADOSGW -n $name --show-config-value rgw_exit_timeout_secs`
+          if [ $t -gt $timeout ]; then timeout=$t; fi
+        done
+
         killproc $RADOSGW
         echo "Stopping radosgw instance(s)..."
+        while pidof $RADOSGW >/dev/null && [ $timeout -gt 0 ] ; do
+          sleep 1
+          timeout=$(($timeout - 1))
+        done
         ;;
     status)
         daemon_is_running $RADOSGW