]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Propoerly call oslo's Service stop and wait
authorGorka Eguileor <geguileo@redhat.com>
Tue, 16 Feb 2016 18:20:46 +0000 (19:20 +0100)
committerGorka Eguileor <geguileo@redhat.com>
Tue, 16 Feb 2016 18:20:46 +0000 (19:20 +0100)
We are not calling oslo_service.Service's stop method with the graceful
parameter which ensure that stop waits for threads to properly stop
instead of just forcefully stopping them.  This is not an issue for
Cinder at this moment because the rpcserver.stop call waits for
everything to gracefully stop, but we may have something there running
and we wouldn't want to kill it.

We should also call oslo_service.Service.wait method from our
Service.wait method.

This patch ensures that we are properly calling oslo_Service.Service's
methods.

Change-Id: I8764571c41509fdf1ff7950e9d8d7d6cf0d2f57d

cinder/service.py

index 6054da6c5ea4c3520964386057d08470ad0debb6..650d75f6376c0d858e7936d30130b2d467e3d8e3 100644 (file)
@@ -277,7 +277,7 @@ class Service(service.Service):
                 x.stop()
             except Exception:
                 self.timers_skip.append(x)
-        super(Service, self).stop()
+        super(Service, self).stop(graceful=True)
 
     def wait(self):
         skip = getattr(self, 'timers_skip', [])
@@ -289,6 +289,7 @@ class Service(service.Service):
                     pass
         if self.rpcserver:
             self.rpcserver.wait()
+        super(Service, self).wait()
 
     def periodic_tasks(self, raise_on_error=False):
         """Tasks to be run at a periodic interval."""