The functionality from model_query is already in neutron-lib and
consumers are using it. This patch removes the _model_query module
from neutron and updates all imports to use neutron-lib's version of
it instead.
NeutronLibImpact
Change-Id: Ib2eae9edb009a93e60b3b0d63ca365056138566b
There is a analysis [1] suggested to run queries against specific
columns rather than full ORM entities to optimize the performance.
Right now, it is impossible to execute such optimization because
OVO doesn't support fetching specific column yet.
This commit introduces a new method 'get_values' in the base
neutron object class. Subclass of neutron object can leverage
this method to fetch specific field of a OVO. It supports fetching
non-synthetic fields only as syntheic fields are not directly backed
by corresponding DB table columns.
neutron-lib patch: https://review.openstack.org/#/c/619047/
[1] https://review.openstack.org/#/c/592361/
Needed-By: https://review.openstack.org/#/c/610184/
Change-Id: Ib90eae7738a5d2e4548fe9fed001d6cdaffddf3b
Partial-Implements: blueprint adopt-oslo-versioned-objects-for-db
The implementation of method 'apply_filters' in
neutron_lib.db.model_query is updated [1]. This patch sync up
the neutron's side implementation.
[1] https://review.openstack.org/#/c/609847/
Change-Id: I180c0813bb433088f6037ff108327fd7a119512b
This patch shims the model query hook functionality to use neutron-lib.
A shim is used as the query hooks are cached in a shared dict and by
shimming them to use neutron-lib we can let consumers move over to
neutron-lib's version at will. Once all current consumers are moved
over to lib, we can remove the shim and consume from lib directly.
The DBQueryHooksFixture is also used in this patch to replace the
existing cleanup function in the unit tests.
Change-Id: I18a4e836ce89b607b5452527e5f8dd172cad6b4f
The APIs our consumers are using from neutron.db_utils were rehomed into
neutron-lib with https://review.openstack.org/#/c/540161/
This patch consumes them by removing the rehomed APIs and using lib's
implementation where applicable.
NeutronLibImpact
Change-Id: I7ee53bce917feae8e37bf278eb3121a5af47131c
The neutron.object.utils module was rehomed into neutron-lib with
https://review.openstack.org/#/c/557809/
This patch consumes it by removing the neutron.objects.utils module
and corresponding test module, updating the contributor internals for
objects and using lib's version of the module.
NeutronLibImpact
Change-Id: If53d0ad660851275462d2641ed1829cdb4c32d05
The make_weak_ref and resolve_ref functions were rehomed into
neutron-lib with https://review.openstack.org/#/c/557809/
This patch consumes them by removing the functions and using lib's
version of them instead.
NeutronLibImpact
Change-Id: I41169ed0d93ea8caee530dcfc01a91271f02d538
Function _kwargs_to_filters() in objects/db/api.py creates a filter
dictionary where all the values are made iterables except in the case
of StringMatchingFilterObj objects. As a consequence, when processing
such a filter, function apply_filters() in db/_model_query.py must
check if a value is a StringMatchingFilterObj before assuming it is
an iterable.
Change-Id: I1b43a06f6e35eaa61c6e6770076a167e6ee83987
Closes-Bug: #1724177
In some cases we may need to pass key=None filters to get_object()
and get_objects() methods, however we lack of NULL check before these
filters reach in_(), which will not return any matching queries in db
layer.
We need to do manual equals matches if NULL element exists in filters,
instead of pass them to in_() operator.
Change-Id: I7980b82e2627b7b097cae0a714d22e680cddd340
Closes-Bug: #1724177
neutron-lib now contains the functionality from neutron's attributes
module. This patch moves the local references over to neturon-lib's
implementation and removes the functionality from the attributes
module.
NeutronLibImpact
Change-Id: I773702ebd4b66d28059cb3ced64b2b477ceff8af
Move the CommonDbMixin methods to model_query.py and
resource_extend.py
This leaves CommonDbMixin as just a shim, and it should be easy
to remove once subprojects have stopped depending on it.
Related-Blueprint: neutron-lib
Change-Id: I5b804e09e630d88d551271d9731cc1f65c065259
Move the model query hook registration and resource extend funcs
registration methods out of the CommonDbMixin class and make them
regular utility functions.
This is a step in refactoring the CommonDbMixin class.
Change-Id: Iec1bb7f7098c83640ae695fd7cf2f4736f414ad2