Merge "[OVN] Remove the check for external ports support"
This commit is contained in:
@@ -602,11 +602,6 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
|
||||
spacing=ovn_const.MAINTENANCE_ONE_RUN_TASK_SPACING,
|
||||
run_immediately=True)
|
||||
def check_for_ha_chassis_group(self):
|
||||
# If external ports is not supported stop running
|
||||
# this periodic task
|
||||
if not self._ovn_client.is_external_ports_supported():
|
||||
raise periodics.NeverAgain()
|
||||
|
||||
external_ports = self._nb_idl.db_find_rows(
|
||||
'Logical_Switch_Port', ('type', '=', ovn_const.LSP_TYPE_EXTERNAL)
|
||||
).execute(check_error=True)
|
||||
@@ -825,11 +820,6 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
|
||||
Update baremetal ports DHCP options based on the
|
||||
"disable_ovn_dhcp_for_baremetal_ports" configuration option.
|
||||
"""
|
||||
# If external ports is not supported stop running
|
||||
# this periodic task
|
||||
if not self._ovn_client.is_external_ports_supported():
|
||||
raise periodics.NeverAgain()
|
||||
|
||||
context = n_context.get_admin_context()
|
||||
ports = ports_obj.Port.get_ports_by_vnic_type_and_host(
|
||||
context, portbindings.VNIC_BAREMETAL)
|
||||
|
@@ -142,10 +142,6 @@ class OVNClient:
|
||||
for cmd in commands:
|
||||
txn.add(cmd)
|
||||
|
||||
def is_external_ports_supported(self):
|
||||
return self._nb_idl.is_col_present(
|
||||
'Logical_Switch_Port', 'ha_chassis_group')
|
||||
|
||||
def _get_allowed_addresses_from_port(self, port):
|
||||
if not port.get(psec.PORTSECURITY):
|
||||
return [], []
|
||||
@@ -440,12 +436,8 @@ class OVNClient:
|
||||
port_type = ovn_const.LSP_TYPE_LOCALPORT
|
||||
|
||||
if utils.is_port_external(port):
|
||||
if self.is_external_ports_supported():
|
||||
port_type = ovn_const.LSP_TYPE_EXTERNAL
|
||||
else:
|
||||
LOG.warning('The version of OVN used does not support '
|
||||
'the "external ports" feature used for '
|
||||
'SR-IOV ports with OVN native DHCP')
|
||||
port_type = ovn_const.LSP_TYPE_EXTERNAL
|
||||
|
||||
addresses = []
|
||||
port_security, new_macs = (
|
||||
self._get_allowed_addresses_from_port(port))
|
||||
@@ -619,8 +611,7 @@ class OVNClient:
|
||||
'dhcpv6_options': dhcpv6_options
|
||||
}
|
||||
|
||||
if (self.is_external_ports_supported() and
|
||||
port_info.type == ovn_const.LSP_TYPE_EXTERNAL):
|
||||
if port_info.type == ovn_const.LSP_TYPE_EXTERNAL:
|
||||
kwargs['ha_chassis_group'], _ = (
|
||||
utils.sync_ha_chassis_group_network(
|
||||
context, self._nb_idl, self._sb_idl, port['id'],
|
||||
@@ -752,15 +743,14 @@ class OVNClient:
|
||||
portbindings.VIF_TYPE_UNBOUND):
|
||||
columns_dict['addresses'] = []
|
||||
|
||||
if self.is_external_ports_supported():
|
||||
if port_info.type == ovn_const.LSP_TYPE_EXTERNAL:
|
||||
columns_dict['ha_chassis_group'], _ = (
|
||||
utils.sync_ha_chassis_group_network(
|
||||
context, self._nb_idl, self._sb_idl, port['id'],
|
||||
port['network_id'], txn))
|
||||
else:
|
||||
# Clear the ha_chassis_group field
|
||||
columns_dict['ha_chassis_group'] = []
|
||||
if port_info.type == ovn_const.LSP_TYPE_EXTERNAL:
|
||||
columns_dict['ha_chassis_group'], _ = (
|
||||
utils.sync_ha_chassis_group_network(
|
||||
context, self._nb_idl, self._sb_idl, port['id'],
|
||||
port['network_id'], txn))
|
||||
else:
|
||||
# Clear the ha_chassis_group field
|
||||
columns_dict['ha_chassis_group'] = []
|
||||
|
||||
addr_pairs_diff = utils.compute_address_pairs_diff(ovn_port, port)
|
||||
|
||||
@@ -2203,11 +2193,6 @@ class OVNClient:
|
||||
|
||||
Check for changes in the HA Chassis Groups upon a network update.
|
||||
"""
|
||||
# If there are no external ports in this network, there's
|
||||
# no need to check the AZs
|
||||
if self.is_external_ports_supported():
|
||||
return
|
||||
|
||||
# Check for changes in the network Availability Zones
|
||||
ovn_ls_azs = lswitch.external_ids.get(
|
||||
ovn_const.OVN_AZ_HINTS_EXT_ID_KEY, '')
|
||||
|
@@ -117,9 +117,6 @@ class ChassisEvent(row_event.RowEvent):
|
||||
This method handles the inclusion and removal of Chassis to/from
|
||||
the default HA Chassis Group.
|
||||
"""
|
||||
if not self.driver._ovn_client.is_external_ports_supported():
|
||||
return
|
||||
|
||||
is_gw_chassis = utils.is_gateway_chassis(row)
|
||||
# If the Chassis being created is not a gateway, ignore it
|
||||
if not is_gw_chassis and event == self.ROW_CREATE:
|
||||
|
@@ -473,17 +473,9 @@ class TestDBInconsistenciesPeriodics(testlib_api.SqlTestCaseLight,
|
||||
]
|
||||
nb_idl.db_set.assert_has_calls(expected_calls)
|
||||
|
||||
def test_check_for_ha_chassis_group_not_supported(self):
|
||||
self.fake_ovn_client.is_external_ports_supported.return_value = False
|
||||
self.assertRaises(periodics.NeverAgain,
|
||||
self.periodic.check_for_ha_chassis_group)
|
||||
self.assertFalse(
|
||||
self.fake_ovn_client._nb_idl.ha_chassis_group_add.called)
|
||||
|
||||
@mock.patch.object(utils, 'sync_ha_chassis_group_network')
|
||||
def test_check_for_ha_chassis_group_no_external_ports(
|
||||
self, mock_sync_ha_chassis_group_network):
|
||||
self.fake_ovn_client.is_external_ports_supported.return_value = True
|
||||
nb_idl = self.fake_ovn_client._nb_idl
|
||||
nb_idl.db_find_rows.return_value.execute.return_value = []
|
||||
self.assertRaises(periodics.NeverAgain,
|
||||
@@ -493,7 +485,6 @@ class TestDBInconsistenciesPeriodics(testlib_api.SqlTestCaseLight,
|
||||
@mock.patch.object(utils, 'sync_ha_chassis_group_network')
|
||||
def test_check_for_ha_chassis_group(self,
|
||||
mock_sync_ha_chassis_group_network):
|
||||
self.fake_ovn_client.is_external_ports_supported.return_value = True
|
||||
nb_idl = self.fake_ovn_client._nb_idl
|
||||
|
||||
hcg0 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||
@@ -782,7 +773,6 @@ class TestDBInconsistenciesPeriodics(testlib_api.SqlTestCaseLight,
|
||||
def _test_check_baremetal_ports_dhcp_options(self, dhcp_disabled=False):
|
||||
cfg.CONF.set_override('disable_ovn_dhcp_for_baremetal_ports',
|
||||
dhcp_disabled, group='ovn')
|
||||
self.fake_ovn_client.is_external_ports_supported.return_value = True
|
||||
nb_idl = self.fake_ovn_client._nb_idl
|
||||
self.fake_ovn_client._get_port_options.return_value = 'fake-port-opts'
|
||||
|
||||
|
@@ -655,7 +655,6 @@ class TestChassisEvent(base.BaseTestCase):
|
||||
super().setUp()
|
||||
self.driver = mock.MagicMock()
|
||||
self.nb_ovn = self.driver.nb_ovn
|
||||
self.driver._ovn_client.is_external_ports_supported.return_value = True
|
||||
self.event = ovsdb_monitor.ChassisEvent(self.driver)
|
||||
self.is_gw_ch_mock = mock.patch.object(
|
||||
utils, 'is_gateway_chassis').start()
|
||||
|
@@ -1155,6 +1155,7 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
|
||||
mock_is_ext.return_value = is_extport_present
|
||||
self.sb_ovn.get_extport_chassis_from_cms_options.return_value = [
|
||||
mock.Mock()]
|
||||
mock_sync.return_value = (mock.ANY, mock.ANY)
|
||||
with self.network() as net1, \
|
||||
self.subnet(network=net1) as subnet1, \
|
||||
self.port(subnet=subnet1, is_admin=True,
|
||||
@@ -1189,9 +1190,12 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
|
||||
ulsp.assert_called_once_with(mock.ANY, mock.ANY)
|
||||
|
||||
if is_extport_present:
|
||||
mock_sync.assert_called_once_with(
|
||||
# Method "sync_ha_chassis_group_network" called twice: when the
|
||||
# port is created and when the port is set to UP.
|
||||
calls = [mock.call(
|
||||
mock.ANY, self.nb_ovn, self.sb_ovn, port1['port']['id'],
|
||||
port1['port']['network_id'], mock.ANY)
|
||||
port1['port']['network_id'], mock.ANY)] * 2
|
||||
mock_sync.assert_has_calls(calls)
|
||||
else:
|
||||
mock_sync.assert_not_called()
|
||||
|
||||
@@ -4434,9 +4438,6 @@ class TestOVNMechanismDriverSecurityGroup(
|
||||
self.assertEqual(
|
||||
3, self.mech_driver.nb_ovn.pg_add_ports.call_count)
|
||||
|
||||
@mock.patch('neutron.plugins.ml2.drivers.ovn.mech_driver.ovsdb.'
|
||||
'ovn_client.OVNClient.is_external_ports_supported',
|
||||
lambda *_: True)
|
||||
@mock.patch.object(ovn_utils, 'sync_ha_chassis_group_network')
|
||||
def _test_create_port_with_vnic_type(self, vnic_type, sync_mock):
|
||||
fake_grp = 'fake-default-ha-group-uuid'
|
||||
|
@@ -0,0 +1,7 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Removed support for OVN versions under v20.03.0. The "ha_chassis_group"
|
||||
field is expected in the "Logical_Router_Port" Northbound table. For more
|
||||
information, see commit `ovn: Support a new Logical_Switch_Port.type -
|
||||
'external' <https://github.com/ovn-org/ovn/commit/b31c76000bef314b68e776d318d1ce4cf152450b>`_.
|
Reference in New Issue
Block a user