The run_sql_cmd method in functional tests is not used. The method uses
Engine.execute() method which was removed in 2.0.
Change-Id: I6f9ea1dfd852a2d311e17964da0ea56c052b3fda
This is follow-up of 1e683483e7 and
replaces the generic Exception asserted in a unit tests by the specific
castellan exception, according to the 4.4.0 release.
This change does not bump minimum required version of castellan because
the version requirement only affects unit tests.
Depends-on: https://review.opendev.org/c/openstack/requirements/+/911059
Change-Id: Id1ed909f179038713d9da2fd72cf39e7fb7c8dfe
Made `centralized_db` cache driver as default driver so that we
can test it using tempest jobs in gate.
Implements blueprint centralized-cache-db
Depends-On: https://review.opendev.org/c/openstack/devstack/+/907110
Change-Id: Id94e93e3ba3fc207b39c7dbff92495805aa0f6f9
oslo.concurrency 6.0.0 has relocated the lock_path that is required
for external locks from [DEFAULT] to the [oslo_concurrency] config
section. Instead of messing with configuration, we can use the
lockutils.set_defaults() method to set this for tests. So add this
to the BaseTestCase so that it's available for all tests.
Change-Id: I2878b4162dddaf935002c168bc544eb1eff71efd
In cache migration unit tests, I was using same cache.db file name
in the setup method which was used by all the tests, which was
causing a issue of deleting a file by other test and resulted
in random failure.
Using random filename to fix this issue permenantly.
Related blueprint centralized-cache-db
Change-Id: I321982013bdf571741a8ef2d0575f65288fff53f
In castellan 4.4.0, we fixed the wrong exception MockKeyManager.get
raised in case the requested key does not exist. This change interferes
with the way one unit test case ensure a key is gone.
This replaces the asserted exception by generic Exception so that we
can unblock u-c bump now. We can later replace it by the specific and
correct exception (ManagedObjectNotFoundError) once castellan 4.4.0 is
pulled to u-c.
[1] 2cc410f56e7275d982bca95aa65cd11e22fc7c3c
Change-Id: I8cc1420e8b16ce0bc74314fd7b8aabf6e133abd8
Made provision to migrate existing cache records from
sqlite to centralized db and delete those from sqlite
after successful migration.
Implements blueprint centralized-cache-db
Change-Id: I2a840915bb6d9d72d6379cae09ebec0e51a4a6dd
Added centralized_db driver for image cache which will use
centralized database for storing cache related information.
Related blueprint centralized-cache-db
Change-Id: Iafaaa86666176cc95f77d85a4ab77286f0042bdd
Added required database API methods for cache related
operations.
Related blueprint centralized-cache-db
Change-Id: Iae1f1927566f4bda74c5aeccf464df820cfae9d4
Added expand script and model to define `cached_images` and
`node_reference` database tables.
Related blueprint centralized-cache-db
Change-Id: I9991a4e945bd4d231e942096445fd5374ff7ff2a
Stream optimized VMDKs are also monolithic disks images, and start
with the same sparse extend header as normal monolithic sparse files,
so we can parse the virtual disk size in the same manner.
See "VMware Virtual Disks Virtual Disk Format 1.1" p. 17.
> Header and Footer
> The header and the footer are both described by the same SparseExtentHeader
> structure shown in Hosted Sparse Extent Header on page 8.
Closes-Bug: #2052291
Change-Id: I7d63951ff080dc699b8d11babc0a5998d90621e4
Co-Authored-By: Rajiv Mucheli <rajiv.mucheli@gmail.com>
The following options set in functional tests do not exist.
[DEFAULT] send_identity_credentials
[DEFAULT] send_identity_headers
Change-Id: Ia739af13e0f88d0861e453a4d54ecc626e32b34b
The oslo.limit 2.3.0 release contains the validation to ensure
the [oslo_limit] endpoint_id option is set[1]. This fixes the test
failures caused by that validation by overriding the option in all
test cases where unified quota implementation is used.
[1] https://review.opendev.org/c/openstack/oslo.limit/+/897509
Closes-Bug: #2049064
Change-Id: I704393892799ee0d5edf45fabe07afe01473e38d
We already got rid of implicit autocommit. Now get rid of explicit
autocommit. This is far more involved than the prior patch but the basic
strategy here is that no public method should take a 'session' argument
and instead should call 'get_session'. In addition, all private methods
should take both a 'context' and 'session' argument and they should be
the first and second arguments, respectively. Finally, public methods
should only call private methods. Combined, this ensures we only ever
have one session in play and the transactions are correctly started and
ended as expected.
Change-Id: I5245c402699e179c219039514b626a52fa0028d8
Resolve the following SAWarning warning:
Class DeleteFromSelect will not make use of SQL compilation caching as
it does not set the 'inherit_cache' attribute to ``True``. This can
have significant performance implications including some performance
degradations in comparison to prior SQLAlchemy versions. Set this
attribute to True if this object can make use of the cache key
generated by the superclass. Alternatively, this attribute may be set
to False which will disable this warning.
This uses different arguments so the cache presumably does not make
sense.
Change-Id: I958ba79ca7ac6709e8c16eceb212f329c807aea8
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Resolve the following RemovedIn20Warning warning:
The current statement is being autocommitted using implicit
autocommit, which will be removed in SQLAlchemy 2.0. Use the .begin()
method of Engine or Connection in order to use an explicit transaction
for DML and DDL statements.
This is the trickiest one hence it's left to last. We really need to get
off of the legacy EngineFacade pattern since it's harder to track
transactions when they're not local (the request context-based binding
of sessions allows us to decorate individual methods) but that's a
larger work item that we're not going to tackle here.
Change-Id: Ie16965a8e3e2f316b807068a868cee6fbb2f33ba
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
We were doing this adhoc in tests, which doesn't seem to be possible in
SQLAlchemy 2.0. Do it everywhere instead.
This highlights a small issue that we have to workaround in the tests.
Change-Id: I9dd70c9976f83a00a8cb270422e545ff2c77f12f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Resolve the following RemovedIn20Warning:
Using non-integer/slice indices on Row is deprecated and will be
removed in version 2.0; please use row._mapping[<key>], or the
mappings() accessor on the Result object.
Change-Id: Ife8bdf766eb6d6fe9748565c9c61aa971d1af6f8
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Resolve the following RemovedIn20Warning warning:
Passing a string to Connection.execute() is deprecated and will be
removed in version 2.0. Use the text() construct, or the
Connection.exec_driver_sql() method to invoke a driver-level SQL
string.
We also resolve two additional RemovedIn20Warning warnings along the
way, since we're already touching this code:
The Engine.execute() method is considered legacy as of the 1.x series
of SQLAlchemy and will be removed in 2.0. All statement execution in
SQLAlchemy 2.0 is performed by the Connection.execute() method of
Connection, or in the ORM by the Session.execute() method of Session.
The Executable.execute() method is considered legacy as of the 1.x
series of SQLAlchemy and will be removed in 2.0. All statement
execution in SQLAlchemy 2.0 is performed by the Connection.execute()
method of Connection, or in the ORM by the Session.execute() method of
Session.
Change-Id: I547bd2f441085fcdc5dc4a0e58d27d11e8a8b223
Resolve the following RemovedIn20Warning warning:
The ``aliased`` and ``from_joinpoint`` keyword arguments to
Query.join() are deprecated and will be removed in SQLAlchemy 2.0.
This one is a little trickier to grok, but the SQLAlchemy docs explain
it rather well [1] (Look for "Legacy Features of Query.join()" and
"Joins to a Target with an ON Clause"). Essentially, because we are
joining e.g. the ImageTag table multiple times, we need to create an
alias and use it for both the join and resulting queries.
[1] https://docs.sqlalchemy.org/en/14/orm/query.html#sqlalchemy.orm.Query.join
Change-Id: Ifb818df8ca8500adcf1354eff0671f5762473110
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Resolve the following RemovedIn20Warning warnings:
The "whens" argument to case(), when referring to a sequence of items,
is now passed as a series of positional elements, rather than as a
list.
Change-Id: I4df3a52333d71809d6ff305a786ba6ae03a230ca
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>