NAME

virsh - management user interface


SYNOPSIS

virsh <subcommand> [args]


DESCRIPTION

The virsh program is the main interface for managing virsh guest domains. The program can be used to create, pause, and shutdown domains. It can also be used to list current domains. Libvirt is a C toolkit to interract with the virtualization capabilities of recent versions of Linux (and other OSes). It is free software available under the GNU Lesser General Public License. Virtualization of the Linux Operating System means the ability to run multiple instances of Operating Systems concurently on a single hardware system where the basic resources are driven by a Linux instance. The library aim at providing long term stable C API initially for the Xen paravirtualization but should be able to integrate other virtualization mechanisms if needed.

The basic structure of every virsh command is almost always:

  virsh <subcommand> <domain-id> [OPTIONS]

Where subcommand is one of the sub commands listed below, domain-id is the numeric domain id, or the domain name (which will be internally translated to domain id), and OPTIONS are sub command specific options. There are a few exceptions to this rule in the cases where the sub command in question acts on all domains, the entire machine, or directly on the xen hypervisor. Those exceptions will be clear for each of those sub commands.


NOTES

All virsh opperations rely upon the libvirt library. For any virsh commands to run xend/qemu, or what ever virtual library that libvirt suports. For this reason you should start xend/qemu as a service when your system first boots using xen/qemu.

Most virsh commands require root privledges to run due to the communications channels used to talk to the hypervisor. Running as non root will return an error.

Most virsh commands act asynchronously, so just because the virsh command returned, doesn't mean the action is complete. This is important, as many operations on domains, like create and shutdown, can take considerable time (30 seconds or more) to bring the machine into a fully compliant state. If you want to know when one of these actions has finished you must poll through virsh list periodically.


DOMAIN SUBCOMMANDS

The following sub commands manipulate domains directly, as stated previously most commands take domain-id as the first parameter.

connect optional --readonly
Connect to local hypervisor. This is build-in command after shell start up.

The --readonly option read-only connection

create FILE
Create a domain from an XML <file> an easy way to create one if you have a pre-existing xen guest created via xm create <XMLFILE>.

Example

virsh dumpxml <domain-name or id> to a file.

dinfo domain-name or id
Returns basic information about the domain.

dumpxml domain-name or id
Ouput the domain informations as an XML dump to stdout, this format can be used by the create sub command.

destroy domain-name or id
Immediately terminate the domain domain-id. This doesn't give the domain OS any chance to react, and it the equivalent of ripping the power cord out on a physical machine. In most cases you will want to use the shutdown command instead.

domid domain-name
Converts a domain name to a domain id using xend's internal mapping.

dominfo domain-name or id
Returns basic information about the domain.

domname domain-id
convert a domain Id to domain name

domstate domain-name or id
Returns state about a running domain.

help optional subcommand
Displays the short help message (i.e. common commands).

help subcommand will print out a detailed help message on that sub command

list
Prints information about one or more domains. If no domains are specified it prints out information about all domains.

An example format for the list is as follows:

virsh list Id Name State

----------------------------------

  0 Domain-0             running 
  2 fedora               paused

Name is the name of the domain. ID the domain numeric id. State is the run state (see below).

STATES

The State field lists 6 states for a Xen Domain, and which ones the current Domain is in. =back

r - running
The domain is currently running on a CPU

b - blocked
The domain is blocked, and not running or runable. This can be caused because the domain is waiting on IO (a traditional wait state) or has gone to sleep because there was nothing else for it to do.

p - paused
The domain has been paused, usually occurring through the administrator running xm pause. When in a paused state the domain will still consume allocated resources like memory, but will not be eligible for scheduling by the Xen hypervisor.

s - shutdown
FIXME: Why would you ever see this state?

c - crashed
The domain has crashed, which is always a violent ending. Usually this state can only occur if the domain has been configured not to restart on crash. See xmdomain.cfg for more info.

d - dying
The domain is in process of dying, but hasn't completely shutdown or crashed.

FIXME: Is this right?

nodeinfo domain-name or id
Returns basic information about the node.

quit
quit this interactive terminal

reboot domain-id
Reboot a domain. This acts just as if the domain had the reboot command run from the console. The command returns as soon as it has executed the reboot action, which may be significantly before the domain actually reboots.

For xen vm the behavior of what happens to a domain when it reboots is set by the on_reboot parameter of the xmdomain.cfg file when the domain was created.

restore state-file
Restores a domain from an virsh save state file. See save for more info.

save domain-id state-file
Saves a running domain to a state file so that it can be restored later. Once saved, the domain will no longer be running on the system, thus the memory allocated for the domain will be free for other domains to use. virsh restore restores from this state file.

This is roughly equivalent to doing a hibernate on a running computer, with all the same limitations. Open network connections may be severed upon restore, as TCP timeouts may have expired.

shutdown domain-id
Gracefully shuts down a domain. This coordinates with the domain OS to perform graceful shutdown, so there is no guaruntee that it will succeed, and may take a variable length of time depending on what services must be shutdown in the domain.

For a xen guest vm the behavior of what happens to a domain when it reboots is set by the on_shutdown parameter of the xmdomain.cfg file when the domain was created.

resume domain-id
Moves a domain out of the paused state. This will allow a previously paused domain to now be eligible for scheduling by the the under lying hypervisor.

version
Will print out the major version info about what this built from.

Example

virsh version

Compiled against library: libvir 0.0.6

Using library: libvir 0.0.6

Using API: Xen 3.0.0

Running hypervisor: Xen 3.0.0


SEE ALSO

xm(1), xmdomain.cfg(5), xentop(1) , http://www.libvirt.org/


AUTHOR

  Andrew Puch <apuch @ redhat.com> 
  Daniel Veillard <veillard @ redhat.com>
  Based on the xm man paged by 
  Sean Dague <sean at dague dot net>
  Daniel Stekloff <dsteklof at us dot ibm dot com>


BUGS

Bugs can be view on the RedHat buzilla page under the libvirt https://bugzilla.redhat.com/

https://bugzilla.redhat.com/bugzilla/buglist.cgi?product=Fedora+Core&component=libvirt&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=MODIFIED&short_desc_type=allwordssubstr&short_desc=&long_desc_type=allwordssubstr


=