Missing wild VMS following upgrade from v5.12.0.3 to v6.2.0.1

Hi,

I am in the process of upgrading opennebula from v5.12.0.3 to v6.2.0.1.

We would like to re-import some vcenter VMs to pick up datastore change.

The first problem we hit was that that VMs could not be deleted . We got the following error even when we ran cleartags in advance:

onevm recover --delete-db 255
[one.vm.recover] Action “delete” is not supported for imported VMs

I followed the instructions here and the VM was removed:

onedb update-body vm --id 255
Remove the tag IMPORTED
onevm recover --delete-db 255

However, any VMs which we delete in this manner do not appear in the host wild list hours later.

The VMs are quickly picked up in /var/log/one/vcenter_monitor.log. For example:

VM = [ ID="-1", VM_NAME=“VM919-XXXX”, DEPLOY_ID=“vm-44571”, VCENTER_TEMPLATE=“YES”,IMPORT_TEMPLATE=“xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”]

The associated IMPORT_TEMPLATE looks like:

NAME = “VM919-XXXX”
CPU = “4”
vCPU = “4”
MEMORY = “16384”
HYPERVISOR = “vcenter”
CONTEXT = [
NETWORK = “YES”,
SSH_PUBLIC_KEY = “$USER[SSH_PUBLIC_KEY]”
]
VCENTER_INSTANCE_ID =“a5a4e696-7233-41f8-a9a6-cfb12dd824c3”
VCENTER_CCR_REF =“domain-c7”
DEPLOY_ID =“vm-44571”
IMPORT_STATE =“POWEROFF”
VCENTER_DS_REF = “datastore-59485”
GRAPHICS = [
TYPE =“vnc”,
PORT =“6155”,
LISTEN =“0.0.0.0”
]
DESCRIPTION = "vCenter Template
imported by OpenNebula from Cluster "

Do you guys have any idea how we can re-import these VMs?

Thanks for your help,

Colm

After fiddling around for several hours, I eventually discovered a workaround here.

Looking at the VM delete workaround I used which came from here:

onedb update-body vm --id 255
Remove the tag IMPORTED
onevm recover --delete-db 255

Removal of the IMPORTED tag means that ‘–delete-db’ leaves behind a record in the the vm_import table which in turn prevents the VM from ever appearing as a wild.

To fix, I had to run the the following from the DB:

MariaDB [opennebula]> delete from vm_import where vmid = ‘255’;

Colm