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

Symptoms:
  • vMotion is greyed out for a powered off virtual machine, or
  • Attempts to vmotion 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:
    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."
    --> }
    --> Args:
    -->
    --> Arg spec:
    --> (vim.vm.RelocateSpec) {
    --> service = (vim.ServiceLocator) null, folder = <unset>, datastore =
    --> <unset>, diskMoveType = <unset>
     

    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 vCenter Server 7.0.x
VMware vSphere ESXi 6.7
VMware vSphere ESXi 7.0.x
VMware vCenter Server Appliance 6.5.x
VMware vCenter Server 6.5.x
VMware vCenter Server 6.7.x
VMware Update Manager 6.5

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>192.168.1.50</hostIp>
<hostKey>52c3a796-5e12-2f32-3b86-4b8545272176</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 adress or any other string such as "hostname", vMotion will fails with the error above.

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>192.168.10.153</hostIp>
    <hostKey>52c3a796-5e12-2f32-3b86-4b8545272176</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
  1. create a backup copy of the exported file:
    # cp tmp.json tmp.json.bak
  1. 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
       "host_key": "5221bda6-c907-d938-3259-22d6ea7e93fa",
       "host_port": 443,
       "server_ip": "vcenter_server_ip",
       "server_port": 902,
       "valid_user": "vpxuser"
    }
  1. re-import the changed configuration:
    # configstorecli config current update -c esx -g services -k vpxa_solution_user_config -infile tmp.json
  1. verify that the IP change was correctly applied:
    # configstorecli config current get -c esx -g services -k vpxa_solution_user_config
  1. 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.