Propoerly call oslo's Service stop and wait

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
This commit is contained in:
Gorka Eguileor 2016-02-16 19:20:46 +01:00
parent 010df28d76
commit 6daa6ad3f5
1 changed files with 2 additions and 1 deletions

View 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."""