diff options
-rw-r--r-- | ironic/openstack/common/rpc/impl_kombu.py | 5 | ||||
-rw-r--r-- | ironic/openstack/common/rpc/impl_qpid.py | 8 | ||||
-rw-r--r-- | requirements.txt | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/ironic/openstack/common/rpc/impl_kombu.py b/ironic/openstack/common/rpc/impl_kombu.py index 2d06be9aa..31c079f75 100644 --- a/ironic/openstack/common/rpc/impl_kombu.py +++ b/ironic/openstack/common/rpc/impl_kombu.py @@ -458,6 +458,9 @@ class Connection(object): self.params_list = params_list + brokers_count = len(self.params_list) + self.next_broker_indices = itertools.cycle(range(brokers_count)) + self.memory_transport = self.conf.fake_rabbit self.connection = None @@ -528,7 +531,7 @@ class Connection(object): attempt = 0 while True: - params = self.params_list[attempt % len(self.params_list)] + params = self.params_list[next(self.next_broker_indices)] attempt += 1 try: self._connect(params) diff --git a/ironic/openstack/common/rpc/impl_qpid.py b/ironic/openstack/common/rpc/impl_qpid.py index 718ff7259..324fcf2bf 100644 --- a/ironic/openstack/common/rpc/impl_qpid.py +++ b/ironic/openstack/common/rpc/impl_qpid.py @@ -467,6 +467,10 @@ class Connection(object): self.brokers = params['qpid_hosts'] self.username = params['username'] self.password = params['password'] + + brokers_count = len(self.brokers) + self.next_broker_indices = itertools.cycle(range(brokers_count)) + self.connection_create(self.brokers[0]) self.reconnect() @@ -494,7 +498,6 @@ class Connection(object): def reconnect(self): """Handles reconnecting and re-establishing sessions and queues.""" - attempt = 0 delay = 1 while True: # Close the session if necessary @@ -504,8 +507,7 @@ class Connection(object): except qpid_exceptions.ConnectionError: pass - broker = self.brokers[attempt % len(self.brokers)] - attempt += 1 + broker = self.brokers[next(self.next_broker_indices)] try: self.connection_create(broker) diff --git a/requirements.txt b/requirements.txt index 520bf0ade..2ab830db8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ paramiko>=1.9.0 iso8601>=0.1.9 python-neutronclient>=2.3.4,<3 python-glanceclient>=0.9.0 -python-keystoneclient>=0.6.0 +python-keystoneclient>=0.7.0 stevedore>=0.14 websockify>=0.5.1,<0.6 oslo.config>=1.2.0 |