This looks like a serious issue. Cloudstack goes into a bad state due to this.

From the UI the host first needs to be put into maintenance and only after that 
the host can be deleted. But if deleteHost API is directly invoked there is no 
such restriction (there is no check to see the ResourceState of the host). Now 
if there are VMs running on the host the system goes into a bad state. The VMs 
remain in the database but no operations can be performed on them.

The fix is to put a check that the resource state is 'Maintenance' for delete 
host to succeed. Before going ahead with the fix just wanted to check if the 
current behavior is intentional to handle some specific scenarios.

-Koushik

Reply via email to