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.
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
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
"
To resolve this issue
cp /etc/vmware/vpxa/vpxa.cfg /etc/vmware/vpxa/vpxa.bak
/etc/vmware/vpxa/vpxa.cfg
hostname
" with correct ESXi management IP:<vpxa>
<bundleVersion>1000000</bundleVersion>
<datastorePrincipal>root</datastorePrincipal>
<hostIp>ip-address</hostIp>
<hostKey>######-5e12-2f32-3b86-#####</hostKey>
/etc/init.d/vpxa restart
/bin/configstorecli config current get -c esx -g services -k vpxa_solution_user_config -outfile tmp.json
cp tmp.json tmp.json.bak
{
"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"
}
configstorecli config current update -c esx -g services -k vpxa_solution_user_config -infile tmp.json
configstorecli config current get -c esx -g services -k vpxa_solution_user_config
/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.