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.0.x
VMware vSphere ESXi 6.5
VMware vCenter Server 6.5.x
VMware vSphere ESXi 5.5
VMware vSphere ESXi 6.7
VMware vCenter Server 6.7.x
VMware vCenter Server 5.5.x
VMware vSphere ESXi 6.0
VMware vSphere ESXi 7.0.0
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 to take a full backup of your existing database before proceeding with any of these options. Involve a Database Administrator if you have any difficulty with these steps.
 
To solve this issue, use one of these options:

Manually remove entries from the vCenter Server SQL database

Caution: This procedure modifies the database. Ensure to take a full backup of your existing database before proceeding with this workaround. Involve a Database Administrator if you have any difficulty with these steps.
 
  1. Stop the vCenter Server services. For more information, see How to stop, start, or restart vCenter Server services (1003895)
  2. Take a backup of the vCenter Server database.
  3. Run this SQL query against the vCenter Server database:

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

    For example:

    select ID from VPX_VM WHERE FILE_NAME LIKE '%VM1%';
     
  4. Make a note of the vm-ID_Number value returned by the SQL query in step 3.
  5. To confirm the stale entry, run this SQL statement against the vCenter Server database:

    select * from VPX_DISABLED_METHODS WHERE ENTITY_MO_ID_VAL = 'vm-ID from step 4';
     
  6. To remove the stale entry, run this SQL statement against the vCenter Server database:

    delete from VPX_DISABLED_METHODS WHERE ENTITY_MO_ID_VAL = 'vm-ID from step 4';
     
  7. Start the vCenter Server services, then retry the vMotion.

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

Caution: This procedure modifies the database. Ensure to take a snapshot and/or full backup of your existing database before proceeding with this workaround. For guidance on backing up the vPostgres database for the vCenter Server Appliance, see Backing up and restoring the vCenter Server Appliance 5.x vPostgres database (2034505). Involve a Database Administrator if you have any difficulty with these steps.
To manually remove the entries from the vCenter Server Appliance vPostgres database for vCenter Server Appliance 5.0 Update 1, 5.1, 5.5, 6.0, and 6.5:
 
  1. Connect to the vCenter Server Appliance using SSH. For more information, see Toggling the vCenter Server Appliance 6.x default shell (2100508)
  2. Stop the VMware VirtualCenter Server service using this command:

    service vmware-vpxd stop
For vCenter 6.0 and above: 

service-control --stop vmware-vpxd
 
  1. Take a backup of the vCenter Server database. For more information, see Backing up and restoring the vCenter Server Appliance 5.x vPostgres database (2034505) or Back up and restore vCenter Server Appliance/vCenter Server 6.x vPostgres database (2091961)
  2. 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.
    • User is the postgres username. For vCenter 5.x, use vc. For vCenter 6.x, use postgres.
       
  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 VMware VirtualCenter Server service, then retry the vMotion. For more information, see How to stop, start, or restart vCenter Server Appliance 5.x services (2054085).

Windows installed vCenter Server with Postgres database

  1. Stop the vCenter Server services.
  2. Connect to the Postgres database. For more information, see Connecting to the embedded vPostgres Database in a Windows installed vCenter Server 6.0 (2108848).
  3. Run this command against the vCenter Server database.

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

    For example:

    select * from VPX_VM WHERE FILE_NAME LIKE '%VM1%';
     
  4. 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.
  5. To confirm the stale entry, run this command against the vCenter Server database:

    select * from VPX_DISABLED_METHODS WHERE ENTITY_MO_ID_VAL = 'vm-ID from step 4';
     
  6. To remove the stale entry, run this command against the vCenter Server database:

    delete from VPX_DISABLED_METHODS WHERE ENTITY_MO_ID_VAL = 'vm-ID from step 4';
     
  7. Start the VMware VirtualCenter Server service, then retry the vMotion. For more information, see How to stop, start, or restart vCenter Server Appliance 5.x services (2054085).

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.


Workaround:
 


Additional Information

VMware Skyline Health Diagnostics for vSphere - FAQ
How to stop, start, or restart vCenter Server services
Backing up and restoring the vCenter Server Appliance 5.x vPostgres database
How to stop, start, or restart vCenter Server Appliance 5.x services
Toggling the vCenter Server Appliance 6.x default shell
在关闭了电源的虚拟机中,迁移选项呈灰显状态 
パワーオフ状態の仮想マシンで移行オプションが灰色で表示される

Impact/Risks:

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