The current shebang requires /usr/bin/python which is not available in
Ubuntu Jammy by default.
This also fixes some unnecessary/missing shebangs.
Change-Id: Ib25a0a7f39f68f43622609391710dd3b1abc2d00
After updating pylint, it started emitting additional "C"
warnings in some cases, fix some of them.
use-implicit-booleaness-not-comparison,
use-maxsplit-arg,
unnecessary-dunder-call
Trivialfix
Change-Id: I53558e6bc52aaea590f6c147aacc062c08099464
The neutron.plugins.ml2.drivers.agent.config module registers options
commonly used by the ml2 agents but in fact it is used only by linux
bridge agent and macvtap agent.
This change makes all ml2 agents use that base module consistently in
individual config modules.
Change-Id: Ib3ec8a8eaf347721bb06f092a0887e62f3a6bffd
Importing some modules lead to registering config options that may
collide with config options from a project that calls the import. This
patch wraps the side effect that registers config options into a
function that needs to be called in case the caller wants to register
the options.
This solution is also not perfect as it guards the common options to be
registered only once even if the function is called multiple times. This
is to solve problems in unittests, ideally we should always call the
function just once even in our testing suites.
Resolves-Bug: #1968606
Change-Id: Ic1532eb8de887ff1b1085206df11f53e22f7f524
Signed-off-by: Jakub Libosvar <libosvar@redhat.com>
"IPWrapper.add_vxlan" method must have "dev" parameter as possitional
argument. A VXLAN interface must be always created on top of an existing
network device:
https://www.kernel.org/doc/Documentation/networking/vxlan.txt
Closes-Bug: #1954316
Change-Id: Ia082f8531ffcc1599206124774599dcdb500274a
Attempting to terminate a vxlan on the lo interface with
multiple ip addresses fails. This seems to be because only
the first ip address on the interface is used. If this address
is invalid for vxlan creation (ie. 127.0.0.1), the vxlan
interface will be created, but will not have a source ip
address, and will therefore be non-functional. To remedy this
issue, when L2population is used, we can set the local
argument to the local_ip, thus ensuring the intended ip
address is configured.
Closes-Bug: 1929998
Change-Id: I9c54a268fc4ef9705637556ecba161bd6523a047
Signed-off-by: Anthony Timmins <atimmins@datto.com>
Changed the logic of decorator "catch_exceptions" to provide a
Pythonic output: if succeeds, returns True; if fails, returns False.
Change-Id: Idbf2ffb4ef403f343973bde3b3599f9cd3aaddf2
Story: #2007686
Task: #39975
There is no real reason we should be using some of the
terms we do, they're outdated, and we're behind other
open-source projects in this respect. Let's switch to
using more inclusive terms in all possible places.
Change-Id: I99913107e803384b34cbd5ca588451b1cf64d594
Now that we use setproctitle for neutron-server workers (and
neutron-keepalived-state-change), this has the side effect of changing
the process name for agents, impacting some monitoring systems. More
details in launchpad bug.
This patch fixes it by setting the name with setproctitle to:
agent name (original process name).
Also use the newly introduced name constants to replace existing
hardcoded uses.
Change-Id: I74c3a4d3e9f833752571a75f196560cd45529385
Closes-Bug: #1881297
By default, if no metric is defined, the kernel interprets the
highest value (0).
The current implementation, using pyroute2, is a translation from
the CLI command "ip route". This command uses the netlink API to
communicate with the kernel. In IPv6, when the metric value is not
set is translated as 1024 as default [1].
[1]https://access.redhat.com/solutions/3659171
Change-Id: I0c5f9e320bbbf314a2d6a22c515bf903de84cdaf
Related-Bug: #1855759
The gateway IP address in the gateway dictionary returned by
"ip_lib.list_ip_routes" is stored in "via".
"priority" parameter is changed to "metric", to match input and
output parameters.
Change-Id: I67ae473dca8d706f963c3b55b9410f9a79d7f32b
Closes-Bug: #1855759
Removed E125 (continuation line does not distinguish itself
from next logical line) from the ignore list and fixed all
the indentation issues. Didn't think it was going to be
close to 100 files when I started.
Change-Id: I0a6f5efec4b7d8d3632dd9dbb43e0ab58af9dff3
There are a few places in neutron that are not yet using the agent
topics module from neutron-lib. This patch address them by:
- Removing neutron.agent._topics
- Switching all uses of topics over to use neutron-lib
NeutronLibImpact
Change-Id: Ic9699ca93cd6fe59ed575ab444c4a4f9456323b2
Reduces E128 warnings by ~260 to just ~900,
no way we're getting rid of all of them at once (or ever).
Files under neutron/tests still have a ton of E128 warnings.
Change-Id: I9137150ccf129bf443e33428267cd4bc9c323b54
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Today the neutron common exceptions already live in neutron-lib and are
shimmed from neutron. This patch removes the neutron.common.exceptions
module and changes neutron's imports over to use their respective
neutron-lib exception module instead.
NeutronLibImpact
Change-Id: I9704f20eb21da85d2cf024d83338b3d94593671e
Convert unnessary instance method to staticmethod so that any plugin
API can use the methods.
Closes-Bug: #1805356
Change-Id: Ic568f470b813b85cfa46aa46308480e2579f779c
As part of the implementation of multiple port bindings [1], add binding
activation support to the linux bridge agent. This will enable the
execution with linux bridge agents of the complete sequence of steps
outlined in [1] during an instance migration:
1) Create inactive port bindings for destination host
2) Migrate the instance to the destination host and plug its VIFs
3) Activate the port bindings in the destination host
4) Delete the port bindings for the source host
[1] https://review.openstack.org/#/c/309416/
Change-Id: I2c937cc0a551e5ce0e8534c4dd4384ec2ca92da1
Partial-Bug: #1580880
This commit adds a binding_deactivate method to the Linux bridge agent
to receive messages from the ML2 plugin when a binding is de-activated
for a port. After receiving that message, the agent un-plugs the
corresponding tap interface from the port's network bridge.
To support this, a binding_deactivate method is also added to the agents
notifier. Finally, the activate method in the ML2 plugin is updated to
use the binding_deactivate method in the agents notifier.
Change-Id: I3f4e34766791c472a2c81842190094f697baa05c
Partial-Bug: #1580880
In case when MTU value configured for VXLAN network is
higher than physical device's MTU - VXLAN overhead
then Linuxbridge agent will not be able to create properly
vxlan interface with desired MTU value.
In patch [1] there was introduced validation if MTU of
physical device is big enough to create MTU with required
MTU value but it was working only for IPv4 tunnels as
for IPv6 overhead is bigger.
This patch changes this validation a bit and now it will
works properly for both IPv4 and IPv6 VXLAN tunnels.
[1] https://review.openstack.org/#/c/546291/
Change-Id: Ib707312adb45dae7295884aba4ece6538d330d56
Related-Bug: #1744101
A bulk of the public APIs that are part of neutron.plugins.common.utils
were rehomed into neutron-lib with [1] and the remaining with [2].
This patch consumes [1] by:
- Removing the rehomed code from neutron.
- Removing the UTs that are no longer applicable.
- Leaving the functions in [2][3] in neutron.plugins.common.utils until
we release [2][3] and can consume it at which point we should be able to
remove the utils module.
NeutronLibImpact
[1] Iabb155b5d2d0ec6104ebee5dd42cf292bdf3ec61
[2] I2c0e4ef03425ba0bb2651ae3e68d6c8cde7b8f90
[3] I73f5e8ad7a1a83392094db846d18964d811b8bb2
Change-Id: I1d63cbea463e92e1d2e053f8e1a564ed52cb84f8
Fix W503 (line break before binary operator) pep8 warnings
and no longer ignore new failures.
Trivialfix
Change-Id: I7539f3b7187f2ad40681781f74b6e05a01bac474
New releases of oslo.config support a 'mutable' parameter to Opts.
This is only respected when the new method mutate_config_files is
called instead of reload_config_files. Neutron delegates making this
call to oslo.service. This was provided in patchset
Icec3e664f3fe72614e373b2938e8dee53cf8bc5e
Further patches will be needed to make select config options be
marked as mutable. This change enables support for oslo provided
config options to be updated via SIGHUP such as log level.
Task: 6389
Story: 2001545
Change-Id: I9442965607f3248706464643c6d87a04edcae24e
The linuxbridge agent was using its own version of
ensure_device_is_ready() called _bridge_exists_and_ensure_up(),
just use the one in ip_lib since it does an additional MAC
address check.
Trivialfix
Change-Id: I02cdbe40fddb220623e341b94edb3d8c96099581
The neutron.common.topics module was rehomed into neutron-lib with
commit Ie88b84949cbd55a4e7ad06341aab77b286cdc485
This patch consumes it by removing the rehomed module from neutron
and using the module from neutron-lib instead.
NeutronLibImpact
Change-Id: Ia4a4604c259ce862597de80c6deeb3d408bf0e95
This patch replaces usage of "ip addr add/del/flush" commands
with pyroute2 library.
This also switches from rootwrap to privsep when doing those
actions.
This patch adds also UT for _run_iproute_neigh/addr functions
from privileged module.
Change-Id: I6f4df391ec1899f8a4b10b50735dc9a79fa8483f
Related-Bug: #1492714
In case when MTU value configured for VXLAN network is
higher than physical device's MTU - 50 (VXLAN overhead)
then Linuxbridge agent will log proper error message.
Change-Id: I2c1142877fee4ab2fa06e6e4d203c78a776d9591
Related-Bug: #1744101
Adding ability to set DSCP field in OVS tunnels outer header, or
inherit it from the inner header's DSCP value for OVS and linuxbridge.
Change-Id: Ia59753ded73cd23019605668e60cfbc8841e803d
Closes-Bug: #1692951
This commit adds common_agent_extension class which is agent API
for L2 extension drivers used e.g. by Linuxbridge agent.
This is necessary to be able to use instance of iptables_manager
used in firewall driver also in L2 extension drivers (like qos).
This patch refactors little bit iptables_manager code to make possible
to initialize e.g. mangle or nat table on demand, even if iptables
is created as "state_less"
Change-Id: I3b66e49b7f176124e8aea3eb96d0d465f1ab1ea0
Closes-Bug: #1736674
If callers of get_devices_with_ip(), or
device.addr.list(to=address) pass an ip_cidr, it
could match any ip_cidr in that range on the interface.
Callers need to pass the IP without the prefix portion in
order to match it exactly. Added a helper utility to
strip the cidr part from a ip_cidr.
Determined the unit test for this can't actually check
this case since we are mocking the return value from
/sbin/ip, so modified it to just make sure the dict
is correct.
Added a functional test that adds two IP addresses in
the same IP range to verify that we actually filter
correctly when a 'to=IP' is specified.
Change-Id: I3a95b3bb72a43f322ad23892d8959398aac22a1c
Closes-bug: #1728080
neutron-lib contains a number of the plugin related constants from
neutron.plugins.common.constants. This patch consumes those constants
from neutron-lib and removes them from neutron. In addition the notion
of the dummy plugin service type is moved strictly into the test
package of neutron since it's not a real service plugin.
NeutronLibImpact
Change-Id: I767c626f3fe6159ab3abd6a7ae3cb9893b79bf66
The LinuxBridgeManager class has already created a
local version of IPWrapper() at self.ip, just use it.
Trivialfix
Change-Id: I9524144c4762ab3f26c42c5dee967df5436e1a62
Since Pike log messages should not be translated.
This patch removes calls to i18n _LC, _LI, _LE, _LW from
logging logic throughout the code. Translators definition
from neutron._i18n is removed as well.
This patch also removes log translation verification from
ignore directive in tox.ini.
Change-Id: If9aa76fcf121c0e61a7c08088006c5873faee56e
This removes the network_id from the network_map dict when
a network is deleted on the Linux Bridge agent.
Change-Id: I0bd3be91626fd7c4e258c35041bb92130ee23182
Closes-Bug: #1705185
If network_deletes are received before port creates
are processed, the agent might not have the network in
it's map even though it has a bridge to delete.
This adjusts the logic to always try to delete the bridge
corresponding to a network_id even if it's not in the
network_map yet.
Change-Id: I5e72bff2ffd9568f272ed48187ad543ab5a3d1ec
Closes-Bug: #1698271
Introduce vxlan.{udp_srcport_min, udp_srcport_max and udp_dstport}
for setting the port range used for VXLAN communication.
Change-Id: I97999988090eee7aee9b533ac1dad2de95b29cbe
Closes-Bug: #1483853
DocImpact: vxlan.{udp_srcport_min, udp_srcport_max and udp_dstport}
can be used to set UDP port numbers used for VXLAN in LinuxBridge
agent.
If bridge IP address already exists, when we try and add
it an error will be raised. Check for the existence of
the IP to avoid the error.
Closes-Bug: #1697926
Change-Id: I9aae3b4f0fab053e8c215887f58b983d9549582d
This reverts commit 1b987be2b5.
This probably triggered a race between nova and l2 agent when
hot-detaching VIFs.
Change-Id: I2fc20666d43942446878da358ccf4472e04ad94c
Related-Bug: #1696125