Commit Graph

1012 Commits (b07dd1d2f8f7adbf91392694534b333893b8d508)
 

Author SHA1 Message Date
Takashi Kajinami b07dd1d2f8 Remove logic for Python <= 2.6
... because that old version is no longer supported.

Also the check_python_version method is removed by this change, because
the required python version is now enforced by setup.cfg.

Change-Id: Ie9c91adcb81a1a5dbca2587b6592a58d4cc91e4a
11 months ago
Gorka Eguileor 73ebb70542 Support os-brick specific lock_path for Cinder
As a new feature relevant for the Cinder store, os-brick now supports
setting the location of file locks in a different location from the
locks of the service.

The functionality is intended for HCI deployments and hosts that are
running Cinder and Glance using Cinder backend.  In those scenarios the
service can use a service specific location for its file locks while
only sharing the location of os-brick with the other services.

To leverage this functionality the new os-brick code is needed and
method ``os_brick.setup`` needs to be called once the service
configuration options have been loaded.

The default value of the os-brick ``lock_path`` is the one set in
``oslo_concurrency``.

This patch adds support for this new feature in a backward compatible
way so code works even if using an os-brick version that doesn't have
this feature.  That is the case for many CI jobs that install os-brick
from PyPi instead of the code present in master.

Change-Id: Ib11d63e3c388e12f145f40247d17030a566b8c5e
11 months ago
liyou01 5ff06df97f Remove Python 2 support
Python 2 has been deprecated for almost two years, and has not been
guaranteed to work with glance_store for a while. This patch removes all
traces of six, unicode strings and Python 2 tweaks.

Co-Authored-By: Cyril Roelandt <cyril@redhat.com>
Change-Id: Ifa78924d7ecf4f2d9a54c677888ab2926530c487
1 year ago
Ghanshyam Mann aeee48b561 Update python testing as per zed cycle teting runtime
In Zed cycle, we have dropped the python 3.6/3.7[1] testing
and its support. Moving the py36 job to py3 based so that they run
on latest supported python 3. Updating the python classifier also to reflect the same.

[1] https://governance.openstack.org/tc/reference/runtimes/zed.html

Change-Id: Ida582daf7db6fb3cedb3c7e37fc512d094b37c6e
1 year ago
Zuul aac2a83df6 Merge "Remove redundant try except around volume create" 1 year ago
Zuul 111a7a14b0 Merge "Cinder: Correct exception logging during attach" 1 year ago
Zuul 3b948892d7 Merge "Add coverage for add method" 1 year ago
Zuul 0ec0bc3851 Merge "Add exception coverage for get, get_size, delete" 1 year ago
Zuul 57eaa35bb9 Merge "Add coverage for helper methods" 1 year ago
whoami-rajat 3ee399a1e3 Cinder: Correct exception logging during attach
There is a syntax error in the exception logging when attaching a
volume fails in attachment state manager. This patch corrects it
and adds a test to guard against similar changes in future.

Closes-Bug: #1970698

Change-Id: I43c407046a49bb37631113e2ea65d05450f9365d
1 year ago
whoami-rajat ba4af147fb Correct retry interval during attach volume
When we try to simultaneously attach same volume multiple times
(multiattach), there are multiple attachments created, suppose
attachA and attachB. If attachA marks the volume "reserved" then
attachB can't proceed until the volume is in "in-use" or "available"
state. We retry until we reach any of these states for which we use
the retrying library.

The retrying library defaults to 1 second retry[1] (5 times) which causes
the original failure as the volume takes time to transition between
"reserved" -> "in-use" state. This patch corrects it by adding an
exponential retry time and max exponential retry i.e.

1: 2 ** 1 = 2 seconds
2: 2 ** 2 = 4 seconds
3: 2 ** 3 = 8 seconds
4: 2 ** 4 = 16 seconds (but max wait time is 10 seconds)
5: 2 ** 5 = 32 seconds (but max wait time is 10 seconds)

[1] https://github.com/rholder/retrying/blob/master/retrying.py#L84

Closes-Bug: #1969373

Change-Id: I0094b044085d7f92b07ea86236de3b6efd7d67ea
1 year ago
whoami-rajat f9253a4ade Add coverage for add method
This patch adds test coverage of code paths like extend volume,
exception blocks, when image_size is zero, volume delete call etc

Change-Id: I59b1579dc9877668b82d4195431c14cc41cfe892
1 year ago
whoami-rajat 4bd0304efb Add exception coverage for get, get_size, delete
This patch adds coverage for the various exceptions handled and
raised in get, get_size and delete methods.
It also corrects the behavior of _test_cinder_get_size method where
client.volumes returned dictionary instead of a MagicMock and it
worked due to the existing method "get" in dictionary which has
same name as "get" method in cinderclient. The dictionary object
is replaced with the appropriate MagicMock object in this patch.

Change-Id: If63a6c810b5aab992e54857bc81f5052c2c593c4
1 year ago
whoami-rajat e5a3c9eefa Add coverage for helper methods
Add coverage for helper methods like ``get_hash_str``,
``_get_mount_path`` and ``_get_host_ip``.

Change-Id: Idb232f2d7b0f74e9c65e42955c767fb7bb6ae004
1 year ago
whoami-rajat 77919e15d2 Add coverage for get_cinderclient and _check_context
This patch adds coverage for some parts in get_cinderclient
method like ``cinder_endpoint_template`` option and keystone
exception case when catalog info for cinder could not be found.
Also it adds tests for complete coverage of _check_context
method.

Change-Id: I18b1e5e8fd818824a2dda2ad14d9456190fe9ff4
1 year ago
whoami-rajat 8ec07902cb Remove redundant try except around volume create
The cinder volume create call was moved to the cinder_utils
module to keep the driver code cleaner with commit[1].
A decorator was also added to handle NotFound exception which
made the existing try/except block redundant.
Also the current try/except block has misleading messages:

1) "Invalid volume type configured"
2) "Failed to create image-volume due to invalid
   `cinder_volume_type` configured."

A volume create could fail because of many reasons and "invalid
volume type" is just one of them. These messages will confuse
the operators even if the configured volume type is correct.
This patch removes them since the NotFound exception is already
handled at[2] and the messages are misleading.

[1] 1178f113c4
[2] c0c4969a4a/glance_store/common/cinder_utils.py (L37)

Change-Id: I39c9caec85f574fc717e60f11e5681860a20ed30
1 year ago
whoami-rajat 3666d2d2e4 Add coverage for StoreLocation
This patch adds code coverage (UTs) for methods in StoreLocation class:
1) process_specs
2) get_uri
3) parse_uri

It also adds a missing method (_set_url_prefix) coverage in
Multistore cinder tests (test_multistore_cinder).

Change-Id: I8ced5af11669fb131c665ce53be57143f2c7b518
1 year ago
whoami-rajat c0c4969a4a Add coverage for get_cinder_session
Add test coverage for two config options used to create a keystone
session object for cinderclient namely ``cinder_api_insecure`` and
``cinder_ca_certificates_file``.

Change-Id: Idb6db9f87ef7290441dfe60ca2eb9a59c9ee7bd3
1 year ago
whoami-rajat 95b49304cd Remove six usage
six has been used to maintain compatibility between python2 and
python3 code. Since current openstack development branches doesn't
support python2, we don't need the six library and can use python3
code directly.
This patch removes six usage from cinder store tests.

Change-Id: I4deb193b44394ae9f99f57e31fb81fe04394e247
1 year ago
whoami-rajat fba6d0dd83 Refactor cinder store tests[2/2]
This patch aims at a refactoring effort that would remove
duplicate tests (current and future) by moving them into a
common base class which is called via both single and multi store
test modules with their specific configurations.

This has a lot of benefits:

1) Removes duplicate code
2) Makes addition of new tests easier and cleaner
3) Ensuring a new method/code path added is tested in both
   single and multi store configurations
4) Fixing issues detected while refactoring methods
   (Eg: tests for add method in test_multistore_cinder were not
    passing the hashing_algo parameter which is currently handled
    by the backward compat code (back_compat_add decorator) but
    those tests will break when we remove backward compatibility)

Change-Id: I12569af5623f1cd7803c00a6c3b9eb211f15b6fd
1 year ago
whoami-rajat bb790de1dc Refactor cinder store tests[1/2]
This patch aims at a refactoring effort that would remove
duplicate tests (current and future) by moving them into a
common base class which is called via both single and multi store
test modules with their specific configurations.

This has a lot of benefits:

1) Removes duplicate code
2) Makes addition of new tests easier and cleaner
3) Ensuring a new method/code path added is tested in both
   single and multi store configurations
4) Fixing issues detected while refactoring methods
   (Eg: fake_chown accepted an optional backend parameter which
    does not match the signature of original method temporary_chown)

Change-Id: Iaacb3e117cac2a661750bdb21bd0a7496078ea26
1 year ago
whoami-rajat 7b5b50fd9f Replace FakeObject with MagicMock[2/2]
FakeObject is used to set dynamic attributes to a fake class which
works in most cases but fails when an attribute is accessed which
is not defined/passed explicitly.
This causes failure of tests whenever a new attribute is accessed
and it's hard to maintain the set of attributes for every object
used.
MagicMock provides the same functionality with additional features
and handles the case effectively when an attribute is accessed
which is not explicitly defined in the tests.
This change will help safeguard against cases seen earlier in[1].
This patch replaces FakeObject with MagicMock in test_multistore_cinder.py

[1] https://review.opendev.org/c/openstack/glance/+/805974

Change-Id: I193bb03d174e6c010132702dedef1dea05f40e41
1 year ago
whoami-rajat 4b2aab18c1 Replace FakeObject with MagicMock[1/2]
FakeObject is used to set dynamic attributes to a fake class which
works in most cases but fails when an attribute is accessed which
is not defined/passed explicitly.
This causes failure of tests whenever a new attribute is accessed
and it's hard to maintain the set of attributes for every object
used.
MagicMock provides the same functionality with additional features
and handles the case effectively when an attribute is accessed
which is not explicitly defined in the tests.
This change will help safeguard against cases seen earlier in[1].
This patch replaces FakeObject with MagicMock in test_cinder_store.py

[1] https://review.opendev.org/c/openstack/glance/+/805974

Change-Id: Ifd0905b139cc90c2bd7444bc9e7638f3af6879a7
1 year ago
OpenStack Release Bot db235f1b21 Update master for stable/yoga
Add file to the reno documentation build to show release notes for
stable/yoga.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/yoga.

Sem-Ver: feature
Change-Id: I99772281621ebce5a57ddd37cee879d7cc387c47
1 year ago
whoami-rajat f3433ed1a5 Cinder store: Wait for device resize
When we have an image with size > 1 GB, we follow the following steps
to accomodate the image:
1) Detach the volume
2) extend the volume
3) Attach the volume
4) Open the volume device as a file and resume writing the image

Sometimes due to several reasons (mostly network related), the
size of the device file could mismatch with the actual volume size
(or the backend LUN size). This can happen if the extend was performed
(i.e. the control path) but it takes the time to reflect that into
the mapped device (i.e. the data path). This mismatch can cause the
issue "IOError: [Errno 28] No space left on device".
To avoid this scenario, we check if the device size is less than the
volume size, we wait for the extended LUN to show up in mapped device
and then continue the image writing operation.

Closes-Bug: #1959913

Change-Id: I206580f6be615ebc5e15b546b9c23728d4116a5d
1 year ago
Zuul 16b9d1f7ad Merge "Correct attachment_complete call" 1 year ago
Zuul bd8c0ac639 Merge "nit: Correct debug log" 1 year ago
whoami-rajat e1ced9ea31 Correct attachment_complete call
Cinder's attachment_complete API is called to mark the volume from
"attaching" state to "in-use" state stating that the volume is
ready to use.
In the current code, attachment_complete is called before the
brick connection is complete. This should be done after the
connection to brick is successful and we have a volume path
to write the image into. This patch corrects the behavior.

The wrong sequence of execution won't have any issues functionally
since we open the volume after all steps are completed but flow
wise it is incorrect.
This change won't have any end user impact.

Change-Id: Ia9652a4ff6d7efbabb58511f0ce93a87b3a4dfa8
1 year ago
whoami-rajat 8b4d97a6f7 Pass valid IP address to os-brick
While fetching connector information the cinder driver of
glance-store is passing 'hostname' as IP address whereas it
actually needs IP address.

This path fetches the IPV4 or IPV6 address from the available
'hostname' and passes it to os-brick.

This worked for other cinder backends which don't rely specifically
on IP address for initializing connection like fibre channel, nfs etc
and even for some iscsi backends since, in some environments,
the hostname is same as the ip address. This is not the case always
and we should pass the correct IPv4/IPv6 address of the host to
avoid this issue.

Closes-Bug: #1955668

Change-Id: Ic79815972e654a8bfe2775f57c68cfa0bf115e2f
1 year ago
Zuul 63d6f8341a Merge "[RBD] Clone v2: Image is unusable if deletion fails" 1 year ago
Abhishek Kekane 3d221ec529 [RBD] Clone v2: Image is unusable if deletion fails
Recently cinder has utilized Ceph clone v2 support for its
RBD backend, since then if you attempt to delete an image from
glance that has a dependent volume, all future uses of that
image will fail in error state. Despite the fact that image
itself is still inside of Ceph/Glance. This issue is reproducible
if you are using ceph client version greater than 'luminous'

To resolve this issue glance RBD driver now checks whether snapshot
of original image has any external references before deleting/removing
it's snapshot and returns 409 Conflict response if it has any.

NOTE: To check this dependency glance osd needs 'read' access to
cinder and nova side RBD pool.

Closes-Bug: #1954883
Depends-on: https://review.opendev.org/c/openstack/devstack-plugin-ceph/+/819476
Change-Id: If30b7bd7acac148b6f89ce46abbe128c678c90e7
1 year ago
Zuul a7ad9af0d6 Merge "Updating python testing classifier as per Yoga testing runtime" 1 year ago
Ghanshyam Mann 8bc3f816a3 Updating python testing classifier as per Yoga testing runtime
Yoga testing runtime[1] has been updated to add py39
testing as voting. Unit tests update are handled by the
job template change in openstack-zuul-job

- https://review.opendev.org/c/openstack/openstack-zuul-jobs/+/820286

this commit updates the classifier in setup.cfg file.

[1] https://governance.openstack.org/tc/reference/runtimes/yoga.html

Change-Id: I2241143bb4936d7258f156b8e9d760607ed61d0e
1 year ago
OpenStack Proposal Bot 6295d2eead Imported Translations from Zanata
For more information about this automatic import see:
https://docs.openstack.org/i18n/latest/reviewing-translation-import.html

Change-Id: I8c8283efd0e7bb030b886e4a4e27a29d56e71288
1 year ago
Zuul 8c644ed1ba Merge "Fix option load for swift/vmware" 1 year ago
Zuul 5cba0182f0 Merge "Fix typos" 1 year ago
whoami-rajat 5677ae3cba nit: Correct debug log
Correct debug log when initializing _AttachmentStateManager.

Change-Id: Ifa909a67c76b897f2ab4b1ee5926046bc7045d3d
2 years ago
Zuul 395f792358 Merge "setup.cfg: Replace dashes with underscores" 2 years ago
Zuul ddb6871aa2 Merge "Cleanup devstack jobs" 2 years ago
Dr. Jens Harbott fe51a87372
Cleanup devstack jobs
Both Python 3.x and Keystone v3 are hardcoded settings in devstack for
quite some time, drop the old variables from the job definitions.

Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
Change-Id: I06ae79267159f3769dfcba860115e2c45ba2a8c6
2 years ago
Cyril Roelandt e4930e5dc8 Fix documentation build with Sphinx>=4.2.0
Change-Id: I07b14385290cbaba570115a85233d35a88b4d586
Closes-Bug: #1946789
2 years ago
Cyril Roelandt e6b1e2dea3 Fix typos
Change-Id: I7432abc646acf3dce7a6b5965dab83d3732f09d2
2 years ago
OpenStack Release Bot 68200a88ff Add Python3 yoga unit tests
This is an automatically generated patch to ensure unit testing
is in place for all the of the tested runtimes for yoga.

See also the PTI in governance [1].

[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html

Change-Id: I7d6e6666e56c1a20cad3153cb84a4290f6ca3692
2 years ago
OpenStack Release Bot bf8418c96e Update master for stable/xena
Add file to the reno documentation build to show release notes for
stable/xena.

Use pbr instruction to increment the minor version number
automatically so that master versions are higher than the versions on
stable/xena.

Sem-Ver: feature
Change-Id: I9bda41a2d9ab44b97a1095600629ae2c048aac04
2 years ago
Abhishek Kekane 6807722bec Xena cycle Release Notes
Change-Id: I595207658e812556d726121c1fe4400668c819ec
2 years ago
Zuul 9c96922d49 Merge "Add volume multiattach handling" 2 years ago
Zuul 4598766890 Merge "Raise correct exception from "Quota full"" 2 years ago
Erno Kuvaja 6a241a20c9 Raise correct exception from "Quota full"
Swift driver reraises the client exception causing glance-api
to return 500. Lets raise g_s StoreFull correctly instead.

Change-Id: I5be151afe242a75142e74d488c4787a35929e189
Closes-bug: #1926404
2 years ago
whoami-rajat ecda7f640f Add volume multiattach handling
We implemented cinder's new attachment API support with patch[1].
It was needed to add multiattach volume handling added with this
patch.
There is no special configuration change or user interference needed.
If a volume is of a multiattach type, then it will be handled as
a multiattach volume.

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

Implements: blueprint attachment-api-and-multiattach-support
Closes-Bug: #1904546

Change-Id: Iffb825492a20fd877476acad05f817b399072f01
2 years ago
Rajat Dhasmana b42ffa4035 Drop lower-constraints job
Change-Id: I1de76a70e07bbf2bd70900b4d93104a1b0fda74b
2 years ago