The common rpc and exceptions were rehomed into
neutron-lib with [1]. This patch shims those rehomed
modules in neutron to switch over to neutron-lib's
versions under the covers.
To do so:
- The rpc and common exceptions are changed to
reference their counterpart in neutron-lib effectively
swapping the impl over to neutron-lib.
- The fake_notifier is removed from neutron and lib's
version is used instead.
- The rpc tests are removed; they live in lib now.
- A few unit test related changes are required
including changing mock.patch to mock.patch.object,
changing the mock checks for a few UTs as they don't
quite work the same with the shim in place.
- Using the RPC fixture from neutron-lib rather than
that setup in neutron's base test class.
With this shim in place, consumers are effectively using
neutron-lib's RPC plumbing and thus we can move consumers
over to neutron-lib's version at will. Once all
consumers are moved over we can come back and remove
the RPC logic from neutron and follow-up with a consumption
patch.
NeutronLibImpact
[1] https://review.openstack.org/#/c/319328/
Change-Id: I87685be8764a152ac24366f13e190de9d4f6f8d8
oslo_messaging's rpc_backend setting, which is set by
ConfFixture.transport_driver has been deprecated since Newton. To allow
oslo_messaging to remove it, switch to setting transport_url instead.
Partial-Bug: #1712399
Change-Id: I2fbf5159febe9d4970935d77bd75e84204710c8e
Today neutron.common.rpc has a handful of public constants and functions
that are not used outside of neutron. This patch removes those not
externally used and enhances the rpc.init function to accept extra
RPC exception modules (though it's not used today) to still support
the notion of "extra mods" for RPC.
This patch also paves the way for easier rehoming the module to
neutron-lib.
Change-Id: I51607216a39980c17807dcccace3ab66b549607b
I15cc2d6ae48e505c2da121880e27481dedf36d3b catches exceptions for
specific RPC endpoints affected by a recent change related to
push-notifications. There may be more changes like that in the future,
so instead of fixing them one by one, this patch consistently catches
exceptions from all cast calls for all RPC clients.
Change-Id: Ia7e6cd717758a9d5b18fe9cb07c55938f52040ce
Partial-Bug: #1705351
The old endpoint generates a deprecation warning:
neutron/common/rpc.py:61: DeprecationWarning: Using function/method
'oslo_messaging.transport.get_transport()' is deprecated: use
get_rpc_transport or get_notification_transport
TrivialFix
Change-Id: I51a3878dd0a50be2e4c4c93e6e7db4d330a22f23
With backoff client, setting .timeout property on it doesn't take any
effect. It means that starting from Mitaka, we broke
quitting_rpc_timeout option.
Now, when the TERM signal is received, we reset the dict capturing
per-method timeouts; and we cap waiting times by the value of the
option. This significantly reduces time needed for the agent to
gracefully shut down.
Change-Id: I2d86ed7a6f337395bfcfdb0698ec685cf384f172
Related-Bug: #1663458
This should get rid of the following deprecation message:
FutureWarning: The access_policy argument is changing its default value
to <class 'oslo_messaging.rpc.dispatcher.DefaultRPCAccessPolicy'> in
version '?', please update the code to explicitly set None as the value:
access_policy defaults to LegacyRPCAccessPolicy which exposes private
methods. Explicitly set access_policy to DefaultRPCAccessPolicy or
ExplicitRPCAccessPolicy.
BTW the previous attempt [1] to get rid of the message was ineffective.
That's because the library does not distinguish between access_policy
explicitly picked by method consumer, and access_policy using the
default keyword value.
NeuttronLibImpact this change will break plugins that may expose RPC
endpoints that are prefixed with an underscore.
[1] Ia8922baf422ee84e55f05534678b2f0377843688
Change-Id: Ia2498eb5079050bfb4741c8b6c259bf1c116b8d6
oslo.messaging allow dispatcher to restrict endpoint methods since
5.11.0 in I42239e6c8a8be158ddf5c3b1773463b7dc93e881, set with
LegacyRPCAccessPolicy explicitly to ensure it's compatible and
fix FutureWarning like:
"The access_policy argument is changing its default value to <class
'oslo_messaging.rpc.dispatcher.DefaultRPCAccessPolicy'> in version '?',
please update the code to explicitly set None as the value:
access_policy defaults to LegacyRPCAccessPolicy which exposes private
methods. Explicitly set access_policy to DefaultRPCAccessPolicy or
ExplicitRPCAccessPolicy.
Change-Id: Ia8922baf422ee84e55f05534678b2f0377843688
Those are remnants from the oslo-incubator times. Also, oslo.messaging
deprecated [1] transport aliases since 5.2.0+ that is the minimal
version supported for stable/newton. The patch that bumped the minimal
version for Neutron landed 3 months+ ago, so we can proceed ripping
those aliases from the code base.
[1] I314cefa5fb1803fa7e21e3e34300e5ced31bba89
Change-Id: I9e66140ad0b10c50e216c78e4914c98313cada05
Closes-Bug: #1424728
Refactoring neutron common config opts to be in neutron/conf/common so
that all the configuration options reside in a centralized location.
This simplifies the process of looking up the config opts and provides
an easy way to import.
Moved conf/common/config.py to conf/common.py as per review comments.
Partial-Bug: #1563069
Change-Id: Ib5fa294906549237630f87b9c848eebe0644088c
The context objects accepts and ignores unknown keyword arguments. This
was to allow it to handle the deserialization of parameters it didn't
understand from the base class' to_dict method. This will make it
difficult to pass unknown attributes to the base class so fix the
from_dict method to only accept params it knows about.
Related-Bug: #1602081
Change-Id: Ic58a2025680e8e1ba4f8a177d898be457e2c3160
This adds an exponential backoff mechanism for timeout values
on any RPC calls in Neutron that don't explicitly request a timeout
value. This will prevent the clients from DDoSing the server by
giving up on requests and retrying them before they are fulfilled.
Each RPC call method in each namespace gets its own timeout value since
some calls are expected to be much more expensive than others and we
don't want to modify the timeouts of cheap calls.
The backoff currently has no reduction mechanism under the assumption
that timeouts not legitimately caused by heavy system load
(i.e. messages completely dropped by AMQP) are rare enough that the
cost of shrinking the timeout back down and potentially causing
another server timeout isn't worth it. The timeout does have a ceiling
of 10 times the configured default timeout value.
Whenever a timeout exception occurs, the client will also sleep for a
random value between 0 and the configured default timeout value to
introduce a splay across all of the agents that may be trying to
communicate with the server.
This patch is intended to be uninvasive for candidacy to be
back-ported. A larger refactor of delivering data to the agents
is being discussed in I3af200ad84483e6e1fe619d516ff20bc87041f7c.
Closes-Bug: #1554332
Change-Id: I923e415c1b8e9a431be89221c78c14f39c42c80f
In oslo.messaging 2.9.0, the RPC and notification buses were decoupled
into separate transport. This changes over the Neutron notifier to use
the notification transport provided from oslo.messaging instead of the
original transport (which is now used for RPC). By default, the
notification transport will pull in the original transport if nothing is
configured in oslo_messaging_notification, so this can be an in-place
replacement without impacting upgrades or configurations.
This functionality was added to oslo.messaging to address bug #1504622
Change-Id: I89c8a84c81079677088cc7d656a0bcb5e323de4d
The public methods and classes within the neutron.common.rpc module are
untested. This adds tests for all public-facing functions within the
module.
Closes-Bug: #1535327
Change-Id: I80227dd73e58f8b5dbde9cea01ceac22cc8b2e34
This change ensures that the structure of the unit test tree matches
that of the code tree to make it obvious where to find tests for a
given module. A check is added to the pep8 job to protect against
regressions.
The plugin test paths are relocated to neutron/tests/unit/plugins
but are otherwise ignored for now.
Change-Id: If307593259139171be21a71c58e3a34bf148cc7f
Partial-Bug: #1440834