ensure correct cleanup of multi-attach volumes

If a host has multiple instance with the same shared
multi attach volume and you delete them in parallel
nova need to correctly clean up the volume connection on
the host when the last instance is removed.

currently we do not have a volume level lock to guard the
critical section that determins if the current disconnect is
removing the final usage of the volume.

This can lead to leaking the volume or other issues as
noted in bug: #2048837

This change introduces a FairLockGuard to ensure we acquire
and release the locks in a fair and orderd manner.
The FairLockGuard is used to lock the server delete with
one lock per multi attach volume.

This will ensure that disconnects of diffrent volumes can happen
in parallel but if we are disconnecting the same volume in multiple
greenthread concurrently they will be serialised.

Assisted-By: Cursor Auto
Closes-Bug: #2048837
Change-Id: I67e10cace451259127a5d7da8fbdf7739afe3e51
Signed-off-by: Sean Mooney <work@seanmooney.info>
This commit is contained in:
Sean Mooney
2024-04-18 17:48:08 +01:00
parent fac1a4d9de
commit 22012360c4
8 changed files with 497 additions and 59 deletions
@@ -0,0 +1,11 @@
---
fixes:
- |
When deleting multiple instances that share the same multi-attach volume
on the same compute host in parallel, the volume connection could be left
attached to the host even after all instances were deleted, preventing the
volume from being properly detached and reused. Nova now correctly cleans
up multi-attach volume connections when deleting instances, including when
multiple instances sharing the same volume are deleted concurrently. For
more details, see `bug 2048837 <https://bugs.launchpad.net/nova/+bug/2048837>`__.