VM stuck in "Migrating to"

Latest response

Can't start,stop, cancel migration or migrate the VM.
It's stuck in "Migrating to" in the RHEV GUI.

Think I hit this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=922490

Anyone else had this?
How do I recover the affected VMs?

Responses

Does "service ovirt-engine restart" help to recover the status?

No. Already tried that. It helped for some of the VMs, but still have two that are stuck.

The two vms which are stuck, are they running on any of the hypervisors? You can log into each hypervisor and run "vdsClient -s 0 list table" to verify this.

No, they're not.

I recommend you open a case. The db need to be changed to manually to change the vm status to Down. You can also explore /usr/share/ovirt-engine/dbscripts/unlock_entity.sh script.

Yeah already have a support case. Will look into the script.
Thank you.

I think by running the following two commands on the rhevm server you will be able to bring the VM into "down"  state and then need to migrate the VM manually to the required host.

# psql -U engine -c "update vm_dynamic SET status=0 where vm_guid='xxxxxxxx';"

# psql -U engine -c "UPDATE vm_dynamic SET run_on_vds = null  WHERE vm_guid='xxxxxxxx';"

If the VM itself is in "Migrating to" state then I think "/usr/share/ovirt-engine/dbscripts/unlock_entity.sh" script will not help. I guess it will help only for the disk/snapshot/template .

To get the "vm_guid" and "status" of the VM you need to use the following commands on the rhevm system.

 

   # psql -U engine -c "select vm_guid status from vm_static where vm_name='XXXX';"

   # psql -U engine -c "select status from vm_dynamic where vm_guid='xxxx';"

Hi!

Thank you for your posting. I have the problem that a vm is in a pause status after a failed migration and nothing helps to change this over the gui. So I tried to change it with your postgres commands. And I can change the status while the engine-service ist stopped. But if I start the service again, vm_dynamic changes back on 4 (paused). So the db is not the only truth. Do you know where to search the place to find the status outside the db?

Hi Christopher!

This discussion is a few years old, so you may get better results if you post a new topic for your issue.

Thanks a lot. Two years passed but still it helped me survive and bring back a very important VM.

Hello, everyone! I was faced with the same situation. I tried to remove a VM with "Migrating to" status, but it was unsuccessful. VMs didn't turn off, didn't reboot and nothing could be done with them in general. I looked at the answer of Udayendu Kar above, but I had no possibility to set "psql" for use (no command found). Because of these VMs I couldn't put the datacenter into service mode. I searched for the answer for a long time and it was incredibly simple) If it helps someone, I will be very happy :) 1) Sign in to your hosted-engine VM console. 2) Now we will know the vm_guid of the required machine for that: # engine-db-query --statement "select vm_guid status from vm_static where vm_name='xxxx';". - where XXX name of your VM 3) Forcibly turn off the VM: #engine-db-query --statement "update vm_dynamic SET status=0 where vm_guid='XXXX';". - where XXX - vm_guid from the previous query. Good luck with the setup and never stop)).

Thanks, Work for me! ;)

Hi Patrick.

thanks, this works for me

In my situation there was a VM with 'Image Locked' status and It wasn't possible to unlock with unlock_entity.sh. This method worked also for my situation.

By the way it is possible to reach psql as above on engine(RHV-M) server ; 1- Switch postgres user as below;

su - postgres

2- Check software collection list with command below ;

scl -l

3- Enable your scl with command below ( It's an example. The version can change according to you RHV/oVirt version.

$ scl enable rh-postgresqlXX bash

4- Now you can reach engine database just with ;

$ psql -d engine

After that keep going with sql queries as Patrick suggested.

In my situation there was a VM with 'Image Locked' status and It wasn't possible to unlock with unlock_entity.sh. This method worked also for my situation.

By the way it is possible to reach psql as above on engine(RHV-M) server ; 1- Switch postgres user as below;

su - postgres

2- Check software collection list with command below ;

scl -l

3- Enable your scl with command below ( It's an example. The version can change according to you RHV/oVirt version.

$ scl enable rh-postgresqlXX bash

4- Now you can reach engine database just with ;

$ psql -d engine

After that keep going with sql queries as Patrick suggested.