There are some logic left which checks device owner values set by
LBaaS v1 or v2, but LBaaS was already retired in favor of Octavia.
Change-Id: Ieca7a29a45f0686babe68619ff9da133edd89dec
Parse and validate the "permitted_ethertypes" configuration variable at
the OVS firewall initialization. Any error in the configuration will be
logged only once.
Closes-Bug: #2009728
Change-Id: Ib5439791d7bc0a8457bb10f887b1077fd6438619
rpc_workers can be set < 1 with 'ovn' backend when no
other agent is running apart from ovn agents to
consume these rpc notifications.
Add and apply disable_notifications decorator on
methods which do rpc cast calls to agents, the
decorator makes the caller method execute only
when rpc_workers >=1. This patch not changing
default behavior and utilizes the rpc_workers config option
to enable rpc notification on resources updates only when
rpc_workers >= 1.
Also set rpc_workers=0 in ovn jobs to cover this scenario.
Closes-Bug: #1889737
Closes-Bug: #1992352
Change-Id: I700fe2cd422bc1eb8b5144ec116e7f0a60238419
Move _sign_instance_id to common utils for distributed metadata.
Partially-Implements: blueprint distributed-metadata-datapath
Change-Id: I0ef9330232e2ed5dbda6e45917c291c7385d1e0d
When a new network and its first subnet is created, the DHCP agent
bumps the "load" parameter to reflect the number of networks handled.
This "load" parameter is modified when:
- As commented, when the first subnet of a network is created. The
"load" value is bumped.
- When periodically the DHCP agent sends the status, informing about
the current number of networks handled.
If during the subnet creation this "load" value is not updated, it will
be in the next periodic update of the agent.
This "load" value is used by the scheduler to equally distribute the
objects to be managed by any agent type (DHCP agents manage networks).
The bug refers to DHCP but is valid for any other agent.
Change-Id: Ief402048d99d40b64d81fcf58eb2e39b1ba7ebbb
Closes-Bug: #1939432
Class "Timer" is not being used and the related unit tests
are failing quite often in py38 CI job.
Change-Id: Ib1d8f2f4adeadbd59c3dccc7be1546baedc4b978
Related-Bug: #1922563
neutron.tests.unit.common.test_utils.TestThrottler.test_throttler
is failing with "AssertionError: 1 not greater than 1", change the
assert to assertGreaterEqual.
Change-Id: Iba29ab0b1141e731cc811e8bee076dd5726248b5
Closes-Bug: #1916572
assertItemsEqual was removed from Python's unittest.TestCase in
Python 3.3 [1][2]. We have been able to use them since then, because
testtools required unittest2, which still included it. With testtools
removing Python 2.7 support [3][4], we will lose support for
assertItemsEqual, so we should switch to use assertCountEqual.
NOTE(dmllr): added hacking check
[1] - https://bugs.python.org/issue17866
[2] - https://hg.python.org/cpython/rev/d9921cb6e3cd
[3] - testing-cabal/testtools#286
[4] - testing-cabal/testtools#277
Change-Id: I7c20fec08e5dc9f67b34100c925ea6724bbd25f0
Use less than 2 as a way to account for test on slower systems.
This is a follow up to: https://review.opendev.org/#/c/691883/
Trivial-Fix
Change-Id: Ia313b9c4028f0242cb0da8764b9921c5c30c465a
Fixes-Bug: #1891517
"NeutronOvsdbIdl" should be a singleton class; only one instance
should be shared everywhere is called. Currently the connection
and the "OvsIdlMonitor" instances are global; those instances are
used to declare the "NeutronOvsdbIdl" instance.
As commented in the related bug, this singleton will ensure that
the OvsIdl indexes are created just once.
Change-Id: I639cf673a983b7b1be810495d8a8c2d89919a9b6
Related-Bug: #1881424
With python 3.x, six.text_type and six.string_type
are just str.
Also removed a six.integer_type since it was the only
one left in a file.
Another step in removing all of six usage from neutron.
Change-Id: I5208dc41bff1983ecd323286f427296b722da62a
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
Since it's no longer supported past Train, lets stop
running the tests.
Updated docs and made some pep8 code tweaks as well.
Change-Id: I1c171ab906a3b4c66558163ad26947ebf710a276
While working on improving the osprofiler report in neutron I'm finding
various places where the profiling can be extended by propagating the
profiler info further then before.
This change starts to profile BatchNotifier threads (e.g. various
callbacks to nova) when the code starting the thread was already
profiled (it's not at the moment, but that will be another change).
In this change we use osprofiler.profiler.clean(). Since that has became
part of the public interface of osprofiler in version 2.3.0, we bump
osprofiler version to 2.3.0 both in lower-constraints and requirements.
Change-Id: Ibd08e097b6f8457c50f8ba9e4a63b96e7e3182bc
Partial-Bug: #1833674
This patch switches over to neutron-lib's version of the the
_AuthenticBase, AuthenticEUI and AuthenticIPNetwork classes by
deleting them from neutron and using lib's version instead.
Depends-On: https://review.opendev.org/#/c/659881/
NeutronLibImpact
Change-Id: Ia3d3db401d6abcb9c9965b945bcd4c199f8e812b
This class creates a context that:
* Triggers a timeout exception if the timeout is set.
* Returns the time elapsed since the context was initialized.
* Returns the time spent in the context once it's closed.
The timeout exception can be suppressed; when the time expires, the
context finishes without rising TimerTimeout.
This class can be used to execute blocking methods and finish them if
there is no return. For example, in the followup patch [1], this class
is used in the method "neutron.agent.linux.ip_lib.ip_monitor" to control
how much time the blocking function "IPRSocket.get" is being called. By
using this strategy the method "ip_monitor" can be finished gracefully
using an external event signal in the main loop.
[1] https://review.opendev.org/#/c/660611/
Change-Id: I1f33535b201d49b875437bcc3397fcb465118064
Related-Bug: #1680183
Pyroute2 is modifying the default logger, adding NullHandler to it. If
the logger is not properly configured, like in any service or agent
spawn in Neutron, the only handler will be NullHandler. This prevents
from rendering the message passed, as when StreamHandler is used.
This issue is present only in version 0.5.4 and 0.5.5. Current Pyroute2
master version implements a new logger which removes this problem.
[1]https://github.com/svinota/pyroute2/blob/0.5.5/pyroute2/__init__.py#L78-L79
Change-Id: Ic89d8503e9d1a7f622f0c3a148bf78766b92ed08
Related-Bug: #1811515
We have a problem with SNAT with too many connections using the
same source and destination on the network nodes.
In addition we can see in the conntrack table that the who
"instert_failed" increases.
This might be a generic problem with conntrack and linux.
We suspect that we encounter the following "limitation / bug"
in the kernel.
There seems to be a workaround to alleviate this behavior by
setting the -random-fully flag in iptables for port consumption.
This patch fixes the problem by adding the --random-fully to
the SNAT rules.
Change-Id: I246c1f56df889bad9c7e140b56c3614124d80a19
Closes-Bug: #1814002
All of the externally consumed variables from neutron.common.constants
now live in neutron-lib. This patch removes neutron.common.constants
and switches all uses over to lib.
NeutronLibImpact
Depends-On: https://review.openstack.org/#/c/647836/
Change-Id: I3c2f28ecd18996a1cee1ae3af399166defe9da87
The get_port_binding_by_status_and_host function was rehomed into
neutron-lib with https://review.openstack.org/#/c/580786/ and released
in neutron-lib 1.18.0. This patch consumes the function by removing it
in neutron and replacing all uses with lib's version.
NeutronLibImpact
Change-Id: Iac3246d0eb59709749e0b7e857091447d11a0133
Functionality is added to the ML2 plugin to handle multiple port
bindings
Co-Authored-By: Anindita Das <anindita.das@intel.com>
Co-Authored-By: Miguel Lavalle <miguel.lavalle@huawei.com>
Partial-Bug: #1580880
Change-Id: Ie31d4e27e3f55edfe334c4029ca9ed685e684c39
This incorporates flake8 2.6.x and pycodestyle will be used
instead of older pep8. This ensures future python3 compatibility
and a bit better code styling.
Change-Id: Ia7c7c5a44727f615a151e1e68dd94c7ed42f974f
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
This patch removes a handful of unused exceptions from
neutron.common.exceptions as follows:
The following exceptions already live in neutron-lib and are thus
duplicates in neutron:
PlacementEndpointNotFound
PlacementResourceProviderNotFound
PlacementInventoryNotFound
PlacementAggregateNotFound
PlacementInventoryUpdateConflict
NetworkVlanRangeError
PhysicalNetworkNameError
MacAddressGenerationFailure
The following exception is not used anywhere today:
TenantNetworksDisabled
NeutronLibImpact
Change-Id: Ie8227954681292ead1da0dedc950c54028ce84f1
For OVS based DPDK ports ingress bandwidth limit is now implemented
using egress-policer qos type.
Additionally limit values are set in other_config of QoS because there
is no queue used in this case.
This patch moves also helper methods used to conversion between
bytes and bits and between bits and kilobits to neutron.common.utils
to be able to use it also in ovs_lib module.
Change-Id: I94d1e8dfb82df5c602476db8aaa884ae91fecd7f
Closes-Bug: #1724729
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 neutron agents fail to start on Windows, due to the fact that
neutron.common.utils.import_modules_recursively expects the paths
to be forwardslash separated, while on Windows they are backslash
separated.
Change-Id: I5e15273c2f70b70fad0cf1216ef0b33c6a99d702
Closes-Bug: #1694220
Multiple SIGHUPs in quick succession might cause the master keepalived
to forfeit its mastership (which will cause keepalived to remove IPs of
its external devices, severing connectivity). This can happen when, for
example, associating or disassociating multiple floatingips.
The patch makes the agent throttle SIGHUP sent to keepalived: the very first
SIGHUP is always sent; as for subsequent signals, they are delayed till
agent threshold is reached. (It's 3 seconds by default.)
As an example, when three consequent router updates trigger keepalived
respawn then:
* the very first signal is sent as usual;
* the second signal is deferred and sent in up to 3 seconds since the
first signal;
* the third signal is ignored, though the change that triggered it will
be correctly applied by the second signal handler when it is triggered
after threshold delay.
If the last time a spawn request occurred is older than current-time
minus threshold then there is no delay.
Co-Authored-By: Jakub Libosvar <libosvar@redhat.com>
Co-Authored-By: Cedric Brandily <zzelle@gmail.com>
Co-Authored-By: Ihar Hrachyshka <ihrachys@redhat.com>
Closes-Bug: 1647432
Change-Id: I2955e0de835458a2eea4dd088addf33b656f8670
The following methods are now supported in neutron_lib. These have
been marked as depracted in neutron for over a cycle now so we can
remove them:
- parse_mappings - Use parse_mappings from neutron_lib.utils.helpers
- get_hostname - Use get_hostname from neutron_lib.utils.net
- compare_elements - Use compare_elements from neutron_lib.utils.helpers
- safe_sort_key - Use safe_sort_key from neutron_lib.utils.helpers
- dict2str - Use dict2str from neutron_lib.utils.helpers
- str2dict - Use str2dict from neutron_lib.utils.helpers
- dict2tuple - Use dict2tuple from neutron_lib.utils.helpers
- diff_list_of_dict - Use diff_list_of_dict from neutron_lib.utils.helpers
- cpu_count - Use cpu_count from neutron_lib.utils.host
- round_val - Use round_val from neutron_lib.utils.helpers
- replace_file - Use replace_file from neutron_lib.utils
- safe_decode_utf8 - Use safe_decode_utf8 from neutron_lib.utils.helpers
NeutronLibImpact
Change-Id: Ie31da47b34e49a1974ad6b50d9e46ea8e82db294
Partially-implements: blueprint neutron-lib
This patch creates test that generates port ranges and
uses software diversity for comparison the results.
Change-Id: I77a76aa8288b505a0f083357f26a3bce23625897
Related-bug: 1611991
This method was moved to neutron-lib
No projects currently use this so its safe to blow it away.
NeutronLibImpact
Change-Id: Ibf58da7f18cc89cc186e5e8e0af8ef089d576e75
Since the function already uses os.walk that will iterate through all
subdirectories for us, there is no need to recursively call the
function.
The recursive call was not just redundant, but also had another problem,
where we were passing relative paths to subdirectories, which made the
function to attempt importing modules that are not located under the
topdir. It could crash, or, worse, import a module that is
not under the expected parent directory.
This patch also modifies an existing unit test for the function to
validate that modules from subdirectories are also imported, even
without the recursive call.
Change-Id: I8b3a844460e4987b8a8375b01353d01e57d91604
Closes-Bug: #1634735
In several cases port masking algorithm borrowed
from networking_ovs_dpdk didn't behave correctly.
This caused non-restricted ports to be open due to
wrong tp_src field value in resulting ovs rules.
This was fixed by alternative port masking
implementation.
Functional and unit tests to cover the bug added as well.
Co-Authored-By: Jakub Libosvar <libosvar@redhat.com>
Co-Authored-By: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
Closes-Bug: #1611991
Change-Id: Idfc0e9c52e0dd08852c91c17e12edb034606a361
With 7c0f189309 in tree, we made
neutron-db-manage require neutron/tests/tools.py installed. Some
distributions, like RDO, may split the python package into core package
and the one that contains python code needed for testing only (anything
under neutron/tests/), and hence don't guarantee that all setups have
neutron.tests package available.
This fix moves the import_module_recursively function from
neutron.tests.tools into neutron.common.utils because it has non-testing
use cases. All existing cases where we use the function switched to the
new location. The old symbol still works, though triggers a deprecation
warning, and will be removed in the next cycle.
Change-Id: Ia8d91a1704c894bc1f6cf14e6cdd971fab255b62
Closes-Bug: #1612959
Since Ia2d911a6a90b1baba1d5cc36f7c625e156a2bc33, we use version_id_col
SQLAlchemy feature to routinely bump revision numbers for resources. By
doing so, SQLAlchemy also enforces the expected number on any UPDATE and
DELETE, which may not be valid when the transaction is actually applied.
In that case, the library will raise StaleDataError:
http://docs.sqlalchemy.org/en/latest/orm/exceptions.html#sqlalchemy.orm.exc.StaleDataError
The exception is then logged by ml2 and bubbles up to API layer where
retry mechanism will correctly catch it and issue another attempt.
If API layer does not retry on exception, it already logs the error,
including the traceback.
In ml2, it's too early to decide if an exception is worth being logged.
Plugin instead should just silently allow all unexpected exceptions to
bubble up and be dealt by API layer.
At the same time, there are some details that are known at the plugin
level only, that are not easily deducible from the API request details.
That's why we save details about the error on the exception object that
bubbles up into API layer, where we are ready to decide if those details
are worth being logged.
Change-Id: I848df0aef5381e50dfb58e46d7a652113ac27a49
Closes-Bug: #1593719
Instead of using Python error strings in the error messages for
parse_network_vlan_range(), which are unstable and not translatable,
use our own fixed error message.
Change-Id: Iae4484b0a9a983452812bc76b47f5e16850641d5
Closes-Bug: 1559191