Rajat Dhasmana 915dffabc1 Cinder: Handle multiattach volumes in multi worker env
Since glance completed the support for uWSGI[1], devstack[2]
along with other deployment tools have started to default
glance in uWSGI mode.
The problem we currently face is that the attachment state
manager (written with threading locks) is not capable of
handling multiple uWSGI processes accessing the same image-volume
with multiple attach/detach operations which are not coordinated.

This patch aims to address the problem with a different approach
keeping the following things in mind:

1. Attachment create doesn't require locking since we already handle
it with Cinder attachment states ('reserved', 'attaching', 'in-use')
and the retry mechanism while creating attachment[3]

2. While disconnecting, we need to only perform it if there are
no other attachments for same volume

3. Delete attachment should always be performed to remove
attachment records from Cinder DB to make decision for step 2.
NOTE that Cinder volume driver handles case for multiattach
volumes and avoids unmapping if LUN is attached > 1 times.

With the following in mind, the new approach is:

1. Stop persisting attachment state in memory and rely on
Cinder DB since that is more reliable and fault tolerant.

2. Removing locking from attachment create call

3. Use external/file locks for disconnect and detach operations

4. While disconnecting, acquire file lock and count number
of attachments for a specific volume and don't disconnect if
attachments > 1

5. For non-multiattach volumes, always disconnect

6. Delete the volume attachment inside file lock to ensure
the attachment counting is accurate.

[1] https://review.opendev.org/c/openstack/glance/+/742065
[2] https://review.opendev.org/c/openstack/devstack/+/932201
[3] https://review.opendev.org/c/openstack/glance_store/+/786410

Closes-Bug: #1965679
Closes-Bug: #2125840

Depends-On: https://review.opendev.org/c/openstack/cinder/+/962409

Signed-off-by: Rajat Dhasmana <rajatdhasmana@gmail.com>
Change-Id: I32fce5aeebe3319f167affa954c681598f81ad74
2025-10-05 09:36:00 +00:00
2023-11-16 01:09:09 +09:00
2019-04-19 19:42:31 +00:00
2025-09-01 18:22:42 +00:00
2014-01-24 18:30:46 +01:00
2019-10-06 14:37:10 +08:00
2025-06-09 18:06:12 +09:00
2020-04-05 08:20:21 +02:00
2025-09-17 00:22:03 +09:00

Team and repository tags

The following tags have been asserted for the Glance Store
Library:
"project:official",
"stable:follows-policy",
"vulnerability:managed".
Follow the link for an explanation of these tags.

Glance Store Library

Glance's stores library

This library has been extracted from the Glance source code for the specific use of the Glance and Glare projects.

The API it exposes is not stable, has some shortcomings, and is not a general purpose interface. We would eventually like to change this, but for now using this library outside of Glance or Glare will not be supported by the core team.

Description
Glance stores library
Readme 14 MiB
Languages
Python 100%