At VMware we are pleased to announce the publishing of a new fling: PowerCLI Extensions! PowerCLI Extensions gives PowerCLI users access to early access functionality by extending the core PowerCLI cmdlets to include new experimental features and gives PowerCLI customers the ability to provide early feedback. So what is included in this fling? Read on…
Instant Clone
‘Instant Clone’ also known as VM Fork or Project Fargo, gives admins the ability to rapidly clone and deploy virtual machines, as much as 10x faster than what is currently possible today. Instant Clone uses rapid in-memory cloning of running virtual machines and copy-on-write to quickly deploy clones of a parent virtual machine.
Because Instant Clone uses a private API, PowerCLI is currently the only way Instant Clone can be accessed and leveraged.
What is actually happening?
The Instant Clone capability allows admins to ‘fork’ a running virtual machine, meaning, it is not a full clone. The parent virtual machine is brought to a state where the admin will Instant Clone it, at which time the parent virtual machine is quiesced and placed in a state of a ‘parent VM’. This allows the admins to create as many “child VMs” as they please. These child VMs are created in mere seconds (or less) depending on the environment (I’ve seen child VMs created in .6 seconds). The reason these child VMs can be created so quickly is because they leverage the memory and disk of the parent VM. Once the child VM is created, any writes are placed in delta disks.
When the parent virtual machine is quiesced, a prequiesce script cleans up certain aspects of the parent VM while placing it in its parent state, allowing the child VMs to receive unique MAC addresses, UUID, and other information when they are instantiated. When spinning up the child VMs a post clone script can be used to set properties such as the network information of the VM, and/or kick off additional scripts or actions within the child VM.
Specific information can be passed to the child VM for the post clone script to use to quickly perform actions on the virtual machine as it powers on (I use the term power-on because when the VM is cloned it is shown in vSphere as ‘Powered-Off’ however, when you “Power-On” the VM, it is already in its fully running state, there is no boot up). If you assigned a -PostCloneScript to the child VM, when it is Powered-On, the script will execute. Values such as network properties, can be passed to the Child VM through configuration parameters stored in the VMX file. These can be set with an array where the left-side is the name of the property and the right-side is the value:
$configSettings = @{
‘ipaddress’ = “10.134.14.75”;
‘netmask’ = ‘255.255.255.0’;
‘gateway’ = ‘10.134.14.253’;
}
When included in the New-InstantCloneVM cmdlet’s -ConfigParams, they will be added to it’s VMX file:
$childForkVm = New-InstantCloneVM -ParentVM $parentforkVm -Name “2012ChildClone$_” -ConfigParams $configSettings
Because of VM Tools, these values can then be retrieved from within the Child VM using the VMware Tools RPCTool, which can read guest information from the VMX file (using the example configparameters above):
- “%programfiles%\vmware\vmware tools\rpctool” “info-get guestinfo.fork.ipaddress”
- “%programfiles%\vmware\vmware tools\rpctool” “info-get guestinfo.fork.netmask”
- “%programfiles%\vmware\vmware tools\rpctool” “info-get guestinfo.fork.gateway”
In the demo below you will see a walkthrough of verifying the intended-parent VM’s network settings, and that the VM is in the desired state to instant clone. It then walks through the PowerCLI commands to create 9 child VMs off of the parent VM.
On my equipment it took me 15 seconds to create 9 Instant Clone child VMs of a Windows Server 2012 Parent VM. Times will vary based on a number of factors including the number of configuration parameters saved to each virtual machine, hardware, etc.
Get PowerCLI Extensions
You can download the user guide and PowerCLI Extensions module from the VMware Flings site HERE. I strongly recommend reading the user guide and following the step-by-step instructions for getting started.
VSAN cmdlets removed
Originally the PowerCLI Extensions module included VSAN cmdlets. As of PowerCLI 6.0 R1 those cmdlets have been removed from PowerCLI Extensions and added into PowerCLI.
Stay tuned for the next post. which will be a tutorial of how to use the Instant Clone functionality