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
When the segmentation ID of a network is updated, first the provider
network segment is validated and then reserved. If service plugin
"network_segment_range" is enabled, the Neutron server retrieves the
network segment ranges with shared=True or those ones with the same
project_id as the network.
This patch adds the "project_id" information to the filters when
reserving the network provider segment. This change will allow to
retrieve those private networks segments belonging to the same
project.
Change-Id: I21bd60af000276779f56b3a6d45b4a6c1836bed1
Closes-Bug: #1863619
In [1] the concept of "connectivity" was introduced for the ML2 drivers.
This parameter defines the mech driver connectivity type (layer 2, layer
3 only or legacy - not defined).
The spec defined in the blueprint allows to spawn a VM with ports
without IP addresses. As commented in the Nova spec [2], those ports can
be bound only to "l2" drivers.
[1] https://review.opendev.org/#/c/645645/
[2] https://review.opendev.org/#/c/641670/
bp boot-vm-with-unaddressed-port
Related-Bug: #1821058
Change-Id: I438cbab43b45b5f7afc820b77fcf5a0e823d0eff
In the ML2 plugin, allow to update the segmentation ID of a single
provider network.
A new method in the "SimpleAgentMechanismDriverBase" is added:
"provider_network_attribute_updates_supported". This method returns,
if implemented in the specific agent, which network attributes can
be updated on a live network with ports bound to this network back-end.
By default, an empty list is returned.
Partial-Bug: #1806052
Change-Id: I2595335d6fbc51562b070f14eaeaadf49cf7c418
Drive the choice of mechanism driver during binding as inferred from
the resource provider allocated by nova and as told to neutron via the
port's binding:profile.
As discussed on a neutron qos irc meeting some time ago
this patch introduces a new assumption on bind_port() implementations.
That is an implementation of bind_port() in any mech driver supporting
Guaranteed Minimum Bandwidth bind_port() must not have a non-idempotent
side effect. Because the last binding level will be redone for a 2nd
time with a narrowed down list of mechanism drivers. And if the 2nd call
does not give the same result as the first all kind of weird things can
happen.
Change-Id: I2b7573ec6795170ce45a13d5d0ad7844fb85182d
Depends-On: https://review.openstack.org/574781
Depends-On: https://review.openstack.org/635160
Partial-Bug: #1578989
See-Also: https://review.openstack.org/502306 (nova spec)
See-Also: https://review.openstack.org/508149 (neutron spec)
Avoid binding loop caused by the wrong comparison between
"id" and "segmentation_id" of a "segment" object.
Change-Id: Ibc9f3093318d92027eaaf81bd08401c0f02ae414
Closes-Bug: #1760029
when a mechinism driver calls context.continue_binding to
continue binding, it will be called again because
_check_driver_to_bind compares driver name with driver.
Closes-Bug: #1745572
Change-Id: I62b32c9b9d01dd929fe8cd3634c78dc0cbe325b6
Refactoring neutron ml2 config opts to be in neutron/conf/plugins/ml2.
This would allow centralization of all configuration options and
provides an easy way to import.
NeutronLibImpact
Change-Id: Ibc5a9ab268578c243ef13f7e0041bacd6c0c410b
Partial-Bug: #1563069
Needed-By: Id0a97dda7718f06e33b2d30ce01cdcb3e9a46f7d
The ml2 MechanismDriver is now in neutron-lib along with its associated
constants. This patch switches over to the lib versions of those, but
leaves a shim of the MechanismDriver that just ref's the driver from
lib. This shim allows our broad consumer base of the driver to switch
over at their leisure.
NeutronLibImpact
Change-Id: I99e3de6d933a1bb341394f85415fb07306a82a01
By using the on_missing_entrypoints_callback and
on_load_failure_callback options[1] we can call a handler for the
missing driver error properly.
As the bug states, I logged it as a critical failure and terminated
the neutron server.
I used SystemExit, I wasn't sure if there was a more graceful way
of exiting.
[1] http://docs.openstack.org/developer/stevedore/managers.html
Change-Id: Id18afd159d0b0ada0cc36964dd9c1ebe7a1cd94b
Closes-Bug: #1659290
Db retriable error by precommit can be recovered with upper layer by
retry instead of converting into ML2MechanismDriverError.
Raise retriable db error instead of swallowing it and let upper layer to
retry.
Due to concurrency, db error by precommit is sometimes inevitable.
precommit may issue db transactions depending on mechanism driver, Some
operations on e.g. subnet, routers, touches many other resources (e.g. ip
allocation, ports) in single db transaction as well. And background
operation by mechanism driver (e.g. background sync, monitoring
resources periodically, etc) may touch those db tables with other
order.
Change-Id: Ifc670c1eb5801934bf46fdc23a7721ce4c2cfa6c
Closes-Bug: #1609184
Closes-Bug: #1609149
From [1], the segments_to_bind should be a list of dict, so the
"level.segment_id in segments_to_bind" will never work.
This patch extracts a set of segment ids and uses the set in the
if condition.
[1] https://goo.gl/yKYSTA
Change-Id: I58f1d128e6cd79546d84f7d5bfcb026affc4fc5e
Closes-bug: #1524356