Deprecate vlan_qinq and vlan_transparent config options

Those config knobs are now deprecated as availability of the appropriate
API extension can be calculated based on the mech drivers loaded.
It still can be disabled manually using deprecated config options but
to do that it has to be explicitly set to "False".

Additionally this patch changes default value of both those config
options to be `None` now which means - calculate it automatically.

Closes-bug: #2092174
Change-Id: I3df2d3ebc8320c7df80ced25c18f5f573722b8d5
This commit is contained in:
Slawek Kaplonski
2025-05-28 15:14:12 +02:00
committed by Brian Haley
parent e0a379037a
commit 11ff4f2f98
10 changed files with 48 additions and 30 deletions

View File

@ -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.')),

View File

@ -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.')

View File

@ -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.')

View File

@ -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']

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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()

View File

@ -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):

View File

@ -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.