Commit Graph

57 Commits

Author SHA1 Message Date
Rodolfo Alonso Hernandez ebb7ec1eed ``IpLinkCommand.set_netns`` "is_ovs_port" parameter no longer needed
The input parameter "is_ovs_port" is no longer needed in the method
``IpLinkCommand.set_netns`` since [1].

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

Trivial-Fix

Change-Id: I0e36cf8afe76904997e14eca415a0e978f05c55a
2024-02-21 07:48:01 +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
Slawek Kaplonski 2af5fd889b Add sleep before checking if ovs port is in the namespace
When network device which is ovs internal port is moved to the namespace
it may happend sometimes that it will have "shy port syndrome" [1].
Even though there is wait for device to be in namespace in the set_netns
method it may happend that device is in namespace during this check but
it dissapears for short time later and that causes failures e.g. in
functional tests like described in [2].
To avoid that, this patch proposed simple (and ugly) sleep for 1 second
before checking if port really exists in the namespace. If it will be
"shy" port it should already flap during that 1 second.

[1] https://bugs.launchpad.net/neutron/+bug/1618987
[2] https://bugs.launchpad.net/neutron/+bug/1961740

Related-Bug: #1961740
Related-Bug: #1998337
Change-Id: I442587e7ef55917f4ea873e190bf8afbc0e911e1
2023-03-01 09:26:42 +01:00
Zuul 8aea971574 Merge "Add debug logs to OVSInterfaceDriver.plug_new" 2023-02-03 02:08:10 +00:00
elajkat de0918cea3 Add debug logs to OVSInterfaceDriver.plug_new
DVR lifecycle functional tests fail frequently with exceptions
like this: "Network interface * not found in namespace *"
The reproduction locally is hard if possible, so by adding
extra log messages I hope we can have more clue where to find
the possible root cause of this issue.

Change-Id: I2c6acf3c29f3d1e7574240376f7bcb46c98579c6
Related-Bug: #1995031
2023-01-12 14:18:47 +01:00
Slawek Kaplonski c362016620 Ensure that MAC address of the device is set correctly
For unknown (for me at least) reason sometimes we observed e.g. in the
CI jobs that interfaces created by e.g. L3 agent didn't had properly set
MAC address to the one generated by Neutron.
To avoid that this patch adds check if the requested MAC was actually
set on the device before moving on to configure MTU and other attributes
of the device.

Co-Authored-By: Brian Haley <haleyb.dev@gmail.com>

Closes-bug: #2000164
Change-Id: I23facc53795a9592ccb137c60fb1f356406a4e00
2023-01-09 12:39:16 +01:00
Slawek Kaplonski 76578393ab Reset device namespace when adding to the namespace fails
In case when during adding device to the namespace, device will be "shy"
and will disappear for a moment and NetworkInterfaceNotFound exception
will be raised, we need to reset device.namespace to be None.
Otherwise, in the next attempt of adding interface to namespace, when it
will be added back to ovs (and will be in global scope), Neutron will
already look for it in the "namespace" and that will always be failing.

Closes-bug: #1961740
Change-Id: Ie9331c72c44084b0a382598c3359214cce2f2ebd
2022-09-09 08:28:12 +00:00
Slawek Kaplonski a22d6d6a95 Use ovs constants from neutron-lib
Ovs constants were moved from neutron to neutron_lib some time ago.
This patch switches to use them from neutron-lib already.

That decision was agreed during the Neutron team meeting. See [1] for
details.

[1] https://meetings.opendev.org/meetings/networking/2021/networking.2021-11-09-14.00.log.html#l-83

Requires: https://review.opendev.org/c/openstack/neutron-lib/+/834908

Change-Id: I2fd1954bec6a52856195190441d77ac8b7d97055
2022-06-17 10:36:44 +05:30
Slawek Kaplonski f7fac03ae1 Repeat few times put new interface in the namespace
It seems that from time to time we may experience another variant of the
shy ovs ports issue (see [1] for details) while trying to put interface,
e.g. router's port into the namespace by the interface driver.
To avoid that, this patch adds some repeats of the putting interface in
the namespace, in the same way like it was done originally with
set_address of the device.

Additionally, this patch also refactors a bit part which is responsible
to set mac address of the device to be able to clean ports in case of
the permanent error there.

[1] https://bugs.launchpad.net/neutron/+bug/1618987

Closes-Bug: #1961740
Change-Id: I3e0786fd8d0320036b9046746ae579c8ed2ecf27
2022-03-14 14:38:36 +00:00
Slawek Kaplonski 19b9662837 Remove _safe_plug_new method from the interface driver
It was added temporary to have compatybility with 3rd party code
which uses Neutron interface driver but it was said that since
"W" release that old, deprecated way of calling "plug_new" method
will be removed. Now we are far after "W" release so it's time to
do some cleaning there.

Related-Bug: #1879307
Change-Id: I03214079f752c7efe6611f2e928f32652fe681bc
2021-12-16 20:57:52 +00:00
Rodolfo Alonso Hernandez b52e2e6f16 Migrate "ethtool" to oslo.privsep
Story: #2007686
Task: #40290

Change-Id: I78cc06c635e806b50ca2cc631732d55e430dd2f1
2020-07-07 17:45:54 +00:00
Zuul 0580d03a2b Merge "Workaround for TCP checksum issue with ovs-dpdk and veth pair" 2020-06-20 18:58:11 +00:00
Slawek Kaplonski 30d573d5ab Allow usage of legacy 3rd-party interface drivers
In the patch [1] we changed definition of the abstract method
"plug" in the LinuxInterfaceDriver class.
That broke e.g. 3rd-party drivers which still don't accept this
new parameter called "link_up" in the plug_new method.

So this patch fixes this to make such legacy drivers to be still working
with the new base interface driver class.

This commit also marks such definition of the plug_new method as
deprecated. Possibility of using it without accepting link_up parameter
will be removed in the "W" release of the OpenStack.

[1] https://review.opendev.org/#/c/707406/

Change-Id: Icd555987a1a57ca0b31fa7e4e830583d6c69c861
Closes-Bug: #1879307
2020-05-20 00:32:49 +00:00
Alexander Vlasov 11838a2bc5 Workaround for TCP checksum issue with ovs-dpdk and veth pair
The need for this change stems from following issues:
1) When ovs_use_veth = False with ovs-dpdk issue with ovs
was observed - after vswitch restart interface is not comming up.
Meaning ovs-dpdk uses ovs internal ports and it is not able to bring
them up on restart.
2) When ovs_use_veth = True and ovs-dpkd is used, packets sent with
incorrect checksum due to the fact that ovs-dpdk does not do checksum
calculations for veth interface.

This commit allows to use second option and resolve checksum issue by
disabling checksum offload.

Closes-Bug: #1832021
Related-Bug: #1831935

Change-Id: Iecce8d2c6c2c46718cc1020c6e8f914cd4560e4b
2020-05-08 10:19:07 -05:00
Brian Haley 7594bb0627 Remove the dependency on the "mock" package
Now that we are python3 only, we should move to using the built
in version of mock that supports all of our testing needs and
remove the dependency on the "mock" package.

This patch moves all references to "import mock" to
"from unittest import mock". It also cleans up some new line
inconsistency.

Fixed an inconsistency in the OVSBridge.deferred() definition
as it needs to also have an *args argument.

Fixed an issue where an l3-agent test was mocking
functools.partial, causing a python3.8 failure.

Unit tests only, removing from tests/base.py affects
functional tests which need additional work.

Change-Id: I40e8a8410840c3774c72ae1a8054574445d66ece
2020-04-28 18:05:37 -04:00
Rodolfo Alonso Hernandez 33fb446add Deprecate config option "ovs_integration_bridge"
Remove this duplicated option and rely only in OVS.integration_bridge.

NOTE: other projects are still using it; first we need to deprecate it
      in those projects.

Change-Id: I4e826c8b9fa764b1820adacc3427934dc393c0bc
Related-Bug: #1856152
2020-02-17 11:02:16 +00:00
Rodolfo Alonso Hernandez e54b64f725 OVSInterfaceDriver.plug_new should catch correct exceptions
Now that "IPWrapper.add_device_to_namespace" is implemented with
Pyroute2, the function should catch the correct exceptions:
- NetlinkError in case of duplicated interface
- OSError in case of corrupted namespace

Change-Id: I12b5710dc3bfdcc4c6b1e96bbfbfab9e59684065
Closes-Bug: #1856853
2019-12-19 17:43:04 +00:00
Rodolfo Alonso Hernandez df401ddca1 Remove unused arguments in test methods
"testtool" library do not pass arguments to the test methods when
executing the tests, except for those ones decorated with mock
patches.

TrivialFix

Change-Id: I623f9a80541b7fd06edce05722577f7cb4d7a653
2019-12-13 17:17:14 +00:00
Brian Haley b083d39a83 Change agents to use get_devices_with_ip()
Instead of instantiating an IPDevice object just to get
the list of IPs, call get_devices_with_ip() instead since
that's what it's doing anyways.

Trivialfix

Change-Id: I5055d24a40d45f3f3b13b05249d353ea67acf4d5
2019-02-05 18:30:01 +02:00
Boden R 68fd13af40 remove neutron.common.exceptions
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
2019-02-01 14:35:00 -07:00
Zuul 5a71695d93 Merge "Delete ovs port if namespace is corrupted" 2018-09-05 21:47:30 +00:00
yong sheng gong 4f2f5eeb8b Delete ovs port if namespace is corrupted
This patch isolates a corrupted dhcp
namespace and protects the ovs from being
blasted by thousands of dangling ovs
ports created by dhcp agent.

Change-Id: I80138b3c37f41a18dc488a306768b8e2fa299eda
Closes-bug: #1728642
2018-09-04 14:46:03 -04:00
Hongbin Lu 12bb26fd0e Use constant IP_VERSION_4/6 in unit tests
Change-Id: I54bec2c06940b0b1362fecacef7860361d081601
2018-08-27 21:45:39 +00:00
Brian Haley 3ad91f61f2 Remove deprecated IVS interface driver
This was marked deprecated in Queens for removal in Rocky,
https://review.openstack.org/#/c/505401/

Change-Id: I77fa59ae1819e87ab8ccc1fa5f0db86de3b90e2e
2018-04-26 20:15:46 +00:00
Jacky Hu 6c437b7ced Correctly configure the IPv6 LLA address
Handle a corner case where the address allocated by slaac is the
same as the ipv6 default link local address.

Closes-bug: #1709215
Change-Id: Ida667292fce41e281e016d56a278eef3b8939ed4
2017-11-30 11:54:51 +00:00
Jenkins 1077184d8d Merge "Refactoring agent linux&ovsdb config" 2017-09-13 00:33:56 +00:00
sindhu devale 51ca683797 Refactoring agent linux&ovsdb config
Refactoring neutron agent linux and ovsdb config opts
to be in neutron/conf/agent so that all the config options
reside in a centralized location. This simplifies the
process of looking up the config opts and provides an easy
way to import.

NeutronLibImpact

Change-Id: Ib1e0e63dec2985c417412d1ecc68e2a74ef87182
Partial-Bug: #1563069
2017-08-25 10:41:39 -04:00
Gábor Antal 789acb3a7e Removed unnecessary setUp calls in tests
There are several places where base class setUp() method call was
called unnecessary. In this patchset, they are removed.

TrivialFix

Change-Id: I2961fa4a0216f7f1223ab87a249151f0feb91518
2017-07-31 17:16:01 +02:00
Terry Wilson 1eec265ad0 Update to support the ovdsbapp 0.4.0 API
idl_factory was removed in favor of just passing in an Idl instance
as an Idl doesn't start a connection until its .run() is called.

The try/excepts will be removed when the ovsdbapp 0.4.0 constraint
changes are merged.

Change-Id: Id22faa1f6179c2fdf8a136972d65f10749c9fc2e
2017-05-17 19:58:34 +00:00
John Perkins 7f23ccce23 Agent common config
Refactoring Neutron configuration options for agent common config to be
in neutron/conf/agent/common. This will allow centralization of all
configuration options and provide an easy way to import.

Partial-Bug: #1563069
Change-Id: Iebac0cdd3bcfd0135349128921b7ad7a1a939ab8
Needed-By: Ib676003bbe909b5a9013a3178b12dbe291d936af
2017-03-15 09:52:18 -06:00
Ihar Hrachyshka 37a1b4a46f Stop handling interface drivers that don't support MTU
We were issuing a deprecation warning for interface drivers that have
not accepted mtu= argument for a cycle. It's time to clean that code
path up.

NeutronLibImpact

Change-Id: I47eca98c25d4f5a30a5a726d5edc1a919954a280
2017-02-22 06:07:48 +00:00
Jenkins 14079d0f21 Merge "Update MTU on existing devices" 2016-12-19 13:08:14 +00:00
Ihar Hrachyshka 5c8dffa7fb Update MTU on existing devices
This patch makes OVS and Linuxbridge interface drivers to set MTU on
plug() attempt if the device already exists. This helps when network MTU
changes (which happens after some configuration file changes).

This will allow to update MTU values on agent restart, without the need
to bind all ports to new nodes, that would involve migrating agents. It
will also help in case when you have no other nodes to migrate to (in
single node mode).

Both OVS and Linuxbridge interface drivers are updated.

Other drivers (in-tree IVS as well as 3party drivers) will use the
default set_mtu implementation, that only warns about the missing
feature (once per process startup).

DocImpact suggest to restart agents after MTU config changes instead of
          rewiring router/DHCP ports.

Related: If438e4816b425e6c5021a55567dcaaa77d1fffff
Related: If09eda334cddc74910dda7a4fb498b7987714be3
Closes-Bug: #1649845
Change-Id: I3c6d6cb55c5808facec38f87114c2ddf548f05f1
2016-12-15 22:27:12 +00:00
Brian Haley 21bb776670 Correctly configure IPv6 addresses on upgrades
When starting the dhcp-agent after an upgrade, there could
be stale IPv6 addresses in the namespace that had been
configured via SLAAC.  These need to be removed, and the
same address added back statically, in order for the
agent to start up correctly.

To avoid the race condition where an IPv6 RA could arrive
while we are making this change, we must move the call
to disable RAs in the namespace from plug(), since devices
may already exist that are receiving packets.

Uncovered by the grenade tests.

Change-Id: I7e1e5d6c1fa938918aac3fb63888d20ff4088ba7
Closes-bug: #1627902
2016-12-07 12:32:06 -05:00
Kevin Benton a75ce6850f Retry setting mac address on new OVS port 10 times
We've seen several times in the gate an OVS add port call
succeed and then have the mac address set fail to find it
seconds later. The vswitch log frequently shows that it
returns milliseconds later. Until we get to the bottom of
it, we should just retry several times before giving up
and raising.

Closes-Bug: #1618987
Partial-Bug: #1623732
Change-Id: Ia73a9be047093c02f61e3e9ce13d98dccd49dfeb
2016-09-15 21:09:40 +00:00
Ihar Hrachyshka a9133b7255 Remove deprecated network_device_mtu option
The right way to configure Neutron to work with infrastructure MTU is by
using plugin agnostic global_physnet_mtu and ml2 specific
path_mtu/physical_network_mtus options. The deprecated option is error
prone and does not allow to use different MTUs per network.

Closes-Bug: #1603493
Related-Bug: #1549470
Related-Bug: #1542108
Related-Bug: #1542475

DocImpact Remove all references to network_device_mtu option from
          Neutron documentation. Note that Nova has a deprecated option
          with the same name that will need a separate patch to be removed.

Depends-On: I8e6cc99fe70d0c41a705431fb3160e8fccacff10
Depends-On: I337b284076a794027fbd63796119d56bd1923cf2
Change-Id: I7287db9df25a78a59b2dfa28acfde7fe69d17f40
2016-07-25 19:51:00 +00:00
Inessa Vasilevskaya bdeb7bcc2b enable OVSDB native interface by default
- unit tests were fixed mainly by mocking
  Connection class of native implementation.

- some ovs-lib tests rely on direct ovs-vsctl
  output. Temporarily decorated with @vsctl_only.

UpgradeImpact

Change-Id: I2632b0e21edd61536867a9fc830a45d9899091e4
2016-06-25 10:43:12 +03:00
Henry Gessau 4148a347b3 Use constants from neutron-lib
With this we enable the deprecation warnings by default.

Related-Blueprint: neutron-lib

Change-Id: I5b9e53751dd164010e5bbeb15f534ac0fe2a5105
2016-04-23 21:23:56 -04:00
Ihar Hrachyshka 8a86ba1d01 Support interface drivers that don't support mtu parameter for plug_new
The method signature before Mitaka did not have the mtu= parameter. We
should continue supporting the old signature, since it can be used in
out of tree interface drivers. The class is part of public neutron API,
so we should make an effort to not break out of tree code.

Change-Id: I8e0c07c76fd0b4c55b66c20ebe29cdb7c07d6f27
Closes-Bug: #1570392
2016-04-14 16:53:00 +02:00
YAMAMOTO Takashi 6fcc62b71b Remove MidonetInterfaceDriver
Now it lives in networking-midonet repository.

Closes-Bug: #1510826
Depends-On: I0a4d19ddeddfde2319dcbe24665a24d371625b10
Related-blueprint: core-vendor-decomposition
Change-Id: Ifd18ee1703541d04f1a4717a8b0b8e6dc61a2f4e
2015-11-10 16:09:52 +09:00
Gary Kotton 2b7fb6ff08 Removes the use of mutables as default args
Passing mutable objects as default args is a known Python pitfall.
We'd better avoid this. This commit changes mutable default args with
None, then use 'arg = arg or {}', 'arg = arg or []'. For unit code which
doesn't use the args , just set with None. This commit also adds hacking
check.

This code was taken from commit 0bea84ac20fe498bd08f7212a0017196c8cb0812
in Nova.

Change-Id: I36d07cade687690dc02a8f6cc3d70f5d00caf112
Co-Authored-By: ChangBo Guo(gcb) <glongwave@gmail.com>
2015-10-29 07:57:31 -07:00
Carl Baldwin aa2c0490f5 Move gateway processing out of init_router_port
This method is a bit overloaded

Change-Id: Idc8526c3714856feb3e75d7bab9f6acc33499e3f
Partially-Implements: blueprint address-scopes
2015-10-05 21:07:10 +00:00
Carl Baldwin da4ee8c8d2 Add list routes
This adds list routes while refactoring list_onlink_routes to share
implementation.  It changes test_onlink_routes to be consistent in the
type of data that it returns with the new list_routes.

Change-Id: I386a8e2cb146385bb59a7a8387a29dddbec48d8a
Partially-Implements: blueprint address-scopes
2015-09-09 20:58:58 +00:00
Jenkins cc49b7d7d9 Merge "IPv6 display suitable message when MTU is invalid on iface" 2015-08-30 02:55:02 +00:00
John Davidge 4b329c345c L3 agent changes and reference implementation for IPv6 PD
This patch adds the common framework to be used by specific
implementations of the DHCPv6 protocol for Prefix Delegation.

It also includes a reference implementation based on the Dibbler
DHCPv6 client. Dibbler version 1.0.1 or greater is required.
Sanity tests are included to verify the installed version.

A patch for admin/user documentation is up for review here:

https://review.openstack.org/#/c/178739

Video guides for configuring and using this feature are available on
YouTube:

https://www.youtube.com/watch?v=wI830s881HQ
https://www.youtube.com/watch?v=zfsFyS01Fn0

Co-Authored-By: Baodong (Robert) Li <baoli@cisco.com>
Co-Authored-By: Sam Betts <sam@code-smash.net>

Change-Id: Id94acbbe96c717f68f318b2d715dd9cb9cc7fe4f
Implements: blueprint ipv6-prefix-delegation
2015-08-25 08:44:13 +01:00
sridhargaddam 9750ab79c6 IPv6 display suitable message when MTU is invalid on iface
IPv6 protocol requires a minimum MTU of 1280 bytes on the interface
to configure an IPv6 address to the interface. This patch logs an
appropriate error message and exits the agent if ipv6 is enabled and
network_device_mtu is less than the minimum value.

DocImpact

Closes-Bug: #1475015
Change-Id: I13666de4e6f5f6775ad26342e513c3c17a003b8e
2015-08-21 07:09:18 +00:00
Hirofumi Ichihara 6ff8582896 Metaplugin removal
Metaplugin is removed in Liberty.
Remove all metaplugin related codes.

DocImpact
APIImpact

Co-Authored-By: Itsuro Oda <oda@valinux.co.jp>
Change-Id: I9cf36e1fd3a009c175e0d475af407a30f4e5c408
Closes-Bug: #1465126
2015-07-23 19:05:05 +09:00
Kevin Benton 3a871a73b8 Fix failures introduced by the new version of mock
This reverts commit 1b60df85ba.

The new version of mock is now released which has the fix to
make mock.patch.stopall behave deterministically. The code to
stop double-mocking is no longer required.

Other fixes:

'assert_has_calls' that have changed behavior in the new version
(no longer accepts single calls).

Calls to non-existent assert methods that did not exist and were
silently passing.

Use of autospec on a class with decorated functions.

Closes-Bug: #1473369
Change-Id: I164a9af2a7f9ac0f0229ec3c5071f7a470445c98
2015-07-09 17:54:32 -07:00
Carl Baldwin f9e9de9f81 Refactor init_l3 to separate router port use case
Future work will extend init_l3 with more code specific to router
ports.  It makes sense to separate these out in to one basic method
with basic L3 and another for router port specific logic.

Change-Id: Iec9a46cd0490c4f48bb306083711ff0c5e70ba87
Partially-Implements: blueprint address-scopes
2015-07-06 22:20:56 +00:00
ChangBo Guo(gcb) c3d65a0ed9 Switch to oslo_utils.uuidutils
Get rid of oslo-incubator uuidutils

Closes-Bug: #1467020
Depends-On: I2df519965883b05d5d58cdc4785c850b0685dc2c
Depends-On: I9f8e98ad9517864a9ffdacf01c0a9a5aab554edb
Depends-On: Ied0faac809a5b72b1cd466c8babc9ca5418692c3
Change-Id: Iebe491b981b4b7c02785412fadd27678bb5e47de
2015-06-22 11:06:18 +00:00