We've a check in glance cinder store that waits for the volume size to match the volume file size. This check was added for the powerflex driver where it takes some amount of time to resize the volume file after an extend operation.
However, this check causes problems when we are using file formats that doesn't actually match the volume size provided in the volume like thin volumes and sparse volumes in-case of nfs driver.
Currently the glance cinder store fails to create an image because this check fails as the sparse file (default in nfs) doesn't equal to the size of volume object.
Dec 27 06:44:33.833208 ubuntu-jammy-ovh-bhs1-0032584430 <email address hidden>[86788]: ERROR glance_store._drivers.cinder [-] Timeout while waiting while volume b3d6652b-2586-461f-93fe-41aba7e20d4a to resize the device in 6 tries.
Dec 27 06:44:33.834071 ubuntu-jammy-ovh-bhs1-0032584430 <email address hidden>[86788]: DEBUG oslo_concurrency.processutils [-] Running cmd (subprocess): sudo glance-rootwrap /etc/glance/rootwrap.conf chown 0 /opt/stack/data/glance/images/mnt/nfs/8db6edfa5db8c4a4b76e2ad4526a0f97806edb8c809ce63ffcdb8d1a551aa57a/volume-b3d6652b-2586-461f-93fe-41aba7e20d4a {{(pid=86788) execute /usr/local/lib/python3.10/dist-packages/oslo_concurrency/processutils.py:384}}
Dec 27 06:44:33.847531 ubuntu-jammy-ovh-bhs1-0032584430 sudo[89786]: stack : PWD=/ ; USER=root ; COMMAND=/usr/local/bin/glance-rootwrap /etc/glance/rootwrap.conf chown 0 /opt/stack/data/glance/images/mnt/nfs/8db6edfa5db8c4a4b76e2ad4526a0f97806edb8c809ce63ffcdb8d1a551aa57a/volume-b3d6652b-2586-461f-93fe-41aba7e20d4a
Dec 27 06:44:33.847957 ubuntu-jammy-ovh-bhs1-0032584430 sudo[89786]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1001)
Dec 27 06:44:34.186098 ubuntu-jammy-ovh-bhs1-0032584430 sudo[89786]: pam_unix(sudo:session): session closed for user root
Dec 27 06:44:34.187801 ubuntu-jammy-ovh-bhs1-0032584430 <email address hidden>[86788]: DEBUG oslo_concurrency.processutils [-] CMD "sudo glance-rootwrap /etc/glance/rootwrap.conf chown 0 /opt/stack/data/glance/images/mnt/nfs/8db6edfa5db8c4a4b76e2ad4526a0f97806edb8c809ce63ffcdb8d1a551aa57a/volume-b3d6652b-2586-461f-93fe-41aba7e20d4a" returned: 0 in 0.353s {{(pid=86788) execute /usr/local/lib/python3.10/dist-packages/oslo_concurrency/processutils.py:422}}
Dec 27 06:44:34.189696 ubuntu-jammy-ovh-bhs1-0032584430 <email address hidden>[86788]: ERROR glance_store._drivers.cinder [-] Exception while accessing to cinder volume b3d6652b-2586-461f-93fe-41aba7e20d4a.: glance_store.exceptions.BackendException: Timeout while waiting while volume b3d6652b-2586-461f-93fe-41aba7e20d4a to resize the device in 6 tries.
Dec 27 06:44:34.189696 ubuntu-jammy-ovh-bhs1-0032584430 <email address hidden>[86788]: ERROR glance_store._drivers.cinder Traceback (most recent call last):
Dec 27 06:44:34.189696 ubuntu-jammy-ovh-bhs1-0032584430 <email address hidden>[86788]: ERROR glance_store._drivers.cinder File "/usr/local/lib/python3.10/dist-packages/glance_store/_drivers/cinder.py", line 813, in _open_cinder_volume
Dec 27 06:44:34.189696 ubuntu-jammy-ovh-bhs1-0032584430 <email address hidden>[86788]: ERROR glance_store._drivers.cinder yield f
Dec 27 06:44:34.189696 ubuntu-jammy-ovh-bhs1-0032584430 <email address hidden>[86788]: ERROR glance_store._drivers.cinder File "/usr/local/lib/python3.10/dist-packages/glance_store/_drivers/cinder.py", line 994, in add
Dec 27 06:44:34.189696 ubuntu-jammy-ovh-bhs1-0032584430 <email address hidden>[86788]: ERROR glance_store._drivers.cinder Store._wait_resize_device(volume, f)
Dec 27 06:44:34.189696 ubuntu-jammy-ovh-bhs1-0032584430 <email address hidden>[86788]: ERROR glance_store._drivers.cinder File "/usr/local/lib/python3.10/dist-packages/glance_store/_drivers/cinder.py", line 676, in _wait_resize_device
Dec 27 06:44:34.189696 ubuntu-jammy-ovh-bhs1-0032584430 <email address hidden>[86788]: ERROR glance_store._drivers.cinder raise exceptions.BackendException(msg)
Dec 27 06:44:34.189696 ubuntu-jammy-ovh-bhs1-0032584430 <email address hidden>[86788]: ERROR glance_store._drivers.cinder glance_store.exceptions.BackendException: Timeout while waiting while volume b3d6652b-2586-461f-93fe-41aba7e20d4a to resize the device in 6 tries.
Reviewed: https:/ /review. opendev. org/c/openstack /glance_ store/+ /843103 /opendev. org/openstack/ glance_ store/commit/ d0733a0f4f0c803 ca0333605a21552 dba1da931e
Committed: https:/
Submitter: "Zuul (22348)"
Branch: master
commit d0733a0f4f0c803 ca0333605a21552 dba1da931e
Author: whoami-rajat <email address hidden>
Date: Tue May 24 11:44:48 2022 +0530
Refactor/ restructure glance cinder store
This is an effort to decouple some of the cinder backend specific
code (like nfs, scaleio) from the generic logic.
The purpose is to make the code modular and any change
for a particular cinder backend should not affect the code path
of other backends thereby reducing regression.
This is also required for another use case of supporting extend
of attached volumes added in [1].
Following are the major changes done in this patch:
1) Move cinder store to a new directory 'cinder' and rename
'cinder.py' to 'store.py' (similar to swift)
2) Create new files for nfs and scaleio backends for moving code
specific to these backends into their own separate file.
This also fixes one bug when using sparse files in nfs and
we wait for file size to be equal to volume size (initially done
for scaleio/powerflex backend) but this will never happen for
nfs sparse files. See bug: 2000584
3) Move cinder tests to 'tests/unit/cinder' directory and add tests
for base, nfs and scaleio files.
4) Modify/fix existing tests
Closes-Bug: #2000584
[1] https:/ /review. opendev. org/c/openstack /glance_ store/+ /868742
Depends-On: https:/ /review. opendev. org/c/openstack /glance/ +/869021
Change-Id: I26c272b6c503e9 8fbbafca411d3ee c47283bd6fc