Retry Coordinator start indefinitely
Change-Id: Iab9a131bf2b606431033236ec40dcda655a9ee78 Closes-Bug: 1514602
This commit is contained in:
parent
62f578174b
commit
c4c421e528
@ -17,6 +17,7 @@
|
||||
# under the License.
|
||||
|
||||
import math
|
||||
import time
|
||||
import uuid
|
||||
|
||||
from oslo_config import cfg
|
||||
@ -79,12 +80,17 @@ class CoordinationMixin(object):
|
||||
super(CoordinationMixin, self).start()
|
||||
|
||||
if self._coordinator is not None:
|
||||
self._coordinator.start()
|
||||
while not self._coordination_started:
|
||||
try:
|
||||
self._coordinator.start()
|
||||
self._coordinator.create_group(self.service_name)
|
||||
self._coordinator.join_group(self.service_name)
|
||||
self._coordination_started = True
|
||||
|
||||
self._coordinator.create_group(self.service_name)
|
||||
self._coordinator.join_group(self.service_name)
|
||||
|
||||
self._coordination_started = True
|
||||
except Exception:
|
||||
LOG.warn(_LW("Failed to start Coordinator:"),
|
||||
exc_info=True)
|
||||
time.sleep(15)
|
||||
|
||||
def stop(self):
|
||||
if self._coordinator is not None:
|
||||
|
@ -47,7 +47,7 @@ class TestCoordinationMixin(TestCase):
|
||||
service._coordinator.get_groups().get())
|
||||
self.assertIn(service._coordination_id.encode('utf-8'),
|
||||
service._coordinator.get_members(
|
||||
service.service_name).get())
|
||||
service.service_name).get())
|
||||
service.stop()
|
||||
|
||||
def test_stop(self):
|
||||
|
Loading…
Reference in New Issue
Block a user