fling logo of VMFork for pyVmomi

VMFork for pyVmomi

version 1.0.3 — November 17, 2017

Contributors 1

View All

Comments 5

  • profile picture of Anonymous
  • profile picture of Anonymous
  • profile picture of Anonymous
  • profile picture of Anonymous
  • profile picture of Anonymous
View All
The functionality of this Fling is now officially available in vSphere 6.7!

Summary

What would you do if you could instantiate hundreds of VMs that are booted up and ready-to-use in just a few seconds? We present VMFork-- a new technology in VMware ESX Hypervisor-- that lets you do just that. VMFork enables "forking" instances of a live, powered-on VM, each with its own unique identity. By leveraging the existing linked-clone technology for disks and extending the hypervisor to enable Copy-on-Write memory and VM state, VMFork fosters instant creation of VMs with little CPU overhead.

VMFork for pyVmomi enables seamless integration of vSphere VMFork APIs into a customer's existing vSphere environment regardless of the platform it is running on. Previously this functionality was only available to PowerCLI, but now everyone can take advantage of VMFork without any extra overhead. All you have to do is import the module into an existing pyVmomi-enabled vSphere environment, and you'll be on your way to instantly clone virtual machines in no time. The examples also demonstrate the use of the primitive APIs in a full Linux workflow so that forking Linux VMs is just a button click away.

Brian would like to give a shoutout to the other VMfork engineers: Gabriel Tarasuk-Levin, Li Zheng, Rohan Shah, Derek Beard, Janitha Karunaratne and Shruthi Rajashekar

Requirements

  • Python 2.7.x
  • pyVmomi version >= 6.0.0
  • paramiko >= 1.16.0
  • vCenter and ESX 6.0

Instructions

On the surface, the workflow is straightforward. First, a parent must be enabled for forking. This can be accomplished via the vim.VirtualMachine.EnableForkParent call. To reverse the process, call DisableForkParent.

Once the parent is enabled for forking, the next step is to quiesce the VM. Quiescing consists of the guest letting ESX know that it is in a stable state and is ready to be forked. When the "vmfork begin -1 -1" call is issued through vmware-rpctool from within the guest, ESX will stop running guest instructions, halt all IO, and mark the parent's memory pages copy-on-write. At this point the VM is considered quiesced. VMware suggests that the admin execute a script on the guest that sandwiches the quiesce call between any pre-customization and post-customization, such as NIC management. A simple example of customization is provided with the code.

Finally, the VI admin can now call vim.VirtualMachine.CreateForkChild with the appropriate parameters on the VM in order to create fork children. At this point, fork children will be created almost instantly. When the VI admin powers on a fork child, the VM will resume running guest instructions from the point the parent called vmfork-begin instead of the normal power on workflow.

For more complete documentation and examples view the README and inline code examples and comments.

Changelog

Version 1.0.3

  • Fixed a bug that prevented CreateChildSpec from being referenced in versions of 6.5 of pyVmomi
  • Updated the requirement to include pyVmomi 6.5 only, up from 6.0, due to a dependency issue

Version 1.0.2

  • Bug fixes & Improvements

Contributors

Similar Flings

May 23, 2022
fling logo of Virtual Machine Desired State Configuration

Virtual Machine Desired State Configuration

version 1.1.3 (4092207)

Virtual Machine Desired State Configuration (VMDSC) allows virtual administrators to specify VM CPU/Memory desired state which will take effect upon the next Guest OS reboot. This removes the burden of having to schedule a downtime window with the business/app owners.

Apr 27, 2018
fling logo of Cross vCenter VM Mobility - CLI

Cross vCenter VM Mobility - CLI

version 1.6.0

Cross vCenter VM Mobility - CLI is a command line interface (CLI) tool that can be used to migrate or clone a VM from one host to another host managed by a linked or isolated vCenter (VC) instance.

Jul 25, 2023
fling logo of vSphere Diagnostic Tool

vSphere Diagnostic Tool

version 1.1.6

vSphere Diagnostic Tool is a python script that runs diagnostic commands on the Photon Appliance or ESXi platform to return useful troubleshooting data while running within the confines of the local environment with out upstream dependencies.