diff --git a/neutron/conf/common.py b/neutron/conf/common.py index f042599a090..02b10faca96 100644 --- a/neutron/conf/common.py +++ b/neutron/conf/common.py @@ -125,10 +125,24 @@ core_opts = [ help=_("Neutron IPAM (IP address management) driver to use. " "By default, the reference implementation of the " "Neutron IPAM driver is used.")), - cfg.BoolOpt('vlan_transparent', default=False, + cfg.BoolOpt('vlan_transparent', default=None, + deprecated_for_removal=True, + deprecated_reason=_( + 'This option is going to be removed as availability ' + 'of the `vlan_transparency` in the deployment is ' + 'now calculated automatically based on the loaded ' + 'mechanism drivers.'), + deprecated_since='2025.2', help=_('If True, then allow plugins that support it to ' 'create VLAN transparent networks.')), - cfg.BoolOpt('vlan_qinq', default=False, + cfg.BoolOpt('vlan_qinq', default=None, + deprecated_for_removal=True, + deprecated_reason=_( + 'This option is going to be removed as availability ' + 'of the `vlan_qinq` in the deployment is ' + 'now calculated automatically based on the loaded ' + 'mechanism drivers.'), + deprecated_since='2025.2', help=_('If True, then allow plugins that support it to ' 'create VLAN transparent networks using 0x8a88 ' 'ethertype.')), diff --git a/neutron/extensions/qinq.py b/neutron/extensions/qinq.py index 0c7b5dd5418..7d1845b68e5 100644 --- a/neutron/extensions/qinq.py +++ b/neutron/extensions/qinq.py @@ -22,7 +22,7 @@ LOG = logging.getLogger(__name__) def _disable_extension_by_config(aliases): - if not cfg.CONF.vlan_qinq: + if cfg.CONF.vlan_qinq is False: if apidef.ALIAS in aliases: aliases.remove(apidef.ALIAS) LOG.info('Disabled VLAN QinQ extension.') diff --git a/neutron/extensions/vlantransparent.py b/neutron/extensions/vlantransparent.py index e4a4cf9cab5..d0d66c4e541 100644 --- a/neutron/extensions/vlantransparent.py +++ b/neutron/extensions/vlantransparent.py @@ -21,7 +21,7 @@ LOG = logging.getLogger(__name__) def _disable_extension_by_config(aliases): - if not cfg.CONF.vlan_transparent: + if cfg.CONF.vlan_transparent is False: if 'vlan-transparent' in aliases: aliases.remove('vlan-transparent') LOG.info('Disabled vlantransparent extension.') diff --git a/neutron/plugins/ml2/drivers/macvtap/mech_driver/mech_macvtap.py b/neutron/plugins/ml2/drivers/macvtap/mech_driver/mech_macvtap.py index f52ef12e048..9fd53962313 100644 --- a/neutron/plugins/ml2/drivers/macvtap/mech_driver/mech_macvtap.py +++ b/neutron/plugins/ml2/drivers/macvtap/mech_driver/mech_macvtap.py @@ -15,6 +15,8 @@ # under the License. from neutron_lib.api.definitions import portbindings +from neutron_lib.api.definitions import qinq as qinq_apidef +from neutron_lib.api.definitions import vlantransparent as vlan_apidef from neutron_lib import constants from neutron_lib.plugins.ml2 import api from oslo_log import log @@ -37,6 +39,11 @@ class MacvtapMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): network. """ + _explicitly_not_supported_extensions = set([ + vlan_apidef.ALIAS, + qinq_apidef.ALIAS + ]) + def __init__(self): vif_details = {portbindings.CAP_PORT_FILTER: False, portbindings.VIF_DETAILS_CONNECTIVITY: @@ -56,14 +63,6 @@ class MacvtapMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): def get_mappings(self, agent): return agent['configurations'].get('interface_mappings', {}) - def check_vlan_transparency(self, context): - """Macvtap driver vlan transparency support.""" - return False - - def check_vlan_qinq(self, context): - """Currently Macvtap driver doesn't support QinQ vlan.""" - return False - def _is_live_migration(self, context): # We cannot just check if # context.original['host_id'] != context.current['host_id'] diff --git a/neutron/plugins/ml2/drivers/mech_agent.py b/neutron/plugins/ml2/drivers/mech_agent.py index 7c950c15ffb..0f3418db26a 100644 --- a/neutron/plugins/ml2/drivers/mech_agent.py +++ b/neutron/plugins/ml2/drivers/mech_agent.py @@ -43,6 +43,8 @@ class AgentMechanismDriverBase(api.MechanismDriver, metaclass=abc.ABCMeta): __init__(), and must implement try_to_bind_segment_for_agent(). """ + _explicitly_not_supported_extensions = set() + def __init__(self, agent_type, supported_vnic_types): """Initialize base class for specific L2 agent type. @@ -56,6 +58,11 @@ class AgentMechanismDriverBase(api.MechanismDriver, metaclass=abc.ABCMeta): def initialize(self): pass + def supported_extensions(self, extensions): + # filter out extensions which this mech driver explicitly claimed + # that are not supported + return extensions - self._explicitly_not_supported_extensions + def create_port_precommit(self, context): self._insert_provisioning_block(context) diff --git a/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py b/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py index f5b1dab582a..c0417861753 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py +++ b/neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py @@ -18,6 +18,8 @@ import uuid from neutron_lib.api.definitions import portbindings from neutron_lib.api.definitions import provider_net +from neutron_lib.api.definitions import qinq as qinq_apidef +from neutron_lib.api.definitions import vlantransparent as vlan_apidef from neutron_lib.callbacks import events from neutron_lib.callbacks import registry from neutron_lib import constants @@ -53,6 +55,11 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): resource_provider_uuid5_namespace = uuid.UUID( '87ee7d5c-73bb-11e8-9008-c4d987b2a692') + _explicitly_not_supported_extensions = set([ + vlan_apidef.ALIAS, + qinq_apidef.ALIAS + ]) + def __init__(self): sg_enabled = securitygroups_rpc.is_firewall_enabled() vif_details = {portbindings.CAP_PORT_FILTER: sg_enabled, @@ -109,14 +116,6 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): _('Cannot standardize bridge mappings of agent type: %s'), agent['agent_type']) - def check_vlan_transparency(self, context): - """Currently Openvswitch driver doesn't support vlan transparency.""" - return False - - def check_vlan_qinq(self, context): - """Currently Openvswitch driver doesn't support QinQ vlan.""" - return False - def bind_port(self, context): vnic_type = context.current.get(portbindings.VNIC_TYPE, portbindings.VNIC_NORMAL) diff --git a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py index e345bb88624..41e9b2fb5e4 100644 --- a/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py +++ b/neutron/tests/functional/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py @@ -1148,8 +1148,6 @@ class TestVlanTransparencyOptions(base.TestOVNFunctionalBase): def setUp(self): common_conf.register_core_common_config_opts() - common_conf.cfg.CONF.set_override('vlan_qinq', True) - common_conf.cfg.CONF.set_override('vlan_transparent', True) super().setUp() self._ovn_client = self.mech_driver._ovn_client diff --git a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py index 72dea031a82..b059807bcf7 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py +++ b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/test_mech_driver.py @@ -180,8 +180,6 @@ class TestOVNMechanismDriverBase(MechDriverSetupBase, # Need to register here for 'vlan_transparent' config before # setting up test_plugin config.register_common_config_options() - cfg.CONF.set_override('vlan_transparent', True) - cfg.CONF.set_override('vlan_qinq', True) cfg.CONF.set_override('ovsdb_connection_timeout', 30, group='ovn') mock.patch.object(impl_idl_ovn.Backend, 'schema_helper').start() super().setUp() diff --git a/neutron/tests/unit/plugins/ml2/test_plugin.py b/neutron/tests/unit/plugins/ml2/test_plugin.py index 641f630e253..ecbae60910a 100644 --- a/neutron/tests/unit/plugins/ml2/test_plugin.py +++ b/neutron/tests/unit/plugins/ml2/test_plugin.py @@ -49,7 +49,6 @@ import webob from neutron._i18n import _ from neutron.agent import rpc as agent_rpc -from neutron.common import config from neutron.common import utils from neutron.db import agents_db from neutron.db import ipam_pluggable_backend @@ -678,11 +677,6 @@ class TestMl2NetworksWithVlanTransparencyBase(TestMl2NetworksV2): pnet.PHYSICAL_NETWORK: 'physnet1'}], 'vlan_transparent': 'True'}} - def setUp(self, plugin=None): - config.register_common_config_options() - cfg.CONF.set_override('vlan_transparent', True) - super().setUp(plugin) - class TestMl2NetworksWithVlanTransparency( TestMl2NetworksWithVlanTransparencyBase): diff --git a/releasenotes/notes/deprecate-vlan_transparent-and-vlan_qinq-config-options-ed2384c02e2dab53.yaml b/releasenotes/notes/deprecate-vlan_transparent-and-vlan_qinq-config-options-ed2384c02e2dab53.yaml new file mode 100644 index 00000000000..8735a36b2a9 --- /dev/null +++ b/releasenotes/notes/deprecate-vlan_transparent-and-vlan_qinq-config-options-ed2384c02e2dab53.yaml @@ -0,0 +1,9 @@ +--- +deprecations: + - | + Config options ``vlan_transparent`` and ``vlan_qinq`` are now deprecated and + will be removed in a future release. Availability of the ``vlan-transparent`` + and ``vlan-qinq`` API extensions can now be calculated by Neutron based on the + mechanism drivers enabled in the environment. If any of the enabled + mechanism drivers do not support these features, the API extensions will be + disabled automatically.