Hi,
we are trying to migrate from VMFS5 datastore to VMFS6. As usually, I have tried simple script doing Move-VM. But it fails on vm with snapshots with error:
Move-VM | The operation for the entity "xxx" failed with the following message: "The specified delta disk format 'redoLogFormat' is not supported."` |
I have found this error also here PowerCLI Core - Bugs
Bugs bugs and bugs?
Looks like you might have an older PowerShell version.
What does $PSVErsionTable show?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Which PowerCLI version are you using?
The bug you point to was for the PowerCLI Core alfa.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm running 6.5 release 1 build 4624819, since version 10 have no installer. Running that Install-Module seems not working for me.
PS > Install-Module -Name VMware.PowerCLI -Scope CurrentUser Install-Module : The term 'Install-Module' is not recognized as the name of a cmdlet, function, script file, or operabe program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Install-Module -Name VMware.PowerCLI -Scope CurrentUser + ~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Instead of powercli, I have written my migrate script in python (pyvmomi) and it works!
Looks like you might have an older PowerShell version.
What does $PSVErsionTable show?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hey LucD,
I think this is still an issue. I've been working with VMware support and tried a few different PowerCLI versions between 10-11 and nothing has worked so far. I believe it is being escalated through the SDK team. My $PSVersionTable is below. They think it has something to do with "vim.vm.RelocateSpec.DiskLocator" having the "deltaDiskFormat" set to "<unset>". Workaround may be creating a custom spec that sets the deltaDiskFormat to "redoLogFormat"?
PS C:\Windows\system32> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.14393.2608
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.2608
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
the relocatespec from a recent failed move-vm:
(vim.vm.RelocateSpec.DiskLocator) {
--> diskId = 2001,
--> datastore = 'stuff',
--> diskMoveType = "moveAllDiskBackingsAndDisallowSharing",
--> diskBackingInfo = (vim.vm.device.VirtualDisk.FlatVer2BackingInfo) {
--> fileName = "stuff",
--> datastore = 'stuff',
--> backingObjectId = "",
--> diskMode = "persistent",
--> split = false,
--> writeThrough = false,
--> thinProvisioned = true,
--> eagerlyScrub = <unset>,
--> uuid = "stuff",
--> contentId = "stuff",
--> changeId = <unset>,
--> parent = (vim.vm.device.VirtualDisk.FlatVer2BackingInfo) null,
--> deltaDiskFormat = <unset>, <<---------------------------------------------HERE IS THE ISSUE?--------------------------------------
--> digestEnabled = false,
--> deltaGrainSize = <unset>,
--> deltaDiskFormatVariant = <unset>,
--> sharing = "sharingNone",
--> keyId = (vim.encryption.CryptoKeyId) null
--> },
--> profile = <unset>
--> }
Is that VMDK sitting on an NFS datastore?
And are you trying to do a vMotion or a svMotion? Or both?
What type (NFS, iSCSI...) and version (VMFS5/VMFS6) is the target datastore?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you already try using the RelocateVM method instead of the cmdlet?
The HTML5 fling with Code Capture might come in handy.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
We are all FC / VMFS shop. Doing full storage migration, evacuating old arrays, filling new arrays. Strictly storage vmotion.
Source datastores are VMFS5. Destination datastores are VMFS6.
My Move-VM scripts worked perfectly for about 3500 VMs which didn't have snapshots. The remaining 500 or so which have snapshots all fail with this same error. Don't ask why we have so many snapshots. It's a sore subject :/.
Manual vMotion works just fine.
That seems to indicate that the API method would work as well.
And that you are probably encountering a PowerCLI "issue".
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Replying to your 2nd query,
I have not tried the RelocateVM method yet as i'm less familiar with API vs cmdlet. Below is a sample of the script i'm using. Could this be easily converted?
________________________________________
connect-viserver vcenter
# Maximum simultaneous tasks
$maxtasks = 16
$VMsToRelocate = get-folder -type vm -name "foldername" | Get-VM
$Datastore = Get-DatastoreCluster -Name "clustername"
$CP= get-cluster -name "cluster"
$SQL = get-cluster -name "cluster"
$i = 0
foreach ($VM in $VMsToRelocate)
{
if ((get-vm $VM | get-datastorecluster) -ne $datastore -and (get-vm $VM | get-cluster) -ne $CP -and (get-vm $VM | get-cluster) -ne $SQL){
$i=$i+1
$tasks = Get-Task -Status "Running" | where {$_.Name -eq "ApplyStorageDrsRecommendation_Task"}
while($tasks.Count -gt ($maxtasks-1)) {
sleep 5
$tasks = Get-Task -Status "Running" | where {$_.Name -eq "ApplyStorageDrsRecommendation_Task"}
}
Write-Host $i ". Relocating VM:" $VM.Name "to" $Datastore
Get-VM -Name $VM.Name | ? {$_.ExtensionData.Runtime.ToolsInstallerMounted -eq $true } | Dismount-Tools
Get-VM -Name $VM.Name | Move-VM -datastore $Datastore > $null -runasync
}
}
Write-Host $i " Migrations Completed!"
Let's try a simple approach and let SDRS do it's work.
Test with 1 of the problematic VMs.
$vmName = 'MyVM'
$dscName = 'TargetDSC'
$vm = Get-VM -Name $vmName
$dsc = Get-DatastoreCluster -Name $dscName
$storMgr = Get-View StorageResourceManager
$spec = New-Object VMware.Vim.StoragePlacementSpec
$spec.RelocateSpec = New-Object VMware.Vim.VirtualMachineRelocateSpec
$spec.Vm = $vm.ExtensionData.MoRef
$spec.PodSelectionSpec = New-Object VMware.Vim.StorageDrsPodSelectionSpec
$spec.PodSelectionSpec.StoragePod = $dsc.ExtensionData.MoRef
$spec.Type = [VMware.Vim.StoragePlacementSpecPlacementType]::relocate
$recommendations = $storMgr.RecommendDatastores($spec)
$recommendations.Recommendations | ForEach-Object -Process {
$storMgr.ApplyStorageDrsRecommendation($_.Key)
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
So, it looks like this is working. I was able to incorporate this into my script. One question, how do I get it to run async?
Use the same method with the _Task suffix.
$storMgr.ApplyStorageDrsRecommendation_Task($_.Key)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hmm, it looks like it's still waiting on the task to complete. Also it looks like it's trying to execute multiple tasks for the same migration. Sample output:
_____________________
12 . Relocating VM: VMNAME to DRS CLUSTER
Type : Task
Value : task-12432461
Type : Task
Value : task-12432462
Type : Task
Value : task-12432463
Type : Task
Value : task-12432464
Type : Task
Value : task-12432465
Type : Task
Value : task-12432466
Type : Task
Value : task-12432467
________
Is that a VM with multiple VMDK?
Is SDRS set to Automatic?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I've run tests with single and multiple vmdk VMs with the same result. SDRS cluster is set to manual mode but it still makes migration recommendations.
Are the svMotions for thar VM not waiting to be approved under SDRS?
Since it is set to manual, you will have to approve
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
They are not waiting for approval. Cluster automation is set to manual but that only affects automatic migrations. If we are triggering sDRS vmotion it will still make datastore recommendation. I have not had to approve any of the migrations that have started via this script.
Can you have a look at Tasks and Events on the vCenter, and check what tasks and events are triggered by the script?
There might be a reason indicated there why the svMotion doesn't progress.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference