Move virsh into tools/ directory

Move the virsh tool and its man page into the tools directory

* Makefile.am: Remove rules for virsh.1 man page
* virsh.1: Remove auto-generated file
* docs/Makefile.am: Remove rules for virsh.pod man page
* docs/virsh.pod: Move to tools/ directory
* src/Makefile.am, src/.gitignore: Remove rules for virsh
* src/console.c, src/console.h, src/*.ico, src/virsh_win_icon.rc,
  src/virsh.c: Move into tools/ directory
* tools/Makefile.am: Add rules for building virsh
* tools/.gitignore: Ignore virsh built files
* tests/virshtest.c, tests/int-overflow: Update for new
  virsh location
This commit is contained in:
Daniel P. Berrange 2009-09-16 12:01:53 +01:00
parent e56c6a83b4
commit 7ff256ec98
18 changed files with 122 additions and 793 deletions

View File

@ -13,7 +13,7 @@ EXTRA_DIST = \
libvirt.spec libvirt.spec.in \
mingw32-libvirt.spec.in \
libvirt.pc libvirt.pc.in \
$(man_MANS) autobuild.sh \
autobuild.sh \
.x-sc_avoid_if_before_free \
.x-sc_require_config_h_first \
.x-sc_prohibit_strcmp \
@ -23,8 +23,6 @@ EXTRA_DIST = \
Makefile.nonreentrant \
autogen.sh
man_MANS = virsh.1
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libvirt.pc

View File

@ -72,15 +72,10 @@ EXTRA_DIST= \
$(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \
$(xml) $(fig) $(png) \
$(patches) \
virsh.pod ChangeLog.awk
ChangeLog.awk
all: web $(top_builddir)/NEWS $(man_MANS)
virsh.1: virsh.pod
pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)" $(srcdir)/virsh.pod > $@-t
mv $@-t $@
cp $@ $(top_builddir)
api: libvirt-api.xml libvirt-refs.xml $(srcdir)/html/index.html
web: $(dot_html)

3
src/.gitignore vendored
View File

@ -5,7 +5,6 @@ Makefile.in
*.lo
*.loT
*.la
virsh
*.exe
*.gcda
*.gcno
@ -13,8 +12,6 @@ virsh
*.cov
libvirt_parthelper
libvirt_lxc
virsh-net-edit.c
virsh-pool-edit.c
libvirt.syms
*.i
*.s

View File

@ -22,14 +22,7 @@ INCLUDES = \
confdir = $(sysconfdir)/libvirt/
conf_DATA = qemu.conf
ICON_FILES = \
libvirt_win_icon_16x16.ico \
libvirt_win_icon_32x32.ico \
libvirt_win_icon_48x48.ico \
libvirt_win_icon_64x64.ico \
virsh_win_icon.rc
EXTRA_DIST = $(conf_DATA) $(ICON_FILES)
EXTRA_DIST = $(conf_DATA)
lib_LTLIBRARIES = libvirt.la
@ -617,6 +610,8 @@ EXTRA_DIST += \
libvirt_bridge.syms \
libvirt_linux.syms
BUILT_SOURCES = libvirt.syms
libvirt.syms: libvirt_public.syms $(USED_SYM_FILES)
rm -f $@-tmp $@
printf '# WARNING: generated from the following:\n# $^\n\n' >$@-tmp
@ -662,82 +657,6 @@ libvirt_test_la_LIBADD = $(libvirt_la_LIBADD)
libvirt_test_la_LDFLAGS = $(test_LDFLAGS)
libvirt_test_la_CFLAGS = $(COVERAGE_CFLAGS)
bin_PROGRAMS = virsh
virsh_SOURCES = \
console.c console.h \
virsh.c
virsh_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDFLAGS)
virsh_LDADD = \
$(STATIC_BINARIES) \
$(WARN_CFLAGS) \
$(NUMACTL_LIBS) \
libvirt.la \
../gnulib/lib/libgnu.la \
$(VIRSH_LIBS)
virsh_CFLAGS = $(COVERAGE_CFLAGS) $(READLINE_CFLAGS) $(NUMACTL_CFLAGS)
BUILT_SOURCES = virsh-net-edit.c virsh-pool-edit.c libvirt.syms
virsh-net-edit.c: virsh.c Makefile.am
rm -f $@-tmp
echo '/* Automatically generated from: $^ */' > $@-tmp
echo 'static int' >> $@-tmp
awk '/^cmdEdit/, /^}/' $< \
| sed -e 's/domain/network/g' \
-e 's/Domain/Network/g' \
-e 's/cmdEdit/cmdNetworkEdit/g' \
-e 's/dom/network/g' \
-e 's/int flags.*/int flags = 0;/g' \
>> $@-tmp
chmod a-w $@-tmp
rm -f $@
mv $@-tmp $@
virsh-pool-edit.c: virsh.c Makefile.am
rm -f $@-tmp
echo '/* Automatically generated from: $^ */' > $@-tmp
echo 'static int' >> $@-tmp
awk '/^cmdEdit/, /^}/' $< \
| sed -e 's/domain/pool/g' \
-e 's/vshCommandOptDomain/vshCommandOptPool/g' \
-e 's/Domain %s/Pool %s/g' \
-e 's/(ctl, cmd, NULL);/(ctl, cmd, "pool", NULL);/' \
-e 's/Domain/StoragePool/g' \
-e 's/cmdEdit/cmdPoolEdit/g' \
-e 's/\(virStoragePoolDefineXML.*\));/\1, 0);/' \
-e 's/dom/pool/g' \
-e 's/int flags.*/int flags = 0;/g' \
>> $@-tmp
chmod a-w $@-tmp
rm -f $@
mv $@-tmp $@
if WITH_WIN_ICON
virsh_LDADD += virsh_win_icon.$(OBJEXT)
# Before you edit virsh_win_icon.rc, please note the following
# limitations of the resource file format:
#
# (1) '..' is not permitted in the icon filename field.
# (2) '-' is not permitted in the icon filename field.
# (3) Comments are not permitted in the file.
#
# Windows appears to choose the first <= 32x32 icon it finds
# in the resource file. Therefore you should list the available
# icons from largest to smallest, and make sure that the 32x32
# icon is the most legible.
#
# Windows .ICO is a special MS-only format. GIMP and other
# tools can write it. However there are several variations,
# and Windows seems to do its own colour quantization. More
# information is needed in this area.
virsh_win_icon.$(OBJEXT): virsh_win_icon.rc
$(WINDRES) \
--input-format rc --input $< \
--output-format coff --output $@
endif
libexec_PROGRAMS =

View File

@ -14,7 +14,7 @@ mkdir "$t_" || fail=1
cd "$t_" || fail=1
echo "error: failed to get domain '4294967298'" > exp || fail=1
echo domname 4294967298 | $abs_top_builddir/src/virsh --quiet \
echo domname 4294967298 | $abs_top_builddir/tools/virsh --quiet \
--connect test://$abs_top_srcdir/docs/testnode.xml \
> /dev/null 2> err || fail=1
diff -u err exp || fail=1

View File

@ -82,13 +82,13 @@ static int testCompareOutput(const char *expect_rel, const char *filter,
}
#endif
#define VIRSH_DEFAULT "../src/virsh", \
#define VIRSH_DEFAULT "../tools/virsh", \
"--connect", \
"test:///default"
static char *custom_uri;
#define VIRSH_CUSTOM "../src/virsh", \
#define VIRSH_CUSTOM "../tools/virsh", \
"--connect", \
custom_uri

8
tools/.gitignore vendored
View File

@ -1,4 +1,10 @@
virt-xml-validate
virt-xml-validate.1
*.1
Makefile
Makefile.in
virsh-net-edit.c
virsh-pool-edit.c
virsh
*.exe
.libs
.deps

View File

@ -1,16 +1,117 @@
bin_SCRIPTS = \
virt-xml-validate
POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"
ICON_FILES = \
libvirt_win_icon_16x16.ico \
libvirt_win_icon_32x32.ico \
libvirt_win_icon_48x48.ico \
libvirt_win_icon_64x64.ico \
virsh_win_icon.rc
EXTRA_DIST = $(ICON_FILES) virt-xml-validate.in virsh.pod
bin_SCRIPTS = virt-xml-validate
bin_PROGRAMS = virsh
man1_MANS = virt-xml-validate.1 virsh.1
virt-xml-validate: virt-xml-validate.in Makefile
sed -e 's,@SCHEMADIR@,$(pkgdatadir)/schemas,' < $< > $@ || (rm $@ && exit 1)
chmod +x $@
man1_MANS = virt-xml-validate.1
virt-xml-validate.1: virt-xml-validate
$(POD2MAN) $< $@
virsh_SOURCES = \
console.c console.h \
virsh.c
virsh_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDFLAGS)
virsh_LDADD = \
$(STATIC_BINARIES) \
$(WARN_CFLAGS) \
../src/libvirt.la \
../gnulib/lib/libgnu.la \
$(VIRSH_LIBS)
virsh_CFLAGS = \
-I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
-I../include \
-I../src \
-DGETTEXT_PACKAGE=\"$(PACKAGE)\" \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
$(COVERAGE_CFLAGS) \
$(LIBXML_CFLAGS) \
$(READLINE_CFLAGS)
BUILT_SOURCES = virsh-net-edit.c virsh-pool-edit.c
virsh-net-edit.c: virsh.c Makefile.am
rm -f $@-tmp
echo '/* Automatically generated from: $^ */' > $@-tmp
echo 'static int' >> $@-tmp
awk '/^cmdEdit/, /^}/' $< \
| sed -e 's/domain/network/g' \
-e 's/Domain/Network/g' \
-e 's/cmdEdit/cmdNetworkEdit/g' \
-e 's/dom/network/g' \
-e 's/int flags.*/int flags = 0;/g' \
>> $@-tmp
chmod a-w $@-tmp
rm -f $@
mv $@-tmp $@
virsh-pool-edit.c: virsh.c Makefile.am
rm -f $@-tmp
echo '/* Automatically generated from: $^ */' > $@-tmp
echo 'static int' >> $@-tmp
awk '/^cmdEdit/, /^}/' $< \
| sed -e 's/domain/pool/g' \
-e 's/vshCommandOptDomain/vshCommandOptPool/g' \
-e 's/Domain %s/Pool %s/g' \
-e 's/(ctl, cmd, NULL);/(ctl, cmd, "pool", NULL);/' \
-e 's/Domain/StoragePool/g' \
-e 's/cmdEdit/cmdPoolEdit/g' \
-e 's/\(virStoragePoolDefineXML.*\));/\1, 0);/' \
-e 's/dom/pool/g' \
-e 's/int flags.*/int flags = 0;/g' \
>> $@-tmp
chmod a-w $@-tmp
rm -f $@
mv $@-tmp $@
if WITH_WIN_ICON
virsh_LDADD += virsh_win_icon.$(OBJEXT)
# Before you edit virsh_win_icon.rc, please note the following
# limitations of the resource file format:
#
# (1) '..' is not permitted in the icon filename field.
# (2) '-' is not permitted in the icon filename field.
# (3) Comments are not permitted in the file.
#
# Windows appears to choose the first <= 32x32 icon it finds
# in the resource file. Therefore you should list the available
# icons from largest to smallest, and make sure that the 32x32
# icon is the most legible.
#
# Windows .ICO is a special MS-only format. GIMP and other
# tools can write it. However there are several variations,
# and Windows seems to do its own colour quantization. More
# information is needed in this area.
virsh_win_icon.$(OBJEXT): virsh_win_icon.rc
$(WINDRES) \
--input-format rc --input $< \
--output-format coff --output $@
endif
virsh.1: virsh.pod
$(POD2MAN) $< $@
EXTRA_DIST = virt-xml-validate.in
CLEANFILES = $(bin_SCRIPTS) $(man1_MANS)
%.1: %
pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)" $< $@
DISTCLEANFILES = $(BUILT_SOURCES)

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

687
virsh.1
View File

@ -1,687 +0,0 @@
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.07)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "VIRSH 1"
.TH VIRSH 1 "2009-08-20" "libvirt-0.7.0" "Virtualization Support"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
virsh \- management user interface
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
virsh <subcommand> [args]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \fBvirsh\fR 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 interact with the virtualization capabilities of recent versions of Linux (and other OSes). It is free software available under the \s-1GNU\s0 Lesser General Public License. Virtualization of the Linux Operating System means the ability to run multiple instances of Operating Systems concurrently on a single hardware system where the basic resources are driven by a Linux instance. The library aim at providing long term stable C \s-1API\s0 initially for the Xen paravirtualization but should be able to integrate other virtualization mechanisms, it currently also support QEmu and \s-1KVM\s0.
.PP
The basic structure of most virsh usage is:
.PP
.Vb 1
\& virsh <command> <domain\-id> [OPTIONS]
.Ve
.PP
Where \fIcommand\fR is one of the commands listed below, \fIdomain-id\fR
is the numeric domain id, or the domain name (which will be internally
translated to domain id), and \fI\s-1OPTIONS\s0\fR are command specific
options. There are a few exceptions to this rule in the cases where
the 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 commands.
.PP
The \fBvirsh\fR program can be used either to run one command at a time
by giving the command as an argument on the command line, or as a shell
if no command is given in the command line, it will then start a minimal
interpreter waiting for your commands and the \fBquit\fR command will then exit
the program.
.SH "NOTES"
.IX Header "NOTES"
All \fBvirsh\fR operations rely upon the libvirt library.
For any virsh commands to run xend/qemu, or what ever virtual library that libvirt supports. For this reason you should start xend/qemu as a service when your system first boots using xen/qemu. This can usually be done using the command
\&\fBservice libvirtd start\fR .
.PP
Most \fBvirsh\fR commands require root privileges to run due to the
communications channels used to talk to the hypervisor. Running as
non root will return an error.
.PP
Most \fBvirsh\fR commands act asynchronously, so just because the \fBvirsh\fR
program 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.
.SH "GENERIC COMMANDS"
.IX Header "GENERIC COMMANDS"
The following commands are generic i.e. not specific to a domain.
.IP "\fBhelp\fR optional \fIcommand\fR" 4
.IX Item "help optional command"
This prints a small synopsis about all commands available for \fBvirsh\fR
\&\fBhelp\fR \fIcommand\fR will print out a detailed help message on that command.
.IP "\fBquit\fR" 4
.IX Item "quit"
quit this interactive terminal
.IP "\fBversion\fR" 4
.IX Item "version"
Will print out the major version info about what this built from.
.RS 4
.Sp
.RS 4
\&\fBExample\fR
.Sp
\&\fBvirsh\fR version
.Sp
Compiled against library: libvir 0.0.6
.Sp
Using library: libvir 0.0.6
.Sp
Using \s-1API:\s0 Xen 3.0.0
.Sp
Running hypervisor: Xen 3.0.0
.RE
.RE
.RS 4
.RE
.IP "\fBcd\fR \fIdirectory\fR optional" 4
.IX Item "cd directory optional"
Will change current directory to \fIdirectory\fR. The default directory
for the \fBcd\fR command is the home directory or, if there is no \fI\s-1HOME\s0\fR
variable in the environment, the root directory.
.Sp
This command is only available in interactive mode.
.IP "\fBpwd\fR" 4
.IX Item "pwd"
Will print the current directory.
.IP "\fBconnect\fR \fI\s-1URI\s0\fR optional \fI\-\-readonly\fR" 4
.IX Item "connect URI optional --readonly"
(Re)\-Connect to the hypervisor. This is a build-in command after shell
start up, and usually get an \fI\s-1URI\s0\fR parameter specifying how to connect
to the hypervisor. The documentation page at <http://libvirt.org/uri.html>
list the values supported but the most common are:
.RS 4
.IP "xen:///" 4
.IX Item "xen:///"
this is used to connect to the local Xen hypervisor, this is the default
.IP "qemu:///system" 4
.IX Item "qemu:///system"
allow to connect locally as root to the daemon supervising QEmu and \s-1KVM\s0 domains
.IP "qemu:///session" 4
.IX Item "qemu:///session"
allow to connect locally as a normal user to his own set of QEmu and \s-1KVM\s0 domains
.RE
.RS 4
.Sp
For remote access see the documentation page on how to make URIs.
The \fI\-\-readonly\fR option allows for read-only connection
.RE
.IP "\fBuri\fR" 4
.IX Item "uri"
Prints the hypervisor canonical \s-1URI\s0, can be useful in shell mode.
.IP "\fBhostname\fR" 4
.IX Item "hostname"
Print the hypervisor hostname.
.IP "\fBnodeinfo\fR" 4
.IX Item "nodeinfo"
Returns basic information about the node, like number and type of \s-1CPU\s0,
and size of the physical memory.
.IP "\fBcapabilities\fR" 4
.IX Item "capabilities"
Print an \s-1XML\s0 document describing the capabilities of the hypervisor
we are currently connected to. This includes a section on the host
capabilities in terms of \s-1CPU\s0 and features, and a set of description
for each kind of guest which can be virtualized. For a more complete
description see:
<http://libvirt.org/formatcaps.html>
The \s-1XML\s0 also show the \s-1NUMA\s0 topology information if available.
.IP "\fBlist\fR" 4
.IX Item "list"
Prints information about one or more domains. If no domains are
specified it prints out information about all domains.
.Sp
An example format for the list is as follows:
.Sp
\&\fBvirsh\fR list
Id Name State
.Sp
\&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
.Sp
.Vb 2
\& 0 Domain\-0 running
\& 2 fedora paused
.Ve
.Sp
Name is the name of the domain. \s-1ID\s0 the domain numeric id.
State is the run state (see below).
.Sp
\&\fB\s-1STATES\s0\fR
.Sp
The State field lists 6 states for a domain, and which ones the
current domain is in.
.RS 4
.IP "\fBrunning\fR" 4
.IX Item "running"
The domain is currently running on a \s-1CPU\s0
.IP "\fBidle\fR" 4
.IX Item "idle"
The domain is idle, and not running or runnable. This can be caused
because the domain is waiting on \s-1IO\s0 (a traditional wait state) or has
gone to sleep because there was nothing else for it to do.
.IP "\fBpaused\fR" 4
.IX Item "paused"
The domain has been paused, usually occurring through the administrator
running \fBvirsh suspend\fR. When in a paused state the domain will still
consume allocated resources like memory, but will not be eligible for
scheduling by the hypervisor.
.IP "\fBshutdown\fR" 4
.IX Item "shutdown"
The domain is in the process of shutting down, i.e. the guest operating system
has been notified and should be in the process of stopping its operations
gracefully.
.IP "\fBcrashed\fR" 4
.IX Item "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.
.IP "\fBdying\fR" 4
.IX Item "dying"
The domain is in process of dying, but hasn't completely shutdown or
crashed.
.RE
.RS 4
.RE
.IP "\fBfreecell\fR optional \fIcellno\fR" 4
.IX Item "freecell optional cellno"
Prints the available amount of memory on the machine or within a
\&\s-1NUMA\s0 cell if \fIcellno\fR is provided.
.SH "DOMAIN COMMANDS"
.IX Header "DOMAIN COMMANDS"
The following commands manipulate domains directly, as stated
previously most commands take domain-id as the first parameter. The
\&\fIdomain-id\fR can be specified as an short integer, a name or a full \s-1UUID\s0.
.IP "\fBautostart\fR optional \fI\-\-disable\fR \fIdomain-id\fR" 4
.IX Item "autostart optional --disable domain-id"
Configure a domain to be automatically started at boot.
.Sp
The option \fI\-\-disable\fR disable autostarting.
.IP "\fBconsole\fR \fIdomain-id\fR" 4
.IX Item "console domain-id"
Connect the virtual serial console for the guest.
.IP "\fBcreate\fR \fI\s-1FILE\s0\fR" 4
.IX Item "create FILE"
Create a domain from an \s-1XML\s0 <file>. An easy way to create the \s-1XML\s0 <file> is to use the \fBdumpxml\fR command to obtain the definition of a pre-existing guest.
.Sp
\&\fBExample\fR
.Sp
virsh dumpxml <domain\-id> > file.
.IP "\fBdefine\fR \fI\s-1FILE\s0\fR" 4
.IX Item "define FILE"
Define a domain from an \s-1XML\s0 <file>. The domain definitions is registered
but not started.
.IP "\fBdestroy\fR \fIdomain-id\fR" 4
.IX Item "destroy domain-id"
Immediately terminate the domain domain-id. This doesn't give the domain
\&\s-1OS\s0 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 \fBshutdown\fR command instead.
.IP "\fBdomblkstat\fR \fIdomain\fR \fIblock-device\fR" 4
.IX Item "domblkstat domain block-device"
Get device block stats for a running domain.
.IP "\fBdomifstat\fR \fIdomain\fR \fIinterface-device\fR" 4
.IX Item "domifstat domain interface-device"
Get network interface stats for a running domain.
.IP "\fBdominfo\fR \fIdomain-id\fR" 4
.IX Item "dominfo domain-id"
Returns basic information about the domain.
.IP "\fBdomuuid\fR \fIdomain-name-or-id\fR" 4
.IX Item "domuuid domain-name-or-id"
Convert a domain name or id to domain \s-1UUID\s0
.IP "\fBdomid\fR \fIdomain-name-or-uuid\fR" 4
.IX Item "domid domain-name-or-uuid"
Convert a domain name (or \s-1UUID\s0) to a domain id
.IP "\fBdominfo\fR \fIdomain-id\fR" 4
.IX Item "dominfo domain-id"
Returns basic information about the domain.
.IP "\fBdomname\fR \fIdomain-id-or-uuid\fR" 4
.IX Item "domname domain-id-or-uuid"
Convert a domain Id (or \s-1UUID\s0) to domain name
.IP "\fBdomstate\fR \fIdomain-id\fR" 4
.IX Item "domstate domain-id"
Returns state about a running domain.
.IP "\fBdump\fR \fIdomain-id\fR \fIcorefilepath\fR" 4
.IX Item "dump domain-id corefilepath"
Dumps the core of a domain to a file for analysis.
.IP "\fBdumpxml\fR \fIdomain-id\fR" 4
.IX Item "dumpxml domain-id"
Output the domain information as an \s-1XML\s0 dump to stdout, this format can be used by the \fBcreate\fR command.
.IP "\fBedit\fR \fIdomain-id\fR" 4
.IX Item "edit domain-id"
Edit the \s-1XML\s0 configuration file for a domain.
.Sp
This is equivalent to:
virsh dumpxml domain > domain.xml
edit domain.xml
virsh define domain.xml
except that it does some error checking.
.Sp
The editor used can be supplied by the \f(CW$EDITOR\fR environment
variable, or if that is not defined defaults to \f(CW\*(C`vi\*(C'\fR.
.IP "\fBmigrate\fR optional \fI\-\-live\fR \fIdomain-id\fR \fIdesturi\fR \fImigrateuri\fR" 4
.IX Item "migrate optional --live domain-id desturi migrateuri"
Migrate domain to another host. Add \-\-live for live migration. The \fIdesturi\fR
is the connection \s-1URI\s0 of the destination host, and \fImigrateuri\fR is the
migration \s-1URI\s0, which usually can be omitted.
.IP "\fBreboot\fR \fIdomain-id\fR" 4
.IX Item "reboot domain-id"
Reboot a domain. This acts just as if the domain had the \fBreboot\fR
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.
.Sp
The exact behavior of a domain when it reboots is set by the
\&\fIon_reboot\fR parameter in the domain's \s-1XML\s0 definition.
.IP "\fBrestore\fR \fIstate-file\fR" 4
.IX Item "restore state-file"
Restores a domain from an \fBvirsh save\fR state file. See \fIsave\fR for more info.
.IP "\fBsave\fR \fIdomain-id\fR \fIstate-file\fR" 4
.IX Item "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. \fBvirsh restore\fR restores from this state file.
.Sp
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 \s-1TCP\s0 timeouts may have expired.
.IP "\fBschedinfo\fR optional \fI\-\-set\fR \fBparameter=value\fR \fIdomain-id\fR" 4
.IX Item "schedinfo optional --set parameter=value domain-id"
.PD 0
.IP "\fBschedinfo\fR optional \fI\-\-weight\fR \fBnumber\fR optional \fI\-\-cap\fR \fBnumber\fR \fIdomain-id\fR" 4
.IX Item "schedinfo optional --weight number optional --cap number domain-id"
.PD
Allows to show (and set) the domain scheduler parameters.
.Sp
\&\fBNote\fR: The weight and cap parameters are defined only for the
\&\s-1XEN_CREDIT\s0 scheduler and are now \fI\s-1DEPRECATED\s0\fR.
.IP "\fBsetmem\fR \fIdomain-id\fR \fBkilobytes\fR" 4
.IX Item "setmem domain-id kilobytes"
Change the current memory allocation in the guest domain. This should take
effect immediately. The memory limit is specified in
kilobytes.
.Sp
For Xen, you can only adjust the memory of a running domain if the
domain is paravirtualized or running the \s-1PV\s0 balloon driver.
.IP "\fBsetmaxmem\fR \fIdomain-id\fR \fBkilobytes\fR" 4
.IX Item "setmaxmem domain-id kilobytes"
Change the maximum memory allocation limit in the guest domain. This should
not change the current memory use. The memory limit is specified in
kilobytes.
.IP "\fBsetvcpus\fR \fIdomain-id\fR \fIcount\fR" 4
.IX Item "setvcpus domain-id count"
Change the number of virtual CPUs active in the guest domain. Note that
\&\fIcount\fR may be limited by host, hypervisor or limit coming from the
original description of domain.
.Sp
For Xen, you can only adjust the virtual CPUs of a running domain if
the domain is paravirtualized.
.IP "\fBshutdown\fR \fIdomain-id\fR" 4
.IX Item "shutdown domain-id"
Gracefully shuts down a domain. This coordinates with the domain \s-1OS\s0
to perform graceful shutdown, so there is no guarantee that it will
succeed, and may take a variable length of time depending on what
services must be shutdown in the domain.
.Sp
The exact behavior of a domain when it shuts down is set by the
\&\fIon_shutdown\fR parameter in the domain's \s-1XML\s0 definition.
.IP "\fBstart\fR \fIdomain-name\fR" 4
.IX Item "start domain-name"
Start a (previously defined) inactive domain.
.IP "\fBsuspend\fR \fIdomain-id\fR" 4
.IX Item "suspend domain-id"
Suspend a running domain. It is kept in memory but won't be scheduled
anymore.
.IP "\fBresume\fR \fIdomain-id\fR" 4
.IX Item "resume domain-id"
Moves a domain out of the suspended state. This will allow a previously
suspended domain to now be eligible for scheduling by the underlying
hypervisor.
.IP "\fBttyconsole\fR \fIdomain-id\fR" 4
.IX Item "ttyconsole domain-id"
Output the device used for the \s-1TTY\s0 console of the domain. If the information
is not available the processes will provide an exit code of 1.
.IP "\fBundefine\fR \fIdomain-id\fR" 4
.IX Item "undefine domain-id"
Undefine the configuration for an inactive domain. Since it's not running
the domain name or UUId must be used as the \fIdomain-id\fR.
.IP "\fBvcpuinfo\fR \fIdomain-id\fR" 4
.IX Item "vcpuinfo domain-id"
Returns basic information about the domain virtual CPUs, like the number of
vCPUs, the running time, the affinity to physical processors.
.IP "\fBvcpupin\fR \fIdomain-id\fR \fIvcpu\fR \fIcpulist\fR" 4
.IX Item "vcpupin domain-id vcpu cpulist"
Pin domain VCPUs to host physical CPUs. The \fIvcpu\fR number must be provided
and \fIcpulist\fR is a comma separated list of physical \s-1CPU\s0 numbers.
.IP "\fBvncdisplay\fR \fIdomain-id\fR" 4
.IX Item "vncdisplay domain-id"
Output the \s-1IP\s0 address and port number for the \s-1VNC\s0 display. If the information
is not available the processes will provide an exit code of 1.
.SH "DEVICE COMMANDS"
.IX Header "DEVICE COMMANDS"
The following commands manipulate devices associated to domains.
The domain-id can be specified as an short integer, a name or a full \s-1UUID\s0.
To better understand the values allowed as options for the command
reading the documentation at <http://libvirt.org/formatdomain.html> on the
format of the device sections to get the most accurate set of accepted values.
.IP "\fBattach-device\fR \fIdomain-id\fR \fI\s-1FILE\s0\fR" 4
.IX Item "attach-device domain-id FILE"
Attach a device to the domain, using a device definition in an \s-1XML\s0 file.
See the documentation to learn about libvirt \s-1XML\s0 format for a device.
.IP "\fBattach-disk\fR \fIdomain-id\fR \fIsource\fR \fItarget\fR optional \fI\-\-driver driver\fR \fI\-\-subdriver subdriver\fR \fI\-\-type type\fR \fI\-\-mode mode\fR" 4
.IX Item "attach-disk domain-id source target optional --driver driver --subdriver subdriver --type type --mode mode"
Attach a new disk device to the domain.
\&\fIsource\fR and \fItarget\fR are paths for the files and devices.
\&\fIdriver\fR can be \fIfile\fR, \fItap\fR or \fIphy\fR depending on the kind of access.
\&\fItype\fR can indicate \fIcdrom\fR or \fIfloppy\fR as alternative to the disk default.
\&\fImode\fR can specify the two specific mode \fIreadonly\fR or \fIshareable\fR.
.IP "\fBattach-interface\fR \fIdomain-id\fR \fItype\fR \fIsource\fR optional \fI\-\-target target\fR \fI\-\-mac mac\fR \fI\-\-script script\fR" 4
.IX Item "attach-interface domain-id type source optional --target target --mac mac --script script"
Attach a new network interface to the domain.
\&\fItype\fR can be either \fInetwork\fR to indicate a physical network device or \fIbridge\fR to indicate a bridge to a device.
\&\fIsource\fR indicates the source device.
\&\fItarget\fR allows to indicate the target device in the guest.
\&\fImac\fR allows to specify the \s-1MAC\s0 address of the network interface.
\&\fIscript\fR allows to specify a path to a script handling a bridge instead of
the default one.
.IP "\fBdetach-device\fR \fIdomain-id\fR \fI\s-1FILE\s0\fR" 4
.IX Item "detach-device domain-id FILE"
Detach a device from the domain, takes the same kind of \s-1XML\s0 descriptions
as command \fBattach-device\fR.
.IP "\fBdetach-disk\fR \fIdomain-id\fR \fItarget\fR" 4
.IX Item "detach-disk domain-id target"
Detach a disk device from a domain. The \fItarget\fR is the device as seen
from the domain.
.IP "\fBdetach-interface\fR \fIdomain-id\fR \fItype\fR optional \fI\-\-mac mac\fR" 4
.IX Item "detach-interface domain-id type optional --mac mac"
Detach a network interface from a domain.
\&\fItype\fR can be either \fInetwork\fR to indicate a physical network device or \fIbridge\fR to indicate a bridge to a device.
It is recommended to use the \fImac\fR option to distinguish between the interfaces
if more than one are present on the domain.
.SH "VIRTUAL NETWORK COMMANDS"
.IX Header "VIRTUAL NETWORK COMMANDS"
The following commands manipulate networks. Libvirt has the capability to
define virtual networks which can then be used by domains and linked to
actual network devices. For more detailed information about this feature
see the documentation at <http://libvirt.org/formatnetwork.html> . A lot
of the command for virtual networks are similar to the one used for domains,
but the way to name a virtual network is either by its name or \s-1UUID\s0.
.IP "\fBnet-autostart\fR \fInetwork\fR optional \fI\-\-disable\fR" 4
.IX Item "net-autostart network optional --disable"
Configure a virtual network to be automatically started at boot.
The \fI\-\-disable\fR option disable autostarting.
.IP "\fBnet-create\fR \fIfile\fR" 4
.IX Item "net-create file"
Create a virtual network from an \s-1XML\s0 \fIfile\fR, see the documentation to get
a description of the \s-1XML\s0 network format used by libvirt.
.IP "\fBnet-define\fR \fIfile\fR" 4
.IX Item "net-define file"
Define a virtual network from an \s-1XML\s0 \fIfile\fR, the network is just defined but
not instantiated.
.IP "\fBnet-destroy\fR \fInetwork\fR" 4
.IX Item "net-destroy network"
Destroy a given virtual network specified by its name or \s-1UUID\s0. This takes
effect immediately.
.IP "\fBnet-dumpxml\fR \fInetwork\fR" 4
.IX Item "net-dumpxml network"
Output the virtual network information as an \s-1XML\s0 dump to stdout.
.IP "\fBnet-edit\fR \fInetwork\fR" 4
.IX Item "net-edit network"
Edit the \s-1XML\s0 configuration file for a network.
.Sp
This is equivalent to:
virsh net-dumpxml network > network.xml
edit network.xml
virsh define network.xml
except that it does some error checking.
.Sp
The editor used can be supplied by the \f(CW$EDITOR\fR environment
variable, or if that is not defined defaults to \f(CW\*(C`vi\*(C'\fR.
.IP "\fBnet-list\fR optional \fI\-\-inactive\fR or \fI\-\-all\fR" 4
.IX Item "net-list optional --inactive or --all"
Returns the list of active networks, if \fI\-\-all\fR is specified this will also
include defined but inactive networks, if \fI\-\-inactive\fR is specified only the
inactive ones will be listed.
.IP "\fBnet-name\fR \fInetwork-UUID\fR" 4
.IX Item "net-name network-UUID"
Convert a network \s-1UUID\s0 to network name.
.IP "\fBnet-start\fR \fInetwork\fR" 4
.IX Item "net-start network"
Start a (previously defined) inactive network.
.IP "\fBnet-undefine\fR \fInetwork\fR" 4
.IX Item "net-undefine network"
Undefine the configuration for an inactive network.
.IP "\fBnet-uuid\fR \fInetwork-name\fR" 4
.IX Item "net-uuid network-name"
Convert a network name to network \s-1UUID\s0.
.SH "SECRET COMMMANDS"
.IX Header "SECRET COMMMANDS"
The following commands manipulate \*(L"secrets\*(R" (e.g. passwords, passphrases and
encryption keys). Libvirt can store secrets independently from their use, and
other objects (e.g. volumes or domains) can refer to the secrets for encryption
or possibly other uses. Secrets are identified using an \s-1UUID\s0. See
<http://libvirt.org/formatsecret.html> for documentation of the \s-1XML\s0 format
used to represent properties of secrets.
.IP "\fBsecret-define\fR \fIfile\fR" 4
.IX Item "secret-define file"
Create a secret with the properties specified in \fIfile\fR, with no associated
secret value. If \fIfile\fR does not specify a \s-1UUID\s0, choose one automatically.
If \fIfile\fR specifies an \s-1UUID\s0 of an existing secret, replace its properties by
properties defined in \fIfile\fR, without affecting the secret value.
.IP "\fBsecret-dumpxml\fR \fIsecret\fR" 4
.IX Item "secret-dumpxml secret"
Output properties of \fIsecret\fR (specified by its \s-1UUID\s0) as an \s-1XML\s0 dump to stdout.
.IP "\fBsecret-set-value\fR \fIsecret\fR \fIbase64\fR" 4
.IX Item "secret-set-value secret base64"
Set the value associated with \fIsecret\fR (specified by its \s-1UUID\s0) to the value
Base64\-encoded value \fIbase64\fR.
.IP "\fBsecret-get-value\fR \fIsecret\fR" 4
.IX Item "secret-get-value secret"
Output the value associated with \fIsecret\fR (specified by its \s-1UUID\s0) to stdout,
encoded using Base64.
.IP "\fBsecret-undefine\fR \fIsecret\fR" 4
.IX Item "secret-undefine secret"
Delete a \fIsecret\fR (specified by its \s-1UUID\s0), including the associated value, if
any.
.IP "\fBsecret-list\fR" 4
.IX Item "secret-list"
Output a list of UUIDs of known secrets to stdout.
.SH "ENVIRONMENT"
.IX Header "ENVIRONMENT"
The following environment variables can be set to alter the behaviour
of \f(CW\*(C`virsh\*(C'\fR
.IP "\s-1VIRSH_DEFAULT_CONNECT_URI\s0" 4
.IX Item "VIRSH_DEFAULT_CONNECT_URI"
The hypervisor to connect to by default. Set this to a \s-1URI\s0, in the same
format as accepted by the \fBconnect\fR option.
.IP "LIBVIRT_DEBUG=LEVEL" 4
.IX Item "LIBVIRT_DEBUG=LEVEL"
Turn on verbose debugging of all libvirt \s-1API\s0 calls. Valid levels are
.RS 4
.IP "\(bu" 4
LIBVIRT_DEBUG=1
.Sp
Messages at level \s-1DEBUG\s0 or above
.IP "\(bu" 4
LIBVIRT_DEBUG=2
.Sp
Messages at level \s-1INFO\s0 or above
.IP "\(bu" 4
LIBVIRT_DEBUG=3
.Sp
Messages at level \s-1WARNING\s0 or above
.IP "\(bu" 4
LIBVIRT_DEBUG=4
.Sp
Messages at level \s-1ERROR\s0 or above
.RE
.RS 4
.Sp
For further information about debugging options consult \f(CW\*(C`http://libvirt.org/logging.html\*(C'\fR
.RE
.SH "BUGS"
.IX Header "BUGS"
Report any bugs discovered to the libvirt community via the mailing
list \f(CW\*(C`http://libvirt.org/contact.html\*(C'\fR or bug tracker \f(CW\*(C`http://libvirt.org/bugs.html\*(C'\fR.
Alternatively report bugs to your software distributor / vendor.
.SH "AUTHORS"
.IX Header "AUTHORS"
.Vb 2
\& Andrew Puch <apuch @ redhat.com>
\& Daniel Veillard <veillard @ redhat.com>
\&
\& Based on the xm man page by:
\& Sean Dague <sean at dague dot net>
\& Daniel Stekloff <dsteklof at us dot ibm dot com>
.Ve
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright (C) 2005, 2007\-2009 Red Hat, Inc.
.SH "LICENSE"
.IX Header "LICENSE"
virsh is distributed under the terms of the \s-1GNU\s0 \s-1LGPL\s0 v2+.
This is free software; see the source for copying conditions. There
is \s-1NO\s0 warranty; not even for \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0
\&\s-1PURPOSE\s0
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIvirt\-install\fR\|(1), \fIvirt\-xml\-validate\fR\|(1), \fIvirt\-top\fR\|(1), \fIvirt\-mem\fR\|(1), \fIvirt\-df\fR\|(1), <http://www.libvirt.org/>