Browse Source

Merge "Fix PlugVIPAmphora revert function in amphorav2" into stable/victoria

changes/28/820328/1
Zuul 6 months ago committed by Gerrit Code Review
parent
commit
274f701fa6
  1. 3
      octavia/controller/worker/v2/tasks/network_tasks.py
  2. 12
      octavia/tests/unit/controller/worker/v2/tasks/test_network_tasks.py

3
octavia/controller/worker/v2/tasks/network_tasks.py

@ -452,12 +452,13 @@ class PlugVIPAmphora(BaseNetworkTask):
id=amphora.get(constants.ID))
db_amp.vrrp_port_id = result[constants.VRRP_PORT_ID]
db_amp.ha_port_id = result[constants.HA_PORT_ID]
db_subnet = self.network_driver.get_subnet(subnet[constants.ID])
db_lb = self.loadbalancer_repo.get(
db_apis.get_session(),
id=loadbalancer[constants.LOADBALANCER_ID])
self.network_driver.unplug_aap_port(db_lb.vip,
db_amp, subnet)
db_amp, db_subnet)
except Exception as e:
LOG.error('Failed to unplug AAP port. Resources may still be in '
'use for VIP: %s due to error: %s', db_lb.vip, str(e))

12
octavia/tests/unit/controller/worker/v2/tasks/test_network_tasks.py

@ -1019,8 +1019,10 @@ class TestNetworkTasks(base.TestCase):
mock_get.return_value = self.db_amphora_mock
mock_get_net_driver.return_value = mock_driver
net = network_tasks.PlugVIPAmphora()
mockSubnet = mock_driver.get_subnet()
net.execute(self.load_balancer_mock, amphora, mockSubnet)
subnet = {constants.ID: SUBNET_ID}
mockSubnet = mock.MagicMock()
mock_driver.get_subnet.return_value = mockSubnet
net.execute(self.load_balancer_mock, amphora, subnet)
mock_driver.plug_aap_port.assert_called_once_with(
LB, LB.vip, self.db_amphora_mock, mockSubnet)
@ -1034,11 +1036,13 @@ class TestNetworkTasks(base.TestCase):
mock_get.return_value = self.db_amphora_mock
mock_get_net_driver.return_value = mock_driver
net = network_tasks.PlugVIPAmphora()
mockSubnet = mock.MagicMock()
amphora = {constants.ID: AMPHORA_ID,
constants.LB_NETWORK_IP: IP_ADDRESS}
subnet = {constants.ID: SUBNET_ID}
mockSubnet = mock.MagicMock()
mock_driver.get_subnet.return_value = mockSubnet
net.revert(AMPS_DATA[0].to_dict(), self.load_balancer_mock,
amphora, mockSubnet)
amphora, subnet)
mock_driver.unplug_aap_port.assert_called_once_with(
LB.vip, self.db_amphora_mock, mockSubnet)

Loading…
Cancel
Save