[OVN] Always exclude the local chassis creating `HA_Chassis_Group`
When a ``HA_Chassis_Group`` for an external port is created, the method always discards the chassis bound to the port. A logical port can have several chassis stored in the ``Port_Binding`` register, in the ``name`` field (the main one) and in the ``additional_chassis`` list (see method ``get_chassis_host_for_port``). Closes-Bug: #2125569 Signed-off-by: Rodolfo Alonso Hernandez <ralonsoh@redhat.com> Change-Id: I3346c2a16f69c3b16d1693db42335b133a721bf9
This commit is contained in:
@@ -1209,20 +1209,19 @@ def sync_ha_chassis_group_network(context, nb_idl, sb_idl, port_id,
|
||||
chassis_list = sb_idl.get_extport_chassis_from_cms_options()
|
||||
if chassis_list:
|
||||
group_name = ovn_extport_chassis_group_name(port_id)
|
||||
# Check if the port is bound to a chassis and if so, ignore that
|
||||
# chassis when building the HA Chassis Group to ensure the
|
||||
# external port is bound to a different chassis than the VM
|
||||
ignore_chassis = sb_idl.get_chassis_host_for_port(port_id)
|
||||
LOG.debug('HA Chassis Group %s is based on external port %s '
|
||||
'(network %s)', group_name, port_id, network_id)
|
||||
else:
|
||||
chassis_list = sb_idl.get_gateway_chassis_from_cms_options(
|
||||
name_only=False)
|
||||
group_name = ovn_name(network_id)
|
||||
ignore_chassis = set()
|
||||
LOG.debug('HA Chassis Group %s is based on network %s',
|
||||
group_name, network_id)
|
||||
|
||||
# Check if the port is bound to a chassis and if so, ignore that
|
||||
# chassis when building the HA Chassis Group to ensure the
|
||||
# external port is bound to a different chassis than the VM
|
||||
ignore_chassis = sb_idl.get_chassis_host_for_port(port_id)
|
||||
plugin = directory.get_plugin()
|
||||
resource = plugin.get_network(context, network_id)
|
||||
az_hints = common_utils.get_az_hints(resource)
|
||||
|
||||
@@ -2884,7 +2884,9 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
|
||||
self.sb_ovn.get_extport_chassis_from_cms_options.return_value = []
|
||||
self.sb_ovn.get_gateway_chassis_from_cms_options.return_value = [
|
||||
ch0, ch1, ch2, ch3, ch4, ch5]
|
||||
|
||||
expected_ignore_chassis = [ch4.name, ch5.name]
|
||||
self.sb_ovn.get_chassis_host_for_port.return_value = set(
|
||||
expected_ignore_chassis)
|
||||
ovn_utils.sync_ha_chassis_group_network(
|
||||
self.context, self.nb_ovn, self.sb_ovn, fake_port['id'],
|
||||
fake_net['id'], None)
|
||||
@@ -2898,7 +2900,8 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
|
||||
self.assertEqual(expected_ch_list,
|
||||
hcg_info.chassis_list)
|
||||
self.assertEqual(expected_az_hints, hcg_info.az_hints)
|
||||
self.assertEqual(set(), hcg_info.ignore_chassis)
|
||||
self.assertEqual(sorted(expected_ignore_chassis),
|
||||
sorted(hcg_info.ignore_chassis))
|
||||
|
||||
@mock.patch.object(ovn_utils, '_sync_ha_chassis_group')
|
||||
def test_sync_ha_chassis_group_router(self, mock_sync_hcg):
|
||||
|
||||
Reference in New Issue
Block a user