We cannot do VMFork without PowerCLI Extension for now. But that means there are VMFork related APIs in vSphere API.
I explored those APIs using the MOB(The Managed Object Browser). Then I found it and I understand how to use it.
Disclaimer: VMFork is not officially supported by VMware, please use at your own risk.
VMFork related APIs
There are following methods in VirtualMachine object.
Also, there are
runtime.quiescedforkparent in VirtualMachine properties.
These methods and properties are found in the HTML source of VM page on the MOB.
This time, we want to run the VMFork, so we use
How to run the VMFork using the MOB.
1. Open the MOB.
2. Open the VirtualMachine you want to use as parent VM.
Open the parent VM with using rootFolder or searchIndex. The URL would be like here.
3. Run EnableForkParent_Task
Open following URL.
This method has no parameters, you have only to click
4. Quiesce the parent VM
Run this command on the parent VM via console or SSH.
vmtoolsd --cmd 'vmfork-begin -1 -1'
If you want to automate it, you can use GuestOperationsManager.ProcessManager.
Enable-InstantCloneVM upload PreQuiesceScript and PostCloneScript with operations up to this point.
You can upload these scripts with GuestOperationsManager instead of PowerCLI.
Also, It seems that PowerCLI’s
Enable-InstantCloneVM runs PreQuiesceScript and PostCloneScript with GuestOperationsManager. The command is like here.
$prescript_path;vmtoolsd --cmd 'vmfork-begin -1 -1';$postscript_path
5. Run VMFork
CreateForkChild_Task. It is same as PowerCLI’s
New-InstantCloneVM. The URL is following.
CreateForkChild_Task has parameters,
name is child VM name. And I guess
spec is VirtualMachineCreateChildSpec. Minimun
spec is here.
<spec> <persistent>false</persistent> </spec>
Invoke Method. The child VM will be created in an instant.
- VMware Instant Clone is now at your fingertips with the updated PowerCLI Extensions fling!
- Instant Clone PowerCLI cmdlets Best Practices & Troubleshooting
- How to VMFork aka Instant Clone Nested ESXi?
- vSphere Integrated Containers
- How to browse the internal vSphere APIs