Skip to content

Commit 60adf9f

Browse files
authored
Merge pull request #198 from stackhpc/upstream/yoga-2025-02-10
Synchronise yoga with upstream
2 parents 289d48b + dcaf6a3 commit 60adf9f

File tree

4 files changed

+38
-24
lines changed

4 files changed

+38
-24
lines changed

doc/source/contributor/internals/openvswitch_agent.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ The IDs used for bridge and port names are truncated.
494494
| tbr-trunk-id |
495495
| |
496496
| tpt-parent-id spt-subport-id |
497-
| (tag 100) |
497+
| (tag 0) (tag 100) |
498498
+-----+-----------------+--------+
499499
| |
500500
| |
@@ -514,27 +514,27 @@ spi-subport-id: int bridge side of the patch port that implements a subport.
514514
Trunk creation
515515
++++++++++++++
516516

517-
A VM is spawned passing to Nova the port-id of a parent port associated with
518-
a trunk. Neutron will pass to Nova the bridge where to plug the vif as part of the vif details.
519-
The os-vif driver creates the trunk bridge tbr-trunk-id if it does not exist in plug().
520-
It will create the tap interface tap1 and plug it into tbr-trunk-id setting the parent port ID in the external-ids.
521-
The OVS agent will be monitoring the creation of ports on the trunk bridges. When it detects
522-
that a new port has been created on the trunk bridge, it will do the following:
517+
A VM is spawned passing to Nova the port-id of a parent port associated
518+
with a trunk. Neutron will pass to Nova the bridge where to plug the
519+
vif as part of the vif details. The os-vif driver creates the trunk
520+
bridge tbr-trunk-id if it does not exist in plug(). It will create the
521+
tap interface tap1 and plug it into tbr-trunk-id setting the parent port
522+
ID in the external-ids. The trunk driver will wire the parent port via
523+
a patch port to connect the trunk bridge to the integration bridge:
523524

524525
::
525526

526-
ovs-vsctl add-port tbr-trunk-id tpt-parent-id -- set Interface tpt-parent-id type=patch options:peer=tpi-parent-id
527-
ovs-vsctl add-port br-int tpi-parent-id tag=3 -- set Interface tpi-parent-id type=patch options:peer=tpt-parent-id
527+
ovs-vsctl add-port tbr-trunk-id tpt-parent-id -- set Interface tpt-parent-id type=patch options:peer=tpi-parent-id -- set Port tpt-parent-id vlan_mode=access tag=0
528+
ovs-vsctl add-port br-int tpi-parent-id -- set Interface tpi-parent-id type=patch options:peer=tpt-parent-id
528529

529530

530-
A patch port is created to connect the trunk bridge to the integration bridge.
531-
tpt-parent-id, the trunk bridge side of the patch is not associated to any
532-
tag. It will carry untagged traffic.
533-
tpi-parent-id, the br-int side the patch port is tagged with VLAN 3. We assume that the
534-
trunk is on network1 that on this host is associated with VLAN 3.
535-
The OVS agent will set the trunk ID in the external-ids of tpt-parent-id and tpi-parent-id.
536-
If the parent port is associated with one or more subports the agent will process them as
537-
described in the next paragraph.
531+
tpt-parent-id, the trunk bridge side of the patch will carry untagged
532+
traffic (vlan_mode=access tag=0). The OVS agent will be monitoring the
533+
creation of ports on the integration bridge. tpi-parent-id, the br-int
534+
side the patch port is tagged with VLAN 3 by ovs-agent. We assume that
535+
the trunk is on network1 that on this host is associated with VLAN 3.
536+
If the parent port is associated with one or more subports the agent
537+
will process them as described in the next paragraph.
538538

539539
Subport creation
540540
++++++++++++++++

neutron/services/trunk/drivers/openvswitch/agent/trunk_manager.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(self, trunk_id, port_id, port_mac=None):
9191
self.DEV_PREFIX, port_id)
9292
self._transaction = None
9393

94-
def plug(self, br_int):
94+
def plug(self, br_int, tag=0):
9595
"""Plug patch ports between trunk bridge and given bridge.
9696
9797
The method plugs one patch port on the given bridge side using
@@ -124,6 +124,9 @@ def plug(self, br_int):
124124
self.patch_port_trunk_name))
125125
txn.add(ovsdb.db_set('Interface', self.patch_port_trunk_name,
126126
*patch_trunk_attrs))
127+
txn.add(ovsdb.db_set('Port', self.patch_port_trunk_name,
128+
('vlan_mode', 'access'),
129+
('tag', tag)))
127130

128131
def unplug(self, bridge):
129132
"""Unplug the trunk from bridge.
@@ -168,12 +171,7 @@ def plug(self, br_int):
168171
:param br_int: an integration bridge where peer endpoint of patch port
169172
will be created.
170173
"""
171-
ovsdb = self.bridge.ovsdb
172-
with ovsdb.transaction() as txn:
173-
super(SubPort, self).plug(br_int)
174-
txn.add(ovsdb.db_set(
175-
"Port", self.patch_port_trunk_name,
176-
("tag", self.segmentation_id)))
174+
super(SubPort, self).plug(br_int, tag=self.segmentation_id)
177175

178176
def unplug(self, bridge):
179177
"""Unplug the sub port from the bridge.

neutron/tests/functional/services/trunk/drivers/openvswitch/agent/test_trunk_manager.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ def test_plug(self):
5555
self.trunk.bridge.get_port_name_list())
5656
self.assertIn(self.trunk.patch_port_int_name,
5757
self.br_int.get_port_name_list())
58+
self.assertEqual(
59+
'access',
60+
self.trunk.bridge.db_get_val(
61+
'Port', self.trunk.patch_port_trunk_name, 'vlan_mode'))
62+
self.assertEqual(
63+
0,
64+
self.trunk.bridge.db_get_val(
65+
'Port', self.trunk.patch_port_trunk_name, 'tag'))
5866

5967
def test_plug_failure_doesnt_create_ports(self):
6068
with mock.patch.object(
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
issues:
3+
- |
4+
The fix of `bug 2048785 <https://bugs.launchpad.net/neutron/+bug/2048785>`_
5+
only fixes newly created trunk parent ports. If the fix of already existing
6+
trunks is needed, then either delete and re-create the affected trunks
7+
or set tpt ports' vlan_mode and tag manually:
8+
``ovs-vsctl set Port tpt-... vlan_mode=access tag=0``

0 commit comments

Comments
 (0)