func (v *VM) Clone(cloneType CloneType, destVmxFile string) (*VM, error) {
	var jobHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var clonedHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var err C.VixError = C.VIX_OK

	dstVmxFile := C.CString(destVmxFile)
	defer C.free(unsafe.Pointer(dstVmxFile))

	jobHandle = C.VixVM_Clone(v.handle,
		C.VIX_INVALID_HANDLE,      // snapshotHandle
		C.VixCloneType(cloneType), // cloneType
		dstVmxFile,                // destConfigPathName
		0,                         // options,
		C.VIX_INVALID_HANDLE,      // propertyListHandle
		nil,                       // callbackProc
		nil)                       // clientData

	defer C.Vix_ReleaseHandle(jobHandle)

	err = C.get_vix_handle(jobHandle,
		C.VIX_PROPERTY_JOB_RESULT_HANDLE,
		&clonedHandle,
		C.VIX_PROPERTY_NONE)

	if C.VIX_OK != err {
		return nil, &Error{
			Operation: "vm.Clone",
			Code:      int(err & 0xFFFF),
			Text:      C.GoString(C.Vix_GetErrorText(err, nil)),
		}
	}

	return NewVirtualMachine(clonedHandle, destVmxFile)
}
func (v *VM) Clone(cloneType CloneType, destVmxFile string) (*VM, error) {
	var jobHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var clonedHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var err C.VixError = C.VIX_OK

	dstVmxFile := C.CString(destVmxFile)
	defer C.free(unsafe.Pointer(dstVmxFile))

	jobHandle = C.VixVM_Clone(v.handle,
		C.VIX_INVALID_HANDLE,      // snapshotHandle
		C.VixCloneType(cloneType), // cloneType
		dstVmxFile,                // destConfigPathName
		0,                         // options,
		C.VIX_INVALID_HANDLE,      // propertyListHandle
		nil,                       // callbackProc
		nil)                       // clientData

	defer C.Vix_ReleaseHandle(jobHandle)

	err = C.get_vix_handle(jobHandle,
		C.VIX_PROPERTY_JOB_RESULT_HANDLE,
		&clonedHandle,
		C.VIX_PROPERTY_NONE)

	if C.VIX_OK != err {
		return nil, &Error{
			Operation: "vm.Clone",
			Code:      int(err & 0xFFFF),
			Text:      C.GoString(C.Vix_GetErrorText(err, nil)),
		}
	}

	return NewVirtualMachine(clonedHandle, destVmxFile)
}
// Clone creates a copy of the virtual machine specified by the current VM instance.
//
// Parameters:
//
//   cloneType: Must be either CLONETYPE_FULL or CLONETYPE_LINKED.
//     * CLONETYPE_FULL: Creates a full, independent clone of the virtual machine.
//     * CLONETYPE_LINKED: Creates a linked clone, which is a copy of a virtual
//       machine that shares virtual disks with the parent
//       virtual machine in an ongoing manner.
//       This conserves disk space as long as the parent and
//       clone do not change too much from their original state.
//
//   destVmxFile: The path name of the virtual machine configuration file that will
//     be created for the virtual machine clone produced by this operation.
//     This should be a full absolute path name, with directory names delineated
//     according to host system convention: \ for Windows and / for Linux.
//
// Remarks:
//
//   * The function returns a new VM instance which is a clone of its parent VM.
//
//   * It is not possible to create a full clone of a powered on virtual machine.
//     You must power off or suspend a virtual machine before creating a full
//     clone of that machine.
//
//   * With a suspended virtual machine, requesting a linked clone results in
//     error 3007 VIX_E_VM_IS_RUNNING.
//     Suspended virtual machines retain memory state, so proceeding with a
//     linked clone could cause loss of data.
//
//   * A linked clone must have access to the parent's virtual disks. Without
//     such access, you cannot use a linked clone
//     at all because its file system will likely be incomplete or corrupt.
//
//   * Deleting a virtual machine that is the parent of a linked clone renders
//     the linked clone useless.
//
//   * Because a full clone does not share virtual disks with the parent virtual
//     machine, full clones generally perform better than linked clones.
//     However, full clones take longer to create than linked clones. Creating a
//     full clone can take several minutes if the files involved are large.
//
//   * This function is not supported when using the VMWARE_PLAYER provider.
//