When you delete a host connected to vCenter and all the VMs attached to this host, try to recreate the same host and import the VMs.
we have the error below
[VirtualMachineAllocate] Error allocating a new virtual machine. Virtual Machine 4202ef13-0afe-f1a2-cdae-8e0240484b68 already imported.
We were also thinking about removing them . However, when the VM no longer exits in OpenNebula (i.e. DONE state) it should not exist in the hypervisor either. Note that the VM reaches the DONE state after issuing SHUTDOWN, DELETE or any other operation that will also terminate the VM.
At the end we decided not to add the extra logic and keep it there as records that would be potentially useful…