Installation guide

Chapter 30.
257
Managing guests with virsh
virsh is a command line interface tool for managing guests and the hypervisor.
The virsh command-line tool is built on the libvirt management API and operates as an
alternative to the qemu-kvm command and the graphical virt-manager application. The virsh
command can be used in read-only mode by unprivileged users or, with root access, full administration
functionality. The virsh command is ideal for scripting virtualization administration.
virsh command quick reference
The following tables provide a quick reference for all virsh command line options.
Table 30.1. Guest management commands
Command Description
help Prints basic help information.
list Lists all guests.
dumpxml Outputs the XML configuration file for the guest.
create Creates a guest from an XML configuration file
and starts the new guest.
start Starts an inactive guest.
destroy Forces a guest to stop.
define Outputs an XML configuration file for a guest.
domid Displays the guest's ID.
domuuid Displays the guest's UUID.
dominfo Displays guest information.
domname Displays the guest's name.
domstate Displays the state of a guest.
quit Quits the interactive terminal.
reboot Reboots a guest.
restore Restores a previously saved guest stored in a
file.
resume Resumes a paused guest.
save Save the present state of a guest to a file.
shutdown Gracefully shuts down a guest.
suspend Pauses a guest.
undefine Deletes all files associated with a guest.
migrate Migrates a guest to another host.
The following virsh command options manage guest and hypervisor resources:
Table 30.2. Resource management options
Command Description
setmem Sets the allocated memory for a guest.
setmaxmem Sets maximum memory limit for the hypervisor.