NSX-T Data Center REST API
Retreives the VM Group Execution Details
The result includes a "logical_switch_id_to_vm_instance_id_and_vnics_map" list and an optional"failedVmInstanceIds" list which includes the uuids of VMs that are not found in the source VC.
Construct a map of vmInstanceUuid to (vnic, ls_id) from the "logical_switch_id_to_vm_instance_id_and_vnics_map",
then use the map to populate the relocate spec of each VM and migrate the VM as below:
The VM object can be found in source VC by the vmInstanceUuid using VC API
serviceinstance.content.searchIndex.FindByUuid(uuid=vmInstanceUuid, vmSearch=True, instanceUuid=True)
For each VM vNIC, if the device key "vnic" is not found in the map of vmInstanceUuid to (vnic, ls_id),
then skip the vNIC. Otherwise form a VIF-id for the vNIC by vmInstanceUuid + ':' + str(vnic), e.g.
"52630e5d-ce6f-fac0-424c-4aa4bdf6bd56:4001", and use it to setup the vNIC's network backing.
For VDS6.x migration, opaque-network backing in NVDS will be used; setup the vNIC device as below:
- vdevice.backing = vim.vm.device.VirtualEthernetCard.OpaqueNetworkBackingInfo()
- vdevice.backing.opaqueNetworkId = ls_id
- vdevice.backing.opaqueNetworkType = 'nsx.LogicalSwitch'
- vdevice.externalId = VIF-id
For VDS 7.0 and later versions, "nsx" LogicalSwitch backing in VDS will be used. Go through
all VDS DVPGs in the target VC to find each DVPG whose config.backingType is "nsx" and
config.logicalSwitchUuid is not blank, build a map of dvpg.config.logicalSwitchUuid to
[dvpg.key, dvpg.config.distributedVirtualSwitch.uuid] once. For each vNIC device, get the
dvpg value from the map by the ls_id and then set it up as below:
- vdsPgConn = vim.dvs.PortConnection()
- vdsPgConn.portgroupKey = dvpg.key
- vdsPgConn.switchUuid = dvpg.config.distributedVirtualSwitch.uuid
- vdevice.backing = vim.vm.device.VirtualEthernetCard.DistributedVirtualPortBackingInfo()
- vdevice.backing.port = vdsPgConn
- vdevice.externalId = VIF-id
Request:
Method:
GET
URI Path(s):
/api/v1/migration/vmgroup/actions/get_vm_group_execution_details
Request Headers:
n/a
Query Parameters:
VmGroupExecutionDetailsSpec+
Request Body:
n/a
Successful Response:
Response Code:
200 OK
Response Headers:
Content-type: application/json
Response Body:
VmGroupExecutionDetails+