/// <summary> /// Reboots a virtual machine. /// </summary> /// <param name="virtualMachine">The target virtual machine.</param> /// <param name="force">Optionally forces the virtual machine to reboot.</param> /// <exception cref="XenException">Thrown if the operation failed.</exception> public void Reboot(XenVirtualMachine virtualMachine, bool force = false) { Covenant.Requires <ArgumentNullException>(virtualMachine != null); if (force) { client.SafeInvoke("vm-reboot", $"uuid={virtualMachine.Uuid}", "--force"); } else { client.SafeInvoke("vm-reboot", $"uuid={virtualMachine.Uuid}"); } }
/// <summary> /// Shuts down a virtual machine. /// </summary> /// <param name="virtualMachine">The target virtual machine.</param> /// <param name="force">Optionally forces the virtual machine to shutdown.</param> /// <exception cref="XenException">Thrown if the operation failed.</exception> public void Shutdown(XenVirtualMachine virtualMachine, bool force = false) { Covenant.Requires <ArgumentNullException>(virtualMachine != null, nameof(virtualMachine)); if (force) { client.SafeInvoke("vm-shutdown", $"uuid={virtualMachine.Uuid}", "--force"); } else { client.SafeInvoke("vm-shutdown", $"uuid={virtualMachine.Uuid}"); } }
/// <summary> /// Starts a virtual machine. /// </summary> /// <param name="virtualMachine">The target virtual machine.</param> /// <exception cref="XenException">Thrown if the operation failed.</exception> public void Start(XenVirtualMachine virtualMachine) { Covenant.Requires <ArgumentNullException>(virtualMachine != null); client.SafeInvoke("vm-start", $"uuid={virtualMachine.Uuid}"); }