Language and Page Formatting Options
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
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_shutdownparameter in the guest virtual machine's configuration file. Any change to the
on_shutdownparameter will only take effect after the domain has been shutdown and restarted.
virsh shutdowncommand command can take the following optional argument:
--modechooses the shutdown mode. This can be either
Example 20.13. How to shutdown a guest virtual machine
The following example shuts down the guest1 virtual machine using the
virsh shutdown guest1Domain guest1 is being shutdown
20.8.2. Suspending a Guest Virtual Machine
virsh suspend domaincommand 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 resumecommand. 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
virsh reset domainresets 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.
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
virsh managedsave domaincommand 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
--running | --paused | --verbose
virsh startcommand it is automatically started from this save point. If it is used with the
--bypass-cacheargument the save will avoid the filesystem cache. Note that this option may slow down the save process speed and using the
--verboseoption 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
--runningoption to indicate that it must be left in a running state or by using
--pausedoption which indicates it is to be left in a paused state. To remove the managed save state, use the
virsh managedsave-removecommand which will force the guest virtual machine to do a full boot the next time it is started. Note that the entire managed save process can be monitored using the
domjobinfocommand and can also be canceled using the
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