Fix the amphora noop driver

The amphora no-op driver did not get updated properly for the multi-amphora
failover fix.
This patch fixes that issue and corrects the doc strings for the
haproxy amphora driver update_amphora_listeners method.

Change-Id: Ib0d63da7c5599069f5ea50f0dfbc59eefba58c84
(cherry picked from commit c8074cd18a)
This commit is contained in:
Michael Johnson 2018-08-22 19:04:04 -07:00 committed by Carlos Goncalves
parent 5528268e2f
commit ed2894dfb5
3 changed files with 13 additions and 7 deletions

View File

@ -64,8 +64,10 @@ class HaproxyAmphoraLoadBalancerDriver(
:param listeners: List of listeners to update.
:type listener: list
:param amphora_id: The ID of the amphora to update
:type amphora_id: string
:param amphora_index: The index of the amphora to update
:type amphora_index: integer
:param amphorae: List of amphorae
:type amphorae: list
:param timeout_dict: Dictionary of timeout values for calls to the
amphora. May contain: req_conn_timeout,
req_read_timeout, conn_max_retries,

View File

@ -37,7 +37,9 @@ class NoopManager(object):
super(NoopManager, self).__init__()
self.amphoraconfig = {}
def update_amphora_listeners(self, listeners, amphora_id, timeout_dict):
def update_amphora_listeners(self, listeners, amphora_index,
amphorae, timeout_dict):
amphora_id = amphorae[amphora_index].id
for listener in listeners:
LOG.debug("Amphora noop driver update_amphora_listeners, "
"listener %s, amphora %s, timeouts %s", listener.id,
@ -114,10 +116,11 @@ class NoopAmphoraLoadBalancerDriver(
super(NoopAmphoraLoadBalancerDriver, self).__init__()
self.driver = NoopManager()
def update_amphora_listeners(self, listeners, amphora_id, timeout_dict):
def update_amphora_listeners(self, listeners, amphora_index,
amphorae, timeout_dict):
self.driver.update_amphora_listeners(listeners, amphora_id,
timeout_dict)
self.driver.update_amphora_listeners(listeners, amphora_index,
amphorae, timeout_dict)
def update(self, listener, vip):

View File

@ -69,7 +69,8 @@ class TestNoopAmphoraLoadBalancerDriver(base.TestCase):
constants.CONN_RETRY_INTERVAL: 4}
def test_update_amphora_listeners(self):
self.driver.update_amphora_listeners([self.listener], self.amphora.id,
amphorae = [self.amphora]
self.driver.update_amphora_listeners([self.listener], 0, amphorae,
self.timeout_dict)
self.assertEqual((self.listener, self.amphora.id, self.timeout_dict,
'update_amp'),