func (v *VM) CreateSnapshot(name, description string, options CreateSnapshotOption) (*Snapshot, error) {
	var jobHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var snapshotHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var err C.VixError = C.VIX_OK

	sname := C.CString(name)
	sdesc := C.CString(description)
	defer C.free(unsafe.Pointer(sname))
	defer C.free(unsafe.Pointer(sdesc))

	jobHandle = C.VixVM_CreateSnapshot(v.handle,
		sname, // name
		sdesc, // description
		C.VixCreateSnapshotOptions(options), // options
		C.VIX_INVALID_HANDLE,                // propertyListHandle
		nil,                                 // callbackProc
		nil)                                 // clientData

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

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

	snapshot := &Snapshot{
		handle: snapshotHandle,
	}

	runtime.SetFinalizer(snapshot, cleanupSnapshot)

	return snapshot, nil
}
func (v *VM) CreateSnapshot(name, description string, options CreateSnapshotOption) (*Snapshot, error) {
	var jobHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var snapshotHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var err C.VixError = C.VIX_OK

	sname := C.CString(name)
	sdesc := C.CString(description)
	defer C.free(unsafe.Pointer(sname))
	defer C.free(unsafe.Pointer(sdesc))

	jobHandle = C.VixVM_CreateSnapshot(v.handle,
		sname, // name
		sdesc, // description
		C.VixCreateSnapshotOptions(options), // options
		C.VIX_INVALID_HANDLE,                // propertyListHandle
		nil,                                 // callbackProc
		nil)                                 // clientData

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

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

	snapshot := &Snapshot{
		handle: snapshotHandle,
	}

	runtime.SetFinalizer(snapshot, cleanupSnapshot)

	return snapshot, nil
}
// CreateSnapshot saves a copy of the virtual machine state as a snapshot object.
//
// Parameters:
//
//   name: A user-defined name for the snapshot; need not be unique.
//
//   description: A user-defined description for the snapshot.
//
//   options: Flags to specify how the snapshot should be created. Any combination of the
//   following or 0 to exclude memory:
//     * SNAPSHOT_INCLUDE_MEMORY: Captures the full state of a running virtual
//       machine, including the memory.
//
// Remarks:
//
//   * This function creates a child snapshot of the current snapshot.
//
//   * If a virtual machine is suspended, you cannot snapshot it more than once.
//
//   * If a powered-on virtual machine gets a snapshot created with option 0
//     (exclude memory), the power state is not saved, so reverting to the
//     snapshot sets powered-off state.
//
//   * The 'name' and 'description' parameters can be set but not retrieved
//     using the VIX API.
//
//   * VMware Server supports only a single snapshot for each virtual machine.
//     The following considerations apply to VMware Server:
//      * If you call this function a second time for the same virtual machine
//        without first deleting the snapshot,
//        the second call will overwrite the previous snapshot.
//      * A virtual machine imported to VMware Server from another VMware product
//        might have more than one snapshot at the time it is imported. In that
//        case, you can use this function to add a new snapshot to the series.
//
//   * Starting in VMware Workstation 6.5, snapshot operations are allowed on
//     virtual machines that are part of a team.
//     Previously, this operation failed with error code
//     VIX_PROPERTY_VM_IN_VMTEAM. Team members snapshot independently so they can
//     have different and inconsistent snapshot states.
//
//   * This function is not supported when using the VMWARE_PLAYER provider.
//
//   * If the virtual machine is open and powered off in the UI, this function now
//     closes the virtual machine in the UI before creating the snapshot.
//
// Since VMware Workstation 6.0
//