Disk snapshot delete fails with - Please remove the lock and try again
We use Azure python SDK APIs to create and delete disk snapshots. When we create a snapshot we also create a lock on the snapshot. While deletion on snapshot we have seen sometimes that it fails with an error like this - 'The scope '/subscriptions/6cf87370-7a9a-43b7-8a75-429f6f8d8814/resourceGroups/anirg/providers/Microsoft.Compute/snapshots/nbu7474989985348636988snap1565612042' cannot perform delete operation because following scope(s) are locked: '/subscriptions/6cf87370-7a9a-43b7-8a75-429f6f8d8814/resourcegroups/anirg/providers/Microsoft.Compute/snapshots/nbu7474989985348636988snap1565612042'. Please remove the lock and try again.'
Note: we actually call the API to delete the lock first before issuing snapshot delete request. So most of the times snapshots get deleted.
I am attaching a script with which this issue can be easily reproduced and a log file which shows the same.
I have worked with Azure Customer support to identify the following -
Problem When using the Azure SDK for Python APIs to manage your snapshot, you are experiencing sporadic issues when deleting snapshots due to resource locks, despite removing them beforehand.
Root Cause We suspect that the Python APIs might be affected by a bug that makes the checks for resource locks to fail when using the method locks.list_at_resource_level.
Resolution We recommend that you submit an issue report to the official GitHub repository to inform the development team about this. azure_support_1.zip
Note: Please refer: https://github.com/Azure/azure-sdk-for-python/issues/7238 for the investigation This issue was closed but the problem still exists hence re-opening.
Thanks for letting us know @nitishkochhiveritas, someone on our team will take a look at this //cc: @zikalino
Hi @nitishkochhiveritas. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.
/unresolve
Hi @nitishkochhiveritas, Compute has released the latest version 24.0.0. Please try it with the latest version. Thank you !
Fyi: https://pypi.org/project/azure-mgmt-compute/24.0.0/
Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!