Installation guide
Chapter 26. Managing guests with virsh
virsh is a command line interface tool for managing guests and the hypervisor.
The virsh tool is built on the libvirt management API and operates as an alternative to the xm
command and the graphical guest Manager (virt-manager). virsh can be used in read-only
mode by unprivileged users. You can use virsh to execute scripts for the guest machines.
virsh co mman d q u ick ref eren ce
The following tables provide a quick reference for all virsh command line options.
T ab le 26 .1. G uest man ag emen t co mman d s
Co mman d Descrip t io n
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:
T ab le 26 .2. Reso u rce man ag emen t op t io n s
Co mman d Descrip t io n
setmem
Sets the allocated memory for a guest.
setmaxmem
Sets maximum memory limit for the hypervisor.
setvcpus
Changes number of virtual CPUs assigned to a
guest. Note that this feature is unsupported in
Red Hat Enterprise Linux 5.
vcpuinfo
Displays virtual CPU information about a guest.
Red Hat En t erp rise Lin ux 5 Virt ualizat ion Guid e
258