VMware Cloud Community
Stefan_89
Contributor
Contributor

vCenter API to vMotion a VM from cluster B to Cluster A

I have some troubles to vMotion a VM from cluster B to A.

Cluster A: VCF - stretched domain - vSAN Storage - NSX-T
Cluster B: VCF - Non-stretched domain - vSAN Storage - NSX-T

In the Developer Center we use the VM > /api/vcenter/vm/{vm}?action=relocate

We send the following command:

{
"disks": { },
"placement": {
"cluster": "domain-c8",
"datastore": "datastore-18",
"host": "host-20",
"resource_pool": "resgroup-9"
}
}


But this is not working, the following error is there at 66 percent of the vMotion task.

 

{
"error_type": "INVALID_ARGUMENT",
"messages": [
{
"args": [
"195887107",
"Not found"
],
"default_message": "Failed waiting for data. Error 195887107. Not found. ",
"id": "msg.migrate.waitdata.platform"
},
{
"args": [
"168751377",
"5105457045833758211",
"XX.XX.XXX.XXX",
"Destination"
],
"default_message": "vMotion migration [168751377:5105457045833758211] failed to get DVS state in the restore phase from the source host <XX.XX.XXX.XXX>",
"id": "vob.vmotion.dvs.state.restore.failed"
},
{
"args": [],
"default_message": "2023-01-09T16:25:23.676223Z",
"id": "faultTime"
},
{
"args": [
"10.14.241.9",
"msg.vmk.status.VMK_MIG_CONN_CLOSED",
"195887167"
],
"default_message": "Migration to host <XX.XX.XXX.XXX> failed with error Connection closed by remote host, possibly due to timeout (195887167). ",
"id": "msg.checkpoint.precopyfailure"
},
{
"args": [
"168751377",
"5105457045833758211",
"Connection closed by remote host, possibly due to timeout",
"Source"
],
"default_message": "VMotionStream [168751377:5105457045833758211] failed to read stream keepalive: Connection closed by remote host, possibly due to timeout",
"id": "vob.vmotion.stream.keepalive.read.fail"
},
{
"args": [],
"default_message": "2023-01-09T16:25:23.523871Z",
"id": "faultTime"
}
]
}

 

vMotion trough the GUI is working fine.

Reply
0 Kudos
2 Replies
lamw
Community Manager
Community Manager

Cross vCenter vMotion between two different vCenter SSO Domain is NOT supported currently with the vCenter REST API. I only know this because to do so, you also need to have AuthN into destination vCenter Server and the current REST API doesn't support that which is needed.

You'll need to use the vSphere API if you wish to automate this as the REST API only supports migration within the same SSO Domain. For details on using the vSphere API, you can refer to https://williamlam.com/2017/10/when-to-use-move-vm-cmdlet-vs-xmove-ps1-script-for-performing-cross-v... 

Reply
0 Kudos
Stefan_89
Contributor
Contributor

Cluster A and B in the same vCenter (workload domain in term of VCF).
The clusters shares the NSX-T environment.

Reply
0 Kudos