Commit Graph

27 Commits (master)

Author SHA1 Message Date
Brian Haley 291eabb0b6 Fix some pylint indentation warnings
Running with a stricter .pylintrc generates a lot of
C0330 warnings (hanging/continued indentation). Fix
the ones in neutron/api.


Change-Id: I1258b04f64a18036407e1d9de9ddca7472af0d11
7 months ago
Boden R 9bbe9911c4 remove neutron.common.constants
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.


Change-Id: I3c2f28ecd18996a1cee1ae3af399166defe9da87
4 years ago
Brian Haley eaf990b2bc Fix pep8 E128 warnings in non-test code
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 <>
4 years ago
Boden R 024802aafd remove neutron.common.rpc
The neutron.common.rpc module has been in neutron-lib for awhile now and
neutron is shimmed to use neutron-lib already.
This patch removes neutron.common.rpc and switches the code over to use
neutron-lib's implementation where needed.


Change-Id: I733f07a8c4a2af071b3467bd710290eee11a4f4c
4 years ago
Boden R ef93f7e7f0 use common agent topics from neutron-lib
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.


Change-Id: Ia4a4604c259ce862597de80c6deeb3d408bf0e95
5 years ago
Kevin Benton 458d38e2c7 Don't assume RPC push object has an ID
Test coverage is provided by scenario job. We just
need to get it voting. :)

Closes-Bug: #1718063
Change-Id: I85f638d22206e5621366475009dddd519dfbc476
6 years ago
Kevin Benton 2d8ffe2a08 Stop logging full object in RPC push code
We already log the full object on the agent side
and other server methods log important parts of
the object so there isn't much to gain logging the full
OVO components passed to this function's args.

This adds a specific debug statement that just indicates
the types, IDs, and revision_numbers being pushed out so
they can still be correlated with received objects on the
agent side.

Partial-Bug: #1707307
Change-Id: I4499bb328f0aeb58fe583b83fb42cd2d26c1c4c1
6 years ago
Ihar Hrachyshka ea3028a1c0 Removed Mitaka times compatibility code from RPC callbacks
This code was needed for some Mitaka to Newton upgrade scenarios, but we
are now in Ocata to Pike, so killing the code is overdue.

Change-Id: Ida3fc4ce2d18c50e603b2b71dfb8f884845bf78a
6 years ago
Kevin Benton 9645877da7 Add bulk pull OVO interface
Add an RPC interface to retrieve many OVO resources
at once based on filters.

Partially-Implements: blueprint push-notifications
Change-Id: I5e765712ab8b8065d71653c563f004c7a9ce9021
6 years ago
Kevin Benton cf6ffb78f6 Pass context and resource_type in RPC callback
Maintaining the context is important for keeping the request ID
and subsequently operator/developer sanity while debugging.
The resource_type is also helpful to have since a function could be
subscribed for multiple resources.

This maintains and deprecates the existing 'subscribe' method for
backwards compatibility with callbacks that don't support receiving
the context and resource type. A new 'register' method is added
for callbacks to use that are compatible with receiving the context.

Change-Id: I06c8302951c99039b532acd9f2a68d5b989fdab5
7 years ago
Armando Migliaccio bad3eaace1 Stop oslo_messaging from error logging CallbackNotFound
This is expected when the server is pushing for a resource
and some listeners (like the OVS agent) are not interested
in the event. This happens when Trunk create/delete events
are dispatched by the server.

Change-Id: I90ddffda546af45ca85b3e4f4f22eed005d971df
Closes-bug: #1625872
7 years ago
Kevin Benton ea84699af6 Stop olso_messaging from error logging CallbackNotFound
This is expected when the agents are asking for a resource
that might not exist if a server side service plugin is
not loaded (e.g. Trunks). The Linux Bridge implementation
currently checks if each new port is a trunk so this results
in a bunch of log noise on the server without this patch.

Partially-Implements: blueprint vlan-aware-vms
Change-Id: I503fe51b0b537003a547af6e07304b29a53cde42
7 years ago
lilintan 4c3e876f81 Remove unused logging import
Change-Id: I1288056fc1d5d8b7ccb122fdfb05c2c6f2718553
7 years ago
Miguel Angel Ajo 7f617e6a21 Introduce bulk push to rpc callback mechanism
There are usage patterns which would benefit from having
the capability to send a list of resources in bulk instead
of using individual fanout messages.

From now on, the rpc callback subscriber receives a list of
resources (single or multiple), and the pushers must always
push a list.

Backwards compatibility for QoSPolicy consumers in mitaka
is provided by calling push with "resource" parameter for
single item lists during one release cycle. That will be
dropped when Ocata opens.

Partially-implements: blueprint vlan-aware-vms

Change-Id: I1117925360a29ecbd1902fa527b2f24f94ce81ec
7 years ago
Henry Gessau ae5bad49cc Use exceptions from neutron-lib
Related-Blueprint: neutron-lib

Change-Id: Ia014468bd621c4ee6aea95bf19328c61070174c4
7 years ago
Cedric Brandily edc342be42 Remove unnecessary executable permissions
This removes executable permissions on python modules not requiring it.

Change-Id: I844afa45f9e3d634ad1bcb90c9999d4237dc7f36
7 years ago
Miguel Angel Ajo 97a272a892 RPC Callback rolling upgrades reporting, and integration
This is the second patch to allow upgrades on RPC versioned
objects callbacks.

This enables resource version notifications from agents to all
neutron servers via fanout for updating the version sets in
memory, and via agent status updates for DB storage, so any
neutron server can retrieve such information at boot.

Closes-Bug: #1535247

Change-Id: I67c1323267aaf7e49f4a359ff50b94e52dba4380
7 years ago
Miguel Angel Ajo cb18881770 RPC Callback rolling upgrades logic
Introduces a version manager in the callbacks rpc, which tracks
the agents' known resource versions across the distributed system,
making rpc callback push notifications smart about which resource
versions need to be serialized and sent over the wire during a
cloud upgrade process.

Subsequent patches will implement the callback to fetch agent
resource versions from database, the status updates with
agent resource versions included, and the fast path agent to
neutron-servers fanout call with version details as defined
in change I02b694137eb2d58e5f2f3e7631f0e4b90f7c17ad

Related-Bug: #1535247

Change-Id: I3fb49ae6fe237a926225b508bc8f0286426bf532
7 years ago
Akihiro Motoki 2d8632e412 Use _ from neutron._i18n
Partial-Bug: #1520094
Change-Id: I874a4aa1d71d1f7034a1ff0b7450b419ef5c6864
8 years ago
Ihar Hrachyshka e27299c124 [rpc] pull: removed a hack to avoid object backport triggered
Since oslo.versionedobjects 0.8.0, the object is not backported if the
requested version is the same as the latest known.

Change-Id: Ia1e9aa77b75261e4b2d2b24f31250ce2a2f028a7
8 years ago
Ihar Hrachyshka 4ef2dcc106 resources_rpc: fixed singleton behavior for ResourcesPullRpcApi
__init__ is called for any __call__ on a class, no matter whether it is
a singleton. Meaning, client was reinitialized every time a caller
instantiated the Rpc class. That's not a critical issue, but a minor
performance hit.

Change-Id: I24272ba44eb502c8552d3556c84214942944646c
Partially-Implements: blueprint quantum-qos-api
8 years ago
Jakub Libosvar 088289acd2 Propagate notifications to agent consumers callbacks
The update policy works. We still need to track down the deletes which
don't work currently.

Change-Id: I48e04b42c07c34cf1daa17e7a29a6950453946ff
Partially-Implements: blueprint quantum-qos-api
8 years ago
Jakub Libosvar ac3e1e1256 Add rpc agent api and callbacks to resources_rpc
This patch also refactors existing test cases for server side rpc
classes in order to test code in generic manner. Finally, we remove
notify() and get_resource() from consumers or producers modules
respectively in order to remove circular dependencies. The notificitaion
driver will send events directly using RPC api class instead of going
through registry.

Co-Authored-By: Miguel Angel Ajo <>
Partially-Implements: blueprint quantum-qos-api
Change-Id: I9120748505856acc7aa8d15d896697dd8487bb02
8 years ago
Miguel Angel Ajo 11e22a435a neutron.api.rpc.callbacks interface rework
Split rpc.callbacks interface into consumer and producer parts.

Better terms are chosen for two RPC APIs we have:
- pull when a component actively requests a new object state;
- push when a component updates anyone interested about an object

Also, for callback registration, the following terms are used:
- subscribe when a component is registered in consumer registry;
- provide when a component is registered in provider registry.

Covered the registries with some unit tests.

Lots of existing tests utilize the registries now, and need to be
isolated from other tests that mess with the managers (that are
singletons), so introduced a common qos base test class to mock the
manager with per-test instance of it).

Co-Authored-By: Ihar Hrachyshka <>
Partially-Implements: blueprint quantum-qos-api
Change-Id: I130cfbc8b78da6df4405b90ea1ab47899491ba41
8 years ago
Ihar Hrachyshka a798840a40 get_info: request object backport only if desired version is different
Partially-Implements: blueprint quantum-qos-api
Change-Id: I93fde3c472e4ecd7af8a7ce50be832b7216e40f6
8 years ago
Moshe Levi d2259240bb Add versioned object serialize/deserialize for resources RPC
Also switched RPC callback API to consistently receive resource_type
string and not a resource class. This is because for get_info(), we
cannot propagate a class thru RPC but only a string that uniquely
identifies the class. So it would be not optimal to require the server
to discover the corresponding class from the type name passed from the

Also updated some comments in api/rpc/callbacks directory to reflect
that we handle NeutronObjects, not dicts.

Finally, killed the rule resource registration from QoS plugin and the
rule type from supported resources since it's YAGNI at least now.

Partially-Implements: blueprint quantum-qos-api
Change-Id: I5929338953a2ad7fa68312d79394a306eb0164a2
8 years ago
Moshe Levi 2d38c742e8 Generic Resources RPC
This patch adds Generic Resource RPC from agent to server.

Change-Id: I0ac8a009e781b6edb283d8634b1a2f047db092dc
8 years ago