cloudfoundry / bosh-azure-cpi-release

BOSH Azure CPI
Apache License 2.0
63 stars 87 forks source link

CPI does not delete empty availability sets #236

Closed AbelHu closed 7 years ago

AbelHu commented 7 years ago

CPI Version: v20

Issue Description: CPI does not delete empty availability sets so users can find lots empty availability sets in the resource group when redeploying multiple times.

Solution: Use a temporary file as Mutex, CPI needs to lock before creating an availability set, adding a VM to an availability set or removing a VM from an availability set. If the availability set is empty after removing a VM from it, CPI needs to delete the empty availability set.

cppforlife commented 7 years ago

i was chatting with @voelzmo about potentially adding clean_up cpi command that gets executed outside of running any other cpi commands. clean up could remove any left over artifacts. i wouldnt bother adding above proposed logic (file mutex) if we are going to have clean up cpi method. thoughts?

AbelHu commented 7 years ago

@cppforlife Since cpi methods are called in parallel, create_vm in one process may pick up one empty avset but clean_up method in another process may wants to delete it. The issue still exists.

AbelHu commented 7 years ago

@cppforlife Could BOSH call clean_up method after all cpi commands are executed in one task?