MSpriya
Contributor
Contributor

Folder relocation with RelocateVM() not working in vCenter/ESXi 6.5 setup

Hi @LucD ,

I am trying to relocate a VM to a folder using the RelocateVM() api as below:

$folder = Get-Folder -Id $FolderId
$spec = New-Object VMware.Vim.VirtualMachineRelocateSpec
$spec.Folder = $folder.ExtensionData.MoRef
$vmRef.ExtensionData.RelocateVM($spec, [VMware.Vim.VirtualMachineMovePriority]::defaultPriority)

It works fine in vCenter/ESXi 6.7 and 7.0 versions. However, the relocate to folder does not work in 6.5 vCenter/ESXi version.
However, Move-VM command works in 6.5 setup.

Have you observed or aware of this issue in relocate API in 6.5 version? Will it depend upon vCenter or ESXi version?
Is relocate a vCenter or ESXi operation?

Any help regarding this issue will be very helpful.

Thanks,
Priya

0 Kudos
4 Replies
LucD
Leadership
Leadership

The Folder property was introduced in API 6.0, so it should be available since vSphere 6.0 went GA

.relocate-folder.png

The RelocateVM method is a method on a VirtualMachine object, so it should work while connected to a vCenter or an ESXi node.

Did you check the vpxd log for additioal clues when it seems to fail?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
MSpriya
Contributor
Contributor

Thank you very much for the reply @LucD .

I checked the vpxd log. There are no errors in it. Please find below vpxd logs at the time of folder relocation: 
--------------------------------------------------------------------------------------------------------------------------------------------------------------

2021-06-14T14:41:46.527+05:30 info vpxd[00516] [Originator@6876 sub=vpxLro opID=2eab266b] [VpxLRO] -- BEGIN task-388325 -- vm-16444 -- vim.VirtualMachine.relocate -- 521b2f82-f637-ae0f-7d11-43a4dc7f7eb1(5241287d-0b11-e841-a328-37d8d4599444)
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=vpxLro opID=2eab266b-01] [VpxLRO] -- BEGIN lro-15940844 -- -- VmprovWorkflow --
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Execute local action vpx.vmprov.InvokePrechecks (5%)
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on AutoStartManager
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on CbkServiceMgrMigrateCallback
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on ContextValidator
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on CryptoManager
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on DAS
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on DVS
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on EventEmitter
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on FT
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on InvtId
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on Iofilter
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on MetadataHandler
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on PbmCallBack
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=pbm opID=2eab266b-01] PBMCallback: PbmSkipCallBack::ShouldSkipMigrateCallback: migrate callback is skipped - Same-VC migration with home and all disks and profiles the same
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on PermissionsHandler
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on PmemValidator
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on SDRS
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on VApp
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on DRM
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on ResourceReservation
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on OCM
2021-06-14T14:41:46.531+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Invoking callback type 0 on StorageListeners
2021-06-14T14:41:46.532+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Execute local action vpx.vmprov.SelectDestination (1%)
2021-06-14T14:41:46.532+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] LocalVC Migrate of 0_CentOS_6_0_auto_01_Nov05 on vim.HostSystem:host-15337(<host-ip>) with ds ds:///vmfs/volumes/634a25b3-573e2188/ to vim.HostSystem:host-15337(<host-ip>) with ds ds:///vmfs/volumes/634a25b3-573e2188/ started
2021-06-14T14:41:46.532+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Execute local action vpx.vmprov.CheckCompatibility (1%)
2021-06-14T14:41:46.534+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Execute local action vpx.vmprov.ReserveDirectory (5%)
2021-06-14T14:41:46.547+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Execute local action vpx.vmprov.ComputeSpecs (1%)
2021-06-14T14:41:46.547+05:30 info vpxd[00516] [Originator@6876 sub=VmProv opID=2eab266b-01] Early terminate the workflow after executing action vpx.vmprov.ComputeSpecs
2021-06-14T14:41:46.555+05:30 info vpxd[00516] [Originator@6876 sub=vpxLro opID=2eab266b-01] [VpxLRO] -- FINISH lro-15940844
2021-06-14T14:41:46.556+05:30 info vpxd[00516] [Originator@6876 sub=vpxLro opID=2eab266b] [VpxLRO] -- FINISH task-388325


0 Kudos
LucD
Leadership
Leadership

Then I suggest you open an SR


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
MSpriya
Contributor
Contributor

Okay, thank you @LucD 

0 Kudos