Original Message:
Sent: Jul 04, 2024 09:28 AM
From: Dany Demers
Subject: PowerCli - Cross vcenter vmotion multiple disk on multiples datastores
Hi, well i made a lot of test and added more diagnostic logging to the script and both the source and destination datastore exist and are I can confirm using this line as when I run the script in debug mode I see the $destds variable containing the datastore:
$destDS = Get-Datastore -Name $destDSName -Server $destVC
Also the relocationspec variable contain both the datastore. Do you have a command example on how to migrate a vm with multiple disk in multiple datastore and I can work with that as I couldn't find anything in the help or in my search on how to pass multiple datastore mapping to a move-vm command hence why I resorted to use chatGPT.
Original Message:
Sent: Jul 04, 2024 03:40 AM
From: LucD
Subject: PowerCli - Cross vcenter vmotion multiple disk on multiples datastores
Although I have an aversion to fixing ChatGpt code, the error message indicates that one of the datastores, probablya target, isn't a valid datastore.
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Original Message:
Sent: Jul 03, 2024 04:36 PM
From: Dany Demers
Subject: PowerCli - Cross vcenter vmotion multiple disk on multiples datastores
Hi, I'm trying to migrate VM across vcenter using the move-VM cmdlet and it's working fine but then I came across VM that have multiple disk on multiple datastore and then my plane crashed. I'm using this script that I built with the help of ChatGPt but after many tries we couldn't adjust the script to work with multiple disk on multiple datastore
I'm attaching the working script for standard VM with only 1 datastore and the bad script for cross-vcenter with multiple datastore. The error output by the second script is this:
"VMName","ErrorMessage"
"SQL-04","Exception lors de l'appel de « RelocateVM_Task » avec « 2 » argument(s) : « The object 'vim.Datastore:datastore-261' has already been deleted or has not been completely created »"
I know I could move this VM manually by mapping the appropriate disk but I have other VMs that have 40+ datastore and that is what i'm trying to avoid to manually map by testing on this simple vm with 2 disks.
Here are some more detail from the debug I thought should help, the destination host is found and has access to the datastore, both disk and corresponding datastore are also in the relocationSpec variable.
[DBG]: PS F:\>> $relocationSpec
Service :
Folder :
Datastore :
DiskMoveType :
Pool :
Host : HostSystem-host-1326
Disk : {2000, 2001}
Transform :
DeviceChange :
Profile :
CryptoSpec :
LinkedView :
Using destination host: esx8-10, MoRef: HostSystem-host-1326
[DBG]: PS F:\>>
Migrating VM 'SQL-04' with specified disk mappings
[DBG]: PS F:\>>
[DBG]: PS F:\>>
Failed to migrate VM 'SQL-04'. Error: Exception lors de l'appel de « RelocateVM_Task » avec « 2 » argument(s) : « The object 'vim.Datastore:datastore-261' has already been deleted or has not been completely created »
[DBG]: PS F:\>>
[DBG]: PS F:\>>
Error details: Exception lors de l'appel de « RelocateVM_Task » avec « 2 » argument(s) : « The object 'vim.Datastore:datastore-261' has already been deleted or has not been completely created »