CLOUDSTACK-8862: Lock on volume before attempting to attach it. #1898

Open
wants to merge 1 commit into
from

Projects

None yet

1 participant

@ProjectMoon
Contributor

It is possible to attach a single volume to multiple instances by running the commands close to one another. In KVM, this can be verified by checking the virsh dumpxml for the instances once the volume attaches are complete. This PR adds a lock on the volume ID in the orchestration step to make sure the method is only executed one at a time for any given volume ID. So in the scenario of someone sending simultaneous volume attach requests, one should succeed and the others will fail after hitting the check added in 8aa34d0.

@ProjectMoon ProjectMoon CLOUDSTACK-8862: Lock on volume before attempting to attach it.
This commit updates the volume orchestration to lock on the volume ID
before sending the attach commands. While there is already validation
for checking if a VM is already attached to an instance in both the
API command and the volume orchestration framework, they aren't of
much use if there's no synchronization.

With this commit, a single volume being attached to multiple instances
will successfully attach to one and return the error added in commit
8aa34d0 for the other requests.
c7d174c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment