Migrate option is grayed out on a powered-off virtual machine
search cancel

Migrate option is grayed out on a powered-off virtual machine

book

Article ID: 335225

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

Symptoms:
  • The migrate option is grayed out on a powered-off virtual machine in vSphere Client.

  • You cannot migrate a powered-off virtual machine.

  • In the vSphere Client, when you click the Migrate option in the Summary tab for a virtual machine, you see the error:

    Call "VirtualMachine.Relocate" for object "Virtual Machine-NAME" on vCenter Server "vCenter-Name" failed

  • The virtual machine does not show as orphaned in vCenter Server.



Environment

VMware vCenter Server 6.5.x
VMware vCenter Server 6.7.x
VMware vCenter Server 7.0.x

Cause

This issue can occur if the virtual machine is improperly registered on the vCenter Server Inventory.

This issue occurs due to invalid entries from the VPX_DISABLED_METHODS table. During certain operations, this table is updated to disable migrations of a virtual machine. Some situations can cause these entries to persist after the operation is complete.

Resolution

Caution: This procedure modifies the database. Ensure there is a current backup/snapshot of the vCenter prior to attempting these steps.  VMware vCenter in Enhanced Linked Mode pre-changes snapshot (online or offline) best practice
To solve this issue, use one of these options:
  • Manually remove entries from the vCenter Server Appliance database
  • Manually remove entries from vCenter MOB
  • Remove and re-add the virtual machine from the inventory
  • Remove and re-add the ESXi/ESX hosting the virtual machine from the inventory

Manually remove entries from the vCenter Server and vCenter Server Appliance database

  1. Connect to the vCenter Server Appliance using SSH. For more information, see Toggling the vCenter Server Appliance default shell
  2. Stop the vCenter Server service using this command:

    service-control --stop vmware-vpxd 
  1. To connect to the vCenter Server database:
/opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres
  1. While connected to the vCenter Server database, run:

    select * from VPX_VM WHERE FILE_NAME LIKE '%Virtual_Machine_Name%';

    For example:

    select * from VPX_VM WHERE FILE_NAME LIKE '%VM1%';

     
    • Virtual_Machine_Name is the name of the virtual machine. Leave the percentage (%) signs. 

  2. Make a note of the numerical ID value returned by the SQL statement in step 4, as this will be required in the SQL statement in steps 6 and 7.
  3. To confirm the stale entry, run this command against the vCenter Server database, using the vm-id output from Step 4.

    select * from VPX_DISABLED_METHODS WHERE ENTITY_MO_ID_VAL = 'vm-ID';

    For example:

    select * from VPX_DISABLED_METHODS WHERE ENTITY_MO_ID_VAL = 'vm-1234';
     
  4. To remove the stale entry, run this command against the vCenter Server database, using the vm-id output from Step 4.

    delete from VPX_DISABLED_METHODS WHERE ENTITY_MO_ID_VAL = 'vm-ID';

For example:
delete from VPX_DISABLED_METHODS WHERE ENTITY_MO_ID_VAL = 'vm-1234';
 
  1. Start the vCenter Server service, then retry the vMotion.

    service-control --start vmware-vpxd 

 

Remove and re-add the virtual machine from the inventory

Caution: Removing a virtual machine from inventory removes any performance statistics and historical data associated with the virtual machine. This process should only be used if the preceding procedures are unsuccessful or you do not want to retain any historical or performance data for a defined virtual machine.
  1. Power off the virtual machine.
  2. In vSphere Client, right-click the virtual machine and click Remove from Inventory.
  3. Browse to the datastore where the virtual machine resides.
  4. Right-click the .vmx file of the virtual machine and click Add to Inventory.

    Note: This gives the virtual machine a new ID.
     
  5. Power on the virtual machine and retry the vMotion operation.

Remove and re-add the ESX/ESXi from the inventory

Caution: Removing an ESX/ESXi host from inventory removes any performance statistics and historical data associated with the host. This process should only be used if the preceding procedures are unsuccessful or you do not want to retain any historical or performance data for the defined ESX/ESXi host.
  1. In the vSphere Client, right-click the ESXi/ESX host and click Disconnect.
  2. Right-click the disconnected ESXi/ESX host and click Remove from Inventory.
  3. After the host is removed from inventory, right-click the cluster and click Add Host.
  4. Provide the IP address or hostname of the ESXi/ESX host and the root username and password.

Additional Information


How to stop, start, or restart vCenter Server services
Toggling the vCenter Server Appliance default shell

Impact/Risks:

When removing a virtual machine from the vCenter Server Inventory, the previous performance statistics for the virtual machine are lost.