OpenNebula 4.12 Vcenter issue


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.

You cannot import twice the same VM. If you are starting over, just
delete the database.

To be more precise, just delete the VM ids lines in the “Import” tables that no longer exists in OpenNebula Sunstone



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…