Commit Graph

371 Commits

Author SHA1 Message Date
Abhishek Kekane 9b9111f819 Make `centralized_db` cache driver default
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
2024-03-05 19:35:20 +00:00
Zuul e31022bf9d Merge "Drop ineffective options from config file" 2024-02-15 15:17:20 +00:00
Takashi Kajinami 1e99767d0e Drop ineffective options from config file
The following options set in functional tests do not exist.
 [DEFAULT] send_identity_credentials
 [DEFAULT] send_identity_headers

Change-Id: Ia739af13e0f88d0861e453a4d54ecc626e32b34b
2024-01-31 01:16:12 +00:00
Takashi Kajinami 9f896ab03d Bump hacking
hacking 3.0.x is too old.

Change-Id: I33875c36dbbdb946841f8c583636ccdf88d3331f
2024-01-27 16:55:11 +00:00
Takashi Kajinami 5378396b84 Fix test failures with oslo.limit 2.3.0
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
2024-01-12 00:20:42 +09:00
Abhishek Kekane fd222f3128 Sort locations based on store weight
Related to blueprint store-weight

Change-Id: I2383a476cb7e79c7efecdf33203cff0b50ef3bbb
2023-08-01 14:16:08 +00:00
whoami-rajat 0e70f66165 Fix cinder tests for refactoring effort
We are refactoring the glance cinder store[1] to support the
extend in-use feature[2] due to which cinder store tests on
glance side are failing[3] as they aren't able to locate the
files in their new location.
This patch fixes the issue to import from new path while keeping
backward compatibility to import from old path to pass gate until
the new changes have merged.

[1] https://review.opendev.org/c/openstack/glance_store/+/843103
[2] https://review.opendev.org/c/openstack/glance_store/+/868742
[3] https://zuul.opendev.org/t/openstack/build/41a1abf9c749476bb10a56600ca07f0e

Change-Id: Ib9f7160fdbac74fc419faa6b3ab8acb17400d392
2023-01-03 11:52:04 +05:30
Zuul 5c675bddcf Merge "Extending stores-detail API" 2022-08-24 12:05:46 +00:00
Mridula Joshi b0d727d028 Extending stores-detail API
This patch extends the functionality of the API
``GET /v2/info/stores/detail`` to expose store details
of other stores. Currently the ``stores-detail`` API
exposes store details of RBD backend.

Implements: blueprint expanding-stores-detail
Change-Id: I0c7bbc315b56dc0e40397b4ed8a68d1668203c44
2022-08-23 14:42:53 +00:00
Rajat Dhasmana f40ac40c2c Mock getaddrinfo in cinder store tests
With change Ic79815972e654a8bfe2775f57c68cfa0bf115e2f, we started
using getaddrinfo method from socket lib to fetch the system
IP address (v4 or v6) and pass it to os-brick.
The test works for most systems since a valid IP is returned but
for some deployments, it fails with the following error.

raise socket.gaierror(socket.EAI_NONAME, 'No address found')

In any case, it is a good practice to mock it in tests.
This patch mocks getaddrinfo in the current cinder store tests.

Change-Id: Ib03fefbb6034a7e7d2ff1e16430d28962c2ca355
2022-08-08 07:59:14 +00:00
Abhishek Kekane c1a2b9e221 Immediate caching of an image
Till now glance was dependent on periodic job to get image
cached locally and also has dependency on ``cachemanage``
middleware for the same.

This patch removes the periodic job and dependency of
``cachemanage`` middleware and initiates immediate caching
of an image via ``PUT /cache/image_id`` API call.

Co-Author: Dan Smith <dms@danplanet.com>

Implements: blueprint instant-caching
Change-Id: I9ab3f1b7595e22dbb03af95168314352a44eb930
2022-07-19 05:14:38 +00:00
xuanyandong be997b53ab Remove unicode literal strings
Co-Authored-By: Cyril Roelandt <cyril@redhat.com>
Change-Id: Id9e1a5fb9c732c207ee08f0dbf387436a1783174
2022-06-30 19:37:03 +02:00
Abhishek Kekane a71f7ba44e [APIImpact] Correct API response code for DELETE cache APIs
DELETE /v2/cache/{image_id} and /v2/cache returns HTTP 200 response
code to user but as per proposal it should be HTTP 204. This change
returns HTTP 204 response to user.

Closes-Bug: #1980049
Change-Id: I9d1c25638584fe346e3937d0536413d548d46e8e
2022-06-28 17:31:12 +00:00
Cyril Roelandt 1962f47ed2 Delay string interpolations at logging calls
This was already fixed in 4889dc1814 but
we did not enforce this rule and reintroduced "bad" string
interpolations. This patch adds a hacking rule to prevent us from doing
this again in the future.

Change-Id: I96d9a157d3887286542859d67138ffdae5a589f1
2022-05-14 03:17:34 +02:00
Zuul 331ce59a50 Merge "Fix tests for logging connection info" 2022-05-10 20:05:32 +00:00
Abhishek Kekane ecb040c177 [APIImpact] Correct API response code for PUT /v2/cache/{image_id}
PUT /v2/cache/{image_id} returns HTTP 200 response code to user but as per
proposal it should be HTTP 202. This change returns HTTP 202 response to
user.

Closes-Bug: #1971521
Change-Id: I6a875a38bef5beafe352ab3320f3fd199db89aa1
2022-05-06 14:07:42 +00:00
Durga Malleswari Varanasi cb65cc8e44 Internal server error if shared member tries to stage data
to image

Glance API throws an Internal Server Exception when a non
active image is shared with another project and any member
from that project tries to stage data for the same.

This patch will cover the Functional Test Case for the same

Closes-Bug: #1939922
Change-Id: I065036cff6e107b3438007db40981459400ccb6b
2022-04-28 16:26:12 +00:00
Zuul f5776e6c1c Merge "Fix overwriting of existing tags while creating new tags" 2022-02-17 16:01:16 +00:00
Mridula Joshi 2a9a4c8e0e Fix overwriting of existing tags while creating new tags
It was observed that md-tag-create-multiple
(/v2/metadefs/namespaces/{namespace_name}/tags) API overwrites
existing tags for specified namespace rather than creating new one
in addition to the existing tags.
This patch resolves the issue by introducing a header 'X-Openstack-Append'
which on being True will append the new tags to existing ones and
if False will continue to overwrite the tags.

Implements: blueprint append-tags
Closes-Bug: #1939169
Change-Id: I29448746b14c542e5fbf0283011968ae1516642e
2022-02-16 05:45:06 +00:00
Erno Kuvaja 87eae327bf Cache management API endpoints
This change adds the new cache API endpoints and their related
new policies.

Implements-bp: https://blueprints.launchpad.net/glance/+spec/cache-api
Change-Id: I69162e19bf095ef11fbac56a1ea2159d1caefba7
2022-02-14 15:14:17 +00:00
Zuul a42fda92dc Merge "[APIImpact] Quota usage API" 2022-02-08 03:33:58 +00:00
Dan Smith f865b8cac7 [APIImpact] Quota usage API
This adds a /v2/info/usage API endpoint which exposes to the user
their current limits and usage.

The discovery API does not (appear to) have existing tests, so this
adds a module for that, although only usage tests are added currently.

Implements: blueprint quota-api
Change-Id: I50c98bac50f815bdb9baae024e77afd388f74554
2022-02-03 09:55:50 -08:00
Stephen Finucane 87ba56161b Remove six.moves.urllib usage
Change-Id: I71be65ef7b8f710e9317419d7b38559b39f461b0
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-01-27 14:54:05 +00:00
Stephen Finucane 9679ffc463 Remove six.moves.http_client usage
This is a rather beefy change due to the number of usages of this
import. The changes are trivial though.

Change-Id: I7badeeaca438b0291f4ed86670e7f217e6372c61
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-01-27 14:54:05 +00:00
Stephen Finucane 39e667a145 Remove six.moves.range usage
This is the same as the 'range' keyword in Python 3

Change-Id: If3aa008522c24e870b7bf13de32b8ed1b27cb519
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-01-27 14:54:05 +00:00
Stephen Finucane 6bd7c188ee Remove six.text_type, six.binary_type usage
Change-Id: I2ed464202f8b645aed11490e111c61d3c7423c11
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2022-01-27 14:54:00 +00:00
Stephen Finucane 502fa0ffc8 Remove six.iteritems usage
We also remove hacking tests for this, along with those for iterkeys and
itervalues (no usage of these).

Change-Id: If5b46580078eb756651ac6118f502eccdc693646
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-12-21 13:01:56 +00:00
whoami-rajat acc6f624cd Fix tests for logging connection info
While logging connection info in the glance cinder store driver, we
need to mask passwords for which we use oslo_utils's mask_dict_password
method.
Since this is not mocked in the glance functional tests, we encounter a failure
in cross-glance-tox-functional job in the change[1].
This patch adds the required mocking to pass the tests.

[1] https://review.opendev.org/c/openstack/glance_store/+/818722

Change-Id: Ibd9563fb854f888b4a2f5a5dcf6abce0cfab0f04
2021-11-30 05:41:46 +00:00
whoami-rajat de8c850269 Replace FakeObject with mock.MagicMock
In glance cinder functional tests, we currently use FakeObject class
to create mock objects which has limited functionality.
Replacing it with mock.MagicMock will prevent failures like in change
I129181b2338e09d094ee552a62500c6e460ee621 and other features as well.

Change-Id: I5afa2541bc28970191ea9fd76bf44eb9aaaa1081
2021-11-26 08:43:06 -05:00
Rajat Dhasmana 6fd949a966 Refactor glance cinder tests
Legacy attachment API calls were removed/replaced from the code with
new attachment API support in glance store with change[1]
This patch removes the same methods mocked in the tests.

[1] https://review.opendev.org/c/openstack/glance_store/+/782200

Change-Id: I111fc36dcf3bc203f21377a3095a2170d00bb9bf
2021-11-24 02:09:49 -05:00
Zuul a693e066b3 Merge "Fix typos" 2021-10-20 00:01:42 +00:00
Andre Aranha 947e541fc0 Update qcow test to use qcow2 instead
qemu-img package for Centos 8 doesn't support qcow disk format anymore,
due to this, tests using qcow are failing with
`Unknown file format 'qcow'`.
This patch updates the qcow tests for qcow2 instead.

Closes-Bug: #1946457

Change-Id: If488ae4299a6cab521eec9c5e9ce4f29f94057e1
2021-10-13 10:31:27 +00:00
Cyril Roelandt 0ca2f92161 Fix typos
Change-Id: I5e7776324c01e467799b1296c35b84dc0c10cce2
2021-10-13 03:02:52 +02:00
Zuul 267987a9b3 Merge "Fix failed cinder store migration for non-owners" 2021-09-14 19:01:23 +00:00
Zuul 02cf73ca2b Merge "Reproduce bug #1932337" 2021-09-14 19:01:15 +00:00
Lance Bragstad 07eaf532c7 Remove duplicate _header() implementations in metadef tests
The metadef functional test classes all had their own _header()
implementation and none of them varied. This commit moves the _header()
implementation to a common layer and removes the duplication.

Change-Id: I40942a5dde3cd50a64a5f36fbcb6d9240af25b5e
2021-09-10 08:14:52 -07:00
Lance Bragstad 4e68e5da6f Remove duplicate _url() methods from functional test classes
Most of the functional tests contain a version of _url(). The
implementations don't really differ, outside of one that accepts a
protocol and another that is specific to IPV6 for a single test case.

This commit moves the common method to the functional base class and
removes the duplicated logic across the functional test implementations.

Change-Id: I0b161ad404bdb53e3c1cfe878f78a71c239cf40e
2021-09-10 08:14:52 -07:00
Lance Bragstad 82a8945885 Move global constants to test module setUp
Each metadef test module has its own constants for TENANT1 and TENANT2,
bu they all point to the same underlying value from oslo. This commit
moves the constants to the setUp() method of the base metadef functional
test class and removes the duplication across the metadef tests.

Change-Id: I21e32a34c05b6f091e14c41b4e5a50ccaa294365
2021-09-10 08:14:47 -07:00
Lance Bragstad a8dda8c03c Remove duplicate namespace utilities in functional tests
We're in the process of adding test coverage for the metadef API, which
is sorely needed. This commit introduces two different base classes that
help consolidate some duplication that's grown across the metadef tests.

Since the metadef API contains a whole bunch of nest resources, the
first class is a set of utilities that are handy for creating
metadef resources. This is nice because almost every resources in the
metadef API needs a namespace.

The second class is a subclass of the functional test case, but provides
a layer for metadef-specific test utilities, like assertions. We can
continue using this layer to consolidate test utilities without bloating
the base functional test class.

Change-Id: Ic469ee50b9a3f162fd75a8290766d1e0bb4b26f5
2021-09-10 08:14:11 -07:00
Dan Smith ee1849714e Fix failed cinder store migration for non-owners
This fixes the bug related to cinder store migration being unable to
complete if a non-owner, non-admin user GETs the image before one of
the authorized users has triggered the lazy migration.

Change-Id: I187f626816ef1bc7303251165d2282bf6985cfd1
Closes-Bug: #1932337
2021-09-08 15:23:42 -07:00
Dan Smith b55dbb28c6 Reproduce bug #1932337
This reproduces the behavior described in bug 1932337, where a post-
upgrade GET by a non-owning user will return an error for a valid image
because the cinder store migration cannot complete.

This asserts the broken behavior to reproduce the problem, and the
rest of the test will be enabled when the bug is fixed.

Note that the test for this was duplicating code from the base class,
and since some changes were needed to those methods, this removes the
duplication and modifies only the base.

Change-Id: I741e6377b3aa40c14d637f0fbdf396dc468f6ebd
2021-09-08 15:17:49 -07:00
Pranali Deore 4473a60536 Implement project personas for metadef tags
This commit updates the policies for metadef tags
to use default roles available from keystone.

Change-Id: I2f97c64a72e081ae2f9e558b6fa53dbfd5af2026
2021-09-03 05:37:05 +00:00
Pranali Deore 9796593f31 Implement project personas for metadef properties
This commit updates the policies for metadef properties
to use default roles available from keystone.

Implements: blueprint secure-rbac
Change-Id: Ic93c2a8a7017e6eac16d23fb5a9224d2c11e7211
2021-09-02 16:06:12 -07:00
Pranali Deore c64083badc Implement project personas for metadef resource-types
This commit updates the policies for metadef resource types
to use default roles available from keystone.

Implements: blueprint secure-rbac
Change-Id: Ia0809b2b27ac8cf9325e264b3298149feea07eb4
2021-09-02 16:05:19 -07:00
Pranali Deore 035e714f83 Implement project personas for metadef objects
This commit updates the policies for metadef objects to
use default roles available from keystone.

Implements: blueprint secure-rbac
Change-Id: If2001ef652e21f54048db0fc67893337681a2b6f
2021-09-02 16:05:18 -07:00
Pranali Deore 9d9d7abe21 Implement project personas for metadef namespaces
This commit updates the policies for metadef namespaces
to use default roles available from keystone.

Co-Authored-By: Abhishek Kekane <akekane@redhat.com>
Implements: blueprint secure-rbac

Change-Id: I7bc678b1f61b204574f3a59b6c686fd771af5f54
2021-09-02 15:40:43 -07:00
Zuul e5d2c41aa7 Merge "Check policies for Image Cache in API" 2021-09-01 16:20:48 +00:00
Zuul 25e60aea8e Merge "Check policies for image tasks information in API" 2021-08-30 17:16:06 +00:00
Zuul ad0cba64be Merge "Move metadef tag policy checks in the API" 2021-08-30 17:08:10 +00:00
Zuul 3c9b4b447f Merge "Move metadef property policy checks in the API" 2021-08-30 17:05:49 +00:00