func (v *VM) PowerOff(options VMPowerOption) error {
	var jobHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var err C.VixError = C.VIX_OK

	jobHandle = C.VixVM_PowerOff(v.handle,
		C.VixVMPowerOpOptions(options), // powerOptions,
		nil, // callbackProc,
		nil) // clientData

	defer C.Vix_ReleaseHandle(jobHandle)

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

	return nil
}
func (v *VM) PowerOff(options VMPowerOption) error {
	var jobHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var err C.VixError = C.VIX_OK

	jobHandle = C.VixVM_PowerOff(v.handle,
		C.VixVMPowerOpOptions(options), // powerOptions,
		nil, // callbackProc,
		nil) // clientData

	defer C.Vix_ReleaseHandle(jobHandle)

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

	return nil
}
// PowerOff powers off a virtual machine.
//
// Parameters:
//
//   options: Set of VMPowerOption flags to consider when powering off the
//   virtual machine.
//
// Remarks:
//   * If you call this function while the virtual machine is suspended or powered
//     off, the operation returns a VIX_E_VM_NOT_RUNNING error.
//     If suspended, the virtual machine remains suspended and is not powered off.
//     If powered off, you can safely ignore the error.
//
//   * If you pass VMPOWEROP_NORMAL as an option, the virtual machine is powered
//     off at the hardware level. Any state of the guest that was not committed
//     to disk will be lost.
//
//   * If you pass VMPOWEROP_FROM_GUEST as an option, the function tries to power
//     off the guest OS, ensuring a clean shutdown of the guest. This option
//     requires that VMware Tools be installed and running in the guest.
//
//   * After VMware Tools begin running in the guest, and VM.WaitForToolsInGuest()
//     returns, there is a short delay before VMPOWEROP_FROM_GUEST becomes
//     available.
//     During this time a job may return error 3009,
//     VIX_E_POWEROP_SCRIPTS_NOT_AVAILABLE.
//     As a workaround, add a short sleep after the WaitForTools call.
//
//   * On a Solaris guest with UFS file system on the root partition, the
//     VMPOWEROP_NORMAL parameter causes an error screen at next power on, which
//     requires user intervention to update the Solaris boot archive by logging
//     into the failsafe boot session from the GRUB menu. Hence, although UFS file
//     systems are supported, VMware recommends using the ZFS file system for
//     Solaris guests.
//
// Since VMware Server 1.0
//