28054 Commits

Author SHA1 Message Date
Frode Nordahl
4ccc296f56 [ovn] Honor enable_default_route_ecmp attribute
Only create multiple default routes when the router has the
`enable_default_route_ecmp` attribute set to True.

Partial-Bug: #2002687
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
Change-Id: I17512ec494661151e46282f0bd08abc55bef1df8
2024-01-26 01:56:33 +00:00
Frode Nordahl
0bc9a71387 [ovn] Implement support for external-gateway-multihoming extension
The general approach is to update the ovn_client and ovn_db_sync
code to handle multiple gateway ports wherever a single gateway
port is handled today.

In this patch set multiple static routes for default gateway will
be added by default when multiple gw ports are present.  Support
for the `enable_default_route_ecmp` attribute to control this
behavior will be added in subsequent patch set to avoid making
this change too large.

Partial-Bug: #2002687
Change-Id: I00b1f29172be5a0034b921b11af3a8d502273766
2024-01-25 20:51:22 -05:00
Bence Romsics
27601f8eea Set trunk parent port as access port in ovs to avoid loop
A non-vlan-transparent trunk parent port (tpt) should only forward
untagged frames. Earlier it was configured to forward anything (trunk
mode in ovs). This patch changes the trunk mode to access mode and
sets the trunk parent's tag explicitly to 0.

Change-Id: I4bcfe53fe87d7c9218dd0db9d7224bb323709a21
Closes-Bug: #2048785
2024-01-24 14:42:13 +01:00
Thomas Goirand
bf2f8342d7 python-3.12: do not use datetime.datetime.utcnow()
This is deprecated in the favor of:
oslo_utils.timeutils.utcnow()

Change-Id: Ic7304aea55258822b0be59ce45c6686182f4ecd0
2024-01-20 04:30:48 +00:00
Brian Haley
3ef02cc2fb Consume code from neutron-lib
All of these exceptions and constants have been in
neutron-lib for a while, start using them.

While looking for other things to consume found an old
neutron-lib TODO that did not apply anymore, so removed.

TrivialFix

Change-Id: I9431075a50ba05be872db422125e6af6266ccb99
2024-01-19 17:18:57 -05:00
Rodolfo Alonso Hernandez
64fddf4f2d [OVN][FT] Retry in case of timeout when executing "ovsdb-client".
The shell command "ovsdb-client", in the functional tests, is prone to
timeouts. This patch adds a tenacity decorator and sets the command
timeout to 3 seconds, that should be more than enough to retrieve one
single register.

Closes-Bug: #1955008
Change-Id: I38626835ca809cc3f2894e5f81fab55cf3f40071
2024-01-19 11:41:15 +00:00
Zuul
5ce17647c6 Merge "Router flavors and service type for OVN" 2024-01-17 20:27:17 +00:00
Rodolfo Alonso Hernandez
cd1eb7852d [OVN] Add a start method to the OVN agent extensions
Each OVN agent extension can implement a start method. It is called
after the extension manager initialization, at the end of the
``OVNNeutronAgent.start`` call.

Related-Bug: #2017871
Change-Id: I334027f061fa963c1cf24540b27c1ff76145b977
2024-01-17 18:41:36 +00:00
Rodolfo Alonso Hernandez
9e74ea11e8 [OVN] The OVN agent exposes the `load_config` method.
Now the ``OVNNeutronAgent.load_config`` method is public and accessible
by the OVN agent extensions.

This patch also makes use of the property ``ovs_idl``, that implicitly
loads the OVS IDL if it is not done previously.

Related-Bug: #2017871
Change-Id: I356c16d753b524736673a665a6590ae903be5682
2024-01-17 18:40:47 +00:00
Zuul
52781954c2 Merge "Make get_ports RPC method common for the DHCP and Metadata agent" 2024-01-17 18:35:00 +00:00
Brian Haley
1dbc373869 Update .pylintrc
There are a few warnings disabled that do not generate
failures any more, re-enable them by removing from
.pylintrc file.

TrivialFix

Change-Id: I1a4fff33b0dcd3d88b4ab0c86546098c7a9cafa4
2024-01-17 13:33:08 -05:00
Zuul
e6a7cc26a0 Merge "[OVN] Update lsp host id when virtual parent moves" 2024-01-17 18:08:17 +00:00
Miguel Lavalle
49366ecada Router flavors and service type for OVN
Support is added to the OVN L3 service plugin for the router
flavors and service type framework

Partial-Bug: #2020823
Change-Id: If40d7b39e7b59a39ff7622bd823dbdb14bfc69d2
2024-01-17 09:33:07 -06:00
Felix Huettner
3d5d82a197 ovn-l3: reschedule lower priorities
if a gateway chassis is removed we previously only plugged the hole it
left in the priorities of the lrps. This can lead to bad choice since we
are bound by all other currently used chassis.
By allowing us to also reschedule the lower priorities we get
significantly more freedom in choosing the most appropriate chassis and
prevent overloading an individual one.

As an example from the new testcase:
previously we would have had all prio 2 schedules on chassis3, but with
this change now this distributes better also to chassis4.

Partial-Bug: #2023993
Change-Id: I786ff6c0c4d3403b79819df95f9b1d6ac5e8675f
2024-01-17 12:04:09 +01:00
Felix Huettner
b5f5f3def3 ovn-l3 scheduler: calculate load of chassis per priority
previously we calculated the "load" of a chassis across the highest
priority of each of the chassis. This can lead to suboptimal results in
the following situation:
* you have gateway chassis: hv1, hv2, hv3
* you have routers:
   * g1: with priority 3 on hv1, priority 2 on hv2, priority 1 on hv3
   * g2: with priority 3 on hv1, priority 2 on hv2, priority 1 on hv3
   * g3: with priority 3 on hv3, priority 2 on hv2, priority 1 on hv1
   * g4: with priority 3 on hv3, priority 2 on hv2, priority 1 on hv1

When now creating a new router the previous algorythm would have placed
prio 3 of it either on hv1 or hv3 since their count of highest
priorities (2 of prio 3) is lower than the count of the higest priority
of hv2 (4 of prio 2). So it might have looked like:
* g5: with priority 3 on hv3, priority 2 on hv1, priority 1 on hv3
(This case has been implemented as `test_least_loaded_chassis_per_priority2`).

However this is actually a undesired result. In OVN the gateway chassis
with the highest priority actually hosts the router and processes all of
its external traffic. This means it is highly important that the highest
priority is well balanced.

To do this now we no longer blindly use the count of routers of the
highest priority per chassis, but we only count the routers of the
priority we are currently searching a chassis for. This ensures that in
the above case we would have picked hv2 for priority 3, since it has not
actually active router running.

The algorithm implemented now is based upon the assumption, that amount
of priorities scheduled per router is equal over all routers. This means
it will perform suboptimally if some phyiscal network is available on 5
gateway chassis, while another one is only available on 2. (It is
however unclear if the previous implementation would have been better
there).

In this commit we also adopt the testcases in test_l3_ovn_scheduler to match
to this assumption. Previously the distribution data used for testing
had been unrelasitic as it mostly scheduled one gateway chassis for each
router.

It also fixes the previously broken priority calculation in the
testcase, that would just assign prio 0 to all gateways.

Partial-Bug: #2023993
Change-Id: If2afcd546a1da9964704bcebbfa39d8348e14fe8
2024-01-17 12:04:09 +01:00
Zuul
b28bf2d3a1 Merge "Cleanup setup.py and requirements" 2024-01-17 08:30:41 +00:00
Zuul
1211530294 Merge "Add firewall_v2 to extensions supported by ovn" 2024-01-17 07:47:56 +00:00
Zuul
290cb63003 Merge "dhcp: improving log level of cleanup stale devices" 2024-01-17 07:24:23 +00:00
Rodolfo Alonso Hernandez
e234a7aeab If method `set_netns` fails, restore previous device namespace
If the ``IpLinkCommand.set_netns`` fails, the method restores the
previous device namespace before raising the exception.

Closes-Bug: #2049590
Change-Id: I73b36ef161441b52922d888c11a144eafe8a7ed0
2024-01-17 04:25:44 +00:00
Miro Tomaska
637e7a5007 Make get_ports RPC method common for the DHCP and Metadata agent
This patch is the initial implementation on the suggestion
from this patch[1].

The DHCP agent can query the existing `get_ports` RPC method because
this method is already exposed in the MetadataRpcCallback(server side)
which runs under the same topic(PLUGIN) and namespace(None). The benefit
here is that there is no change needed to the API, however it does
go against how we historically setup the RPC layer between a server and client.

[1] https://review.opendev.org/c/openstack/neutron/+/903572/comments/3d4e0453_4b4d2ab6

Related-Bug: #1982569
Change-Id: Icd7c55d2a5103bdbd90907b1dbfb9ccfe34c020a
2024-01-16 15:30:24 -05:00
70f9dd926f update OVS_BRANCH to be compatible with ovn main branch
Required since [1] included in ovn repo.

[1] https://github.com/ovn-org/ovn/commit/66ef670

Closes-Bug: #2049488
Change-Id: Ia50937dd81a33da8297576e91aa69e1897899529
2024-01-16 13:04:19 +05:30
Zuul
3ced5956a7 Merge "Forbid the subnet gateway IP deletion if a router interface is attached" 2024-01-15 19:45:23 +00:00
Rodolfo Alonso Hernandez
f9e40971e9 Forbid the subnet gateway IP deletion if a router interface is attached
When a router interface is created, the corresponding subnet gateway IP
is tested first [1]. If the subnet has no gateway IP, the router
interface cannot be created. This IP will be assigned to this port.

The Neutron API also prevents from modifying the subnet gateway IP
if assigned to a router interface [2]. However the API is not
preventing the subnet gateway IP deletion. This patch is adding
this check.

This patch is being tested in the neutron-tempest-plugin [3].

[1]de58c1b995/neutron/db/l3_db.py (L902-L904)
[2]de58c1b995/neutron/db/db_base_plugin_v2.py (L715)
[3]https://review.opendev.org/c/openstack/neutron-tempest-plugin/+/904710

Closes-Bug: #2036423
Change-Id: I4c7b399a3a052749abdb88fb50be628ee91b63a0
2024-01-17 13:33:41 +00:00
Zuul
d34c1f916f Merge "Remove deprecated OVN vif_type config option" 2024-01-15 12:45:52 +00:00
Zuul
a89ba3ae32 Merge "Remove _use_db_facade()" 2024-01-15 12:30:02 +00:00
Zuul
6d927d283c Merge "Fix implicit-str-concat warnings" 2024-01-15 12:17:19 +00:00
Zuul
77ad1ba640 Merge "Fix use-maxsplit-arg warnings" 2024-01-15 12:17:15 +00:00
Zuul
8137d0b728 Merge "Fix use-list-literal warnings" 2024-01-15 12:17:11 +00:00
Zuul
3c31f027a1 Merge "Fix unnecessary-list-index-lookup warning" 2024-01-15 11:25:48 +00:00
Zuul
a921d14d9a Merge "Revert "Disable mysql gather performance in jobs"" 2024-01-15 10:24:49 +00:00
Rodolfo Alonso Hernandez
baaf240ce3 [OVN] Add the bridge name and datapath type to the port VIF details
Same as in ML2/OVS, the ML2/OVN mechanism driver adds to the port
VIF details dictionary the OVS bridge the port is connected to
and the integration bridge datapath type.

Closes-Bug: #2045889
Change-Id: Ifda46c42b9506449a58fbaf312cc71c72d9cf2df
2024-01-14 15:51:07 +00:00
Brian Haley
d55b15bedc Fix unnecessary-list-index-lookup warning
Noticed this test file had this warning, fixed it.
No functional change.

TrivialFix

Change-Id: I2c32838d32d7e5c2ef3d573f2b55eb668ea09c67
2024-01-13 13:53:26 -05:00
liushy
5dfb742d71 Add firewall_v2 to extensions supported by ovn
This addition is required to run a devstack setup with ovn
that includes firewall_v2 from the proposed patch [1]

[1]https://review.opendev.org/c/openstack/neutron-fwaas/+/845756

Related-Bug: #1971958
Change-Id: Id370e86e470c160c38cfb5126bbfa0f0babe4485
2024-01-13 03:18:55 +00:00
Brian Haley
d2a50945bf Remove _use_db_facade()
neutron.object.base._use_db_facade() is unused according
to codesearch, except for the test cases. Remove it.

TrivialFix

Change-Id: I8f183584bf66bac157694c51769409dba2c79da2
2024-01-12 18:29:00 -05:00
Brian Haley
c05fa72915 Fix use-list-literal warnings
Noticed a few test files had these warnings, fixed them.
No functional change.

TrivialFix

Change-Id: Ieb31fed3278e0ca226ef7a64902c06c1df70ecc0
2024-01-12 16:00:24 -05:00
Brian Haley
3d8460c222 Fix use-maxsplit-arg warnings
Noticed a few test files had these warnings, fixed them.
No functional change.

TrivialFix

Change-Id: I082baf04588e3f96a975c8fb2d74b5ec1b987801
2024-01-12 15:54:28 -05:00
Brian Haley
3e2ae14c07 Fix implicit-str-concat warnings
Noticed two test files had these warnings, fixed them.
No functional change.

TrivialFix

Change-Id: I495aaef050da2bd10912d87451b8177a6a929563
2024-01-12 15:44:05 -05:00
Michel Nederlof
e68a920c11 [OVN] Update lsp host id when virtual parent moves
When a virtual port is moved from one port to another port the
PortBindingUpdateVirtualPortsEvent event would only update the binding
host id in the neutron database, while it is also usefull to keep the
information in the OVN database up to date with the host information

Other plugins that connect to the OVN database can then also rely on the
information stored in the OVN DB's


Closes-Bug: #2038413

Change-Id: I59c6c4b2c8b023b9c9c3bab1741d957fa1f738fc
2024-01-12 09:50:30 +01:00
Takashi Kajinami
8ac18a8ee1 Cleanup setup.py and requirements
- Python 2 is no longer supported
- setup.py is no longer managed by the global tooling
- Recent pip does not require appropriate order in requirement files

Change-Id: Iaa1aa0022e207cceb26ed45474bc6edfbbec4faa
2024-01-12 17:44:09 +09:00
Zuul
a89b5e5772 Merge "[FT] Add more information to `IpRouteCommandTestCase` if fails" 2024-01-11 19:33:23 +00:00
Rodolfo Alonso Hernandez
d1fe6a1c27 [FT] Add more information to `IpRouteCommandTestCase` if fails
If a test case fails, now the routes present in the system are printed
too.

Related-Bug: #1988037
Change-Id: Ie8931068bc6d3cb401f3dc70654d9b3d6f0e5281
2024-01-19 13:54:15 +00:00
Zuul
1c074df05a Merge "Add info about metering agent gap in the ML2/OVN backend" 2024-01-11 12:47:51 +00:00
Zuul
b1db513783 Merge "Update exception conditions in `_process_create_port`" 24.0.0.0b1 2024-01-11 11:45:18 +00:00
Rodolfo Alonso Hernandez
de40bfbafb Update exception conditions in `_process_create_port`
This is a follow-up patch to handle a missing comment. The except
branch should never catch a ``AttributeError`` exception, only a
``KeyError`` if that is missing in the ``data`` dictionary.

Related-Bug: #2013228
Change-Id: I6a3249649dde58e666048a613640338ea8af7b36
2024-01-17 17:14:23 +00:00
Rodolfo Alonso Hernandez
90ea96b290 Remove the "new_facade" parameter that is no longer needed
Trivial-Fix

Change-Id: Ie910e0b1655113c22e1cfbeff00ca341046cec71
2024-01-17 17:02:46 +00:00
Slawek Kaplonski
3eeb5d3e6a Add info about metering agent gap in the ML2/OVN backend
Metering agent don't supports ML2/OVN backend currently and this should
be documented in the feature parity gaps document.

Related-bug: #2048773
Change-Id: I2b8c37f33e3ae4b17cc88bffde014d7d730e59d3
2024-01-11 11:42:05 +00:00
Zuul
0251c03cf4 Merge "Remove the "new_facade" parameter that is no longer needed" 2024-01-11 11:33:49 +00:00
LIU Yulong
70eb4006c6 Not process security group for none active ports
We recently met an issue during VM live migration:
1. nova starts live migration
2. plug ports on new host
3. neutron-ovs-agent starts to process the port,
   but the port is in 'added' and 'updated' set
   at the same time.
4. because nova still not activate the destination
   port binding, so there is no local vlan for
   this port.
Then, ovs-agent met errors:
Error while processing VIF ports: OVSFWTagNotFound:
Cannot get tag for port tap092f38ed-a7 from its other_config: {}

This fix is to remove ports of the
"binding_no_activated_devices" for ``setup_port_filters``.

Closes-Bug: #2048979
Change-Id: I0f1e6bf202ef08f75246d6e99b3774d0b6fc9e2b
2024-01-11 15:23:24 +08:00
Brian Haley
4007cfa956 Remove deprecated OVN vif_type config option
This config option was originally introduced before
the networking-ovn merge into neutron in 2019, and as
there is no usage it can be safely removed.

TrivialFix

Change-Id: I8ac826926dc8d3881ee57dc677f41bdbed00e5c0
2024-01-10 16:19:18 -05:00
Brian Haley
712d000a7e Remove deprecated name quota_rbac_entry
This deprecated name for quota_rbac_policy was
introduced before 2016, and as there is no usage
according to codesearch it can be safely removed.

TrivialFix

Change-Id: I5cc3392985ee595999a5030e6b9c80a4c3009187
2024-01-10 16:16:16 -05:00