Commit Graph

14109 Commits

Author SHA1 Message Date
Zuul 22a3384194 Merge "Fix assignment-from-no-return error" 2024-04-25 17:31:42 +00:00
Zuul a02b46b5b7 Merge "dhcp: fix auto_scheduler_network understanding dhcp_agents_per_network" 2024-04-23 21:02:27 +00:00
Zuul 34a0e88dce Merge "Bandit: Remove bandit B324 from skip list" 2024-04-23 15:51:38 +00:00
Zuul 4ce6cc8792 Merge "Replace bare Opt by PortOpt" 2024-04-22 16:17:44 +00:00
Zuul febc39733e Merge "Fix global-variable-not-assigned warnings" 2024-04-22 15:48:58 +00:00
Zuul 78f157ca32 Merge "[OVN] Optimize ``HAChassisGroupRouterEvent`` code" 2024-04-22 15:48:50 +00:00
Sahid Orentino Ferdjaoui 1bc945f0d5 dhcp: fix auto_scheduler_network understanding dhcp_agents_per_network
When using routed provided network, the condition is bypassing
dhcp_agents_per_network which results that in a env with 3 agents and
dhcp_agents_per_network=2, for a given network already well handled
by 2 agents. If restarting the third agent It will start to handle the
network also which will result to have 3 agents handling the
network.

Closes-bug: #2058908
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com>
Change-Id: Ia05a879b0ed88172694bd6bffc6f7eb0d36bb6b0
2024-04-22 14:20:20 +02:00
Takashi Kajinami 9148c20b66 Replace bare Opt by PortOpt
The placement_port option in fullstack tests can be implemented by
the native PortOpt instead of defining a specific type.

Change-Id: Iedf50249080d3f631942febb1f5e089f06f43db0
2024-04-22 14:04:13 +09:00
Zuul 73608c24a9 Merge "More precise flow table cleaning" 2024-04-16 21:47:43 +00:00
Zuul 234d7d4238 Merge "Mark L3HA dvr tests unstable" 2024-04-16 17:15:27 +00:00
yatinkarel 4d405ca675 Mark L3HA dvr tests unstable
These test randomly fails with NetworkInterfaceNotFound
from quite some time. Until the issue is fixed added unstable_test
decorator so the job do not fail for these.

Related-Bug: #1961740
Change-Id: I1a352526aac72b417f93f51ba50c3359359c240d
2024-04-16 18:59:29 +05:30
elajkat d782a868d7 Bandit: Remove bandit B324 from skip list
Remove B324 (prohibit list calls: md5, sha1 for python>=3.9)
from bandit skip list, for this replace sha1 with blake2b.

Change-Id: Iafe571ad0de0408414ed321f4b9e9588916a873d
2024-04-10 11:56:46 +02:00
Brian Haley 0914e6db3c Fix global-variable-not-assigned warnings
There were some globals in the IP monitor functional tests
that were only used and never assigned, there is no need
to define them as such in this case. No functional change.

TrivialFix

Change-Id: I0f8e630538ea5ae21537a9a72faf0cdd34096f11
2024-04-09 19:04:55 -04:00
LIU Yulong bac1b1f721 More precise flow table cleaning
OVS-agent wants to clean flows table by table during restart,
but actually it does not. If one table has same cookie with
other tables, all related flows will be clean at once.

This patch adds the table_id param to the related call
to limit the flow clean on one table at once.

Closes-Bug: #2060587
Change-Id: I266eb0f5115af718b91f930d759581616310999d
2024-04-09 14:10:55 +08:00
Rodolfo Alonso Hernandez c2f34e136d [OVN] Optimize ``HAChassisGroupRouterEvent`` code
This patch is addressing some comments made in the previous patch [1]
and optimizing the code of ``HAChassisGroupRouterEvent`` class.

Related-Bug: #2052821

[1]https://review.opendev.org/c/openstack/neutron/+/909437

Change-Id: Ibc4afce16e95ea7d48737c254cd11431e9994704
2024-04-08 22:52:42 +00:00
Rodolfo Alonso Hernandez bd31c23380 [OVN] Provide HA functionality to "Logical_Router" chassis pinning
When an external tunnelled network is used as gateway network in an
OVN router, the "Logical_Router_Port" is not bound to any chassis and
the "Logical_Router" is pinned to a gateway chassis, using the list
provided in a "HA_Chassis_Group".

This patch attends to any change in the "HA_Chassis" list of the
"HA_Chassis_Group" to update the "Logical_Router" chassis assigned.
This provides HA functionality in case that the bound chassis
(chassis pinned) fails.

Closes-Bug: #2052821
Change-Id: Ia3d4271d015386fbec3c3f2276a7f62c2f8ad5dd
2024-04-08 16:38:56 +00:00
Rodolfo Alonso Hernandez 25a1809964 [OVN] "Logical_Router" pinned to chassis, OVN L3 scheduler
Pin a "Logical_Router" to a chassis when the gateway network (external
network) is tunnelled. When the external network is tunnelled, the
"Logical_Router_Port" acting as gateway port is not bound to any
chassis (the network has no physical provider network defined).

In that case, the router is pinned to a chassis instead. A
"HA_Chassis_Group" is created per router. The highest "HA_Chassis" of
this group is assigned to the router. If the gateway port is deleted,
the pinned chassis is removed from the "options" field. If the
router is deleted, the "HA_Chassis_Group" is deleted too.

NOTE: in the a chassis belonging to the router "HA_Chassis_Group"
changes, the list of "HA_Chassis" will be updated in
``ChassisEvent.handle_ha_chassis_group_changes``. However, a
"HA_Chassis_Group" change is handled by OVN, when assiged.

But in this case we are using this artifact, as commented before,
to "manually assign" (from core OVN point of view) the highest
priority "HA_Chassis" to the router (this upcoming funcionality
will be implemented in core OVN). A new follow-up patch will be
pushed to provide HA functionality and update the "HA_Chassis"
assigned to the "Logical_Router" when the chassis list changes.

Partial-Bug: #2052821
Change-Id: I33555fc8a8441149b683ae68f1f10548ffb662a6
2024-04-08 16:38:09 +00:00
Zuul 4cad0eda59 Merge "Fix KeyError failure in _sync_subnet_dhcp_options()" 2024-04-06 00:26:55 +00:00
Zuul 59bee68b1d Merge "dhcp: ensure that cleaning DHCP process with one segment happens first" 2024-04-05 15:37:24 +00:00
Zuul 2db8620523 Merge "[OVN] Create an OVN DB transaction context decorator" 2024-04-02 03:03:52 +00:00
Rodolfo Alonso Hernandez 00b64d289b
[OVN] Create an OVN DB transaction context decorator
This decorator allows to create a new OVN database transaction or
use the existing one in a method. It is needed to pass the transaction
object (if any) and the IDL (Northbound or Southbound).

Related-Bug: #2052821
Change-Id: I925c1d745197edd08a62ced66b275c7b1dad1d6a
2024-03-29 10:13:58 +01:00
elajkat 3c557b29f8 Bandit: Remove bandit B311, B303 from skip list
Remove B303 (md5, sha1 for python<3.9) and
remove B311 (Standard pseudo-random generators are
not suitable for security/cryptographic purpose) from
the skip list of bandit execution.

Change-Id: I6e9e61e7f94dc9ca339942529af8997adef45e38
2024-03-28 13:55:25 +01:00
Miguel Lavalle 8ff8203fd7 Enable HA for OVN router flavors
In this change, we add the ability to create high availability
user defined router flavors under the ML2/OVN L3 service
plugin.

Closes-Bug: #2020823

Change-Id: I0d26f672d6239d840d3cf817a2553a06ef00a854
2024-03-26 20:07:52 -05:00
Zuul 01a6684dd0 Merge "Don't delete already deleted extra router routes" 2024-03-26 17:34:23 +00:00
Zuul 0590bcda68 Merge "Fixing the 500 HTTP code in the metadata service if Nova is down" 2024-03-26 16:42:10 +00:00
Anton Kurbatov 6395b4fe8e Fixing the 500 HTTP code in the metadata service if Nova is down
If the Nova metadata service is unavailable, the requests.request()
function may raise a ConnectionError. This results in the upper code
returning a 500 HTTP status code to the user along with a traceback.
Let's handle this scenario and instead return a 503 HTTP status code
(service unavailable).

If the Nova service is down and is behind another proxy (such as
Nginx), then instead of a ConnectionError, the request may result in
receiving a 502 or 503 HTTP status code. Let's also consider this
situation and add support for an additional 504 code.

Closes-Bug: #2059032
Change-Id: I16be18c46a6796224b0793dc385b0ddec01739c4
2024-03-26 12:14:08 +00:00
Miguel Lavalle 9d729bda20 Check unspecified flavor in user defined driver
In order to decide whether to process a router related
request, the user defined router flavor OVN driver needs to
check the flavor_id specified in the request. This change adds
the code to test the case when the API passed the flavor_id as
unspecified.

Change-Id: I4d7d9d5582b97246cad63ef7f5511b159d6c6791
Closes-Bug: #2059051
2024-03-25 17:30:01 -05:00
Sahid Orentino Ferdjaoui 5453c92a2e dhcp: ensure that cleaning DHCP process with one segment happens first
Previously, the code used to clean up old DHCP processes for a network
before creating new ones supporting multiple segments per network
could potentially not be executed first. Since disabling applies to
cleaning the namespace, this could have led to the network setup being
destroyed after being done.

This change moves the part that cleans up the old DHCP setup to ensure
it is executed first.

Closes-bug: #2049615
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com>
Change-Id: Iecdb2d81ee077c9b9057d0708c5c88e159970039
2024-03-25 10:22:05 +01:00
Zuul 4e9d03d29f Merge "Fix used-before-assignment warnings" 2024-03-22 01:27:48 +00:00
Zuul 57f48b03ac Merge "Fix disallowed-name warnings" 2024-03-22 01:27:40 +00:00
Rodolfo Alonso Hernandez 70ddf4eef5 Add "socket" NUMA affinity policy
This new extension adds a new parameter to the NUMA affinity policy
list: "socket". The "socket" NUMA affinity policy has been supported
in Nova since [1].

[1]https://review.opendev.org/c/openstack/nova/+/773792

Closes-Bug: #2052786
Change-Id: Iad2d4c461a2aceef6ed2d5e622cce38362d79687
2024-03-21 16:04:24 +00:00
Zuul e5d0877045 Merge "Enhance IptablesFirewallDriver with remote address groups" 2024-03-21 10:08:15 +00:00
Robert Breker 5e1188ef38 Enhance IptablesFirewallDriver with remote address groups
This change enhances the IptablesFirewallDriver with support for remote
address groups. Previously, this feature was only available in the
OVSFirewallDriver. This commit harmonizes the capabilities across both
firewall drivers, and by inheritance also to OVSHybridIptablesFirewallDriver.

Background -
The Neutron API allows operators to configure remote address groups [1],
however the OVSHybridIptablesFirewallDriver and IptablesFirewallDriver do
not implement these remote group restrictions. When configuring security
group rules with remote address groups, connections get enabled
based on other rule parameters, ignoring the configured remote address
group restrictions.
This behaviour undocumented, and may lead to more-open-than-configured network
access.

Closes-Bug: #2058138
Change-Id: I76b3cb46ee603fa5e829537af41316bb42a6f30f
2024-03-20 22:20:45 +00:00
Miguel Lavalle 26ff51bf05 Fix making all user defined flavor routers HA
Since [1] was merged, user defined flavor routers with the HA
attribute set to False cannot be created. This change fixes
it.

Closes-Bug: #2057983

[1] https://review.opendev.org/c/openstack/neutron/+/910889

Change-Id: Ic72979cfe535c1bb8cba77fb82a380c167509060
2024-03-18 19:20:03 -05:00
Zuul 00355e092d Merge "[OVN] Use the LSP update event to update the LRP" 2024-03-15 10:30:43 +00:00
Zuul 24a7f20a5e Merge "[OVN] Add the network type to the ``Logical_Switch`` register" 2024-03-15 10:30:38 +00:00
Zuul c0f113073d Merge "[OVN] Implement OVN agent metadata extension" 2024-03-14 16:49:40 +00:00
Sebastian Lohff 27b2f22df1 Don't delete already deleted extra router routes
When handling the deletion of extra routes we need to handle the case
that the route is already deleted by another call in the time we have
fetched the extra routes and try to delete it. This is a classic race
condition when two calls try to update the routes of a router at the
same time. The default MariaDB/MySQL transaction isolation level does
not suffice to prevent this scenario. Directly deleting the route
without fetching it solves this problem.

Change-Id: Ie8238310569eb7c1c53296195800bef5c9cb92a3
Closes-Bug: #2057698
2024-03-13 11:21:32 +01:00
Rodolfo Alonso Hernandez f82c650c8c [OVN] Add the network type to the ``Logical_Switch`` register
Now the ``Logical_Switch`` register (that represents an OVN network),
stored the network type in the "external_ids" field.

Related-Bug: #2056558
Change-Id: I9e55a7412d841b7b59602c56c3a4e2f9c954aeed
2024-03-13 07:38:03 +00:00
Arnau Verdaguer 2a196fefd4 Fix TestOVNMechanismDriver ipv6 tests
- test_update_subnet_dhcp_options_in_ovn_ipv6_not_change
- test_enable_subnet_dhcp_options_in_ovn_ipv6
This tests will fail if host where unit tests has ipv6 dns_servers
configured. This patch mocks get_system_dns_servers to avoid tests
to look at the host configuration.

Closes-Bug: #2056778
Change-Id: I2e703ab4b63c90d7a14f0dc41d37b0a98163bce0
2024-03-11 17:30:11 +01:00
Rodolfo Alonso Hernandez 0fd654f592 [OVN] Use the LSP update event to update the LRP
Now the "Logical_Router_Port" is updated when a "Logical_Switch_Port"
event is received. When the event is received, it is first checked that
the "Logical_Switch_Port" belongs to a router; if that check is
possitive, the router port update method is called.

Closes-Bug: #2056558
Change-Id: I13b4c804ea6a9f8a89d3796c1cec88ffa1de6ded
2024-03-10 04:39:40 +00:00
Rodolfo Alonso Hernandez b8953b543a [OVN] Enable "ha" API flag for OVN routers
The "ha" API flag is now enabled for the OVN routers. Because of the
current implementation, this flag must be always "True". When a new
router is created, this flag is always set. If an OVN router is
explicitly created or updated with "--no-ha" (ha=False), the server
will raise an InvalidInput exception.

Depends-On: https://review.opendev.org/c/openstack/neutron-tempest-plugin/+/911081

Closes-Bug: #2020823
Change-Id: I60ff33680dd5397a226a9051d51bfb0701f862b5
2024-03-06 18:42:29 +00:00
Zuul 5de90ff9c4 Merge "Use the system-dependent string for IP protocol 4" 2024-03-06 18:28:59 +00:00
Zuul c6b9106784 Merge "[FT] Check "Port_Binding" register exists before checking type" 2024-03-06 12:25:42 +00:00
Zuul 91ec092987 Merge "Fix pointless-string-statement warnings" 2024-03-06 12:25:26 +00:00
Zuul 3d1abd3343 Merge "Fix misplaced-bare-raise warning" 2024-03-06 12:25:18 +00:00
Zuul ecbe2a2059 Merge "Fix import-outside-toplevel warnings" 2024-03-06 12:12:54 +00:00
Zuul 36c6da46e5 Merge "Allow HA routers to have automatic l3agent failover" 2024-03-06 09:32:43 +00:00
Brian Haley cd1d191e33 Use the system-dependent string for IP protocol 4
iptables-save uses a system-dependent value, usually that
found in /etc/protocols, when 'ipip' is given as the
security group protocol. The intent is to always use the
string value for IP protocol '4', as iptables-save has no
'-n' flag to print values numerically.

This updates a previous change (793dfb04d) that hard-coded
that string to 'ipencap', which broke CentOS/Fedora, which
uses 'ipv4'.

For this reason we cannot hard-code anything in neutron-lib,
this needs to be added dynamically, so this one-line change
needs to stay here, and effectively closes the bug.

Closes-bug: #2054324
Change-Id: Ic40b539c9ef5cfa4cbbd6575e19e653342e8342b
2024-03-05 15:36:17 -05:00
Rodolfo Alonso Hernandez fe31f4fe02 [OVN] Implement OVN agent metadata extension
This patch is implementing the OVN agent metadata extension, by reusing
the OVN metadata class. The class ``MetadataAgent`` is inherited in the
``MetadataExtension`` class. The goal is to use the same code in both
implementations (until the OVN metadata agent is deprecated).

The OVN agent metadata extension has a different initialization
process. The OVN and OVS IDL connections are created during the
extension initialization but are not accessible. The ``start`` method
is used to load the configuration, execute the sync process and
register the metadata extension.

This extension will replace the need of the OVN metadata agent. The
deprecation of this agent will imply the refactor of the existing code
that now is shared between both agents.

This new OVN agent will be tested in the "neutron-tempest-plugin-ovn"
CI job, after the change done in the following patch.

Needed-By: https://review.opendev.org/c/openstack/neutron-tempest-plugin/+/909860

Partial-Bug: #2017871
Change-Id: I4381a67648a9b6198a8d936db784964d74dc87a1
2024-03-05 16:44:34 +00:00