GitHub user ProjectMoon opened a pull request: https://github.com/apache/cloudstack/pull/1898
CLOUDSTACK-8862: Lock on volume before attempting to attach it. 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 8aa34d048ab3e459de6d254049f3a31dde42b50d. You can merge this pull request into a Git repository by running: $ git pull https://github.com/greenqloud/cloudstack pr-volume-sync-fix Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cloudstack/pull/1898.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1898 ---- commit c7d174ceee5e87d5423741923e4f87086d042bd5 Author: jeff <j...@greenqloud.com> Date: 2017-01-09T16:28:33Z 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 8aa34d048ab3e459de6d254049f3a31dde42b50d for the other requests. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---