cloudfoundry / bosh-vsphere-cpi-release

BOSH vSphere CPI
Apache License 2.0
32 stars 36 forks source link

🐞 Don't fail deleting a VDS VM with NSX Policy #374

Closed cunnie closed 10 months ago

cunnie commented 11 months ago

The CPI would mistakenly fail a deployment when trying to delete a VM when NSX Policy is configured BUT the VM is deployed to a regular, non-NSX VDS (Virtual Distributed Switch) port group.

The failure occurs when attempting to delete the VM from any NSX Groups (load balancer endpoints). The CPI attempts attempts to discover the VM's NSX's ID (get_vm_external_id()); however, since the VM isn't attached to an NSX segment, the VM doesn't have NSX ID, and the CPI raises an error.

This commit fixes the failure by not raising an error; instead, it prints a helpful log message: "... assuming VM is not attached to an NSX segment".

Fixes, during bosh deploy:

Unknown CPI error 'Unknown' with message 'Failed to find vm in realized state with cid: vm-xxx' in 'delete_vm' CPI method (CPI request ID: 'cpi-341326')

Side notes:

Release Notes Blurb:

No longer encounters a fatal error while executing delete_vm when NSX Policy API is configured and the VM is attached to non-NSX VDS network.

rkoster commented 10 months ago

Thanks @cunnie