The hook starts a DB transaction and should be covered with
DB retry decorator.
For Rocky backport had to import neutron_lib.db for retry_db_errors.
Closes-Bug: #1777965
Closes-Bug: #1771293
Change-Id: I044980a98845edc7b0a02e3323a1e62eb54c10c7
(cherry picked from commit ab286bcdac)
(cherry picked from commit 3ec7aed8a3)
(cherry picked from commit 22250e783b)
Add calls to dirty and resync the quota engine during
DELETEs and GETs respectively. This matches the old API controller
behavior and will be covered when the unit tests are switched to
use pecan in [1].
1. I76dc23fb7b96d82b0da50285bd0aac76142e81e5
Closes-Bug: #1714389
Change-Id: I1fb6b471e0e7cbf9b10dd14233931be94af38a41
By changing pecan to store plugins by collection (plural) instead of
resource (singular) we don't need REVERSED_PLURALS and
get_resource_info().
These are not used outside of neutron core.
Consequently, this exposed a bug with some controllers not honoring an
extension's intention of disallowing pagination and sorting. This is
also fixed in this patch to get successful test runs.
Co-Authored-By: Brandon Logan <brandon.logan@rackspace.com>
Change-Id: I9d529d0a2ad369e2be0a8df3c6f06a6532e8b13d
For pecan to support existing agent scheduler controllers, a couple of shim
pecan controllers need to be added. These shim controllers will be used if
there are extensions that have legacy controllers that have not been
registered. The shim controller is just a passthrough to those legacy
controllers. This may have the added benefit of support existing out of
tree extensions that have defined their legacy extension controllers the
same way.
Changes to how the router(s) controllers determines whether something
is a member action has been changed a bit to support this.
Closes-Bug: #1552978
Co-Authored-By: Kevin Benton <kevin@benton.pub>
Change-Id: Icec56676d83b604c3db3377838076d6429d61e48
This change updates the quota enforcement hook to employ reservations
in place of the simple limit check currently used.
As a part of this change, functional tests for the quota enforcement
hook are also added.
Change-Id: I1e8a59ffbb38c252a824337c556249a3e395484d
Related-blueprint: wsgi-pecan-switch
This patch simplifies the process for validating the request body for
POST and PUT requests and preparing it for dispatching to plugins.
In particular it removes the need for parsing the URL to find the
resource identifier, and instead leverages Pecan's routing engine
to extract it. As a result the attribute population hook now simply
deals with request body validation, and has been renamed accordingly.
The logic for loading the current state of the object from the plugin
in order to enforce authZ policy on PUT requests has been moved to
the appropriate hook, PolicyEnforcementHook.
The logic for managing plural/singular names for resource has also been
improved, and two helper functions to retrieve a resource's attributes
have been added to neutron.api.v2.attributes
The logic for aborting requests with unsupported HTTP methods has also
been moved to the REST controllers. It used to be in PolicyEnforcementHook,
which was probably not the right thing to do.
This patch also unskips a functional test concerning ownership checks,
and add functional tests for verifying correct request processing.
Unit tests for the newly added helper functions are also provided.
Related blueprint wsgi-pecan-switch
Change-Id: Ib26998b37bdeec8af7a97f77b66d421b8cd271da
Went through all of the docstrings in Neutron and did
some cleanup. I'm sure there are bunch more that I have missed.
Change-Id: Ib29d2de1c580880c89ed4fd069e1515d0977a3e7
Ensure that core resources, and not only extension resources,
are registered with the quota engine. Otherwise no enforcement
will happen for them.
Further, do not pass anymore the 'resource name' to the resource's
count method as it is not necessary anymore since Liberty.
Change-Id: I895b4e69e50dbf1aac39e07eba07c3e3ff30808a
Closes-bug: #1501948
(cherry picked from commit 809ac21615)
Ensure that core resources, and not only extension resources,
are registered with the quota engine. Otherwise no enforcement
will happen for them.
Further, do not pass anymore the 'resource name' to the resource's
count method as it is not necessary anymore since Liberty.
Change-Id: I895b4e69e50dbf1aac39e07eba07c3e3ff30808a
Closes-bug: #1501948
Pecan defines several efficient mechanism for routing requests to
the appropriate controller, but the current code for Neutron's
Pecan WSGI server basically uses Pecan hooks to route requests.
This patch partially fixes that, removing the 'resource_identifier'
pecan hook and replacing it with explicit pecan routes between
controllers added at resource registration time.
All the remaining hooks, like attribute_population and
policy_enforments, which were relying on finding the resource
name in the pecan.request threadlocal variable have been updated.
This patch also:
- ensures the appropriate plugin is always selected for a given
resource
- add a common NeutronPecanController base class for the classes
CollectionsController and ItemaController
- Fixes the way in which plurals and singulars are handled in
neutron.api.v2.resource_heper
Change-Id: I4ec0d2276c3974117b497228d289c3fb0dc5a140
'newapi' was too generic and not really descriptive of the conversion
to pecan. Since there isn't any ambiguity, we will just keep all of
the pecan components in a directory called 'pecan_wsgi'.
Change-Id: I61f1cfcad4ff00582e0a481400642dd656d5245e
Add a quota enforcement hook so quotas are enforced before
they reach the controller. This spot may need to be revisited
in the future if we want quotas enforced on internal AMQP APIs.
Change-Id: Ia5a134d941df921e44a413613ea11b636f4b8515
Partially-Implements: blueprint wsgi-pecan-switch