Creating a Linked Virtual
Machine From a Snapshot
You first create a snapshot, and then create
the linked virtual machine from the snapshot.
- To create the snapshot, call theCreateSnapshot_Taskmethod for the virtual machine. The virtual machine can be in any power state. The following pseudo code creates a snapshot namedsnap1. The code does not include a memory dump. VMware Tools is used to quiesce the file system in the virtual machine if the virtual machine is powered on.myVm.CreateSnapshot("snap1", "snapshot for creating linked virtual machines", False, True)
- To create the linked virtual machine, specify the snapshot you created and use aVirtualMachineRelocateDiskMoveOptions.diskMoveTypeofcreateNewDeltaDiskBacking, as illustrated in Creating a Linked Virtual Machine from a Snapshot. Creating linked virtual machines from a snapshot works with virtual machines in any power state.
Creating a Linked Virtual Machine from a
Snapshot
relSpec = new VirtualMachineRelocateSpec() relSpec.diskMoveType = VirtualMachineRelocateDiskMoveOptions.createNewChildDiskBacking cloneSpec = new VirtualMachineCloneSpec() cloneSpec.powerOn = False cloneSpec.template = False cloneSpec.location = relSpec cloneSpec.snapshot = myVm.snapshot.currentSnapshot myVm.Clone(myVm.parent, myVm.name + "-clone", cloneSpec)
The result is a virtual machine with the same
base disk as the original, but a new delta disk backing.
Creating a Linked Virtual Machine from a
Snapshot
