Error: Unable to prepare migration. Network address 'hostname' is not valid for migration while migrating a powered-off virtual Machine
search cancel

Error: Unable to prepare migration. Network address 'hostname' is not valid for migration while migrating a powered-off virtual Machine

book

Article ID: 312034

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

vMotion is greyed out for a powered off virtual machine
vMotion of powered off VMs fail with: Unable to prepare migration. Network address 'hostname' is not valid for migration

The vCenter Server service log (vpxd.log) contains the following error:

/var/log/vmware/vpxd/vpxd.log

2017-08-18T23:24:47.430Z info vpxd[7F0A3F44F700] [Originator@6876 sub=Default opID=MigrationWizard-applyOnMultiEntity-1138106-ngc-1b] [VpxLRO] -- ERROR task-14507 -- vm-715 -- vim.VirtualMachine.relocate: vim.fault.GenericVmConfigFault:
--> Result:
--> (vim.fault.GenericVmConfigFault) {
--> faultCause = (vmodl.MethodFault) null, faultMessage =
--> (vmodl.LocalizableMessage) [
--> (vmodl.LocalizableMessage) {
--> key = "msg.migrate.prepare.failed",
--> arg = <unset>,
--> message = "Unable to prepare migration."
--> },
--> (vmodl.LocalizableMessage) {
--> key = "msg.migrate.addr.convert",
--> arg = (vmodl.KeyAnyValue) [
--> (vmodl.KeyAnyValue) {
--> key = "1",
--> value = "hostnamel"
--> }
--> ],
--> message = "Network address 'hostname' is not valid for migration."
--> }
--> ],
--> reason = "Unable to prepare migration."
--> msg = "Unable to prepare migration."

Note: The preceding log excerpts are only examples. Date, time, and environmental variables may vary depending on your environment.

Environment

VMware vSphere ESXi 6.5
VMware vSphere ESXi 6.7
VMware vSphere ESXi 7.0
VMware vSphere ESXi 8.0
VMware vCenter Server 6.5
VMware vCenter Server 6.7
VMware vCenter Server 7.0
VMware vCenter Server 8.0

Cause

This issue occurs when the configuration of the vCenter Server Agent (vpxa) contains the wrong IP address or none at all.

In ESXi 7.0 Update 2 and earlier, the vCenter Server IP is stored in /etc/vmware/vpxa/vpxa.cfg as host_ip, as in the example below:

<vpxa>
<bundleVersion>1000000</bundleVersion>
<datastorePrincipal>root</datastorePrincipal>
<hostIp>ip-address</hostIp>
<hostKey>######-5e12-2f32-3b86-######</hostKey>

From ESXi 7.0 Update 3 on, these setting are no longer stored as a configuration file, but have been moved into the ESXi configuration store, and can be read with:

/bin/configstorecli config current get -c esx -g services -k vpxa_solution_user_config -outfile tmp.json


The host_ip field should match the current management IP address. If it has a different IP address or any other string such as "hostname", vMotion will fails with the error :
"Unable to prepare migration. Network address 'hostname' is not valid for migration"

Resolution

To resolve this issue

On ESXi 7.0 Update 2 or earlier versions:

  1. Create a backup copy of the current vpxa configuration file:
    cp /etc/vmware/vpxa/vpxa.cfg /etc/vmware/vpxa/vpxa.bak
  2. Edit /etc/vmware/vpxa/vpxa.cfg
  3. Replace the "hostname" with correct ESXi management IP:

    <vpxa>
    <bundleVersion>1000000</bundleVersion>
    <datastorePrincipal>root</datastorePrincipal>
    <hostIp>ip-address</hostIp>
    <hostKey>######-5e12-2f32-3b86-#####</hostKey>
     
  4. Save the file and restart the vCenter Server Agent:
    /etc/init.d/vpxa restart

  5. Recheck the vpxa.cfg to confirm the IP persists. If the IP reverts to hostname, check the /etc/hosts file to ensure proper entry.

On ESXi 7.0 Update 3 or later

  1. Export the current settings from the ESXi config store:  
    /bin/configstorecli config current get -c esx -g services -k vpxa_solution_user_config -outfile tmp.json
  2. Create a backup copy of the exported file:
    cp tmp.json tmp.json.bak
  3. Edit the exported file, find the host_ip option and change its value to contain the correct management IP:
    {
       "dvs": {
          "dvs_sync_rate": 86400,
          "port_sync_batch_limit": 100,
          "portgroup_sync_batch_limit": 500
       },
       "host_ip": "esxi_management_ip",                    <== change this to the Management IP of the host if the host name is present.
        "host_key": "5221bda6-c907-d938-3259-22d6ea7e93fa",
       "host_port": 443,
       "server_ip": "vcenter_server_ip",
       "server_port": 902,
       "valid_user": "vpxuser"
    }
  4. Re-import the changed configuration:
    configstorecli config current update -c esx -g services -k vpxa_solution_user_config -infile tmp.json
  5. Verify that the IP change was correctly applied:
    configstorecli config current get -c esx -g services -k vpxa_solution_user_config
  6. Restart vpxa:
    /etc/init.d/vpxa restart

Note: If above methods does not work, try disconnect/connect with vSphere client.
          1. right-click the ESXi host and click Disconnect.
          2. right-click the ESXi host and click Reconnect.

Note: If you have multiple hosts in the same cluster, ensure that the other hosts also have the management IP correctly set in the config file.