Example #1
0
            /// <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}");
                }
            }
Example #2
0
            /// <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}");
                }
            }
Example #3
0
            /// <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}");
            }