cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

VM deletion can fail on volume access revocation if VM's last host is removed

Open mlsorensen opened this issue 2 years ago • 2 comments

ISSUE TYPE
  • Bug Report
COMPONENT NAME
API, Storage
CLOUDSTACK VERSION
main
CONFIGURATION

PowerFlex, Datera storage

OS / ENVIRONMENT
SUMMARY

If a VM is stopped, then the last host it was running on is removed from cloudstack, the VM can fail to delete. This is because deletion attempts to revoke host access to the VM's volumes and various storage plugins will throw errors if the provided host is null.

Looking through the storage plugin implementations, it looks like this would affect Datera and PowerFlex storage types only.

Generally this seems to be due to passing a null host object to the storage provider's revokeAccess() method. Looked into a holistic fix but there are several places where revokeAccess() can be invoked or could be invoked in the future. Additionally, a storage plugin could choose to handle a null host as a "revoke all" command.

STEPS TO REPRODUCE
  1. Create VM with root on Datera or PowerFlex storage
  2. Start/stop the VM
  3. remove the host the VM ran on from CloudStack
  4. attempt to delete the VM
EXPECTED RESULTS

VM should be deleted

ACTUAL RESULTS

Error is thrown during deletion

mlsorensen avatar Sep 14 '22 15:09 mlsorensen

Hey, I want to work on this issue, can you assign this issue to me please? @rohityadavcloud @mlsorensen

sharmadhiraj86 avatar Sep 15 '22 05:09 sharmadhiraj86

@sharmadhiraj86 that would be great. I don't have access to assign.

Looking at the SolidFire implementation, they seem to not be affected. I have a PowerFlex fix already that I've tested.

I do think it might be worth looking at everywhere that we call revokeAccess and figure out if we really do want to even call revoke if the host is null, but at a minimum making sure the managed storage plugins are handling it seems necessary to avoid further issues long term.

mlsorensen avatar Sep 15 '22 19:09 mlsorensen

Closing this as main reported issue fir powerflex has been fixed.

rohityadavcloud avatar Oct 08 '22 01:10 rohityadavcloud