
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
Team and repository 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.
- License: Apache License, Version 2.0
- Documentation: https://docs.openstack.org/glance_store/latest/
- Source: https://opendev.org/openstack/glance_store/
- Bugs: https://bugs.launchpad.net/glance-store
- Release notes: https://docs.openstack.org/releasenotes/glance_store/index.html
Description
Languages
Python
100%