20.8. Shutting off, Shutting down, Rebooting, and Forcing a Shutdown of a Guest Virtual Machine 20.8.1. Shutting down a Guest Virtual Machine The virsh shutdown domain [--mode modename ] command shuts down a guest virtual machine. You can control the behavior of how the guest virtual machine reboots by modifying the on_shutdown parameter in the guest virtual machine's configuration file. Any change to the on_shutdown parameter will only take effect after the domain has been shutdown and restarted. The virsh shutdown command command can take the following optional argument: --mode chooses the shutdown mode. This can be either acpi , agent , initctl , signal , or paravirt . Example 20.13. How to shutdown a guest virtual machine The following example shuts down the guest1 virtual machine using the acpi mode: 20.8.2. Suspending a Guest Virtual Machine The virsh suspend domain command suspends a guest virtual machine. When a guest virtual machine is in a suspended state, it consumes system RAM but not processor resources. Disk and network I/O does not occur while the guest virtual machine is suspended. This operation is immediate and the guest virtual machine can only be restarted with the virsh resume command. Running this command on a transient virtual machine will delete it. Example 20.14. How to suspend a guest virtual machine The following example suspends the guest1 virtual machine: # virsh suspend guest1 20.8.3. Resetting a Virtual Machine The virsh reset domain resets the guest virtual machine immediately without any guest shutdown. A reset emulates the reset button on a machine, where all guest hardware sees the RST line and re-initializes the internal state. Note that without any guest virtual machine OS shutdown, there are risks for data loss. Note Resetting a virtual machine does not apply any pending domain configuration changes. Changes to the domain's configuration only take effect after a complete shutdown and restart of the domain. Example 20.15. How to reset a guest virtual machine The following example resets the guest1 virtual machines: # virsh reset guest1 20.8.4. Stopping a Running Guest Virtual Machine in Order to Restart It Later The virsh managedsave domain --bypass-cache --running | --paused | --verbose command saves and destroys (stops) a running guest virtual machine so that it can be restarted from the same state at a later time. When used with a virsh start command it is automatically started from this save point. If it is used with the --bypass-cache argument the save will avoid the filesystem cache. Note that this option may slow down the save process speed and using the --verbose option displays the progress of the dump process. Under normal conditions, the managed save will decide between using the running or paused state as determined by the state the guest virtual machine is in when the save is done. However, this can be overridden by using the --running option to indicate that it must be left in a running state or by using --paused option which indicates it is to be left in a paused state. To remove the managed save state, use the virsh managedsave-remove command which will force the guest virtual machine to do a full boot the time it is started. Note that the entire managed save process can be monitored using the domjobinfo command and can also be canceled using the domjobabort command. Example 20.16. How to stop a running guest and save its configuration The following example stops the guest1 virtual machine and saves its running configuration setting so that you can restart it: # virsh managedsave guest1 --running

Commands:
virsh shutdown guest1 --mode acpi Domain guest1 is being shutdown