Browse code

Workaround potential failure to shutdown services

Kill them twice to make sure they're good'n'dead. There is a supposed
fix to oslo-incubator code, but we're working around that here in the
meantime with this change.

This returned in Liberty.

Change-Id: I02a7af995dc7de857c4efcf2cef2f95d357c007a
Related-Bug: #1446583
(cherry picked from commit 953baa7998f253681ed31013fd18bd8aa8098b34)

Dan Smith authored on 2015/04/24 01:41:06
Showing 1 changed files
... ...
@@ -1476,6 +1476,22 @@ function stop_process {
1476 1476
         # Kill via pid if we have one available
1477 1477
         if [[ -r $SERVICE_DIR/$SCREEN_NAME/$service.pid ]]; then
1478 1478
             pkill -g $(cat $SERVICE_DIR/$SCREEN_NAME/$service.pid)
1479
+            # oslo.service tends to stop actually shutting down
1480
+            # reliably in between releases because someone believes it
1481
+            # is dying too early due to some inflight work they
1482
+            # have. This is a tension. It happens often enough we're
1483
+            # going to just account for it in devstack and assume it
1484
+            # doesn't work.
1485
+            #
1486
+            # Set OSLO_SERVICE_WORKS=True to skip this block
1487
+            if [[ -z "$OSLO_SERVICE_WORKS" ]]; then
1488
+                # TODO(danms): Remove this double-kill when we have
1489
+                # this fixed in all services:
1490
+                # https://bugs.launchpad.net/oslo-incubator/+bug/1446583
1491
+                sleep 1
1492
+                # /bin/true becakse pkill on a non existant process returns an error
1493
+                pkill -g $(cat $SERVICE_DIR/$SCREEN_NAME/$service.pid) || /bin/true
1494
+            fi
1479 1495
             rm $SERVICE_DIR/$SCREEN_NAME/$service.pid
1480 1496
         fi
1481 1497
         if [[ "$USE_SCREEN" = "True" ]]; then