Error: Unable to prepare migration. Network address 'FQDN of Source ESXi Host' is not valid for migration
search cancel

Error: Unable to prepare migration. Network address 'FQDN of Source ESXi Host' is not valid for migration

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/on VMs fail with: Unable to prepare migration. Network address 'FQDN of Source ESXi Host' is not valid for migration

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

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

yyyy-mm-ddThh:mm:ss.z info vpxd[xxxxxxxx] [Originator@xxxx sub=Default opID=xxxxxxxxxxxxxx] [VpxLRO] -- ERROR task-xxxx-- vm-xxx -- 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 = "FQDN of Source ESXi Host"
--> }
--> ],
--> message = "Network address 'FQDN of Source ESXi Host' 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, fqdn of the Host 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>       <=========== the entry here should be Management I.P address of the ESXi Host
<hostKey>####-####-####-####-####</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 "FQDN", vMotion will fails with the error :
"Unable to prepare migration. Network address 'FQDN of Source ESXi Host' is not valid for migration"

Resolution

To resolve this issue

On ESXi 7.0 Update 2 or earlier versions:

  1. Initiate a SSH session to the affected Host/Host's, if SSH service is disabled consider enabling it first using vCenter Server Web Client or Host Client(UI)
  2. Create a backup copy of the current vpxa configuration file:
    cp /etc/vmware/vpxa/vpxa.cfg /etc/vmware/vpxa/vpxa.bak
  3. Edit /etc/vmware/vpxa/vpxa.cfg
  4. Replace the "FQDN of Source ESXi Host" with correct ESXi Host's Management IP:

    <vpxa>
    <bundleVersion>1000000</bundleVersion>
    <datastorePrincipal>root</datastorePrincipal>
    <hostIp>ip-address</hostIp>            <== change this to the Management IP of the ESXi host if the host name/fqdn or any other value is present.
    <hostKey>####-####-####-####-####</hostKey>
     
  5. Save the file and check if the modifications made are saved successfully using command: cat /etc/vmware/vpxa/vpxa.cfg
  6. Restart the vCenter Server Agent using command:
    /etc/init.d/vpxa restart

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

  8. Repeat  the steps mentioned above for other Host's part of same cluster if they have the same issue wherein FQDN is mentioned for the Host instead of its Management I.P in vpxa config, run the command mentioned in step 5 to validate

On ESXi 7.0 Update 3 or later

  1. Initiate a SSH session to the affected Host/Host's, if SSH service is disabled consider enabling it first using vCenter Server Web Client or Host Client(UI)
  2. 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
  3. Create a backup copy of the exported file:
    cp tmp.json tmp.json.bak
  4. 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_network_ip_address",                    <== change this to the Management IP of the ESXi host if the host name/fqdn or any other value is present.
        "host_key": "####-####-####-####-####",
       "host_port": 443,
       "server_ip": "vcenter_server_ip",
       "server_port": 902,
       "valid_user": "vpxuser"
    }
  5. Re-import the changed configuration:
    configstorecli config current update -c esx -g services -k vpxa_solution_user_config -infile tmp.json
  6. Verify that the IP change was correctly applied:
    configstorecli config current get -c esx -g services -k vpxa_solution_user_config
  7. Restart vpxa:
    /etc/init.d/vpxa restart
  8. Repeat  the steps mentioned above for other Host's part of same cluster if they have the same issue wherein FQDN is mentioned for the Host instead of its Management I.P in vpxa config, run the command mentioned in step 6 to validate

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 configuration file / configstore.



Additional Information

Hostd.log for the Source Host will contain the following entries:

yyyy-mm-ddThh:mm:ss.z info hostd[xxxxxx] [Originator@6876 sub=Vcsvc.VMotionSrc.xxxxxxx opID=xxxxxxxx] ResolveCb: Failed with fault: (vim.fault.GenericVmConfigFault) {
-->    faultMessage = (vmodl.LocalizableMessage) [
-->       (vmodl.LocalizableMessage) {
-->          key = "msg.migrate.prepare.failed",
-->          message = "Unable to prepare migration.",
-->       },
-->       (vmodl.LocalizableMessage) {
-->          key = "msg.migrate.addr.convert",
-->          arg = (vmodl.KeyAnyValue) [
-->             (vmodl.KeyAnyValue) {
-->                key = "1",
-->                value = "FQDN of Source ESXi Host"
-->             }
-->          ],
-->          message = "Network address 'FQDN of the Source Host' is not valid for migration."
-->       }
-->    ],
-->    reason = "Unable to prepare migration.",
-->    msg = "Unable to prepare migration.
--> Network address 'FQDN of the Source Host' is not valid for migration.
--> "
--> }
Note: The preceding log excerpts are only examples. Date, time, and environmental variables may vary depending on your environment.