VMware Cloud Community
BillW
Contributor
Contributor

VAAI Fast Clone from PowerCLI

I'm attempting to clone a VM using NAS VAAI fast clone API.  I can create a fast clone of a vmdk using vmkfstools -I so I know VAAI is working but my attempts using PowerCLI always call VAAI Full Clone. Is there a away to request Fast Clones?
Thanks for any pointers,
Bill
Here is the code I tried:
param( [Parameter(Mandatory=$True)][String]$vcenter,[String] $base_clone = "Fedora")
#Add-PSSnapin VMware.VimAutomation.Core
Connect-VIServer $vcenter -Username root -Password dangerous
$source_vm = Get-VM | where {$_.name -like $base_clone } | Get-View
$clone_folder = $source_vm.parent
$clone_spec = new-object Vmware.Vim.VirtualMachineCloneSpec
$clone_spec.Location = new-object Vmware.Vim.VirtualMachineRelocateSpec
$clone_spec.Location.Transform = [Vmware.Vim.VirtualMachineRelocateTransformation]::flat
$clone_spec.Location.DiskMoveType = [Vmware.Vim.VirtualMachineRelocateDiskMoveOptions]::moveAllDiskBackingsAndAllowSharing
Write-Host "Creating clone from VM: $base_clone"
# Clone VM.
$clone_name = "${base_clone}_clone"
$source_vm.CloneVM_Task($clone_folder, $clone_name, $clone_spec ) | Out-Null
Tags (3)
Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

Afaik, the Fast Linked Clone is only available through a private API, which is used in vmkfstools, View and vCD.

But I would gladly be corrected on this, since I want to use this as well :smileygrin:


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

Reply
0 Kudos