Merge "Remove `ovs_create_tap` configuration options"

This commit is contained in:
Zuul authored and Gerrit Code Review committed 2026-10-02 12:41:09 +00:00
commit 5c387e6ed1
11 files changed
+43 -130

No files matched your search

@@ -57,12 +57,10 @@ The key differences between the generic ML2 and OVN live migration are:
TAP Pre-creation (``ovs_create_tap``)
-------------------------------------
Starting in 2026.1, the ``[ovn] ovs_create_tap`` configuration option
controls whether os-vif (on the destination compute node) pre-creates the
TAP device before libvirt starts the VM transfer. This is ``True`` by
default since 2026.2 and it will be made the default behavior in 2027.1.
When ``ovs_create_tap=True``:
Starting in 2026.1, Neutron includes ``ovs_create_tap: True`` in the
port ``vif_details`` for kernel OVS ports. os-vif (on the destination
compute node) uses this to pre-create the TAP device before libvirt starts
the VM transfer.
#. Neutron includes ``ovs_create_tap: True`` in the port's ``vif_details``
during the binding operation.
@@ -77,21 +75,12 @@ When ``ovs_create_tap=True``:
#. ovn-controller on the destination detects the TAP and starts programming
OpenFlow rules.
When ``ovs_create_tap=False`` (legacy behavior):
#. The TAP device is created by libvirt during the actual VM transfer
(Phase 8). OpenFlow rules cannot be programmed until that point.
#. A "fake" ``network-vif-plugged`` event is sent immediately when the
``Logical_Switch_Port`` is updated in the NB DB, before flows are
programmed. This creates a race window where the VM can be unpaused
without network connectivity.
Migration Phases
----------------
The following phases describe the full live migration flow with
``ovs_create_tap=True``.
The following phases describe the full live migration flow with TAP
pre-creation enabled.
Phase 1: Scheduling
~~~~~~~~~~~~~~~~~~~
@@ -236,8 +225,8 @@ Neutron server monitors the SB DB via OVSDB IDL. The
``PortBindingChassisUpdateEvent`` detects that
``Port_Binding.additional_chassis`` has been populated.
With ``ovs_create_tap=True`` and datapath type ``system`` (not DPDK),
Neutron does **not** immediately signal the port as UP. Instead it waits
For kernel OVS datapaths (``system``, not DPDK), Neutron does **not**
immediately signal the port as UP. Instead it waits
for the destination ovn-controller to confirm that OpenFlow rules are fully
installed (see `Waiting for OpenFlow Rules`_).
@@ -410,19 +399,17 @@ Migration State Detection in the Mechanism Driver
During ``update_port_postcommit``, the OVN mechanism driver checks if a
port is in migration state (status ``DOWN`` with ``migrating_to`` in the
binding profile). The behavior depends on the VIF type and configuration:
binding profile). The behavior depends on the VIF type:
* ``vif_type=unbound``: The port will be rebound; processing continues
normally.
* ``ovs_create_tap=True`` and ``vif_type=ovs``: Return immediately
without sending a fake event. Wait for the
``PortBindingChassisUpdateEvent`` Southbound event, which fires when
``Port_Binding.additional_chassis`` is populated by ovn-controller.
* ``vif_type=ovs``: Return immediately without sending a fake event. Wait
for the ``PortBindingChassisUpdateEvent`` Southbound event, which fires
when ``Port_Binding.additional_chassis`` is populated by ovn-controller.
* ``ovs_create_tap=False`` or ``vif_type=vhostuser``: A "fake"
``network-vif-plugged`` event is sent by forcing the port status to
``ACTIVE``. This is the legacy behavior and does not guarantee that
* ``vif_type=vhostuser``: A "fake" ``network-vif-plugged`` event is sent
by forcing the port status to ``ACTIVE``. This does not guarantee that
OpenFlow rules are in place.
A revision conflict retry mechanism handles the race between the OVN
@@ -33,19 +33,6 @@ ovs_driver_opts = [
"This allows to support hardware offload via tc and "
"that allows us to manage the VF by OpenFlow control "
"plane using representor net-device.")),
cfg.BoolOpt('ovs_create_tap',
default=True,
help=_("If enabled, os-vif will create the TAP devices for "
"kernel OVS ports. This controls the ``ovs_create_tap``"
" parameter in the vif-details dictionary. Only applies"
" to kernel datapath ports (not DPDK or HW-offloaded "
"ports)."),
deprecated_for_removal=True,
deprecated_since='2026.2',
deprecated_reason=(
'This flag was added for backwards compatibility during '
'the development of the functionality in Nova '
'(LP#2069718).')),
]
@@ -257,17 +257,6 @@ ovn_opts = [
'stateless, instead of using the conntrack OVN '
'actions. This strategy is faster in some '
'environments, like for example DPDK deployments.')),
cfg.BoolOpt('ovs_create_tap',
default=True,
help=_('If enabled, os-vif will create the TAP devices for '
'ports. This controls the ``ovs_create_tap`` parameter '
'in the vif-details dictionary.'),
deprecated_for_removal=True,
deprecated_since='2026.1',
deprecated_reason=('This flag was added for backwards '
'compatibility during the development of '
'the functionality in Nova (LP#2069718'),
),
cfg.StrOpt('ha_failover_strategy',
default=ovn_const.OVN_HA_FAILOVER_NORMAL,
choices=ovn_const.OVN_HA_FAILOVER_CHOICES,
@@ -493,7 +482,3 @@ def is_ovn_router_indirect_snat_enabled():
def is_stateless_nat_enabled():
return cfg.CONF.ovn.stateless_nat_enabled
def is_ovs_create_tap():
return cfg.CONF.ovn.ovs_create_tap
@@ -194,8 +194,7 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
'datapath_type', ovs_const.OVS_DATAPATH_SYSTEM)
vnic_type = context.current.get(
portbindings.VNIC_TYPE, portbindings.VNIC_NORMAL)
if (cfg.CONF.OVS_DRIVER.ovs_create_tap and
datapath_type == ovs_const.OVS_DATAPATH_SYSTEM and
if (datapath_type == ovs_const.OVS_DATAPATH_SYSTEM and
vnic_type != portbindings.VNIC_DIRECT and
not a_config.get(portbindings.OVS_HYBRID_PLUG)):
details['ovs_create_tap'] = True
@@ -240,14 +240,13 @@ class OVNMechanismDriver(api.MechanismDriver):
def _setup_vif_port_bindings(self):
self.supported_vnic_types = ovn_const.OVN_SUPPORTED_VNIC_TYPES
ovs_create_tap = ovn_conf.is_ovs_create_tap()
self.vif_details = {
portbindings.VIF_TYPE_OVS: {
portbindings.CAP_PORT_FILTER: self.sg_enabled,
portbindings.VIF_DETAILS_CONNECTIVITY: self.connectivity,
# TODO(ralonsoh): add "ovs_create_tap" to n-lib
# port_binding constants.
'ovs_create_tap': ovs_create_tap,
'ovs_create_tap': True,
},
portbindings.VIF_TYPE_AGILIO_OVS: {
portbindings.CAP_PORT_FILTER: self.sg_enabled,
@@ -1164,17 +1163,15 @@ class OVNMechanismDriver(api.MechanismDriver):
# the port will be rebind so we just continue here
if port[portbindings.VIF_TYPE] == portbindings.VIF_TYPE_UNBOUND:
pass
# NOTE(ykarel): For ovs_create_tap=True and vif_type=ovs,
# just return as we don't need to send any fake event and instead
# Wait for PortBindingChassisUpdateEvent Southbound event which is
# triggered when ``Port_Binding.additional_chassis`` is populated.
elif (ovn_conf.is_ovs_create_tap() and
port[portbindings.VIF_TYPE] == portbindings.VIF_TYPE_OVS):
# NOTE(ykarel): For vif_type=ovs, return without sending a fake
# event. Wait for PortBindingChassisUpdateEvent Southbound event
# which is triggered when ``Port_Binding.additional_chassis`` is
# populated.
elif port[portbindings.VIF_TYPE] == portbindings.VIF_TYPE_OVS:
return
# NOTE(ykarel): For ovs_create_tap=False or vif_type=vhostuser
# we create fake event instead of waiting for the Southbound event
elif (not ovn_conf.is_ovs_create_tap() or
port[portbindings.VIF_TYPE] ==
# NOTE(ykarel): For vif_type=vhostuser we create a fake event
# instead of waiting for the Southbound event.
elif port[portbindings.VIF_TYPE] == (
portbindings.VIF_TYPE_VHOST_USER):
# Update the port status from DOWN to UP in order to generate
# a "fake" ``vif-interface-plugged`` event.
@@ -355,14 +355,12 @@ class PortBindingChassisUpdateEvent(row_event.RowEvent):
except IndexError:
dest_dp_type = ''
if (not self.is_live_migration(row, old) or
not ovn_conf.is_ovs_create_tap() or
not dest_dp_type == ovs_constants.OVS_DATAPATH_SYSTEM):
dest_dp_type != ovs_constants.OVS_DATAPATH_SYSTEM):
self.driver.set_port_status_up(row.logical_port)
return
# NOTE(ralonsoh): this code branch is only reached if:
# * The port is being migrated.
# * The config knob "ovs_create_tap" is enabled.
# * The datapath type is "system" (not DPDK).
chassis_name = row.additional_chassis[0].name
@@ -1296,10 +1296,9 @@ class TestPortBindingLiveMigrationFlow(base.TestOVNFunctionalBase,
bump and set_port_status_up is deferred until the destination
chassis reaches the expected nb_cfg.
NOTE: this test was implemented on top of the patch that made
``ovs_create_tap`` config value True by default. This is important
because the ``PortBindingChassisUpdateEvent.run`` method validates
if this option is enabled.
NOTE: the ``PortBindingChassisUpdateEvent.run`` method defers
``set_port_status_up`` only for kernel OVS datapaths during live
migration.
"""
with mock.patch.object(
self.mech_driver, 'set_port_status_up') as mock_status_up:
@@ -532,7 +532,6 @@ class OpenvswitchMechanismCreateTapTestCase(OpenvswitchMechanismBaseTestCase):
vnic_type=vnic_type, profile=profile)
def test_ovs_create_tap_kernel_normal_port(self):
cfg.CONF.set_override('ovs_create_tap', True, group='OVS_DRIVER')
agents = [{'alive': True,
'configurations': self.KERNEL_CONFIGS,
'host': 'host',
@@ -542,7 +541,6 @@ class OpenvswitchMechanismCreateTapTestCase(OpenvswitchMechanismBaseTestCase):
self.assertTrue(context._bound_vif_details.get('ovs_create_tap'))
def test_ovs_create_tap_not_set_for_dpdk(self):
cfg.CONF.set_override('ovs_create_tap', True, group='OVS_DRIVER')
agents = [{'alive': True,
'configurations': self.DPDK_CONFIGS,
'host': 'host',
@@ -552,7 +550,6 @@ class OpenvswitchMechanismCreateTapTestCase(OpenvswitchMechanismBaseTestCase):
self.assertNotIn('ovs_create_tap', context._bound_vif_details)
def test_ovs_create_tap_not_set_for_netdev_datapath(self):
cfg.CONF.set_override('ovs_create_tap', True, group='OVS_DRIVER')
agents = [{'alive': True,
'configurations': self.NETDEV_CONFIGS,
'host': 'host',
@@ -562,7 +559,6 @@ class OpenvswitchMechanismCreateTapTestCase(OpenvswitchMechanismBaseTestCase):
self.assertNotIn('ovs_create_tap', context._bound_vif_details)
def test_ovs_create_tap_not_set_for_switchdev(self):
cfg.CONF.set_override('ovs_create_tap', True, group='OVS_DRIVER')
agents = [{'alive': True,
'configurations': self.KERNEL_CONFIGS,
'host': 'host',
@@ -574,18 +570,7 @@ class OpenvswitchMechanismCreateTapTestCase(OpenvswitchMechanismBaseTestCase):
self.driver.bind_port(context)
self.assertNotIn('ovs_create_tap', context._bound_vif_details)
def test_ovs_create_tap_not_set_when_config_disabled(self):
cfg.CONF.set_override('ovs_create_tap', False, group='OVS_DRIVER')
agents = [{'alive': True,
'configurations': self.KERNEL_CONFIGS,
'host': 'host',
'agent_type': self.AGENT_TYPE}]
context = self._make_port_ctx(agents)
self.driver.bind_port(context)
self.assertNotIn('ovs_create_tap', context._bound_vif_details)
def test_ovs_create_tap_not_set_for_hybrid_plug(self):
cfg.CONF.set_override('ovs_create_tap', True, group='OVS_DRIVER')
hybrid_configs = dict(self.KERNEL_CONFIGS,
**{portbindings.OVS_HYBRID_PLUG: True})
agents = [{'alive': True,
@@ -2639,12 +2639,10 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
mock.ANY, passed_fake_port, port_object=passed_fake_port_orig)
mock_notify_dhcp.assert_called_once_with(mock.ANY, fake_port['id'])
def _test_update_port_postcommit_live_migration(self, ovs_create_tap,
vif_type,
def _test_update_port_postcommit_live_migration(self, vif_type,
expected_behavior):
"""Helper function to test update_port_postcommit during live migration
:param ovs_create_tap: Boolean value for ovs_create_tap config
:param vif_type: VIF type constant (e.g., portbindings.VIF_TYPE_OVS)
:param expected_behavior: 'return_early', 'fake_event', or
'normal_processing'
@@ -2658,8 +2656,6 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
mock.patch.object(
ovn_client.OVNClient, 'update_port') as mock_update_port:
ovn_conf.cfg.CONF.set_override(
'ovs_create_tap', ovs_create_tap, group='ovn')
self.plugin.update_port_status = mock.Mock()
fake_context = 'fake_context'
fake_port = fakes.FakePort.create_one_port(
@@ -2699,50 +2695,23 @@ class TestOVNMechanismDriver(TestOVNMechanismDriverBase):
else:
self.fail(f"Unknown expected_behavior: {expected_behavior}")
def test_update_port_postcommit_migration_no_create_tap_ovs(self):
"""Test migration: ovs_create_tap=False + OVS returns fake event."""
def test_update_port_postcommit_migration_ovs(self):
"""Test migration with vif_type=ovs returns early."""
self._test_update_port_postcommit_live_migration(
ovs_create_tap=False,
vif_type=portbindings.VIF_TYPE_OVS,
expected_behavior='fake_event'
)
def test_update_port_postcommit_migration_create_tap_ovs(self):
"""Test migration: ovs_create_tap=True + OVS returns early."""
self._test_update_port_postcommit_live_migration(
ovs_create_tap=True,
vif_type=portbindings.VIF_TYPE_OVS,
expected_behavior='return_early'
)
def test_update_port_postcommit_migration_no_create_tap_vhost_user(self):
"""test migration: ovs_create_tap=False + vhost returns fake event."""
def test_update_port_postcommit_migration_vhost_user(self):
"""Test migration with vif_type=vhostuser returns fake event."""
self._test_update_port_postcommit_live_migration(
ovs_create_tap=False,
vif_type=portbindings.VIF_TYPE_VHOST_USER,
expected_behavior='fake_event'
)
def test_update_port_postcommit_migration_create_tap_vhost_user(self):
"""test migration: ovs_create_tap=True + vhost returns fake event."""
def test_update_port_postcommit_migration_unbound(self):
"""Test migration with vif_type=unbound uses normal processing."""
self._test_update_port_postcommit_live_migration(
ovs_create_tap=True,
vif_type=portbindings.VIF_TYPE_VHOST_USER,
expected_behavior='fake_event'
)
def test_update_port_postcommit_migration_no_create_tap_unbound(self):
"""Test migration: ovs_create_tap=False + UNBOUND not returns."""
self._test_update_port_postcommit_live_migration(
ovs_create_tap=False,
vif_type=portbindings.VIF_TYPE_UNBOUND,
expected_behavior='normal_processing'
)
def test_update_port_postcommit_migration_create_tap_unbound(self):
"""Test migration: ovs_create_tap=True + UNBOUND not returns."""
self._test_update_port_postcommit_live_migration(
ovs_create_tap=True,
vif_type=portbindings.VIF_TYPE_UNBOUND,
expected_behavior='normal_processing'
)
@@ -0,0 +1,8 @@
---
upgrade:
- |
The configuration options ``[ovn]ovs_create_tap`` and
``[OVS_DRIVER]ovs_create_tap`` are removed. Neutron always sets
``ovs_create_tap: True`` in the port ``vif_details`` for kernel OVS
ports, enabling os-vif TAP pre-creation during live migration. Remove
these options from ``neutron.conf`` if present.
-1
View File
@@ -432,7 +432,6 @@
"/$NEUTRON_CORE_PLUGIN_CONF":
ovn:
enable_distributed_floating_ip: True
ovs_create_tap: True
devstack_localrc:
MYSQL_REDUCE_MEMORY: true
CIRROS_VERSION: 0.6.3