We upgraded our cluster from 5.10 to 5.12. We mistakenly had a few hosts that were downgraded back to 5.10.
Even after re-upgrading those KVM hosts to 5.12, the VMs on those host are stuck in UNKOWN state.
How do we recover these VMs?
Answer
We recovered 90% of the vms by running the followiong on the opennebula node
sudo -u oneadmin onehost sync --force
To recover the vms on a specific host, add the host ID
vms=$(onevm list --csv | grep unkn | tail -n 1) #Picks a single VM stuck in UNKNOWN state
vm_id=$(echo $vms | awk '{split($0,a,","); print a[1]}' )
vm_name=$(echo $vms | awk '{split($0,a,","); print a[4]}' )
kvm_name=$(echo $vms | awk '{split($0,a,","); print a[8]}' )
echo $vm_id
echo $vm_name
echo $kvm_name
sudo -u oneadmin onehost sync $kvm_name --force
For the remaining vms we did the following
- Ensure the host is enabled
onehost enable $kvm_id # you can get the id with 'onehost list'
onehost show $kvm_id | grep 'STATE\|LAST' # Wait until this transisions from INIT to MONITORED
- Restart libvirt-bin on the kvm host
sudo service libvirt-bin restart
- Re-run the sync on the nebula host
sudo -u oneadmin onehost sync --force