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.
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, 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
"
To resolve this issue
cp /etc/vmware/vpxa/vpxa.cfg /etc/vmware/vpxa/vpxa.bak
/etc/vmware/vpxa/vpxa.cfg
<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>
/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_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"
}
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 configuration file / configstore.
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.