Fix management network selection when calculating deltas
Providing an AZ dict without the 'management_network' field to CalculateAmphoraDelta task broke the calculation of the interfaces to be deleted. As a result, the management interface might have been removed by the HandleNetworkDelta task. Change-Id: I72796b3ed1c3f180cca8c005fdbad81d9dbef37d
This commit is contained in:
parent
4e02b7639d
commit
b41b275b83
@ -69,10 +69,10 @@ class CalculateAmphoraDelta(BaseNetworkTask):
|
|||||||
|
|
||||||
# Figure out what networks we want
|
# Figure out what networks we want
|
||||||
# seed with lb network(s)
|
# seed with lb network(s)
|
||||||
if availability_zone:
|
if (availability_zone and
|
||||||
management_nets = (
|
availability_zone.get(constants.MANAGEMENT_NETWORK)):
|
||||||
[availability_zone.get(constants.MANAGEMENT_NETWORK)] or
|
management_nets = [
|
||||||
CONF.controller_worker.amp_boot_network_list)
|
availability_zone.get(constants.MANAGEMENT_NETWORK)]
|
||||||
else:
|
else:
|
||||||
management_nets = CONF.controller_worker.amp_boot_network_list
|
management_nets = CONF.controller_worker.amp_boot_network_list
|
||||||
desired_network_ids = {vrrp_port_network_id}.union(management_nets)
|
desired_network_ids = {vrrp_port_network_id}.union(management_nets)
|
||||||
|
@ -230,11 +230,15 @@ class TestNetworkTasks(base.TestCase):
|
|||||||
calc_delta.execute(self.load_balancer_mock, {}))
|
calc_delta.execute(self.load_balancer_mock, {}))
|
||||||
|
|
||||||
# Test with one amp and one pool and one member, nothing plugged
|
# Test with one amp and one pool and one member, nothing plugged
|
||||||
|
# Dummy AZ is provided
|
||||||
# Delta should be one additional subnet to plug
|
# Delta should be one additional subnet to plug
|
||||||
mock_driver.reset_mock()
|
mock_driver.reset_mock()
|
||||||
member_mock = mock.MagicMock()
|
member_mock = mock.MagicMock()
|
||||||
member_mock.subnet_id = 1
|
member_mock.subnet_id = 1
|
||||||
pool_mock.members = [member_mock]
|
pool_mock.members = [member_mock]
|
||||||
|
az = {
|
||||||
|
constants.COMPUTE_ZONE: 'foo'
|
||||||
|
}
|
||||||
mock_driver.get_subnet.return_value = data_models.Subnet(id=2,
|
mock_driver.get_subnet.return_value = data_models.Subnet(id=2,
|
||||||
network_id=3)
|
network_id=3)
|
||||||
|
|
||||||
@ -244,7 +248,7 @@ class TestNetworkTasks(base.TestCase):
|
|||||||
data_models.Interface(network_id=3)],
|
data_models.Interface(network_id=3)],
|
||||||
delete_nics=[]).to_dict(recurse=True)
|
delete_nics=[]).to_dict(recurse=True)
|
||||||
self.assertEqual({self.db_amphora_mock.id: ndm},
|
self.assertEqual({self.db_amphora_mock.id: ndm},
|
||||||
calc_delta.execute(self.load_balancer_mock, {}))
|
calc_delta.execute(self.load_balancer_mock, az))
|
||||||
|
|
||||||
vrrp_port_call = mock.call(PORT_ID)
|
vrrp_port_call = mock.call(PORT_ID)
|
||||||
mock_driver.get_port.assert_has_calls([vrrp_port_call])
|
mock_driver.get_port.assert_has_calls([vrrp_port_call])
|
||||||
|
Loading…
Reference in New Issue
Block a user