mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-10-04 05:44:48 +03:00
Compare commits
30 Commits
v1.2.13
...
v1.2.3-mai
Author | SHA1 | Date | |
---|---|---|---|
|
6f7cfb5ba2 | ||
|
91898c6064 | ||
|
7765ef236c | ||
|
9bdbbd9e7d | ||
|
b0f8b8314e | ||
|
ecb96bcb41 | ||
|
5500d6e67b | ||
|
211566f7fd | ||
|
2c7639f1fe | ||
|
94d18e8f6d | ||
|
4edae3cb96 | ||
|
d109190e49 | ||
|
e0e2f7eafc | ||
|
0c6c56da75 | ||
|
0f82996e30 | ||
|
1343f2377f | ||
|
26f47e6a90 | ||
|
38dce339d3 | ||
|
2a924d876c | ||
|
64700acc91 | ||
|
81edcbb3ca | ||
|
b850e1a95c | ||
|
99497739d1 | ||
|
2f7ea630f0 | ||
|
a45368839f | ||
|
5f109856ff | ||
|
78b239e48e | ||
|
051337b349 | ||
|
44194f22bb | ||
|
77858bf69a |
8
.gitignore
vendored
8
.gitignore
vendored
@@ -40,7 +40,6 @@
|
||||
/build-aux
|
||||
/build-aux/
|
||||
/build/
|
||||
/confdefs.h
|
||||
/config.cache
|
||||
/config.guess
|
||||
/config.h
|
||||
@@ -51,7 +50,6 @@
|
||||
/config.sub
|
||||
/configure
|
||||
/configure.lineno
|
||||
/conftest.*
|
||||
/daemon/*_dispatch.h
|
||||
/daemon/libvirt_qemud
|
||||
/daemon/libvirtd
|
||||
@@ -62,7 +60,6 @@
|
||||
/daemon/libvirtd.pod
|
||||
/daemon/libvirtd.policy
|
||||
/daemon/libvirtd.service
|
||||
/daemon/libvirtd.socket
|
||||
/daemon/test_libvirtd.aug
|
||||
/docs/aclperms.htmlinc
|
||||
/docs/apibuild.py.stamp
|
||||
@@ -77,8 +74,6 @@
|
||||
/examples/object-events/event-test
|
||||
/examples/dominfo/info1
|
||||
/examples/domsuspend/suspend
|
||||
/examples/dommigrate/dommigrate
|
||||
/examples/domtop/domtop
|
||||
/examples/hellolibvirt/hellolibvirt
|
||||
/examples/openauth/openauth
|
||||
/gnulib/lib/*
|
||||
@@ -88,7 +83,7 @@
|
||||
/libtool
|
||||
/libvirt-*.tar.gz
|
||||
/libvirt-[0-9]*
|
||||
/libvirt*.pc
|
||||
/libvirt.pc
|
||||
/libvirt.spec
|
||||
/ltconfig
|
||||
/ltmain.sh
|
||||
@@ -102,7 +97,6 @@
|
||||
/run
|
||||
/sc_*
|
||||
/src/.*.stamp
|
||||
/src/*.pc
|
||||
/src/access/org.libvirt.api.policy
|
||||
/src/access/viraccessapicheck.c
|
||||
/src/access/viraccessapicheck.h
|
||||
|
2
.gnulib
2
.gnulib
Submodule .gnulib updated: c27f1a356f...ce457d622d
2
.mailmap
2
.mailmap
@@ -5,7 +5,6 @@
|
||||
|
||||
<bozzolan@gmail.com> <redshift@gmx.com>
|
||||
<charles_duffy@messageone.com> <charles@dyfis.net>
|
||||
<claudio.bley@gmail.com> <cbley@av-test.de>
|
||||
<dfj@redhat.com> <dfj@dfj.bne.redhat.com>
|
||||
<eblake@redhat.com> <ebb9@byu.net>
|
||||
<gdolley@arpnetworks.com> <gdolley@ucla.edu>
|
||||
@@ -57,4 +56,3 @@ Philipp Hahn <hahn@univention.de>
|
||||
Marco Bozzolan <bozzolan@gmail.com>
|
||||
Marco Bozzolan <redshift@gmx.com>
|
||||
Pritesh Kothari <pritesh.kothari@sun.com>
|
||||
Wang Yufei (James) <james.wangyufei@huawei.com>
|
||||
|
17
AUTHORS.in
17
AUTHORS.in
@@ -8,25 +8,31 @@ Daniel Veillard <veillard@redhat.com> or <daniel@veillard.com>
|
||||
The primary maintainers and people with commit access rights:
|
||||
|
||||
Alex Jia <ajia@redhat.com>
|
||||
Cédric Bosdonnat <cbosdonnat@suse.com>
|
||||
Anthony Liguori <aliguori@us.ibm.com>
|
||||
Chris Lalancette <clalance@redhat.com>
|
||||
Christophe Fergeau <cfergeau@redhat.com>
|
||||
Claudio Bley <claudio.bley@gmail.com>
|
||||
Claudio Bley <cbley@av-test.de>
|
||||
Cole Robinson <crobinso@redhat.com>
|
||||
Daniel Berrange <berrange@redhat.com>
|
||||
Daniel Veillard <veillard@redhat.com>
|
||||
Dave Allan <dallan@redhat.com>
|
||||
Doug Goldstein <cardoe@gentoo.org>
|
||||
Eric Blake <eblake@redhat.com>
|
||||
Gao Feng <gaofeng@cn.fujitsu.com>
|
||||
Guannan Ren <gren@redhat.com>
|
||||
Guido Günther <agx@sigxcpu.org>
|
||||
Ján Tomko <jtomko@redhat.com>
|
||||
Jim Fehlig <jfehlig@suse.com>
|
||||
Jim Meyering <meyering@redhat.com>
|
||||
Jiří Denemark <jdenemar@redhat.com>
|
||||
John Ferlan <jferlan@redhat.com>
|
||||
John Levon <john.levon@sun.com>
|
||||
Laine Stump <laine@redhat.com>
|
||||
Mark McLoughlin <markmc@redhat.com>
|
||||
Martin Kletzander <mkletzan@redhat.com>
|
||||
Matthias Bolte <matthias.bolte@googlemail.com>
|
||||
Michal Prívozník <mprivozn@redhat.com>
|
||||
Osier Yang <jyang@redhat.com>
|
||||
Pavel Hrdina <phrdina@redhat.com>
|
||||
Peter Krempa <pkrempa@redhat.com>
|
||||
Richard W.M. Jones <rjones@redhat.com>
|
||||
@@ -36,18 +42,11 @@ Wen Congyang <wency@cn.fujitsu.com>
|
||||
|
||||
Previous maintainers:
|
||||
|
||||
Anthony Liguori <aliguori@us.ibm.com>
|
||||
Atsushi SAKAI <sakaia@jp.fujitsu.com>
|
||||
Chris Lalancette <clalance@redhat.com>
|
||||
Dan Smith <danms@us.ibm.com>
|
||||
Dave Allan <dallan@redhat.com>
|
||||
Dave Leskovec <dlesko@linux.vnet.ibm.com>
|
||||
Guannan Ren <gren@redhat.com>
|
||||
Jim Meyering <meyering@redhat.com>
|
||||
John Levon <john.levon@sun.com>
|
||||
Justin Clift <jclift@redhat.com>
|
||||
Karel Zak <kzak@redhat.com>
|
||||
Osier Yang <jyang@redhat.com>
|
||||
|
||||
Patches have also been contributed by:
|
||||
|
||||
|
@@ -4286,7 +4286,7 @@ Wed Dec 17 21:45:39 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
Wed Dec 17 21:41:39 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/libvirt_sym.version.in: Remove non-existent symbols
|
||||
* src/libvirt_sym.version.in: Remove non-existant symbols
|
||||
(John Levon)
|
||||
|
||||
Wed Dec 17 21:35:39 GMT 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
@@ -12415,7 +12415,7 @@ Thu Jul 12 11:02:17 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
Thu Jul 12 11:00:17 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* qemud/qemud.c: Add explicit checks for existence of x509
|
||||
* qemud/qemud.c: Add explicit checks for existance of x509
|
||||
certificate & key files to get better error reporting than
|
||||
GNU TLS offers when it can't load a file
|
||||
|
||||
@@ -13276,7 +13276,7 @@ Tue Apr 17 11:30:46 CEST 2007 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
Mon Apr 16 09:11:04 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* qemud/conf.c: Check for existence of QEMU binary path. Fix check
|
||||
* qemud/conf.c: Check for existance of QEMU binary path. Fix check
|
||||
for -no-kqemu flag to work with x86_64 on i386
|
||||
|
||||
Mon Apr 16 09:09:04 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||
@@ -15020,7 +15020,7 @@ Tue Nov 7 16:33:43 CET 2006 Daniel Veillard <veillard@redhat.com>
|
||||
Tue Oct 31 10:31:34 CET 2006 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* src/xend_internal.c: when getting informations about a non
|
||||
existent domain, it is not a good idea to raise the HTTP
|
||||
existant domain, it is not a good idea to raise the HTTP
|
||||
404 GET error, the handling is better done somewhere up in
|
||||
the stack.
|
||||
|
||||
|
91
HACKING
91
HACKING
@@ -14,11 +14,7 @@ General tips for contributing patches
|
||||
(1) Discuss any large changes on the mailing list first. Post patches early and
|
||||
listen to feedback.
|
||||
|
||||
(2) Official upstream repository is kept in git ("git://libvirt.org/libvirt.git")
|
||||
and is browsable along with other libvirt-related repositories (e.g.
|
||||
libvirt-python) online <http://libvirt.org/git/>.
|
||||
|
||||
(3) Post patches in unified diff format, with git rename detection enabled. You
|
||||
(2) Post patches in unified diff format, with git rename detection enabled. You
|
||||
need a one-time setup of:
|
||||
|
||||
git config diff.renames true
|
||||
@@ -61,16 +57,16 @@ Please follow this as close as you can, especially the rebase and git
|
||||
send-email part, as it makes life easier for other developers to review your
|
||||
patch set. One should avoid sending patches as attachments, but rather send
|
||||
them in email body along with commit message. If a developer is sending
|
||||
another version of the patch (e.g. to address review comments), they are
|
||||
advised to note differences to previous versions after the "---" line in the
|
||||
patch so that it helps reviewers but doesn't become part of git history.
|
||||
Moreover, such patch needs to be prefixed correctly with
|
||||
"--subject-prefix=PATCHv2" appended to "git send-email" (substitute "v2" with
|
||||
the correct version if needed though).
|
||||
another version of the patch (e.g. to address review comments), he is advised
|
||||
to note differences to previous versions after the "---" line in the patch so
|
||||
that it helps reviewers but doesn't become part of git history. Moreover, such
|
||||
patch needs to be prefixed correctly with "--subject-prefix=PATCHv2" appended
|
||||
to "git send-email" (substitute "v2" with the correct version if needed
|
||||
though).
|
||||
|
||||
|
||||
|
||||
(4) In your commit message, make the summary line reasonably short (60 characters
|
||||
(3) In your commit message, make the summary line reasonably short (60 characters
|
||||
is typical), followed by a blank line, followed by any longer description of
|
||||
why your patch makes sense. If the patch fixes a regression, and you know what
|
||||
commit introduced the problem, mentioning that is useful. If the patch
|
||||
@@ -82,7 +78,7 @@ is up to you if you want to include or omit them in the commit message.
|
||||
|
||||
|
||||
|
||||
(5) Split large changes into a series of smaller patches, self-contained if
|
||||
(4) Split large changes into a series of smaller patches, self-contained if
|
||||
possible, with an explanation of each patch and an explanation of how the
|
||||
sequence of patches fits together. Moreover, please keep in mind that it's
|
||||
required to be able to compile cleanly (*including* "make check" and "make
|
||||
@@ -93,10 +89,10 @@ things).
|
||||
|
||||
|
||||
|
||||
(6) Make sure your patches apply against libvirt GIT. Developers only follow GIT
|
||||
(5) Make sure your patches apply against libvirt GIT. Developers only follow GIT
|
||||
and don't care much about released versions.
|
||||
|
||||
(7) Run the automated tests on your code before submitting any changes. In
|
||||
(6) Run the automated tests on your code before submitting any changes. In
|
||||
particular, configure with compile warnings set to -Werror. This is done
|
||||
automatically for a git checkout; from a tarball, use:
|
||||
|
||||
@@ -113,7 +109,7 @@ issues, such as leaks or use of uninitialized variables.
|
||||
|
||||
Some tests are skipped by default in a development environment, based on the
|
||||
time they take in comparison to the likelihood that those tests will turn up
|
||||
problems during incremental builds. These tests default to being run when
|
||||
problems during incremental builds. These tests default to being run when when
|
||||
building from a tarball or with the configure option --enable-expensive-tests;
|
||||
you can also force a one-time toggle of these tests by setting
|
||||
VIR_TEST_EXPENSIVE to 0 or 1 at make time, as in:
|
||||
@@ -142,7 +138,7 @@ various tests under gdb or Valgrind.
|
||||
|
||||
|
||||
|
||||
(8) The Valgrind test should produce similar output to "make check". If the output
|
||||
(7) The Valgrind test should produce similar output to "make check". If the output
|
||||
has traces within libvirt API's, then investigation is required in order to
|
||||
determine the cause of the issue. Output such as the following indicates some
|
||||
sort of leak:
|
||||
@@ -218,14 +214,14 @@ to "tests/.valgrind.supp" in order to suppress the warning:
|
||||
|
||||
|
||||
|
||||
(9) Update tests and/or documentation, particularly if you are adding a new
|
||||
(8) Update tests and/or documentation, particularly if you are adding a new
|
||||
feature or changing the output of a program.
|
||||
|
||||
|
||||
|
||||
There is more on this subject, including lots of links to background reading
|
||||
on the subject, on Richard Jones' guide to working with open source projects
|
||||
<http://people.redhat.com/rjones/how-to-supply-code-to-open-source-projects/>.
|
||||
<http://et.redhat.com/~rjones/how-to-supply-code-to-open-source-projects/>.
|
||||
|
||||
|
||||
Code indentation
|
||||
@@ -370,23 +366,16 @@ although use of a semicolon is not currently rejected.
|
||||
|
||||
Curly braces
|
||||
============
|
||||
Omit the curly braces around an "if", "while", "for" etc. body only when both
|
||||
that body and the condition itself occupy a single line. In every other case
|
||||
we require the braces. This ensures that it is trivially easy to identify a
|
||||
single-'statement' loop: each has only one 'line' in its body.
|
||||
Omit the curly braces around an "if", "while", "for" etc. body only when that
|
||||
body occupies a single line. In every other case we require the braces. This
|
||||
ensures that it is trivially easy to identify a single-'statement' loop: each
|
||||
has only one 'line' in its body.
|
||||
|
||||
while (expr) // single line body; {} is forbidden
|
||||
Omitting braces with a single-line body is fine:
|
||||
|
||||
while (expr) // one-line body -> omitting curly braces is ok
|
||||
single_line_stmt();
|
||||
|
||||
while (expr(arg1,
|
||||
arg2)) // indentation makes it obvious it is single line,
|
||||
single_line_stmt(); // {} is optional (not enforced either way)
|
||||
|
||||
while (expr1 &&
|
||||
expr2) { // multi-line, at same indentation, {} required
|
||||
single_line_stmt();
|
||||
}
|
||||
|
||||
However, the moment your loop/if/else body extends on to a second line, for
|
||||
whatever reason (even if it's just an added comment), then you should add
|
||||
braces. Otherwise, it would be too easy to insert a statement just before that
|
||||
@@ -472,33 +461,6 @@ But if negating a complex condition is too ugly, then at least add braces:
|
||||
x = y;
|
||||
}
|
||||
|
||||
Use hanging braces for compound statements: the opening brace of a compound
|
||||
statement should be on the same line as the condition being tested. Only
|
||||
top-level function bodies, nested scopes, and compound structure declarations
|
||||
should ever have { on a line by itself.
|
||||
|
||||
void
|
||||
foo(int a, int b)
|
||||
{ // correct - function body
|
||||
int 2d[][] = {
|
||||
{ // correct - complex initialization
|
||||
1, 2,
|
||||
},
|
||||
};
|
||||
if (a)
|
||||
{ // BAD: compound brace on its own line
|
||||
do_stuff();
|
||||
}
|
||||
{ // correct - nested scope
|
||||
int tmp;
|
||||
if (a < b) { // correct - hanging brace
|
||||
tmp = b;
|
||||
b = a;
|
||||
a = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Preprocessor
|
||||
============
|
||||
@@ -515,7 +477,7 @@ Use parenthesis when checking if a macro is defined, and use indentation to
|
||||
track nesting:
|
||||
|
||||
#if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE)
|
||||
# define fallocate(a, ignored, b, c) posix_fallocate(a, b, c)
|
||||
# define fallocate(a,ignored,b,c) posix_fallocate(a,b,c)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -814,7 +776,7 @@ Variable length string buffer
|
||||
=============================
|
||||
If there is a need for complex string concatenations, avoid using the usual
|
||||
sequence of malloc/strcpy/strcat/snprintf functions and make use of the
|
||||
virBuffer API described in virbuffer.h
|
||||
virBuffer API described in buf.h
|
||||
|
||||
Typical usage is as follows:
|
||||
|
||||
@@ -832,8 +794,11 @@ Typical usage is as follows:
|
||||
|
||||
...
|
||||
|
||||
if (virBufferCheckError(&buf) < 0)
|
||||
if (virBufferError(&buf)) {
|
||||
virBufferFreeAndReset(&buf);
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return virBufferContentAndReset(&buf);
|
||||
}
|
||||
|
@@ -23,8 +23,7 @@ SUBDIRS = . gnulib/lib include src daemon tools docs gnulib/tests \
|
||||
tests po examples/object-events examples/hellolibvirt \
|
||||
examples/dominfo examples/domsuspend examples/apparmor \
|
||||
examples/xml/nwfilter examples/openauth examples/systemtap \
|
||||
tools/wireshark examples/dommigrate \
|
||||
examples/lxcconvert examples/domtop
|
||||
tools/wireshark
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
@@ -38,8 +37,6 @@ EXTRA_DIST = \
|
||||
libvirt.spec libvirt.spec.in \
|
||||
mingw-libvirt.spec.in \
|
||||
libvirt.pc.in \
|
||||
libvirt-qemu.pc.in \
|
||||
libvirt-lxc.pc.in \
|
||||
autobuild.sh \
|
||||
Makefile.nonreentrant \
|
||||
autogen.sh \
|
||||
@@ -49,7 +46,7 @@ EXTRA_DIST = \
|
||||
$(XML_EXAMPLES)
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc
|
||||
pkgconfig_DATA = libvirt.pc
|
||||
|
||||
NEWS: $(top_srcdir)/docs/news.xsl $(top_srcdir)/docs/news.html.in
|
||||
$(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \
|
||||
|
@@ -15,7 +15,7 @@ Specific development tools and versions will be checked for and listed by
|
||||
the bootstrap script.
|
||||
|
||||
Valgrind <http://valgrind.org/> is also highly recommended, if
|
||||
Valgrind supports your architecture.
|
||||
Valgrind supports your architecture. See also README-valgrind.
|
||||
|
||||
While building from a just-cloned source tree may require installing a
|
||||
few prerequisites, later, a plain `git pull && make' should be sufficient.
|
||||
|
@@ -85,7 +85,8 @@ if test -x /usr/bin/i686-w64-mingw32-gcc ; then
|
||||
--host=i686-w64-mingw32 \
|
||||
--prefix="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw" \
|
||||
--enable-expensive-tests \
|
||||
--enable-werror
|
||||
--enable-werror \
|
||||
--without-libvirtd
|
||||
|
||||
make
|
||||
make install
|
||||
@@ -104,7 +105,8 @@ if test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
|
||||
--host=x86_64-w64-mingw32 \
|
||||
--prefix="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw" \
|
||||
--enable-expensive-tests \
|
||||
--enable-werror
|
||||
--enable-werror \
|
||||
--without-libvirtd
|
||||
|
||||
make
|
||||
make install
|
||||
|
@@ -20,10 +20,6 @@ no_git=
|
||||
if test "x$1" = "x--no-git"; then
|
||||
no_git=" $1"
|
||||
shift
|
||||
case "$1 $2" in
|
||||
--gnulib-srcdir=*) no_git="$no_git $1"; shift ;;
|
||||
--gnulib-srcdir\ *) no_git="$no_git $1=$2"; shift; shift;;
|
||||
esac
|
||||
fi
|
||||
if test -z "$NOCONFIGURE" ; then
|
||||
if test "x$1" = "x--system"; then
|
||||
@@ -39,7 +35,7 @@ if test -z "$NOCONFIGURE" ; then
|
||||
echo "Running ./configure with $EXTRA_ARGS $@"
|
||||
else
|
||||
if test -z "$*" && test ! -f "$THEDIR/config.status"; then
|
||||
echo "I am going to run ./configure with no arguments - if you wish"
|
||||
echo "I am going to run ./configure with no arguments - if you wish "
|
||||
echo "to pass any to it, please specify them on the $0 command line."
|
||||
fi
|
||||
fi
|
||||
|
44
bootstrap
44
bootstrap
@@ -1,10 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2014-12-08.12; # UTC
|
||||
scriptversion=2013-12-05.23; # UTC
|
||||
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
# Copyright (C) 2003-2015 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -42,9 +42,6 @@ export LC_ALL
|
||||
|
||||
local_gl_dir=gl
|
||||
|
||||
# Honour $PERL, but work even if there is none
|
||||
PERL="${PERL-perl}"
|
||||
|
||||
me=$0
|
||||
|
||||
usage() {
|
||||
@@ -213,17 +210,7 @@ bootstrap_sync=false
|
||||
use_git=true
|
||||
|
||||
check_exists() {
|
||||
if test "$1" = "--verbose"; then
|
||||
($2 --version </dev/null) >/dev/null 2>&1
|
||||
if test $? -ge 126; then
|
||||
# If not found, run with diagnostics as one may be
|
||||
# presented with env variables to set to find the right version
|
||||
($2 --version </dev/null)
|
||||
fi
|
||||
else
|
||||
($1 --version </dev/null) >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
($1 --version </dev/null) >/dev/null 2>&1
|
||||
test $? -lt 126
|
||||
}
|
||||
|
||||
@@ -421,7 +408,7 @@ sort_ver() { # sort -V is not generally available
|
||||
get_version() {
|
||||
app=$1
|
||||
|
||||
$app --version >/dev/null 2>&1 || { $app --version; return 1; }
|
||||
$app --version >/dev/null 2>&1 || return 1
|
||||
|
||||
$app --version 2>&1 |
|
||||
sed -n '# Move version to start of line.
|
||||
@@ -459,7 +446,6 @@ check_versions() {
|
||||
test "$appvar" = TAR && appvar=AMTAR
|
||||
case $appvar in
|
||||
GZIP) ;; # Do not use $GZIP: it contains gzip options.
|
||||
PERL::*) ;; # Keep perl modules as-is
|
||||
*) eval "app=\${$appvar-$app}" ;;
|
||||
esac
|
||||
|
||||
@@ -477,22 +463,11 @@ check_versions() {
|
||||
ret=1
|
||||
continue
|
||||
} ;;
|
||||
# Another check is for perl modules. These can be written as
|
||||
# e.g. perl::XML::XPath in case of XML::XPath module, etc.
|
||||
perl::*)
|
||||
# Extract module name
|
||||
app="${app#perl::}"
|
||||
if ! $PERL -m"$app" -e 'exit 0' >/dev/null 2>&1; then
|
||||
warn_ "Error: perl module '$app' not found"
|
||||
ret=1
|
||||
fi
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
if [ "$req_ver" = "-" ]; then
|
||||
# Merely require app to exist; not all prereq apps are well-behaved
|
||||
# so we have to rely on $? rather than get_version.
|
||||
if ! check_exists --verbose $app; then
|
||||
if ! check_exists $app; then
|
||||
warn_ "Error: '$app' not found"
|
||||
ret=1
|
||||
fi
|
||||
@@ -623,8 +598,8 @@ case ${GNULIB_SRCDIR--} in
|
||||
# Note that $use_git is necessarily true in this case.
|
||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule init -- "$gnulib_path" || exit $?
|
||||
git submodule update -- "$gnulib_path" || exit $?
|
||||
git submodule init || exit $?
|
||||
git submodule update || exit $?
|
||||
|
||||
elif [ ! -d "$gnulib_path" ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
@@ -653,14 +628,13 @@ case ${GNULIB_SRCDIR--} in
|
||||
# This fallback allows at least git 1.5.5.
|
||||
if test -f "$gnulib_path"/gnulib-tool; then
|
||||
# Since file already exists, assume submodule init already complete.
|
||||
git submodule update -- "$gnulib_path" || exit $?
|
||||
git submodule update || exit $?
|
||||
else
|
||||
# Older git can't clone into an empty directory.
|
||||
rmdir "$gnulib_path" 2>/dev/null
|
||||
git clone --reference "$GNULIB_SRCDIR" \
|
||||
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
||||
&& git submodule init -- "$gnulib_path" \
|
||||
&& git submodule update -- "$gnulib_path" \
|
||||
&& git submodule init && git submodule update \
|
||||
|| exit $?
|
||||
fi
|
||||
fi
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# Bootstrap configuration.
|
||||
|
||||
# Copyright (C) 2010-2014 Red Hat, Inc.
|
||||
# Copyright (C) 2010-2013 Red Hat, Inc.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -35,7 +35,6 @@ clock-time
|
||||
close
|
||||
connect
|
||||
configmake
|
||||
count-leading-zeros
|
||||
count-one-bits
|
||||
crypto/md5
|
||||
crypto/sha256
|
||||
@@ -210,7 +209,6 @@ gzip -
|
||||
libtool -
|
||||
patch -
|
||||
perl 5.5
|
||||
perl::XML::XPath -
|
||||
pkg-config -
|
||||
python-config -
|
||||
rpcgen -
|
||||
|
@@ -27,20 +27,13 @@ my $ret = 0;
|
||||
my $incomment = 0;
|
||||
|
||||
foreach my $file (@ARGV) {
|
||||
# Per-file variables for multiline Curly Bracket (cb_) check
|
||||
my $cb_linenum = 0;
|
||||
my $cb_code = "";
|
||||
my $cb_scolon = 0;
|
||||
|
||||
open FILE, $file;
|
||||
|
||||
while (defined (my $line = <FILE>)) {
|
||||
my $data = $line;
|
||||
# For temporary modifications
|
||||
my $tmpdata;
|
||||
|
||||
# Kill any quoted , ; = or "
|
||||
$data =~ s/'[";,=]'/'X'/g;
|
||||
# Kill any quoted , ; or "
|
||||
$data =~ s/'[";,]'/'X'/g;
|
||||
|
||||
# Kill any quoted strings
|
||||
$data =~ s,"([^\\\"]|\\.)*","XXX",g;
|
||||
@@ -84,17 +77,13 @@ foreach my $file (@ARGV) {
|
||||
#
|
||||
# foo (*bar, wizz);
|
||||
#
|
||||
# We also don't want to spoil the $data so it can be used
|
||||
# later on.
|
||||
$tmpdata = $data;
|
||||
while ($tmpdata =~ /(\w+)\s\((?!\*)/) {
|
||||
while ($data =~ /(\w+)\s\((?!\*)/) {
|
||||
my $kw = $1;
|
||||
|
||||
# Allow space after keywords only
|
||||
if ($kw =~ /^(if|for|while|switch|return)$/) {
|
||||
$tmpdata =~ s/($kw\s\()/XXX(/;
|
||||
$data =~ s/($kw\s\()/XXX(/;
|
||||
} else {
|
||||
print "Whitespace after non-keyword:\n";
|
||||
print "$file:$.: $line";
|
||||
$ret = 1;
|
||||
last;
|
||||
@@ -103,26 +92,26 @@ foreach my $file (@ARGV) {
|
||||
|
||||
# Require whitespace immediately after keywords,
|
||||
# but none after the opening bracket
|
||||
if ($data =~ /\b(if|for|while|switch|return)\(/ ||
|
||||
$data =~ /\b(if|for|while|switch|return)\s+\(\s/) {
|
||||
print "No whitespace after keyword:\n";
|
||||
while ($data =~ /\b(if|for|while|switch|return)\(/ ||
|
||||
$data =~ /\b(if|for|while|switch|return)\s+\(\s/) {
|
||||
print "$file:$.: $line";
|
||||
$ret = 1;
|
||||
last;
|
||||
}
|
||||
|
||||
# Forbid whitespace between )( of a function typedef
|
||||
if ($data =~ /\(\*\w+\)\s+\(/) {
|
||||
print "Whitespace between ')' and '(':\n";
|
||||
while ($data =~ /\(\*\w+\)\s+\(/) {
|
||||
print "$file:$.: $line";
|
||||
$ret = 1;
|
||||
last;
|
||||
}
|
||||
|
||||
# Forbid whitespace following ( or prior to )
|
||||
if ($data =~ /\S\s+\)/ ||
|
||||
$data =~ /\(\s+\S/) {
|
||||
print "Whitespace after '(' or before ')':\n";
|
||||
while ($data =~ /\S\s+\)/ ||
|
||||
$data =~ /\(\s+\S/) {
|
||||
print "$file:$.: $line";
|
||||
$ret = 1;
|
||||
last;
|
||||
}
|
||||
|
||||
# Forbid whitespace before ";" or ",". Things like below are allowed:
|
||||
@@ -135,67 +124,36 @@ foreach my $file (@ARGV) {
|
||||
# errno == EINTR)
|
||||
# ;
|
||||
#
|
||||
if ($data =~ /[^;\s]\s+[;,]/) {
|
||||
print "Whitespace before (semi)colon:\n";
|
||||
while ($data =~ /[^;\s]\s+[;,]/) {
|
||||
print "$file:$.: $line";
|
||||
$ret = 1;
|
||||
last;
|
||||
}
|
||||
|
||||
# Require EOL, macro line continuation, or whitespace after ";".
|
||||
# Allow "for (;;)" as an exception.
|
||||
if ($data =~ /;[^ \\\n;)]/) {
|
||||
print "Invalid character after semicolon:\n";
|
||||
while ($data =~ /;[^ \\\n;)]/) {
|
||||
print "$file:$.: $line";
|
||||
$ret = 1;
|
||||
last;
|
||||
}
|
||||
|
||||
# Require EOL, space, or enum/struct end after comma.
|
||||
if ($data =~ /,[^ \\\n)}]/) {
|
||||
print "Invalid character after comma:\n";
|
||||
while ($data =~ /,[^ \\\n)}]/) {
|
||||
print "$file:$.: $line";
|
||||
$ret = 1;
|
||||
last;
|
||||
}
|
||||
|
||||
# Require spaces around assignment '=', compounds and '=='
|
||||
# with the exception of virAssertCmpInt()
|
||||
$tmpdata = $data;
|
||||
$tmpdata =~ s/(virAssertCmpInt\(.* ).?=,/$1op,/;
|
||||
if ($tmpdata =~ /[^ ]\b[!<>&|\-+*\/%\^=]?=[^=]/ ||
|
||||
$tmpdata =~ /=[^= \\\n]/) {
|
||||
print "Spacing around '=' or '==':\n";
|
||||
while ($data =~ /[^!<>&|\-+*\/%\^'= ]=\+[^=]/ ||
|
||||
$data =~ /[^!<>&|\-+*\/%\^'=]=[^= \\\n]/ ||
|
||||
$data =~ /[\S]==/ ||
|
||||
($data =~ /==[^\s,]/ && $data !~ /[\s]virAssertCmpInt\(/)) {
|
||||
print "$file:$.: $line";
|
||||
$ret = 1;
|
||||
}
|
||||
|
||||
# One line conditional statements with one line bodies should
|
||||
# not use curly brackets.
|
||||
if ($data =~ /^\s*(if|while|for)\b.*\{$/) {
|
||||
$cb_linenum = $.;
|
||||
$cb_code = $line;
|
||||
$cb_scolon = 0;
|
||||
}
|
||||
|
||||
# We need to check for exactly one semicolon inside the body,
|
||||
# because empty statements (e.g. with comment only) are
|
||||
# allowed
|
||||
if ($cb_linenum == $. - 1 && $data =~ /^[^;]*;[^;]*$/) {
|
||||
$cb_code .= $line;
|
||||
$cb_scolon = 1;
|
||||
}
|
||||
|
||||
if ($data =~ /^\s*}\s*$/ &&
|
||||
$cb_linenum == $. - 2 &&
|
||||
$cb_scolon) {
|
||||
|
||||
print "Curly brackets around single-line body:\n";
|
||||
print "$file:$cb_linenum-$.:\n$cb_code$line";
|
||||
$ret = 1;
|
||||
|
||||
# There _should_ be no need to reset the values; but to
|
||||
# keep my inner peace...
|
||||
$cb_linenum = 0;
|
||||
$cb_scolon = 0;
|
||||
$cb_code = "";
|
||||
last;
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
|
174
cfg.mk
174
cfg.mk
@@ -90,7 +90,7 @@ endif
|
||||
|
||||
# Files that should never cause syntax check failures.
|
||||
VC_LIST_ALWAYS_EXCLUDE_REGEX = \
|
||||
(^(HACKING|docs/(news\.html\.in|.*\.patch))|\.(po|fig|gif|ico|png))$$
|
||||
(^(HACKING|docs/(news\.html\.in|.*\.patch))|\.po)$$
|
||||
|
||||
# Functions like free() that are no-ops on NULL arguments.
|
||||
useless_free_options = \
|
||||
@@ -303,7 +303,7 @@ sc_flags_debug:
|
||||
# than d). The existence of long long, and of documentation about
|
||||
# flags, makes the regex in the third test slightly harder.
|
||||
sc_flags_usage:
|
||||
@test "$$(cat $(srcdir)/include/libvirt/libvirt-domain.h \
|
||||
@test "$$(cat $(srcdir)/include/libvirt/libvirt.h.in \
|
||||
$(srcdir)/include/libvirt/virterror.h \
|
||||
$(srcdir)/include/libvirt/libvirt-qemu.h \
|
||||
$(srcdir)/include/libvirt/libvirt-lxc.h \
|
||||
@@ -421,12 +421,6 @@ sc_prohibit_gethostname:
|
||||
halt='use virGetHostname, not gethostname' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit_readdir:
|
||||
@prohibit='\breaddir *\(' \
|
||||
exclude='exempt from syntax-check' \
|
||||
halt='use virDirRead, not readdir' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit_gettext_noop:
|
||||
@prohibit='gettext_noop *\(' \
|
||||
halt='use N_, not gettext_noop' \
|
||||
@@ -568,7 +562,7 @@ sc_avoid_attribute_unused_in_header:
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit_int_ijk:
|
||||
@prohibit='\<(int|unsigned) ([^(=]* )*(i|j|k)\>(\s|,|;)' \
|
||||
@prohibit='\<(int|unsigned) ([^(]* )*(i|j|k)\>(\s|,|;)' \
|
||||
halt='use size_t, not int/unsigned int for loop vars i, j, k' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
@@ -584,12 +578,6 @@ sc_prohibit_loop_var_decl:
|
||||
halt='declare loop iterators outside the for statement' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Use 'bool', not 'int', when assigning true or false
|
||||
sc_prohibit_int_assign_bool:
|
||||
@prohibit='\<int\>.*= *(true|false)' \
|
||||
halt='use bool type for boolean values' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Many of the function names below came from this filter:
|
||||
# git grep -B2 '\<_('|grep -E '\.c- *[[:alpha:]_][[:alnum:]_]* ?\(.*[,;]$' \
|
||||
# |sed 's/.*\.c- *//'|perl -pe 's/ ?\(.*//'|sort -u \
|
||||
@@ -631,7 +619,7 @@ sc_libvirt_unmarked_diagnostics:
|
||||
$(_sc_search_regexp)
|
||||
@{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \
|
||||
grep -A1 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
|
||||
| $(SED) 's/_("\([^\"]\|\\.\)\+"//;s/[ ]"%s"//' \
|
||||
| sed 's/_("\([^\"]\|\\.\)\+"//;s/[ ]"%s"//' \
|
||||
| grep '[ ]"' && \
|
||||
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
|
||||
exit 1; } || :
|
||||
@@ -656,7 +644,7 @@ sc_prohibit_newline_at_end_of_diagnostic:
|
||||
sc_prohibit_diagnostic_without_format:
|
||||
@{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \
|
||||
grep -A2 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
|
||||
| $(SED) -rn -e ':l; /[,"]$$/ {N;b l;}' \
|
||||
| sed -rn -e ':l; /[,"]$$/ {N;b l;}' \
|
||||
-e '/(xenapiSessionErrorHandler|vah_(error|warning))/d' \
|
||||
-e '/\<$(func_re) *\([^"]*"([^%"]|"\n[^"]*")*"[,)]/p' \
|
||||
| grep -vE 'VIR_ERROR' && \
|
||||
@@ -678,7 +666,7 @@ sc_prohibit_useless_translation:
|
||||
# or \n on one side of the split.
|
||||
sc_require_whitespace_in_translation:
|
||||
@grep -n -A1 '"$$' $$($(VC_LIST_EXCEPT)) \
|
||||
| $(SED) -ne ':l; /"$$/ {N;b l;}; s/"\n[^"]*"/""/g; s/\\n/ /g' \
|
||||
| sed -ne ':l; /"$$/ {N;b l;}; s/"\n[^"]*"/""/g; s/\\n/ /g' \
|
||||
-e '/_(.*[^\ ]""[^\ ]/p' | grep . && \
|
||||
{ echo '$(ME): missing whitespace at line split' 1>&2; \
|
||||
exit 1; } || :
|
||||
@@ -686,7 +674,7 @@ sc_require_whitespace_in_translation:
|
||||
# Enforce recommended preprocessor indentation style.
|
||||
sc_preprocessor_indentation:
|
||||
@if cppi --version >/dev/null 2>&1; then \
|
||||
$(VC_LIST_EXCEPT) | grep -E '\.[ch](\.in)?$$' | xargs cppi -a -c \
|
||||
$(VC_LIST_EXCEPT) | grep '\.[ch]$$' | xargs cppi -a -c \
|
||||
|| { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
|
||||
exit 1; }; \
|
||||
else \
|
||||
@@ -698,11 +686,11 @@ sc_preprocessor_indentation:
|
||||
sc_spec_indentation:
|
||||
@if cppi --version >/dev/null 2>&1; then \
|
||||
for f in $$($(VC_LIST_EXCEPT) | grep '\.spec\.in$$'); do \
|
||||
$(SED) -e 's|#|// #|; s|%ifn*\(arch\)* |#if a // |' \
|
||||
sed -e 's|#|// #|; s|%ifn*\(arch\)* |#if a // |' \
|
||||
-e 's/%\(else\|endif\|define\)/#\1/' \
|
||||
-e 's/^\( *\)\1\1\1#/#\1/' \
|
||||
-e 's|^\( *[^#/ ]\)|// \1|; s|^\( */[^/]\)|// \1|' $$f \
|
||||
| cppi -a -c 2>&1 | $(SED) "s|standard input|$$f|"; \
|
||||
| cppi -a -c 2>&1 | sed "s|standard input|$$f|"; \
|
||||
done | { if grep . >&2; then false; else :; fi; } \
|
||||
|| { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
|
||||
exit 1; }; \
|
||||
@@ -772,17 +760,17 @@ sc_prohibit_gettext_markup:
|
||||
# lower-level code must not include higher-level headers.
|
||||
cross_dirs=$(patsubst $(srcdir)/src/%.,%,$(wildcard $(srcdir)/src/*/.))
|
||||
cross_dirs_re=($(subst / ,/|,$(cross_dirs)))
|
||||
mid_dirs=access|conf|cpu|locking|network|node_device|rpc|security|storage
|
||||
sc_prohibit_cross_inclusion:
|
||||
@for dir in $(cross_dirs); do \
|
||||
case $$dir in \
|
||||
util/) safe="util";; \
|
||||
access/ | conf/) safe="($$dir|conf|util)";; \
|
||||
locking/) safe="($$dir|util|conf|rpc)";; \
|
||||
cpu/| network/| node_device/| rpc/| security/| storage/) \
|
||||
safe="($$dir|util|conf|storage)";; \
|
||||
xenapi/ | xenconfig/ ) safe="($$dir|util|conf|xen)";; \
|
||||
*) safe="($$dir|$(mid_dirs)|util)";; \
|
||||
locking/) \
|
||||
safe="($$dir|util|conf|rpc)";; \
|
||||
cpu/ | locking/ | network/ | rpc/ | security/) \
|
||||
safe="($$dir|util|conf)";; \
|
||||
xenapi/ | xenxs/ ) safe="($$dir|util|conf|xen)";; \
|
||||
qemu/ ) safe="($$dir|util|conf|cpu|network|locking|rpc|security|storage)";; \
|
||||
*) safe="($$dir|util|conf|cpu|network|locking|rpc|security)";; \
|
||||
esac; \
|
||||
in_vc_files="^src/$$dir" \
|
||||
prohibit='^# *include .$(cross_dirs_re)' \
|
||||
@@ -795,7 +783,7 @@ sc_prohibit_cross_inclusion:
|
||||
# elements added to the enum by using a _LAST marker.
|
||||
sc_require_enum_last_marker:
|
||||
@grep -A1 -nE '^[^#]*VIR_ENUM_IMPL *\(' $$($(VC_LIST_EXCEPT)) \
|
||||
| $(SED) -ne '/VIR_ENUM_IMPL[^,]*,$$/N' \
|
||||
| sed -ne '/VIR_ENUM_IMPL[^,]*,$$/N' \
|
||||
-e '/VIR_ENUM_IMPL[^,]*,[^,]*[^_,][^L,][^A,][^S,][^T,],/p' \
|
||||
-e '/VIR_ENUM_IMPL[^,]*,[^,]\{0,4\},/p' \
|
||||
| grep . && \
|
||||
@@ -916,96 +904,22 @@ sc_require_space_before_label:
|
||||
halt="Top-level labels should be indented by one space" \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Doesn't catch all cases of mismatched braces across if-else, but it helps
|
||||
sc_require_if_else_matching_braces:
|
||||
@prohibit='( else( if .*\))? {|} else( if .*\))?$$)' \
|
||||
in_vc_files='\.[chx]$$' \
|
||||
halt="if one side of if-else uses {}, both sides must use it" \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_curly_braces_style:
|
||||
@files=$$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); \
|
||||
if $(GREP) -nHP \
|
||||
'^\s*(?!([a-zA-Z_]*for_?each[a-zA-Z_]*) ?\()([_a-zA-Z0-9]+( [_a-zA-Z0-9]+)* ?\()?(\*?[_a-zA-Z0-9]+(,? \*?[_a-zA-Z0-9\[\]]+)+|void)\) ?\{' \
|
||||
$$files; then \
|
||||
echo '$(ME): Non-K&R style used for curly braces around' \
|
||||
'function body, see HACKING' 1>&2; exit 1; \
|
||||
fi; \
|
||||
if $(GREP) -A1 -En ' ((if|for|while|switch) \(|(else|do)\b)[^{]*$$'\
|
||||
$$files | $(GREP) '^[^ ]*- *{'; then \
|
||||
echo '$(ME): Use hanging braces for compound statements,' \
|
||||
'see HACKING' 1>&2; exit 1; \
|
||||
fi
|
||||
@files=$$($(VC_LIST_EXCEPT) | grep '\.[ch]$$'); \
|
||||
$(GREP) -nHP \
|
||||
'^\s*(?!([a-zA-Z_]*for_?each[a-zA-Z_]*) ?\()([_a-zA-Z0-9]+( [_a-zA-Z0-9]+)* ?\()?(\*?[_a-zA-Z0-9]+(,? \*?[_a-zA-Z0-9\[\]]+)+|void)\) ?\{' \
|
||||
$$files && { echo '$(ME): Non-K&R style used for curly' \
|
||||
'braces around function body, see' \
|
||||
'HACKING' 1>&2; exit 1; } || :
|
||||
|
||||
sc_prohibit_windows_special_chars_in_filename:
|
||||
@files=$$($(VC_LIST_EXCEPT) | grep '[:*?"<>|]'); \
|
||||
test -n "$$files" && { echo '$(ME): Windows special chars' \
|
||||
'in filename not allowed:' 1>&2; echo $$files 1>&2; exit 1; } || :
|
||||
|
||||
sc_prohibit_mixed_case_abbreviations:
|
||||
@prohibit='Pci|Usb|Scsi' \
|
||||
in_vc_files='\.[ch]$$' \
|
||||
halt='Use PCI, USB, SCSI, not Pci, Usb, Scsi' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Require #include <locale.h> in all files that call setlocale()
|
||||
sc_require_locale_h:
|
||||
@require='include.*locale\.h' \
|
||||
containing='setlocale *(' \
|
||||
halt='setlocale() requires <locale.h>' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit_empty_first_line:
|
||||
@awk 'BEGIN { fail=0; } \
|
||||
FNR == 1 { if ($$0 == "") { print FILENAME ":1:"; fail=1; } } \
|
||||
END { if (fail == 1) { \
|
||||
print "$(ME): Prohibited empty first line" > "/dev/stderr"; \
|
||||
} exit fail; }' $$($(VC_LIST_EXCEPT));
|
||||
|
||||
sc_prohibit_paren_brace:
|
||||
@prohibit='\)\{$$' \
|
||||
in_vc_files='\.[chx]$$' \
|
||||
halt='Put space between closing parenthesis and opening brace' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# C guarantees that static variables are zero initialized, and some compilers
|
||||
# waste space by sticking explicit initializers in .data instead of .bss
|
||||
sc_prohibit_static_zero_init:
|
||||
@prohibit='\bstatic\b.*= *(0[^xX0-9]|NULL|false)' \
|
||||
in_vc_files='\.[chx](\.in)?$$' \
|
||||
halt='static variables do not need explicit zero initialization'\
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# FreeBSD exports the "devname" symbol which produces a warning.
|
||||
sc_prohibit_devname:
|
||||
@prohibit='\bdevname\b' \
|
||||
exclude='sc_prohibit_devname' \
|
||||
halt='avoid using 'devname' as FreeBSD exports the symbol' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit_system_error_with_vir_err:
|
||||
@prohibit='\bvirReportSystemError *\(VIR_ERR_' \
|
||||
halt='do not use virReportSystemError with VIR_ERR_* error codes' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# Rule to prohibit usage of virXXXFree within library, daemon, remote, etc.
|
||||
# functions. There's a corresponding exclude to allow usage within tests,
|
||||
# docs, examples, tools, src/libvirt-*.c, and include/libvirt/libvirt-*.h
|
||||
sc_prohibit_virXXXFree:
|
||||
@prohibit='\bvir(Domain|Network|NodeDevice|StorageVol|StoragePool|Stream|Secret|NWFilter|Interface|DomainSnapshot)Free\b' \
|
||||
exclude='sc_prohibit_virXXXFree' \
|
||||
halt='avoid using 'virXXXFree', use 'virObjectUnref' instead' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
sc_prohibit_sysconf_pagesize:
|
||||
@prohibit='sysconf\(_SC_PAGESIZE' \
|
||||
halt='use virGetSystemPageSize[KB] instead of sysconf(_SC_PAGESIZE)' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# We don't use this feature of maint.mk.
|
||||
prev_version_file = /dev/null
|
||||
|
||||
ifneq ($(_gl-Makefile),)
|
||||
ifeq (0,$(MAKELEVEL))
|
||||
_curr_status = .git-module-status
|
||||
# The sed filter accommodates those who check out on a commit from which
|
||||
@@ -1018,7 +932,7 @@ ifeq (0,$(MAKELEVEL))
|
||||
# b653eda3ac4864de205419d9f41eec267cb89eeb
|
||||
#
|
||||
# Keep this logic in sync with autogen.sh.
|
||||
_submodule_hash = $(SED) 's/^[ +-]//;s/ .*//'
|
||||
_submodule_hash = sed 's/^[ +-]//;s/ .*//'
|
||||
_update_required := $(shell \
|
||||
cd '$(srcdir)'; \
|
||||
test -d .git || { echo 0; exit; }; \
|
||||
@@ -1038,7 +952,6 @@ ifeq (0,$(MAKELEVEL))
|
||||
maint.mk Makefile: _autogen
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# It is necessary to call autogen any time gnulib changes. Autogen
|
||||
# reruns configure, then we regenerate all Makefiles at once.
|
||||
@@ -1048,14 +961,12 @@ _autogen:
|
||||
./config.status
|
||||
|
||||
# regenerate HACKING as part of the syntax-check
|
||||
ifneq ($(_gl-Makefile),)
|
||||
syntax-check: $(top_srcdir)/HACKING bracket-spacing-check
|
||||
endif
|
||||
|
||||
bracket-spacing-check:
|
||||
$(AM_V_GEN)files=`$(VC_LIST) | grep '\.c$$'`; \
|
||||
$(PERL) $(top_srcdir)/build-aux/bracket-spacing.pl $$files || \
|
||||
{ echo '$(ME): incorrect formatting, see HACKING for rules' 1>&2; \
|
||||
{ echo '$(ME): incorrect whitespace, see HACKING for rules' 1>&2; \
|
||||
exit 1; }
|
||||
|
||||
# sc_po_check can fail if generated files are not built first
|
||||
@@ -1073,7 +984,7 @@ $(srcdir)/src/remote/remote_client_bodies.h: $(srcdir)/src/remote/remote_protoco
|
||||
# List all syntax-check exemptions:
|
||||
exclude_file_name_regexp--sc_avoid_strcase = ^tools/virsh\.h$$
|
||||
|
||||
_src1=libvirt-stream|fdstream|qemu/qemu_monitor|util/(vircommand|virfile)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller|locking/lock_daemon
|
||||
_src1=libvirt|fdstream|qemu/qemu_monitor|util/(vircommand|virfile)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller|locking/lock_daemon
|
||||
_test1=shunloadtest|virnettlscontexttest|virnettlssessiontest|vircgroupmock
|
||||
exclude_file_name_regexp--sc_avoid_write = \
|
||||
^(src/($(_src1))|daemon/libvirtd|tools/virsh-console|tests/($(_test1)))\.c$$
|
||||
@@ -1100,13 +1011,13 @@ exclude_file_name_regexp--sc_prohibit_asprintf = \
|
||||
^(bootstrap.conf$$|src/util/virstring\.[ch]$$|tests/vircgroupmock\.c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_strdup = \
|
||||
^(docs/|examples/|src/util/virstring\.c|tests/vir(netserverclient|cgroup)mock.c$$)
|
||||
^(docs/|examples/|src/util/virstring\.c|tests/virnetserverclientmock.c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_close = \
|
||||
(\.p[yl]$$|\.spec\.in$$|^docs/|^(src/util/virfile\.c|src/libvirt-stream\.c|tests/vir(cgroup|pci)mock\.c)$$)
|
||||
(\.p[yl]$$|^docs/|^(src/util/virfile\.c|src/libvirt\.c|tests/vir(cgroup|pci)mock\.c)$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
|
||||
(^tests/(qemuhelp|nodeinfo|virpcitest)data/|\.diff$$)
|
||||
(^tests/(qemuhelp|nodeinfo|virpcitest)data/|\.(gif|ico|png|diff)$$)
|
||||
|
||||
_src2=src/(util/vircommand|libvirt|lxc/lxc_controller|locking/lock_daemon)
|
||||
exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
|
||||
@@ -1124,7 +1035,7 @@ exclude_file_name_regexp--sc_prohibit_nonreentrant = \
|
||||
^((po|tests)/|docs/.*(py|html\.in)|run.in$$|tools/wireshark/util/genxdrstub\.pl$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_raw_allocation = \
|
||||
^(docs/hacking\.html\.in|src/util/viralloc\.[ch]|examples/.*|tests/(securityselinuxhelper|vircgroupmock)\.c|tools/wireshark/src/packet-libvirt\.c)$$
|
||||
^(docs/hacking\.html\.in)|(src/util/viralloc\.[ch]|examples/.*|tests/securityselinuxhelper\.c|tests/vircgroupmock\.c|tools/wireshark/src/packet-libvirt.c)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_readlink = \
|
||||
^src/(util/virutil|lxc/lxc_container)\.c$$
|
||||
@@ -1132,11 +1043,12 @@ exclude_file_name_regexp--sc_prohibit_readlink = \
|
||||
exclude_file_name_regexp--sc_prohibit_setuid = ^src/util/virutil\.c$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_sprintf = \
|
||||
(^docs/hacking\.html\.in|\.stp|\.pl)$$
|
||||
^(docs/hacking\.html\.in)|(examples/systemtap/.*stp)|(src/dtrace2systemtap\.pl)|(src/rpc/gensystemtap\.pl)|(tools/wireshark/util/genxdrstub\.pl)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_strncpy = ^src/util/virstring\.c$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_strtol = ^examples/dom.*/.*\.c$$
|
||||
exclude_file_name_regexp--sc_prohibit_strtol = \
|
||||
^(src/(util/virsexpr|(vbox|xen|xenxs)/.*)\.c)|(examples/domsuspend/suspend.c)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/virxml\.c$$
|
||||
|
||||
@@ -1151,7 +1063,7 @@ exclude_file_name_regexp--sc_require_config_h_first = \
|
||||
^(examples/|tools/virsh-edit\.c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_trailing_blank = \
|
||||
/qemuhelpdata/|/sysinfodata/.*\.data|/nodeinfodata/.*\.cpuinfo$$
|
||||
(/qemuhelpdata/|/sysinfodata/.*\.data|\.(fig|gif|ico|png)$$)
|
||||
|
||||
exclude_file_name_regexp--sc_unmarked_diagnostics = \
|
||||
^(docs/apibuild.py|tests/virt-aa-helper-test)$$
|
||||
@@ -1177,21 +1089,3 @@ exclude_file_name_regexp--sc_prohibit_getenv = \
|
||||
|
||||
exclude_file_name_regexp--sc_avoid_attribute_unused_in_header = \
|
||||
^src/util/virlog\.h$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_mixed_case_abbreviations = \
|
||||
^src/(vbox/vbox_CAPI.*.h|esx/esx_vi.(c|h)|esx/esx_storage_backend_iscsi.c)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_empty_first_line = \
|
||||
^(README|daemon/THREADS\.txt|src/esx/README|docs/library.xen|tests/vmwareverdata/fusion-5.0.3.txt|tests/nodeinfodata/linux-raspberrypi/cpu/offline)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_useless_translation = \
|
||||
^tests/virpolkittest.c
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_devname = \
|
||||
^(tools/virsh.pod|cfg.mk|docs/.*)$$
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_virXXXFree = \
|
||||
^(docs/|tests/|examples/|tools/|cfg.mk|src/test/test_driver.c|src/libvirt_public.syms|include/libvirt/libvirt-(domain|network|nodedev|storage|stream|secret|nwfilter|interface|domain-snapshot).h|src/libvirt-(domain|qemu|network|nodedev|storage|stream|secret|nwfilter|interface|domain-snapshot).c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_sysconf_pagesize = \
|
||||
^(cfg\.mk|src/util/virutil\.c)$$
|
||||
|
190
configure.ac
190
configure.ac
@@ -1,6 +1,6 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
dnl Copyright (C) 2005-2015 Red Hat, Inc.
|
||||
dnl Copyright (C) 2005-2014 Red Hat, Inc.
|
||||
dnl
|
||||
dnl This library is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Lesser General Public
|
||||
@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU Lesser General Public
|
||||
dnl License along with this library. If not, see
|
||||
dnl <http://www.gnu.org/licenses/>.
|
||||
|
||||
AC_INIT([libvirt], [1.2.13], [libvir-list@redhat.com], [], [http://libvirt.org])
|
||||
AC_INIT([libvirt], [1.2.3], [libvir-list@redhat.com], [], [http://libvirt.org])
|
||||
AC_CONFIG_SRCDIR([src/libvirt.c])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
@@ -175,7 +175,6 @@ case $host in
|
||||
*-*-linux*) with_linux=yes ;;
|
||||
*-*-darwin*) with_osx=yes ;;
|
||||
*-*-freebsd*) with_freebsd=yes ;;
|
||||
*-*-mingw* | *-*-msvc* ) with_win=yes ;;
|
||||
esac
|
||||
|
||||
if test $with_linux = no; then
|
||||
@@ -195,11 +194,6 @@ fi
|
||||
AM_CONDITIONAL([WITH_LINUX], [test "$with_linux" = "yes"])
|
||||
AM_CONDITIONAL([WITH_FREEBSD], [test "$with_freebsd" = "yes"])
|
||||
|
||||
# We don't support the daemon yet
|
||||
if test "$with_win" = "yes" ; then
|
||||
with_libvirtd=no
|
||||
fi
|
||||
|
||||
# The daemon requires remote support. Likewise, if we are not using
|
||||
# RPC, we don't need several libraries.
|
||||
if test "$with_remote" = "no" ; then
|
||||
@@ -275,7 +269,7 @@ dnl and various less common threadsafe functions
|
||||
AC_CHECK_FUNCS_ONCE([cfmakeraw fallocate geteuid getgid getgrnam_r \
|
||||
getmntent_r getpwuid_r getuid kill mmap newlocale posix_fallocate \
|
||||
posix_memalign prlimit regexec sched_getaffinity setgroups setns \
|
||||
setrlimit symlink sysctlbyname getifaddrs sched_setscheduler])
|
||||
setrlimit symlink sysctlbyname])
|
||||
|
||||
dnl Availability of pthread functions. Because of $LIB_PTHREAD, we
|
||||
dnl cannot use AC_CHECK_FUNCS_ONCE. LIB_PTHREAD and LIBMULTITHREAD
|
||||
@@ -569,10 +563,6 @@ AC_ARG_WITH([chrdev-lock-files],
|
||||
[location for UUCP style lock files for character devices
|
||||
(use auto for default paths on some platforms) @<:@default=auto@:>@])])
|
||||
m4_divert_text([DEFAULTS], [with_chrdev_lock_files=auto])
|
||||
AC_ARG_WITH([pm-utils],
|
||||
[AS_HELP_STRING([--with-pm-utils],
|
||||
[use pm-utils for power management @<:@default=yes@:>@])])
|
||||
m4_divert_text([DEFAULTS], [with_pm_utils=check])
|
||||
|
||||
dnl
|
||||
dnl in case someone want to build static binaries
|
||||
@@ -891,9 +881,6 @@ if test $fail = 1; then
|
||||
fi
|
||||
|
||||
if test "$with_libxl" = "yes"; then
|
||||
dnl If building with libxl, use the libxl utility header and lib too
|
||||
AC_CHECK_HEADERS([libxlutil.h])
|
||||
LIBXL_LIBS="$LIBXL_LIBS -lxlutil"
|
||||
AC_DEFINE_UNQUOTED([WITH_LIBXL], 1, [whether libxenlight driver is enabled])
|
||||
fi
|
||||
AM_CONDITIONAL([WITH_LIBXL], [test "$with_libxl" = "yes"])
|
||||
@@ -970,7 +957,7 @@ AM_CONDITIONAL([WITH_XEN], [test "$with_xen" = "yes"])
|
||||
AC_SUBST([XEN_CFLAGS])
|
||||
AC_SUBST([XEN_LIBS])
|
||||
|
||||
AM_CONDITIONAL([WITH_XENCONFIG], [test "$with_libxl" = "yes" || test "$with_xen" = "yes"])
|
||||
AM_CONDITIONAL([WITH_XENXS], [test "$with_libxl" = "yes" || test "$with_xen" = "yes"])
|
||||
|
||||
dnl
|
||||
dnl check for kernel headers required by xen_inotify
|
||||
@@ -1049,21 +1036,19 @@ dnl
|
||||
dnl Checks for the Parallels driver
|
||||
dnl
|
||||
|
||||
|
||||
if test "$with_parallels" = "yes" ||
|
||||
test "$with_parallels" = "check"; then
|
||||
PKG_CHECK_MODULES([PARALLELS_SDK], [parallels-sdk],
|
||||
[PARALLELS_SDK_FOUND=yes], [PARALLELS_SDK_FOUND=no])
|
||||
|
||||
if test "$with_parallels" = "yes" && test "$PARALLELS_SDK_FOUND" = "no"; then
|
||||
AC_MSG_ERROR([Parallels Virtualization SDK is needed to build the Parallels driver.])
|
||||
if test "$with_parallels" = "check"; then
|
||||
with_parallels=$with_linux
|
||||
if test ! $host_cpu = 'x86_64'; then
|
||||
with_parallels=no
|
||||
fi
|
||||
fi
|
||||
|
||||
with_parallels=$PARALLELS_SDK_FOUND
|
||||
if test "$with_parallels" = "yes"; then
|
||||
AC_DEFINE_UNQUOTED([WITH_PARALLELS], 1,
|
||||
[whether Parallels driver is enabled])
|
||||
fi
|
||||
if test "$with_parallels" = "yes" && test "$with_linux" = "no"; then
|
||||
AC_MSG_ERROR([The Parallels driver can be enabled on Linux only.])
|
||||
fi
|
||||
|
||||
if test "$with_parallels" = "yes"; then
|
||||
AC_DEFINE_UNQUOTED([WITH_PARALLELS], 1, [whether Parallels driver is enabled])
|
||||
fi
|
||||
AM_CONDITIONAL([WITH_PARALLELS], [test "$with_parallels" = "yes"])
|
||||
|
||||
@@ -1392,7 +1377,7 @@ AC_ARG_WITH([firewalld],
|
||||
if test "x$with_firewalld" = "xcheck" ; then
|
||||
with_firewalld=$with_dbus
|
||||
fi
|
||||
if test "x$with_firewalld" = "xyes" ; then
|
||||
if test "x$with_firewalld" == "xyes" ; then
|
||||
if test "x$with_dbus" != "xyes" ; then
|
||||
AC_MSG_ERROR([You must have dbus enabled for firewalld support])
|
||||
fi
|
||||
@@ -1636,23 +1621,6 @@ fi
|
||||
|
||||
AM_CONDITIONAL([WITH_PHYP],[test "$with_phyp" = "yes"])
|
||||
|
||||
dnl
|
||||
dnl Should we build with pm-utils support?
|
||||
dnl
|
||||
if test "$with_pm_utils" = "check"; then
|
||||
with_pm_utils=yes
|
||||
if test "$with_dbus" = "yes"; then
|
||||
if test "$init_systemd" = "yes"; then
|
||||
with_pm_utils=no
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$with_pm_utils" = "yes"; then
|
||||
AC_DEFINE_UNQUOTED([WITH_PM_UTILS], 1, [whether to use pm-utils])
|
||||
fi
|
||||
AM_CONDITIONAL([WITH_PM_UTILS], [test "$with_pm_utils" = "yes"])
|
||||
|
||||
dnl virsh libraries
|
||||
VIRSH_LIBS="$VIRSH_LIBS $READLINE_LIBS"
|
||||
AC_SUBST([VIRSH_LIBS])
|
||||
@@ -1739,10 +1707,6 @@ AC_ARG_WITH([storage-gluster],
|
||||
[AS_HELP_STRING([--with-storage-gluster],
|
||||
[with Gluster backend for the storage driver @<:@default=check@:>@])],
|
||||
[],[with_storage_gluster=check])
|
||||
AC_ARG_WITH([storage-zfs],
|
||||
[AS_HELP_STRING([--with-storage-zfs],
|
||||
[with ZFS backend for the storage driver @<:@default=check@:>@])],
|
||||
[],[with_storage_zfs=check])
|
||||
|
||||
if test "$with_libvirtd" = "no"; then
|
||||
with_storage_dir=no
|
||||
@@ -1755,7 +1719,6 @@ if test "$with_libvirtd" = "no"; then
|
||||
with_storage_rbd=no
|
||||
with_storage_sheepdog=no
|
||||
with_storage_gluster=no
|
||||
with_storage_zfs=no
|
||||
fi
|
||||
if test "$with_storage_dir" = "yes" ; then
|
||||
AC_DEFINE_UNQUOTED([WITH_STORAGE_DIR], 1, [whether directory backend for storage driver is enabled])
|
||||
@@ -1973,51 +1936,6 @@ if test "$with_storage_gluster" = "yes"; then
|
||||
fi
|
||||
AM_CONDITIONAL([WITH_STORAGE_GLUSTER], [test "$with_storage_gluster" = "yes"])
|
||||
|
||||
if test "$with_storage_zfs" = "check"; then
|
||||
with_storage_zfs=$with_freebsd
|
||||
fi
|
||||
|
||||
if test "$with_storage_zfs" = "yes" && test "$with_freebsd" = "no"; then
|
||||
AC_MSG_ERROR([The ZFS storage driver can be enabled on FreeBSD only.])
|
||||
fi
|
||||
|
||||
if test "$with_storage_zfs" = "yes" ||
|
||||
test "$with_storage_zfs" = "check"; then
|
||||
AC_PATH_PROG([ZFS], [zfs], [], [$PATH:/sbin:/usr/sbin])
|
||||
AC_PATH_PROG([ZPOOL], [zpool], [], [$PATH:/sbin:/usr/sbin])
|
||||
|
||||
if test "$with_storage_zfs" = "yes"; then
|
||||
if test -z "$ZFS" || test -z "$ZPOOL"; then
|
||||
AC_MSG_ERROR([We need zfs and zpool for ZFS storage driver])
|
||||
fi
|
||||
else
|
||||
if test -z "$ZFS" || test -z "$ZPOOL"; then
|
||||
with_storage_zfs=no
|
||||
fi
|
||||
|
||||
if test "$with_storage_zfs" = "check"; then
|
||||
with_storage_zfs=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$with_storage_zfs" = "yes"; then
|
||||
AC_DEFINE_UNQUOTED([WITH_STORAGE_ZFS], 1,
|
||||
[whether ZFS backend for storage driver is enabled])
|
||||
AC_DEFINE_UNQUOTED([ZFS], ["$ZFS"], [Location of zfs program])
|
||||
AC_DEFINE_UNQUOTED([ZPOOL], ["$ZPOOL"], [Location of zpool program])
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL([WITH_STORAGE_ZFS],
|
||||
[test "$with_storage_zfs" = "yes"])
|
||||
|
||||
if test "$with_storage_fs" = "yes" ||
|
||||
test "$with_storage_gluster" = "yes"; then
|
||||
AC_PATH_PROG([GLUSTER_CLI], [gluster], [], [$PATH:/sbin:/usr/sbin])
|
||||
if test "x$GLUSTER_CLI" != "x"; then
|
||||
AC_DEFINE_UNQUOTED([GLUSTER_CLI], ["$GLUSTER_CLI"],
|
||||
[Location or name of the gluster command line tool])
|
||||
fi
|
||||
fi
|
||||
|
||||
LIBPARTED_CFLAGS=
|
||||
LIBPARTED_LIBS=
|
||||
@@ -2175,19 +2093,9 @@ fi
|
||||
AM_CONDITIONAL([WITH_HYPERV], [test "$with_hyperv" = "yes"])
|
||||
|
||||
|
||||
dnl
|
||||
dnl check for kernel headers required by btrfs ioctl
|
||||
dnl
|
||||
if test "$with_linux" = "yes"; then
|
||||
AC_CHECK_HEADERS([linux/btrfs.h])
|
||||
fi
|
||||
|
||||
dnl Allow perl/python overrides
|
||||
AC_PATH_PROGS([PYTHON], [python2 python])
|
||||
AC_PATH_PROG([PERL], [perl])
|
||||
if test -z "$PERL"; then
|
||||
AC_MSG_ERROR([Failed to find perl.])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH([test-suite],
|
||||
[AS_HELP_STRING([--with-test-suite],
|
||||
@@ -2623,11 +2531,7 @@ if test "$with_linux" = "yes"; then
|
||||
[whether the netlink v1 library is available])
|
||||
], [
|
||||
if test "$with_macvtap" = "yes"; then
|
||||
if test "$LIBNL_REQUIRED" = "3.0";then
|
||||
AC_MSG_ERROR([libnl3-devel >= $LIBNL_REQUIRED is required for macvtap support])
|
||||
else
|
||||
AC_MSG_ERROR([libnl-devel >= $LIBNL_REQUIRED is required for macvtap support])
|
||||
fi
|
||||
AC_MSG_ERROR([libnl-devel >= $LIBNL_REQUIRED is required for macvtap support])
|
||||
fi
|
||||
])
|
||||
fi
|
||||
@@ -2704,8 +2608,7 @@ AC_SUBST([ws_plugindir])
|
||||
# Check for Linux vs. BSD ifreq members
|
||||
AC_CHECK_MEMBERS([struct ifreq.ifr_newname,
|
||||
struct ifreq.ifr_ifindex,
|
||||
struct ifreq.ifr_index,
|
||||
struct ifreq.ifr_hwaddr],
|
||||
struct ifreq.ifr_index],
|
||||
[], [],
|
||||
[#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
@@ -2746,24 +2649,6 @@ AC_CHECK_DECLS([cpuset_getaffinity],
|
||||
#include <sys/cpuset.h>
|
||||
])
|
||||
|
||||
# Check for BSD kvm (kernel memory interface)
|
||||
if test $with_freebsd = yes; then
|
||||
AC_CHECK_LIB([kvm], [kvm_getprocs], [],
|
||||
[AC_MSG_ERROR([BSD kernel memory interface library is required to build on FreeBSD])]
|
||||
)
|
||||
fi
|
||||
|
||||
# FreeBSD 10-STABLE requires _IFI_OQDROPS to be defined for if_data.ifi_oqdrops
|
||||
# field be available
|
||||
old_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -D_IFI_OQDROPS"
|
||||
|
||||
AC_CHECK_MEMBERS([struct if_data.ifi_oqdrops],
|
||||
[],
|
||||
[CFLAGS="$old_CFLAGS"],
|
||||
[#include <net/if.h>
|
||||
])
|
||||
|
||||
# Check if we need to look for ifconfig
|
||||
if test "$want_ifconfig" = "yes"; then
|
||||
AC_PATH_PROG([IFCONFIG_PATH], [ifconfig])
|
||||
@@ -2788,31 +2673,6 @@ test "x$lv_cv_static_analysis" = xyes && t=1
|
||||
AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t],
|
||||
[Define to 1 when performing static analysis.])
|
||||
|
||||
AC_ARG_WITH([default-editor],
|
||||
[AS_HELP_STRING([--with-default-editor],
|
||||
[Editor to use for interactive commands
|
||||
@<:@default=vi@:>@])],
|
||||
[DEFAULT_EDITOR=${withval}],
|
||||
[DEFAULT_EDITOR=vi])
|
||||
AC_DEFINE_UNQUOTED([DEFAULT_EDITOR], ["$DEFAULT_EDITOR"], [Default editor to use])
|
||||
|
||||
AC_ARG_WITH([loader-nvram],
|
||||
[AS_HELP_STRING([--with-loader-nvram],
|
||||
[Pass list of pairs of <loader>:<nvram> paths. Both
|
||||
pairs and list items are separated by a colon.
|
||||
@<:default=paths to OVMF and its clones@:>@])],
|
||||
[if test "$withval" = "no"; then
|
||||
withval=""
|
||||
else
|
||||
l=`echo $withval | tr ':' '\n' | wc -l`
|
||||
if test "`expr $l % 2`" -ne 0; then
|
||||
AC_MSG_ERROR([Malformed --with-loader-nvram argument])
|
||||
fi
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([DEFAULT_LOADER_NVRAM],
|
||||
["$withval"],
|
||||
[List of laoder:nvram pairs])])
|
||||
|
||||
# Some GNULIB base64 symbols clash with a kerberos library
|
||||
AC_DEFINE_UNQUOTED([isbase64],[libvirt_gl_isbase64],[Hack to avoid symbol clash])
|
||||
AC_DEFINE_UNQUOTED([base64_encode],[libvirt_gl_base64_encode],[Hack to avoid symbol clash])
|
||||
@@ -2825,13 +2685,7 @@ AC_CONFIG_FILES([\
|
||||
docs/schemas/Makefile \
|
||||
gnulib/lib/Makefile \
|
||||
gnulib/tests/Makefile \
|
||||
libvirt.pc \
|
||||
libvirt-qemu.pc \
|
||||
libvirt-lxc.pc \
|
||||
src/libvirt.pc \
|
||||
src/libvirt-qemu.pc \
|
||||
src/libvirt-lxc.pc \
|
||||
libvirt.spec mingw-libvirt.spec \
|
||||
libvirt.pc libvirt.spec mingw-libvirt.spec \
|
||||
po/Makefile.in \
|
||||
include/libvirt/Makefile include/libvirt/libvirt.h \
|
||||
daemon/Makefile \
|
||||
@@ -2841,13 +2695,10 @@ AC_CONFIG_FILES([\
|
||||
examples/object-events/Makefile \
|
||||
examples/domsuspend/Makefile \
|
||||
examples/dominfo/Makefile \
|
||||
examples/dommigrate/Makefile \
|
||||
examples/domtop/Makefile \
|
||||
examples/openauth/Makefile \
|
||||
examples/hellolibvirt/Makefile \
|
||||
examples/systemtap/Makefile \
|
||||
examples/xml/nwfilter/Makefile \
|
||||
examples/lxcconvert/Makefile \
|
||||
tools/wireshark/Makefile \
|
||||
tools/wireshark/src/Makefile])
|
||||
AC_OUTPUT
|
||||
@@ -2893,7 +2744,6 @@ AC_MSG_NOTICE([ Disk: $with_storage_disk])
|
||||
AC_MSG_NOTICE([ RBD: $with_storage_rbd])
|
||||
AC_MSG_NOTICE([Sheepdog: $with_storage_sheepdog])
|
||||
AC_MSG_NOTICE([ Gluster: $with_storage_gluster])
|
||||
AC_MSG_NOTICE([ ZFS: $with_storage_zfs])
|
||||
AC_MSG_NOTICE([])
|
||||
AC_MSG_NOTICE([Security Drivers])
|
||||
AC_MSG_NOTICE([])
|
||||
@@ -2995,7 +2845,6 @@ AC_MSG_NOTICE([ rbd: $LIBRBD_LIBS])
|
||||
else
|
||||
AC_MSG_NOTICE([ rbd: no])
|
||||
fi
|
||||
AC_MSG_NOTICE([pm-utils: $with_pm_utils])
|
||||
|
||||
AC_MSG_NOTICE([])
|
||||
AC_MSG_NOTICE([Test suite])
|
||||
@@ -3013,7 +2862,6 @@ AC_MSG_NOTICE([ numad: $with_numad])
|
||||
AC_MSG_NOTICE([ XML Catalog: $XML_CATALOG_FILE])
|
||||
AC_MSG_NOTICE([ Init script: $with_init_script])
|
||||
AC_MSG_NOTICE([Char device locks: $with_chrdev_lock_files])
|
||||
AC_MSG_NOTICE([ Default Editor: $DEFAULT_EDITOR])
|
||||
AC_MSG_NOTICE([])
|
||||
AC_MSG_NOTICE([Developer Tools])
|
||||
AC_MSG_NOTICE([])
|
||||
|
@@ -55,7 +55,6 @@ EXTRA_DIST = \
|
||||
libvirtd.policy.in \
|
||||
libvirtd.sasl \
|
||||
libvirtd.service.in \
|
||||
libvirtd.socket.in \
|
||||
libvirtd.sysconf \
|
||||
libvirtd.sysctl \
|
||||
libvirtd.aug \
|
||||
@@ -141,7 +140,7 @@ libvirtd_SOURCES = $(DAEMON_SOURCES)
|
||||
#-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
|
||||
libvirtd_CFLAGS = \
|
||||
$(LIBXML_CFLAGS) $(GNUTLS_CFLAGS) $(SASL_CFLAGS) \
|
||||
$(XDR_CFLAGS) $(DBUS_CFLAGS) $(LIBNL_CFLAGS) \
|
||||
$(XDR_CFLAGS) $(POLKIT_CFLAGS) $(DBUS_CFLAGS) $(LIBNL_CFLAGS) \
|
||||
$(WARN_CFLAGS) $(PIE_CFLAGS) \
|
||||
$(COVERAGE_CFLAGS) \
|
||||
-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\""
|
||||
@@ -158,6 +157,7 @@ libvirtd_LDADD = \
|
||||
$(GNUTLS_LIBS) \
|
||||
$(SASL_LIBS) \
|
||||
$(DBUS_LIBS) \
|
||||
$(POLKIT_LIBS) \
|
||||
$(LIBNL_LIBS)
|
||||
|
||||
if WITH_DTRACE_PROBES
|
||||
@@ -388,18 +388,15 @@ endif ! LIBVIRT_INIT_SCRIPT_UPSTART
|
||||
if LIBVIRT_INIT_SCRIPT_SYSTEMD
|
||||
|
||||
SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
|
||||
BUILT_SOURCES += libvirtd.service libvirtd.socket
|
||||
BUILT_SOURCES += libvirtd.service
|
||||
|
||||
install-init-systemd: install-sysconfig libvirtd.service libvirtd.socket
|
||||
install-init-systemd: install-sysconfig libvirtd.service
|
||||
$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
|
||||
$(INSTALL_DATA) libvirtd.service \
|
||||
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service
|
||||
$(INSTALL_DATA) libvirtd.socket \
|
||||
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.socket
|
||||
|
||||
uninstall-init-systemd: uninstall-sysconfig
|
||||
rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service
|
||||
rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.socket
|
||||
rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
|
||||
else ! LIBVIRT_INIT_SCRIPT_SYSTEMD
|
||||
install-init-systemd:
|
||||
@@ -423,12 +420,6 @@ libvirtd.service: libvirtd.service.in $(top_builddir)/config.status
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
libvirtd.socket: libvirtd.socket.in $(top_builddir)/config.status
|
||||
$(AM_V_GEN)sed \
|
||||
-e 's|[@]runstatedir[@]|$(runstatedir)|g' \
|
||||
< $< > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
|
||||
check-local: check-augeas
|
||||
|
||||
|
@@ -123,8 +123,8 @@ checkType(virConfValuePtr p, const char *filename,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("remoteReadConfigFile: %s: %s: invalid type:"
|
||||
" got %s; expected %s"), filename, key,
|
||||
virConfTypeToString(p->type),
|
||||
virConfTypeToString(required_type));
|
||||
virConfTypeName(p->type),
|
||||
virConfTypeName(required_type));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -146,30 +146,17 @@ checkType(virConfValuePtr p, const char *filename,
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Like GET_CONF_STR, but for signed integral values. */
|
||||
/* Like GET_CONF_STR, but for integral values. */
|
||||
#define GET_CONF_INT(conf, filename, var_name) \
|
||||
do { \
|
||||
virConfValuePtr p = virConfGetValue(conf, #var_name); \
|
||||
if (p) { \
|
||||
if (p->type != VIR_CONF_ULONG && \
|
||||
checkType(p, filename, #var_name, VIR_CONF_LONG) < 0) \
|
||||
if (checkType(p, filename, #var_name, VIR_CONF_LONG) < 0) \
|
||||
goto error; \
|
||||
data->var_name = p->l; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Like GET_CONF_STR, but for unsigned integral values. */
|
||||
#define GET_CONF_UINT(conf, filename, var_name) \
|
||||
do { \
|
||||
virConfValuePtr p = virConfGetValue(conf, #var_name); \
|
||||
if (p) { \
|
||||
if (checkType(p, filename, #var_name, VIR_CONF_ULONG) < 0) \
|
||||
goto error; \
|
||||
data->var_name = p->l; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
static int
|
||||
remoteConfigGetAuth(virConfPtr conf,
|
||||
@@ -374,8 +361,8 @@ daemonConfigLoadOptions(struct daemonConfig *data,
|
||||
const char *filename,
|
||||
virConfPtr conf)
|
||||
{
|
||||
GET_CONF_UINT(conf, filename, listen_tcp);
|
||||
GET_CONF_UINT(conf, filename, listen_tls);
|
||||
GET_CONF_INT(conf, filename, listen_tcp);
|
||||
GET_CONF_INT(conf, filename, listen_tls);
|
||||
GET_CONF_STR(conf, filename, tls_port);
|
||||
GET_CONF_STR(conf, filename, tcp_port);
|
||||
GET_CONF_STR(conf, filename, listen_addr);
|
||||
@@ -409,11 +396,11 @@ daemonConfigLoadOptions(struct daemonConfig *data,
|
||||
|
||||
GET_CONF_STR(conf, filename, unix_sock_dir);
|
||||
|
||||
GET_CONF_UINT(conf, filename, mdns_adv);
|
||||
GET_CONF_INT(conf, filename, mdns_adv);
|
||||
GET_CONF_STR(conf, filename, mdns_name);
|
||||
|
||||
GET_CONF_UINT(conf, filename, tls_no_sanity_certificate);
|
||||
GET_CONF_UINT(conf, filename, tls_no_verify_certificate);
|
||||
GET_CONF_INT(conf, filename, tls_no_sanity_certificate);
|
||||
GET_CONF_INT(conf, filename, tls_no_verify_certificate);
|
||||
|
||||
GET_CONF_STR(conf, filename, key_file);
|
||||
GET_CONF_STR(conf, filename, cert_file);
|
||||
@@ -430,29 +417,29 @@ daemonConfigLoadOptions(struct daemonConfig *data,
|
||||
goto error;
|
||||
|
||||
|
||||
GET_CONF_UINT(conf, filename, min_workers);
|
||||
GET_CONF_UINT(conf, filename, max_workers);
|
||||
GET_CONF_UINT(conf, filename, max_clients);
|
||||
GET_CONF_UINT(conf, filename, max_queued_clients);
|
||||
GET_CONF_UINT(conf, filename, max_anonymous_clients);
|
||||
GET_CONF_INT(conf, filename, min_workers);
|
||||
GET_CONF_INT(conf, filename, max_workers);
|
||||
GET_CONF_INT(conf, filename, max_clients);
|
||||
GET_CONF_INT(conf, filename, max_queued_clients);
|
||||
GET_CONF_INT(conf, filename, max_anonymous_clients);
|
||||
|
||||
GET_CONF_UINT(conf, filename, prio_workers);
|
||||
GET_CONF_INT(conf, filename, prio_workers);
|
||||
|
||||
GET_CONF_INT(conf, filename, max_requests);
|
||||
GET_CONF_UINT(conf, filename, max_client_requests);
|
||||
GET_CONF_INT(conf, filename, max_client_requests);
|
||||
|
||||
GET_CONF_UINT(conf, filename, audit_level);
|
||||
GET_CONF_UINT(conf, filename, audit_logging);
|
||||
GET_CONF_INT(conf, filename, audit_level);
|
||||
GET_CONF_INT(conf, filename, audit_logging);
|
||||
|
||||
GET_CONF_STR(conf, filename, host_uuid);
|
||||
|
||||
GET_CONF_UINT(conf, filename, log_level);
|
||||
GET_CONF_INT(conf, filename, log_level);
|
||||
GET_CONF_STR(conf, filename, log_filters);
|
||||
GET_CONF_STR(conf, filename, log_outputs);
|
||||
|
||||
GET_CONF_INT(conf, filename, keepalive_interval);
|
||||
GET_CONF_UINT(conf, filename, keepalive_count);
|
||||
GET_CONF_UINT(conf, filename, keepalive_required);
|
||||
GET_CONF_INT(conf, filename, keepalive_count);
|
||||
GET_CONF_INT(conf, filename, keepalive_required);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@@ -56,7 +56,6 @@
|
||||
#include "virstring.h"
|
||||
#include "locking/lock_manager.h"
|
||||
#include "viraccessmanager.h"
|
||||
#include "virutil.h"
|
||||
|
||||
#ifdef WITH_DRIVER_MODULES
|
||||
# include "driver.h"
|
||||
@@ -163,9 +162,9 @@ static int daemonForkIntoBackground(const char *argv0)
|
||||
|
||||
VIR_FORCE_CLOSE(statuspipe[0]);
|
||||
|
||||
if ((stdinfd = open("/dev/null", O_RDONLY)) <= STDERR_FILENO)
|
||||
if ((stdinfd = open("/dev/null", O_RDONLY)) < 0)
|
||||
goto cleanup;
|
||||
if ((stdoutfd = open("/dev/null", O_WRONLY)) <= STDERR_FILENO)
|
||||
if ((stdoutfd = open("/dev/null", O_WRONLY)) < 0)
|
||||
goto cleanup;
|
||||
if (dup2(stdinfd, STDIN_FILENO) != STDIN_FILENO)
|
||||
goto cleanup;
|
||||
@@ -173,9 +172,9 @@ static int daemonForkIntoBackground(const char *argv0)
|
||||
goto cleanup;
|
||||
if (dup2(stdoutfd, STDERR_FILENO) != STDERR_FILENO)
|
||||
goto cleanup;
|
||||
if (VIR_CLOSE(stdinfd) < 0)
|
||||
if (stdinfd > STDERR_FILENO && VIR_CLOSE(stdinfd) < 0)
|
||||
goto cleanup;
|
||||
if (VIR_CLOSE(stdoutfd) < 0)
|
||||
if (stdoutfd > STDERR_FILENO && VIR_CLOSE(stdoutfd) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (setsid() < 0)
|
||||
@@ -250,6 +249,41 @@ static int daemonForkIntoBackground(const char *argv0)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
daemonPidFilePath(bool privileged,
|
||||
char **pidfile)
|
||||
{
|
||||
if (privileged) {
|
||||
if (VIR_STRDUP(*pidfile, LOCALSTATEDIR "/run/libvirtd.pid") < 0)
|
||||
goto error;
|
||||
} else {
|
||||
char *rundir = NULL;
|
||||
mode_t old_umask;
|
||||
|
||||
if (!(rundir = virGetUserRuntimeDirectory()))
|
||||
goto error;
|
||||
|
||||
old_umask = umask(077);
|
||||
if (virFileMakePath(rundir) < 0) {
|
||||
umask(old_umask);
|
||||
goto error;
|
||||
}
|
||||
umask(old_umask);
|
||||
|
||||
if (virAsprintf(pidfile, "%s/libvirtd.pid", rundir) < 0) {
|
||||
VIR_FREE(rundir);
|
||||
goto error;
|
||||
}
|
||||
|
||||
VIR_FREE(rundir);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
daemonUnixSocketPaths(struct daemonConfig *config,
|
||||
bool privileged,
|
||||
@@ -331,10 +365,10 @@ static void daemonInitialize(void)
|
||||
{
|
||||
/*
|
||||
* Note that the order is important: the first ones have a higher
|
||||
* priority when calling virStateInitialize. We must register the
|
||||
* network, storage and nodedev drivers before any stateful domain
|
||||
* driver, since their resources must be auto-started before any
|
||||
* domains can be auto-started.
|
||||
* priority when calling virStateInitialize. We must register
|
||||
* the network, storage and nodedev drivers before any domain
|
||||
* drivers, since their resources must be auto-started before
|
||||
* any domains can be auto-started.
|
||||
*/
|
||||
#ifdef WITH_DRIVER_MODULES
|
||||
/* We don't care if any of these fail, because the whole point
|
||||
@@ -345,9 +379,6 @@ static void daemonInitialize(void)
|
||||
# ifdef WITH_NETWORK
|
||||
virDriverLoadModule("network");
|
||||
# endif
|
||||
# ifdef WITH_INTERFACE
|
||||
virDriverLoadModule("interface");
|
||||
# endif
|
||||
# ifdef WITH_STORAGE
|
||||
virDriverLoadModule("storage");
|
||||
# endif
|
||||
@@ -360,6 +391,9 @@ static void daemonInitialize(void)
|
||||
# ifdef WITH_NWFILTER
|
||||
virDriverLoadModule("nwfilter");
|
||||
# endif
|
||||
# ifdef WITH_INTERFACE
|
||||
virDriverLoadModule("interface");
|
||||
# endif
|
||||
# ifdef WITH_XEN
|
||||
virDriverLoadModule("xen");
|
||||
# endif
|
||||
@@ -425,13 +459,12 @@ static void daemonInitialize(void)
|
||||
}
|
||||
|
||||
|
||||
static int ATTRIBUTE_NONNULL(3)
|
||||
daemonSetupNetworking(virNetServerPtr srv,
|
||||
struct daemonConfig *config,
|
||||
const char *sock_path,
|
||||
const char *sock_path_ro,
|
||||
bool ipsock,
|
||||
bool privileged)
|
||||
static int daemonSetupNetworking(virNetServerPtr srv,
|
||||
struct daemonConfig *config,
|
||||
const char *sock_path,
|
||||
const char *sock_path_ro,
|
||||
bool ipsock,
|
||||
bool privileged)
|
||||
{
|
||||
virNetServerServicePtr svc = NULL;
|
||||
virNetServerServicePtr svcRO = NULL;
|
||||
@@ -443,19 +476,11 @@ daemonSetupNetworking(virNetServerPtr srv,
|
||||
int unix_sock_ro_mask = 0;
|
||||
int unix_sock_rw_mask = 0;
|
||||
|
||||
unsigned int cur_fd = STDERR_FILENO + 1;
|
||||
unsigned int nfds = virGetListenFDs();
|
||||
|
||||
if (config->unix_sock_group) {
|
||||
if (virGetGroupID(config->unix_sock_group, &unix_sock_gid) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (nfds > (sock_path_ro ? 2 : 1)) {
|
||||
VIR_ERROR(_("Too many (%u) FDs passed from caller"), nfds);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virStrToLong_i(config->unix_sock_ro_perms, NULL, 8, &unix_sock_ro_mask) != 0) {
|
||||
VIR_ERROR(_("Failed to parse mode '%s'"), config->unix_sock_ro_perms);
|
||||
goto error;
|
||||
@@ -466,30 +491,30 @@ daemonSetupNetworking(virNetServerPtr srv,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(svc = virNetServerServiceNewFDOrUNIX(sock_path,
|
||||
unix_sock_rw_mask,
|
||||
unix_sock_gid,
|
||||
config->auth_unix_rw,
|
||||
VIR_DEBUG("Registering unix socket %s", sock_path);
|
||||
if (!(svc = virNetServerServiceNewUNIX(sock_path,
|
||||
unix_sock_rw_mask,
|
||||
unix_sock_gid,
|
||||
config->auth_unix_rw,
|
||||
#if WITH_GNUTLS
|
||||
NULL,
|
||||
NULL,
|
||||
#endif
|
||||
false,
|
||||
config->max_queued_clients,
|
||||
config->max_client_requests,
|
||||
nfds, &cur_fd)))
|
||||
false,
|
||||
config->max_queued_clients,
|
||||
config->max_client_requests)))
|
||||
goto error;
|
||||
if (sock_path_ro) {
|
||||
if (!(svcRO = virNetServerServiceNewFDOrUNIX(sock_path_ro,
|
||||
unix_sock_ro_mask,
|
||||
unix_sock_gid,
|
||||
config->auth_unix_ro,
|
||||
VIR_DEBUG("Registering unix socket %s", sock_path_ro);
|
||||
if (!(svcRO = virNetServerServiceNewUNIX(sock_path_ro,
|
||||
unix_sock_ro_mask,
|
||||
unix_sock_gid,
|
||||
config->auth_unix_ro,
|
||||
#if WITH_GNUTLS
|
||||
NULL,
|
||||
NULL,
|
||||
#endif
|
||||
true,
|
||||
config->max_queued_clients,
|
||||
config->max_client_requests,
|
||||
nfds, &cur_fd)))
|
||||
true,
|
||||
config->max_queued_clients,
|
||||
config->max_client_requests)))
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -643,12 +668,6 @@ daemonSetupLogging(struct daemonConfig *config,
|
||||
if (virLogGetNbOutputs() == 0)
|
||||
virLogParseOutputs(config->log_outputs);
|
||||
|
||||
/*
|
||||
* Command line override for --verbose
|
||||
*/
|
||||
if ((verbose) && (virLogGetDefaultPriority() > VIR_LOG_INFO))
|
||||
virLogSetDefaultPriority(VIR_LOG_INFO);
|
||||
|
||||
/*
|
||||
* If no defined outputs, and either running
|
||||
* as daemon or not on a tty, then first try
|
||||
@@ -659,14 +678,7 @@ daemonSetupLogging(struct daemonConfig *config,
|
||||
(godaemon || !isatty(STDIN_FILENO))) {
|
||||
char *tmp;
|
||||
if (access("/run/systemd/journal/socket", W_OK) >= 0) {
|
||||
virLogPriority priority = virLogGetDefaultPriority();
|
||||
|
||||
/* By default we don't want to log too much stuff into journald as
|
||||
* it may employ rate limiting and thus block libvirt execution. */
|
||||
if (priority == VIR_LOG_DEBUG)
|
||||
priority = VIR_LOG_INFO;
|
||||
|
||||
if (virAsprintf(&tmp, "%d:journald", priority) < 0)
|
||||
if (virAsprintf(&tmp, "%d:journald", virLogGetDefaultPriority()) < 0)
|
||||
goto error;
|
||||
virLogParseOutputs(tmp);
|
||||
VIR_FREE(tmp);
|
||||
@@ -715,6 +727,12 @@ daemonSetupLogging(struct daemonConfig *config,
|
||||
VIR_FREE(tmp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Command line override for --verbose
|
||||
*/
|
||||
if ((verbose) && (virLogGetDefaultPriority() > VIR_LOG_INFO))
|
||||
virLogSetDefaultPriority(VIR_LOG_INFO);
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
@@ -727,13 +745,13 @@ daemonSetupAccessManager(struct daemonConfig *config)
|
||||
{
|
||||
virAccessManagerPtr mgr;
|
||||
const char *none[] = { "none", NULL };
|
||||
const char **drv = (const char **)config->access_drivers;
|
||||
const char **driver = (const char **)config->access_drivers;
|
||||
|
||||
if (!drv ||
|
||||
!drv[0])
|
||||
drv = none;
|
||||
if (!driver ||
|
||||
!driver[0])
|
||||
driver = none;
|
||||
|
||||
if (!(mgr = virAccessManagerNewStack(drv)))
|
||||
if (!(mgr = virAccessManagerNewStack(driver)))
|
||||
return -1;
|
||||
|
||||
virAccessManagerSetDefault(mgr);
|
||||
@@ -785,16 +803,11 @@ static void daemonReloadHandler(virNetServerPtr srv ATTRIBUTE_UNUSED,
|
||||
siginfo_t *sig ATTRIBUTE_UNUSED,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (!driversInitialized) {
|
||||
VIR_WARN("Drivers are not initialized, reload ignored");
|
||||
return;
|
||||
}
|
||||
|
||||
VIR_INFO("Reloading configuration on SIGHUP");
|
||||
virHookCall(VIR_HOOK_DRIVER_DAEMON, "-",
|
||||
VIR_HOOK_DAEMON_OP_RELOAD, SIGHUP, "SIGHUP", NULL, NULL);
|
||||
if (virStateReload() < 0)
|
||||
VIR_WARN("Error while reloading drivers");
|
||||
VIR_INFO("Reloading configuration on SIGHUP");
|
||||
virHookCall(VIR_HOOK_DRIVER_DAEMON, "-",
|
||||
VIR_HOOK_DAEMON_OP_RELOAD, SIGHUP, "SIGHUP", NULL, NULL);
|
||||
if (virStateReload() < 0)
|
||||
VIR_WARN("Error while reloading drivers");
|
||||
}
|
||||
|
||||
static int daemonSetupSignals(virNetServerPtr srv)
|
||||
@@ -969,8 +982,9 @@ static int migrateProfile(void)
|
||||
if (!(home = virGetUserDirectory()))
|
||||
goto cleanup;
|
||||
|
||||
if (virAsprintf(&old_base, "%s/.libvirt", home) < 0)
|
||||
if (virAsprintf(&old_base, "%s/.libvirt", home) < 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* if the new directory is there or the old one is not: do nothing */
|
||||
if (!(config_dir = virGetUserConfigDirectory()))
|
||||
@@ -985,18 +999,21 @@ static int migrateProfile(void)
|
||||
}
|
||||
|
||||
/* test if we already attempted to migrate first */
|
||||
if (virAsprintf(&updated, "%s/DEPRECATED-DIRECTORY", old_base) < 0)
|
||||
if (virAsprintf(&updated, "%s/DEPRECATED-DIRECTORY", old_base) < 0) {
|
||||
goto cleanup;
|
||||
if (virFileExists(updated))
|
||||
}
|
||||
if (virFileExists(updated)) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
config_home = virGetEnvBlockSUID("XDG_CONFIG_HOME");
|
||||
if (config_home && config_home[0] != '\0') {
|
||||
if (VIR_STRDUP(xdg_dir, config_home) < 0)
|
||||
goto cleanup;
|
||||
} else {
|
||||
if (virAsprintf(&xdg_dir, "%s/.config", home) < 0)
|
||||
if (virAsprintf(&xdg_dir, "%s/.config", home) < 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
old_umask = umask(077);
|
||||
@@ -1139,7 +1156,35 @@ int main(int argc, char **argv) {
|
||||
|
||||
virUpdateSelfLastChanged(argv[0]);
|
||||
|
||||
virFileActivateDirOverride(argv[0]);
|
||||
if (strstr(argv[0], "lt-libvirtd") ||
|
||||
strstr(argv[0], "/daemon/.libs/libvirtd")) {
|
||||
char *tmp = strrchr(argv[0], '/');
|
||||
char *cpumap;
|
||||
if (!tmp) {
|
||||
fprintf(stderr, _("%s: cannot identify driver directory\n"), argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
*tmp = '\0';
|
||||
char *driverdir;
|
||||
if (virAsprintfQuiet(&driverdir, "%s/../../src/.libs", argv[0]) < 0 ||
|
||||
virAsprintfQuiet(&cpumap, "%s/../../src/cpu/cpu_map.xml",
|
||||
argv[0]) < 0) {
|
||||
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (access(driverdir, R_OK) < 0) {
|
||||
fprintf(stderr, _("%s: expected driver directory '%s' is missing\n"),
|
||||
argv[0], driverdir);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
virLockManagerSetPluginDir(driverdir);
|
||||
#ifdef WITH_DRIVER_MODULES
|
||||
virDriverModuleInitialize(driverdir);
|
||||
#endif
|
||||
cpuMapOverride(cpumap);
|
||||
*tmp = '/';
|
||||
/* Must not free 'driverdir' - it is still used */
|
||||
}
|
||||
|
||||
while (1) {
|
||||
int optidx = 0;
|
||||
@@ -1148,8 +1193,9 @@ int main(int argc, char **argv) {
|
||||
|
||||
c = getopt_long(argc, argv, "ldf:p:t:vVh", opts, &optidx);
|
||||
|
||||
if (c == -1)
|
||||
if (c == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (c) {
|
||||
case 0:
|
||||
@@ -1262,10 +1308,8 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
if (!pid_file &&
|
||||
virPidFileConstructPath(privileged,
|
||||
LOCALSTATEDIR,
|
||||
"libvirtd",
|
||||
&pid_file) < 0) {
|
||||
daemonPidFilePath(privileged,
|
||||
&pid_file) < 0) {
|
||||
VIR_ERROR(_("Can't determine pid file path."));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -1426,7 +1470,7 @@ int main(int argc, char **argv) {
|
||||
VIR_DEBUG("Proceeding without auditing");
|
||||
}
|
||||
}
|
||||
virAuditLog(config->audit_logging > 0);
|
||||
virAuditLog(config->audit_logging);
|
||||
|
||||
/* setup the hooks if any */
|
||||
if (virHookInitialize() < 0) {
|
||||
@@ -1524,10 +1568,8 @@ int main(int argc, char **argv) {
|
||||
|
||||
daemonConfigFree(config);
|
||||
|
||||
if (driversInitialized) {
|
||||
driversInitialized = false;
|
||||
if (driversInitialized)
|
||||
virStateCleanup();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@@ -48,10 +48,6 @@
|
||||
# Override the default configuration which binds to all network
|
||||
# interfaces. This can be a numeric IPv4/6 address, or hostname
|
||||
#
|
||||
# If the libvirtd service is started in parallel with network
|
||||
# startup (e.g. with systemd), binding to addresses other than
|
||||
# the wildcards (0.0.0.0/::) might not be available yet.
|
||||
#
|
||||
#listen_addr = "192.168.0.1"
|
||||
|
||||
|
||||
@@ -77,11 +73,6 @@
|
||||
# UNIX socket access controls
|
||||
#
|
||||
|
||||
# Beware that if you are changing *any* of these options, and you use
|
||||
# socket activation with systemd, you need to adjust the settings in
|
||||
# the libvirtd.socket file as well since it could impose a security
|
||||
# risk if you rely on file permission checking only.
|
||||
|
||||
# Set the UNIX domain socket group ownership. This can be used to
|
||||
# allow a 'trusted' set of users access to management capabilities
|
||||
# without becoming root.
|
||||
@@ -272,7 +263,7 @@
|
||||
# connection succeeds.
|
||||
#max_queued_clients = 1000
|
||||
|
||||
# The maximum length of queue of accepted but not yet
|
||||
# The maximum length of queue of accepted but not yet not
|
||||
# authenticated clients. The default value is zero, meaning
|
||||
# the feature is disabled.
|
||||
#max_anonymous_clients = 20
|
||||
@@ -314,10 +305,6 @@
|
||||
|
||||
# Logging level: 4 errors, 3 warnings, 2 information, 1 debug
|
||||
# basically 1 will log everything possible
|
||||
# Note: Journald may employ rate limiting of the messages logged
|
||||
# and thus lock up the libvirt daemon. To use the debug level with
|
||||
# journald you have to specify it explicitly in 'log_outputs', otherwise
|
||||
# only information level messages will be logged.
|
||||
#log_level = 3
|
||||
|
||||
# Logging filters:
|
||||
@@ -351,8 +338,6 @@
|
||||
# use syslog for the output and use the given name as the ident
|
||||
# x:file:file_path
|
||||
# output to a file, with the given filepath
|
||||
# x:journald
|
||||
# output to journald logging system
|
||||
# In all case the x prefix is the minimal level, acting as a filter
|
||||
# 1: DEBUG
|
||||
# 2: INFO
|
||||
|
@@ -1,3 +1,8 @@
|
||||
# NB we don't use socket activation. When libvirtd starts it will
|
||||
# spawn any virtual machines registered for autostart. We want this
|
||||
# to occur on every boot, regardless of whether any client connects
|
||||
# to a socket. Thus socket activation doesn't have any benefit
|
||||
|
||||
[Unit]
|
||||
Description=Virtualization daemon
|
||||
Before=libvirt-guests.service
|
||||
|
@@ -1,11 +0,0 @@
|
||||
[Socket]
|
||||
ListenStream=@runstatedir@/libvirt/libvirt-sock
|
||||
ListenStream=@runstatedir@/libvirt/libvirt-sock-ro
|
||||
|
||||
; The following settings must match libvirtd.conf file in order to
|
||||
; work as expected because libvirtd can't change them later.
|
||||
; SocketMode=0777 is safe only if authentication on the socket is set
|
||||
; up. For further information, please see the libvirtd.conf file.
|
||||
SocketMode=0777
|
||||
SocketUser=root
|
||||
SocketGroup=root
|
1050
daemon/remote.c
1050
daemon/remote.c
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* stream.c: APIs for managing client streams
|
||||
*
|
||||
* Copyright (C) 2009-2014 Red Hat, Inc.
|
||||
* Copyright (C) 2009, 2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -383,7 +383,7 @@ int daemonFreeClientStream(virNetServerClientPtr client,
|
||||
msg = tmp;
|
||||
}
|
||||
|
||||
virObjectUnref(stream->st);
|
||||
virStreamFree(stream->st);
|
||||
VIR_FREE(stream);
|
||||
|
||||
return ret;
|
||||
@@ -612,10 +612,10 @@ daemonStreamHandleAbort(virNetServerClientPtr client,
|
||||
virStreamEventRemoveCallback(stream->st);
|
||||
virStreamAbort(stream->st);
|
||||
|
||||
if (msg->header.status == VIR_NET_ERROR) {
|
||||
if (msg->header.status == VIR_NET_ERROR)
|
||||
virReportError(VIR_ERR_RPC,
|
||||
"%s", _("stream aborted at client request"));
|
||||
} else {
|
||||
else {
|
||||
VIR_WARN("unexpected stream status %d", msg->header.status);
|
||||
virReportError(VIR_ERR_RPC,
|
||||
_("stream aborted with unexpected status %d"),
|
||||
|
@@ -1,6 +1,6 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
## Copyright (C) 2005-2014 Red Hat, Inc.
|
||||
## Copyright (C) 2005-2013 Red Hat, Inc.
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU Lesser General Public
|
||||
@@ -25,22 +25,9 @@ DOC_SOURCE_DIR=../src
|
||||
|
||||
DEVHELP_DIR=$(datadir)/gtk-doc/html/libvirt
|
||||
|
||||
apihtml = \
|
||||
html/index.html \
|
||||
$(apihtml_generated)
|
||||
|
||||
apihtml_generated = \
|
||||
html/libvirt-libvirt-domain.html \
|
||||
html/libvirt-libvirt-domain-snapshot.html \
|
||||
html/libvirt-libvirt-event.html \
|
||||
html/libvirt-libvirt-host.html \
|
||||
html/libvirt-libvirt-interface.html \
|
||||
html/libvirt-libvirt-network.html \
|
||||
html/libvirt-libvirt-nodedev.html \
|
||||
html/libvirt-libvirt-nwfilter.html \
|
||||
html/libvirt-libvirt-secret.html \
|
||||
html/libvirt-libvirt-storage.html \
|
||||
html/libvirt-libvirt-stream.html \
|
||||
apihtml = \
|
||||
html/index.html \
|
||||
html/libvirt-libvirt.html \
|
||||
html/libvirt-virterror.html
|
||||
|
||||
apipng = \
|
||||
@@ -53,6 +40,7 @@ devhelphtml = \
|
||||
devhelp/libvirt.devhelp \
|
||||
devhelp/index.html \
|
||||
devhelp/general.html \
|
||||
devhelp/libvirt-libvirt.html \
|
||||
devhelp/libvirt-virterror.html
|
||||
|
||||
css = \
|
||||
@@ -198,7 +186,7 @@ todo:
|
||||
|
||||
hvsupport.html:: $(srcdir)/hvsupport.html.in
|
||||
|
||||
$(srcdir)/hvsupport.html.in: $(srcdir)/hvsupport.pl $(api_DATA) \
|
||||
$(srcdir)/hvsupport.html.in: $(srcdir)/hvsupport.pl \
|
||||
$(srcdir)/../src/libvirt_public.syms \
|
||||
$(srcdir)/../src/libvirt_qemu.syms $(srcdir)/../src/libvirt_lxc.syms \
|
||||
$(srcdir)/../src/driver.h
|
||||
@@ -235,7 +223,7 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
|
||||
SGML_CATALOG_FILES='$(XML_CATALOG_FILE)' \
|
||||
$(XMLLINT) --catalogs --nonet --format --valid $< > $(srcdir)/$@ \
|
||||
|| { rm $(srcdir)/$@ && exit 1; }; \
|
||||
else echo "missing XHTML1 DTD"; cat $< > $(srcdir)/$@ ; fi ; fi
|
||||
else echo "missing XHTML1 DTD" ; fi ; fi
|
||||
|
||||
%.php.tmp: %.php.in site.xsl page.xsl sitemap.html.in
|
||||
@if [ -x $(XSLTPROC) ] ; then \
|
||||
@@ -251,8 +239,6 @@ internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
|
||||
-e /php_placeholder/d < $@.tmp > $(srcdir)/$@ \
|
||||
|| { rm $(srcdir)/$@ && exit 1; }; fi
|
||||
|
||||
$(apihtml_generated): html/index.html
|
||||
|
||||
html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in
|
||||
$(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \
|
||||
$(XSLTPROC) --nonet -o $(srcdir)/ \
|
||||
@@ -263,7 +249,7 @@ html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in
|
||||
> /dev/null ; then \
|
||||
SGML_CATALOG_FILES='$(XML_CATALOG_FILE)' \
|
||||
$(XMLLINT) --catalogs --nonet --valid --noout $(srcdir)/html/*.html ; \
|
||||
else echo "missing XHTML1 DTD"; cat $< > $(srcdir)/$@ ; fi ; fi
|
||||
else echo "missing XHTML1 DTD" ; fi ; fi
|
||||
|
||||
$(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl)
|
||||
$(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \
|
||||
@@ -272,6 +258,7 @@ $(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl)
|
||||
|
||||
|
||||
python_generated_files = \
|
||||
$(srcdir)/html/libvirt-libvirt.html \
|
||||
$(srcdir)/html/libvirt-libvirt-lxc.html \
|
||||
$(srcdir)/html/libvirt-libvirt-qemu.html \
|
||||
$(srcdir)/html/libvirt-virterror.html \
|
||||
@@ -291,17 +278,6 @@ $(python_generated_files): $(APIBUILD_STAMP)
|
||||
|
||||
$(APIBUILD_STAMP): $(srcdir)/apibuild.py \
|
||||
$(srcdir)/../include/libvirt/libvirt.h.in \
|
||||
$(srcdir)/../include/libvirt/libvirt-domain-snapshot.h \
|
||||
$(srcdir)/../include/libvirt/libvirt-domain.h \
|
||||
$(srcdir)/../include/libvirt/libvirt-event.h \
|
||||
$(srcdir)/../include/libvirt/libvirt-host.h \
|
||||
$(srcdir)/../include/libvirt/libvirt-interface.h \
|
||||
$(srcdir)/../include/libvirt/libvirt-network.h \
|
||||
$(srcdir)/../include/libvirt/libvirt-nodedev.h \
|
||||
$(srcdir)/../include/libvirt/libvirt-nwfilter.h \
|
||||
$(srcdir)/../include/libvirt/libvirt-secret.h \
|
||||
$(srcdir)/../include/libvirt/libvirt-storage.h \
|
||||
$(srcdir)/../include/libvirt/libvirt-stream.h \
|
||||
$(srcdir)/../include/libvirt/libvirt-lxc.h \
|
||||
$(srcdir)/../include/libvirt/libvirt-qemu.h \
|
||||
$(srcdir)/../include/libvirt/virterror.h \
|
||||
|
@@ -90,7 +90,7 @@
|
||||
types in its API. Each object type, in turn, has a set
|
||||
of permissions defined. To determine what permissions
|
||||
are checked for specific API call, consult the
|
||||
<a href="html/index.html">API reference manual</a>
|
||||
<a href="html/libvirt-libvirt.html">API reference manual</a>
|
||||
documentation for the API in question.
|
||||
</p>
|
||||
|
||||
|
@@ -121,7 +121,7 @@
|
||||
<td>Name of the network interface, unique to the local host</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>interface_macaddr</td>
|
||||
<td>interface_mac</td>
|
||||
<td>MAC address of the network interface, not unique</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
228
docs/api.html.in
228
docs/api.html.in
@@ -16,7 +16,7 @@
|
||||
manipulated through the API is the <code>virConnectPtr</code>, which
|
||||
represents the connection to a hypervisor. Any application using libvirt
|
||||
is likely to start using the
|
||||
API by calling one of <a href="html/libvirt-libvirt-host.html#virConnectOpen"
|
||||
API by calling one of <a href="html/libvirt-libvirt.html#virConnectOpen"
|
||||
>the virConnectOpen functions</a>. You will note that those functions take
|
||||
a name argument which is actually a <a href="uri.html">connection URI</a>
|
||||
to select the right hypervisor to open.
|
||||
@@ -26,10 +26,7 @@
|
||||
name will default to a preselected hypervisor, but it's probably not a
|
||||
wise thing to do in most cases. See the <a href="uri.html">connection
|
||||
URI</a> page for a full descriptions of the values allowed.</p>
|
||||
<p> OnDevice the application obtains a
|
||||
<a href="/html/libvirt-libvirt-host.html#virConnectPtr">
|
||||
<code>virConnectPtr</code>
|
||||
</a>
|
||||
<p> Once the application obtains a <code class='docref'>virConnectPtr</code>
|
||||
connection to the hypervisor it can then use it to manage the hypervisor's
|
||||
available domains and related virtualization
|
||||
resources, such as storage and networking. All those are
|
||||
@@ -41,61 +38,33 @@
|
||||
</p>
|
||||
<p> The figure above shows the five main objects exported by the API:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-host.html#virConnectPtr">
|
||||
<code>virConnectPtr</code>
|
||||
</a>
|
||||
<li><code class='docref'>virConnectPtr</code>
|
||||
<p>Represents the connection to a hypervisor. Use one of the
|
||||
<a href="html/libvirt-libvirt-host.html#virConnectOpen">virConnectOpen</a>
|
||||
<a href="html/libvirt-libvirt.html#virConnectOpen">virConnectOpen</a>
|
||||
functions to obtain connection to the hypervisor which is then used
|
||||
as a parameter to other connection API's.</p></li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virDomainPtr">
|
||||
<code>virDomainPtr</code>
|
||||
</a>
|
||||
<li><code class='docref'>virDomainPtr</code>
|
||||
<p>Represents one domain either active or defined (i.e. existing as
|
||||
permanent config file and storage but not currently running on that
|
||||
node). The function
|
||||
<a href="html/libvirt-libvirt-domain.html#virConnectListAllDomains">
|
||||
<code>virConnectListAllDomains</code>
|
||||
</a>
|
||||
node). The function <code class='docref'>virConnectListAllDomains</code>
|
||||
lists all the domains for the hypervisor.</p></li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-network.html#virNetworkPtr">
|
||||
<code>virNetworkPtr</code>
|
||||
</a>
|
||||
<li><code class='docref'>virNetworkPtr</code>
|
||||
<p>Represents one network either active or defined (i.e. existing
|
||||
as permanent config file and storage but not currently activated).
|
||||
The function
|
||||
<a href="html/libvirt-libvirt-network.html#virConnectListAllNetworks">
|
||||
<code>virConnectListAllNetworks</code>
|
||||
</a>
|
||||
The function <code class='docref'>virConnectListAllNetworks</code>
|
||||
lists all the virtualization networks for the hypervisor.</p></li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-storage.html#virStorageVolPtr">
|
||||
<code>virStorageVolPtr</code>
|
||||
</a>
|
||||
<li><code class='docref'>virStorageVolPtr</code>
|
||||
<p>Represents one storage volume generally used
|
||||
as a block device available to one of the domains. The function
|
||||
<a href="html/libvirt-libvirt-storage.html#virStorageVolLookupByPath">
|
||||
<code>virStorageVolLookupByPath</code>
|
||||
</a>
|
||||
finds the storage volume object based on its path on the node.</p></li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-storage.html#virStoragePoolPtr">
|
||||
<code>virStoragePoolPtr</code>
|
||||
</a>
|
||||
<code class="docref">virStorageVolLookupByPath</code> finds
|
||||
the storage volume object based on its path on the node.</p></li>
|
||||
<li><code class='docref'>virStoragePoolPtr</code>
|
||||
<p>Represents a storage pool, which is a logical area
|
||||
used to allocate and store storage volumes. The function
|
||||
<a href="html/libvirt-libvirt-storage.html#virConnectListAllStoragePools">
|
||||
<code>virConnectListAllStoragePools</code>
|
||||
</a>
|
||||
lists all of the virtualization storage pools on the hypervisor.
|
||||
The function
|
||||
<a href="html/libvirt-libvirt-storage.html#virStoragePoolLookupByVolume">
|
||||
<code>virStoragePoolLookupByVolume</code>
|
||||
</a>
|
||||
finds the storage pool containing a given storage volume.</p></li>
|
||||
<code class='docref'>virConnectListAllStoragePools</code> lists
|
||||
all of the virtualization storage pools on the hypervisor. The function
|
||||
<code class="docref">virStoragePoolLookupByVolume</code> finds
|
||||
the storage pool containing a given storage volume.</p></li>
|
||||
</ul>
|
||||
<p> Most objects manipulated by the library can also be represented using
|
||||
XML descriptions. This is used primarily to create those object, but is
|
||||
@@ -132,114 +101,42 @@
|
||||
<p>Used to perform lookups on objects by some type of identifier,
|
||||
such as:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virDomainLookupByID">
|
||||
<code>virDomainLookupByID</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virDomainLookupByName">
|
||||
<code>virDomainLookupByName</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virDomainLookupByUUID">
|
||||
<code>virDomainLookupByUUID</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virDomainLookupByUUIDString">
|
||||
<code>virDomainLookupByUUIDString</code>
|
||||
</a>
|
||||
</li>
|
||||
<li><code class='docref'>virDomainLookupByID</code></li>
|
||||
<li><code class='docref'>virDomainLookupByName</code></li>
|
||||
<li><code class='docref'>virDomainLookupByUUID</code></li>
|
||||
<li><code class='docref'>virDomainLookupByUUIDString</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>Enumeration</b> [virConnectList..., virConnectNumOf...]
|
||||
<p>Used to enumerate a set of object available to an given
|
||||
hypervisor connection such as:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virConnectListDomains">
|
||||
<code>virConnectListDomains</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virConnectNumOfDomains">
|
||||
<code>virConnectNumOfDomains</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-network.html#virConnectListNetworks">
|
||||
<code>virConnectListNetworks</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-storage.html#virConnectListStoragePools">
|
||||
<code>virConnectListStoragePools</code>
|
||||
</a>
|
||||
</li>
|
||||
<li><code class='docref'>virConnectListDomains</code></li>
|
||||
<li><code class='docref'>virConnectNumOfDomains</code></li>
|
||||
<li><code class='docref'>virConnectListNetworks</code></li>
|
||||
<li><code class='docref'>virConnectListStoragePools</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>Description</b> [...GetInfo]
|
||||
<p>Generic accessor providing a set of generic information about an
|
||||
object, such as: </p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-host.html#virNodeGetInfo">
|
||||
<code>virNodeGetInfo</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virDomainGetInfo">
|
||||
<code>virDomainGetInfo</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-storage.html#virStoragePoolGetInfo">
|
||||
<code>virStoragePoolGetInfo</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-storage.html#virStorageVolGetInfo">
|
||||
<code>virStorageVolGetInfo</code>
|
||||
</a>
|
||||
</li>
|
||||
<li><code class='docref'>virNodeGetInfo</code></li>
|
||||
<li><code class='docref'>virDomainGetInfo</code></li>
|
||||
<li><code class='docref'>virStoragePoolGetInfo</code></li>
|
||||
<li><code class='docref'>virStorageVolGetInfo</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>Accessors</b> [...Get..., ...Set...]
|
||||
<p>Specific accessors used to query or modify data for the given object,
|
||||
such as: </p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-host.html#virConnectGetType">
|
||||
<code>virConnectGetType</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virDomainGetMaxMemory">
|
||||
<code>virDomainGetMaxMemory</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virDomainSetMemory">
|
||||
<code>virDomainSetMemory</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virDomainGetVcpus">
|
||||
<code>virDomainGetVcpus</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-storage.html#virStoragePoolSetAutostart">
|
||||
<code>virStoragePoolSetAutostart</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-network.html#virNetworkGetBridgeName">
|
||||
<code>virNetworkGetBridgeName</code>
|
||||
</a>
|
||||
</li>
|
||||
<li><code class='docref'>virConnectGetType</code></li>
|
||||
<li><code class='docref'>virDomainGetMaxMemory</code></li>
|
||||
<li><code class='docref'>virDomainSetMemory</code></li>
|
||||
<li><code class='docref'>virDomainGetVcpus</code></li>
|
||||
<li><code class='docref'>virStoragePoolSetAutostart</code></li>
|
||||
<li><code class='docref'>virNetworkGetBridgeName</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>Creation</b> [...Create, ...CreateXML]
|
||||
@@ -247,53 +144,21 @@
|
||||
the object based on an XML description, while the ...Create APIs will
|
||||
create the object based on existing object pointer, such as: </p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virDomainCreate">
|
||||
<code>virDomainCreate</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virDomainCreateXML">
|
||||
<code>virDomainCreateXML</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-network.html#virNetworkCreate">
|
||||
<code>virNetworkCreate</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-network.html#virNetworkCreateXML">
|
||||
<code>virNetworkCreateXML</code>
|
||||
</a>
|
||||
</li>
|
||||
<li><code class='docref'>virDomainCreate</code></li>
|
||||
<li><code class='docref'>virDomainCreateXML</code></li>
|
||||
<li><code class='docref'>virNetworkCreate</code></li>
|
||||
<li><code class='docref'>virNetworkCreateXML</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>Destruction</b> [...Destroy]
|
||||
<p>Used to shutdown or deactivate and destroy objects, such as: </p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html#virDomainDestroy">
|
||||
<code>virDomainDestroy</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-network.html#virNetworkDestroy">
|
||||
<code>virNetworkDestroy</code>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-storage.html#virStoragePoolDestroy">
|
||||
<code>virStoragePoolDestroy</code>
|
||||
</a>
|
||||
</li>
|
||||
<li><code class='docref'>virDomainDestroy</code></li>
|
||||
<li><code class='docref'>virNetworkDestroy</code></li>
|
||||
<li><code class='docref'>virStoragePoolDestroy</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Note: functions returning vir*Ptr (like the virDomainLookup functions)
|
||||
allocate memory which needs to be freed by the caller by the corresponding
|
||||
vir*Free function (e.g. virDomainFree for a virDomainPtr object).
|
||||
</p>
|
||||
<p> For more in-depth details of the storage related APIs see
|
||||
<a href="storage.html">the storage management page</a>.
|
||||
</p>
|
||||
@@ -301,11 +166,7 @@
|
||||
<p>Drivers are the basic building block for libvirt functionality
|
||||
to support the capability to handle specific hypervisor driver calls.
|
||||
Drivers are discovered and registered during connection processing as
|
||||
part of the
|
||||
<a href="html/libvirt-libvirt-host.html#virInitialize">
|
||||
<code>virInitialize</code>
|
||||
</a>
|
||||
API. Each driver
|
||||
part of the <code class='docref'>virInitialize</code> API. Each driver
|
||||
has a registration API which loads up the driver specific function
|
||||
references for the libvirt APIs to call. The following is a simplistic
|
||||
view of the hypervisor driver mechanism. Consider the stacked list of
|
||||
@@ -334,10 +195,7 @@
|
||||
The libvirtd daemon service is started on the host at system boot
|
||||
time and can also be restarted at any time by a properly privileged
|
||||
user, such as root. The libvirtd daemon uses the same libvirt API
|
||||
<a href="html/libvirt-libvirt-host.html#virInitialize">
|
||||
<code>virInitialize</code>
|
||||
</a>
|
||||
sequence as applications
|
||||
<code class='docref'>virInitialize</code> sequence as applications
|
||||
for client-side driver registrations, but then extends the registered
|
||||
driver list to encompass all known drivers supported for all driver
|
||||
types supported on the host. </p>
|
||||
|
@@ -21,29 +21,9 @@ debugsym=None
|
||||
# C parser analysis code
|
||||
#
|
||||
included_files = {
|
||||
"libvirt-domain.h": "header with general libvirt API definitions",
|
||||
"libvirt-domain-snapshot.h": "header with general libvirt API definitions",
|
||||
"libvirt-event.h": "header with general libvirt API definitions",
|
||||
"libvirt-host.h": "header with general libvirt API definitions",
|
||||
"libvirt-interface.h": "header with general libvirt API definitions",
|
||||
"libvirt-network.h": "header with general libvirt API definitions",
|
||||
"libvirt-nodedev.h": "header with general libvirt API definitions",
|
||||
"libvirt-nwfilter.h": "header with general libvirt API definitions",
|
||||
"libvirt-secret.h": "header with general libvirt API definitions",
|
||||
"libvirt-storage.h": "header with general libvirt API definitions",
|
||||
"libvirt-stream.h": "header with general libvirt API definitions",
|
||||
"libvirt.h": "header with general libvirt API definitions",
|
||||
"virterror.h": "header with error specific API definitions",
|
||||
"libvirt.c": "Main interfaces for the libvirt library",
|
||||
"libvirt-domain.c": "Domain interfaces for the libvirt library",
|
||||
"libvirt-domain-snapshot.c": "Domain snapshot interfaces for the libvirt library",
|
||||
"libvirt-host.c": "Host interfaces for the libvirt library",
|
||||
"libvirt-interface.c": "Interface interfaces for the libvirt library",
|
||||
"libvirt-network.c": "Network interfaces for the libvirt library",
|
||||
"libvirt-nodedev.c": "Node device interfaces for the libvirt library",
|
||||
"libvirt-nwfilter.c": "NWFilter interfaces for the libvirt library",
|
||||
"libvirt-secret.c": "Secret interfaces for the libvirt library",
|
||||
"libvirt-storage.c": "Storage interfaces for the libvirt library",
|
||||
"libvirt-stream.c": "Stream interfaces for the libvirt library",
|
||||
"virerror.c": "implements error handling and reporting code for libvirt",
|
||||
"virevent.c": "event loop for monitoring file handles",
|
||||
"virtypedparam.c": "virTypedParameters APIs",
|
||||
@@ -85,7 +65,6 @@ ignored_functions = {
|
||||
"virDomainMigratePrepareTunnel3": "private function for tunnelled migration",
|
||||
"DllMain": "specific function for Win32",
|
||||
"virTypedParamsValidate": "internal function in virtypedparam.c",
|
||||
"virTypedParameterValidateSet": "internal function in virtypedparam.c",
|
||||
"virTypedParameterAssign": "internal function in virtypedparam.c",
|
||||
"virTypedParameterAssignFromStr": "internal function in virtypedparam.c",
|
||||
"virTypedParameterToString": "internal function in virtypedparam.c",
|
||||
@@ -459,14 +438,6 @@ class CLexer:
|
||||
if line[0] == '#':
|
||||
self.tokens = map((lambda x: ('preproc', x)),
|
||||
string.split(line))
|
||||
|
||||
# We might have whitespace between the '#' and preproc
|
||||
# macro name, so instead of having a single token element
|
||||
# of '#define' we might end up with '#' and 'define'. This
|
||||
# merges them back together
|
||||
if self.tokens[0][1] == "#":
|
||||
self.tokens[0] = ('preproc', self.tokens[0][1] + self.tokens[1][1])
|
||||
self.tokens = self.tokens[:1] + self.tokens[2:]
|
||||
break
|
||||
l = len(line)
|
||||
if line[0] == '"' or line[0] == "'":
|
||||
@@ -955,7 +926,7 @@ class CParser:
|
||||
if i < len(l) and l[i] == ' ':
|
||||
i = i + 1
|
||||
l = l[i:]
|
||||
if len(l) >= 6 and l[0:7] == "Returns":
|
||||
if len(l) >= 6 and l[0:7] == "returns" or l[0:7] == "Returns":
|
||||
try:
|
||||
l = string.split(l, ' ', 1)[1]
|
||||
except:
|
||||
|
@@ -110,12 +110,6 @@
|
||||
application stap can use libvirt to gather data within virtual
|
||||
machines.
|
||||
</dd>
|
||||
<dt><a href="https://github.com/pradels/vagrant-libvirt/">vagrant-libvirt</a></dt>
|
||||
<dd>
|
||||
Vagrant-Libvirt is a Vagrant plugin that uses libvirt to manage virtual
|
||||
machines. It is a command line tool for developers that makes it very
|
||||
fast and easy to deploy and re-deploy an environment of vm's.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2><a name="configmgmt">Configuration Management</a></h2>
|
||||
@@ -163,21 +157,25 @@
|
||||
<h2><a name="conversion">Conversion</a></h2>
|
||||
|
||||
<dl>
|
||||
<dt><a href="http://libguestfs.org/virt-p2v.1.html">virt-p2v</a></dt>
|
||||
<dt><a href="https://rwmj.wordpress.com/2009/10/13/poor-mans-p2v/">Poor mans p2v</a></dt>
|
||||
<dd>
|
||||
Convert a physical machine to run on KVM. It is a LiveCD
|
||||
which is booted on the machine to be converted. It collects a
|
||||
little information from the user, then copies the disks over
|
||||
to a remote machine and defines the XML for a domain to run
|
||||
the guest. (Note this tool is included with libguestfs)
|
||||
A simple approach for converting a physical machine to a virtual
|
||||
machine, using a rescue CD.
|
||||
</dd>
|
||||
<dt><a href="http://libguestfs.org/virt-v2v.1.html">virt-v2v</a></dt>
|
||||
<dt><a href="http://et.redhat.com/~rjones/virt-p2v/">virt-p2v</a></dt>
|
||||
<dd>
|
||||
virt-v2v converts guests from a foreign hypervisor to run on
|
||||
KVM, managed by libvirt. It can convert guests from VMware or
|
||||
Xen to run on OpenStack, oVirt (RHEV-M), or local libvirt. It
|
||||
An older tool for converting a physical machine into a virtual
|
||||
machine. It is a LiveCD which is booted on the machine to be
|
||||
converted. It collects a little information from the user, then
|
||||
copies the disks over to a remote machine and defines the XML for a
|
||||
domain to run the guest.
|
||||
</dd>
|
||||
<dt><a href="http://git.fedorahosted.org/git/?p=virt-v2v.git;a=summary">virt-v2v</a></dt>
|
||||
<dd>
|
||||
virt-v2v converts guests from a foreign hypervisor to run on KVM,
|
||||
managed by libvirt. It can currently convert Red Hat Enterprise
|
||||
Linux (RHEL) and Fedora guests running on Xen and VMware ESX. It
|
||||
will enable VirtIO drivers in the converted guest if possible.
|
||||
(Note this tool is included with libguestfs)
|
||||
</dd>
|
||||
<dd>
|
||||
For RHEL customers of Red Hat, conversion of Windows guests is also
|
||||
@@ -404,14 +402,6 @@
|
||||
functions, such as live migration that allows for load
|
||||
balancing between cluster nodes, monitoring CPU, memory.
|
||||
</dd>
|
||||
<dt><a href="http://mist.io/">mist.io</a></dt>
|
||||
<dd>
|
||||
Mist.io is an open source project and a service that can assist you in
|
||||
managing your virtual machines on a unified way, providing a simple
|
||||
interface for all of your infrastructure (multiple public cloud
|
||||
providers, OpenStack based public/private clouds, Docker servers, bare
|
||||
metal servers and now KVM hypervisors).
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2><a name="mobile">Mobile applications</a></h2>
|
||||
|
@@ -285,41 +285,6 @@
|
||||
<dd>Updated path of the host entropy source for the RNG</dd>
|
||||
</dl>
|
||||
|
||||
<h4><a name="typeresourcechardev">console/serial/parallel/channel</a></h4>
|
||||
<p>
|
||||
The <code>msg</code> field will include the following sub-fields
|
||||
</p>
|
||||
|
||||
<dl>
|
||||
<dt>reason</dt>
|
||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||
<dt>resrc</dt>
|
||||
<dd>The type of resource assigned. Set to <code>chardev</code></dd>
|
||||
<dt>old-chardev</dt>
|
||||
<dd>Original path of the backing character device for given emulated device</dd>
|
||||
<dt>new-chardev</dt>
|
||||
<dd>Updated path of the backing character device for given emulated device</dd>
|
||||
</dl>
|
||||
|
||||
<h4><a name="typeresourcesmartcard">smartcard</a></h4>
|
||||
<p>
|
||||
The <code>msg</code> field will include the following sub-fields
|
||||
</p>
|
||||
|
||||
<dl>
|
||||
<dt>reason</dt>
|
||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||
<dt>resrc</dt>
|
||||
<dd>The type of resource assigned. Set to <code>smartcard</code></dd>
|
||||
<dt>old-smartcard</dt>
|
||||
<dd>Original path of the backing character device, certificate store or
|
||||
"nss-smartcard-device" for host smartcard passthrough.
|
||||
</dd>
|
||||
<dt>new-smartcard</dt>
|
||||
<dd>Updated path of the backing character device, certificate store or
|
||||
"nss-smartcard-device" for host smartcard passthrough.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4><a name="typeresourceredir">Redirected device</a></h4>
|
||||
<p>
|
||||
|
@@ -44,10 +44,8 @@
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
<strong>Python</strong>: Libvirt's python bindings are split to a
|
||||
separate <a href="http://libvirt.org/git/?p=libvirt-python.git">package</a>
|
||||
since version 1.2.0, older versions came with direct support for the
|
||||
Python language.
|
||||
<strong>Python</strong>: Libvirt comes with direct support for
|
||||
the Python language.
|
||||
</p>
|
||||
<p>
|
||||
If your libvirt is installed as packages, rather than compiled
|
||||
|
@@ -37,31 +37,20 @@ bhyve+ssh://root@example.com/system (remote access, SSH tunnelled)
|
||||
<h3>Example config</h3>
|
||||
<p>
|
||||
The bhyve driver in libvirt is in its early stage and under active development. So it supports
|
||||
only limited number of features bhyve provides.
|
||||
only limited number of features bhyve provides. All the supported features could be found
|
||||
in this sample domain XML.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note: in older libvirt versions, only a single network device and a single
|
||||
disk device were supported per-domain. However,
|
||||
<span class="since">since 1.2.6</span> the libvirt bhyve driver supports
|
||||
up to 31 PCI devices.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note: the Bhyve driver in libvirt will boot whichever device is first. If you
|
||||
want to install from CD, put the CD device first. If not, put the root HDD
|
||||
first.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note: Only the SATA bus is supported. Only <code>cdrom</code>- and
|
||||
<code>disk</code>-type disks are supported.
|
||||
A limitation that is not obvious from this sample domain XML is that currently only a
|
||||
single network and a single disk device are supported for each domain (as PCI slot allocation code
|
||||
in libvirt bhyve driver is yet to be implemented).
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<domain type='bhyve'>
|
||||
<name>bhyve</name>
|
||||
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
|
||||
<name>bhyve</name>
|
||||
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
|
||||
<memory>219136</memory>
|
||||
<currentMemory>219136</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
@@ -82,12 +71,6 @@ Note: Only the SATA bus is supported. Only <code>cdrom</code>- and
|
||||
<source file='/path/to/bhyve_freebsd.img'/>
|
||||
<target dev='hda' bus='sata'/>
|
||||
</disk>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='file' type='raw'/>
|
||||
<source file='/path/to/cdrom.iso'/>
|
||||
<target dev='hdc' bus='sata'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<interface type='bridge'>
|
||||
<model type='virtio'/>
|
||||
<source bridge="virbr0"/>
|
||||
@@ -96,159 +79,5 @@ Note: Only the SATA bus is supported. Only <code>cdrom</code>- and
|
||||
</domain>
|
||||
</pre>
|
||||
|
||||
<p>(The <disk> sections may be swapped in order to install from
|
||||
<em>cdrom.iso</em>.)</p>
|
||||
|
||||
<h3>Example config (Linux guest)</h3>
|
||||
|
||||
<p>
|
||||
Note the addition of <bootloader>.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<domain type='bhyve'>
|
||||
<name>linux_guest</name>
|
||||
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
|
||||
<memory>131072</memory>
|
||||
<currentMemory>131072</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<bootloader>/usr/local/sbin/grub-bhyve</bootloader>
|
||||
<os>
|
||||
<type>hvm</type>
|
||||
</os>
|
||||
<features>
|
||||
<apic/>
|
||||
<acpi/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='file' type='raw'/>
|
||||
<source file='/path/to/guest_hdd.img'/>
|
||||
<target dev='hda' bus='sata'/>
|
||||
</disk>
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='file' type='raw'/>
|
||||
<source file='/path/to/cdrom.iso'/>
|
||||
<target dev='hdc' bus='sata'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<interface type='bridge'>
|
||||
<model type='virtio'/>
|
||||
<source bridge="virbr0"/>
|
||||
</interface>
|
||||
</devices>
|
||||
</domain>
|
||||
</pre>
|
||||
|
||||
<h2><a name="usage">Guest usage / management</a></h2>
|
||||
|
||||
<h3><a name="console">Connecting to a guest console</a></h3>
|
||||
|
||||
<p>
|
||||
Guest console connection is supported through the <code>nmdm</code> device. It could be enabled by adding
|
||||
the following to the domain XML (<span class="since">Since 1.2.4</span>):
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<devices>
|
||||
<serial type="nmdm">
|
||||
<source master="/dev/nmdm0A" slave="/dev/nmdm0B"/>
|
||||
</serial>
|
||||
</devices>
|
||||
...</pre>
|
||||
|
||||
|
||||
<p>Make sure to load the <code>nmdm</code> kernel module if you plan to use that.</p>
|
||||
|
||||
<p>
|
||||
Then <code>virsh console</code> command can be used to connect to the text console
|
||||
of a guest.</p>
|
||||
|
||||
<p><b>NB:</b> Some versions of bhyve have a bug that prevents guests from booting
|
||||
until the console is opened by a client. This bug was fixed in FreeBSD
|
||||
<a href="http://svnweb.freebsd.org/changeset/base/262884">r262884</a>. If
|
||||
an older version is used, one either has to open a console manually with <code>virsh console</code>
|
||||
to let a guest boot or start a guest using:</p>
|
||||
|
||||
<pre>start --console domname</pre>
|
||||
|
||||
<p><b>NB:</b> An bootloader configured to require user interaction will prevent
|
||||
the domain from starting (and thus <code>virsh console</code> or <code>start
|
||||
--console</code> from functioning) until the user interacts with it manually on
|
||||
the VM host. Because users typically do not have access to the VM host,
|
||||
interactive bootloaders are unsupported by libvirt. <em>However,</em> if you happen to
|
||||
run into this scenario and also happen to have access to the Bhyve host
|
||||
machine, you may select a boot option and allow the domain to finish starting
|
||||
by using an alternative terminal client on the VM host to connect to the
|
||||
domain-configured null modem device. One example (assuming
|
||||
<code>/dev/nmdm0B</code> is configured as the slave end of the domain serial
|
||||
device) is:</p>
|
||||
|
||||
<pre>cu -l /dev/nmdm0B</pre>
|
||||
|
||||
<h3><a name="xmltonative">Converting from domain XML to Bhyve args</a></h3>
|
||||
|
||||
<p>
|
||||
The <code>virsh domxml-to-native</code> command can preview the actual
|
||||
<code>bhyve</code> commands that will be executed for a given domain.
|
||||
It outputs two lines, the first line is a <code>bhyveload</code> command and
|
||||
the second is a <code>bhyve</code> command.
|
||||
</p>
|
||||
|
||||
<p>Please note that the <code>virsh domxml-to-native</code> doesn't do any
|
||||
real actions other than printing the command, for example, it doesn't try to
|
||||
find a proper TAP interface and create it, like what is done when starting
|
||||
a domain; and always returns <code>tap0</code> for the network interface. So
|
||||
if you're going to run these commands manually, most likely you might want to
|
||||
tweak them.</p>
|
||||
|
||||
<pre>
|
||||
# virsh -c "bhyve:///system" domxml-to-native --format bhyve-argv --xml /path/to/bhyve.xml
|
||||
/usr/sbin/bhyveload -m 214 -d /home/user/vm1.img vm1
|
||||
/usr/sbin/bhyve -c 2 -m 214 -A -I -H -P -s 0:0,hostbridge -s 3:0,virtio-net,tap0,mac=52:54:00:5d:74:e3 -s 2:0,virtio-blk,/home/user/vm1.img -s 1,lpc -l com1,/dev/nmdm0A vm1
|
||||
</pre>
|
||||
|
||||
<h3><a name="zfsvolume">Using ZFS volumes</a></h3>
|
||||
|
||||
<p>It's possible to use ZFS volumes as disk devices <span class="since">since 1.2.8</span>.
|
||||
An example of domain XML device entry for that will look like:</p>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<disk type='volume' device='disk'>
|
||||
<source pool='zfspool' volume='vol1'/>
|
||||
<target dev='vdb' bus='virtio'/>
|
||||
</disk>
|
||||
...</pre>
|
||||
|
||||
<p>Please refer to the <a href="storage.html">Storage documentation</a> for more details on storage
|
||||
management.</p>
|
||||
|
||||
<h3><a name="grubbhyve">Using grub2-bhyve or Alternative Bootloaders</a></h3>
|
||||
|
||||
<p>It's possible to boot non-FreeBSD guests by specifying an explicit
|
||||
bootloader, e.g. <code>grub-bhyve(1)</code>. Arguments to the bootloader may be
|
||||
specified as well. If the bootloader is <code>grub-bhyve</code> and arguments
|
||||
are omitted, libvirt will try and infer boot ordering from user-supplied
|
||||
<boot order='N'> configuration in the domain. Failing that, it will boot
|
||||
the first disk in the domain (either <code>cdrom</code>- or
|
||||
<code>disk</code>-type devices). If the disk type is <code>disk</code>, it will
|
||||
attempt to boot from the first partition in the disk image.</p>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<bootloader>/usr/local/sbin/grub-bhyve</bootloader>
|
||||
<bootloader_args>...</bootloader_args>
|
||||
...
|
||||
</pre>
|
||||
|
||||
<p>Caveat: <code>bootloader_args</code> does not support any quoting.
|
||||
Filenames, etc, must not have spaces or they will be tokenized incorrectly.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -148,7 +148,7 @@ vpx://example-vcenter.com/folder1/dc1/folder2/example-esx.com
|
||||
</td>
|
||||
<td>
|
||||
If set to 1, this disables libcurl client checks of the server's
|
||||
SSL certificate. The default value is 0. See the
|
||||
SSL certificate. The default value it 0. See the
|
||||
<a href="#certificates">Certificates for HTTPS</a> section for
|
||||
details.
|
||||
</td>
|
||||
@@ -164,7 +164,7 @@ vpx://example-vcenter.com/folder1/dc1/folder2/example-esx.com
|
||||
If set to 1, the driver answers all
|
||||
<a href="#questions">questions</a> with the default answer.
|
||||
If set to 0, questions are reported as errors. The default
|
||||
value is 0. <span class="since">Since 0.7.5</span>.
|
||||
value it 0. <span class="since">Since 0.7.5</span>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@@ -88,8 +88,6 @@ to be provided by all container technologies on Linux.
|
||||
<dd>The fixed string <code>/bin:/usr/bin</code></dd>
|
||||
<dt>TERM</dt>
|
||||
<dd>The fixed string <code>linux</code></dd>
|
||||
<dt>HOME</dt>
|
||||
<dd>The fixed string <code>/</code></dd>
|
||||
</dl>
|
||||
|
||||
<p>
|
||||
@@ -167,7 +165,7 @@ numbered incrementally from there.
|
||||
|
||||
<p>
|
||||
Since /dev/ttyN and /dev/console are linked to the pts devices. The
|
||||
tty device of login program is pts device. The pam module securetty
|
||||
tty device of login program is pts device. the pam module securetty
|
||||
may prevent root user from logging in container. If you want root
|
||||
user to log in container successfully, add the pts device to the file
|
||||
/etc/securetty of container.
|
||||
@@ -542,53 +540,6 @@ debootstrap, whatever) under /opt/vm-1-root:
|
||||
</domain>
|
||||
</pre>
|
||||
|
||||
<h2><a name="capabilities">Altering the available capabilities</a></h2>
|
||||
|
||||
<p>
|
||||
By default the libvirt LXC driver drops some capabilities among which CAP_MKNOD.
|
||||
However <span class="since">since 1.2.6</span> libvirt can be told to keep or
|
||||
drop some capabilities using a domain configuration like the following:
|
||||
</p>
|
||||
<pre>
|
||||
...
|
||||
<features>
|
||||
<capabilities policy='default'>
|
||||
<mknod state='on'/>
|
||||
<sys_chroot state='off'/>
|
||||
</capabilities>
|
||||
</features>
|
||||
...
|
||||
</pre>
|
||||
<p>
|
||||
The capabilities children elements are named after the capabilities as defined in
|
||||
<code>man 7 capabilities</code>. An <code>off</code> state tells libvirt to drop the
|
||||
capability, while an <code>on</code> state will force to keep the capability even though
|
||||
this one is dropped by default.
|
||||
</p>
|
||||
<p>
|
||||
The <code>policy</code> attribute can be one of <code>default</code>, <code>allow</code>
|
||||
or <code>deny</code>. It defines the default rules for capabilities: either keep the
|
||||
default behavior that is dropping a few selected capabilities, or keep all capabilities
|
||||
or drop all capabilities. The interest of <code>allow</code> and <code>deny</code> is that
|
||||
they guarantee that all capabilities will be kept (or removed) even if new ones are added
|
||||
later.
|
||||
</p>
|
||||
<p>
|
||||
The following example, drops all capabilities but CAP_MKNOD:
|
||||
</p>
|
||||
<pre>
|
||||
...
|
||||
<features>
|
||||
<capabilities policy='deny'>
|
||||
<mknod state='on'/>
|
||||
</capabilities>
|
||||
</features>
|
||||
...
|
||||
</pre>
|
||||
<p>
|
||||
Note that allowing capabilities that are normally dropped by default can seriously
|
||||
affect the security of the container and the host.
|
||||
</p>
|
||||
|
||||
<h2><a name="usage">Container usage / management</a></h2>
|
||||
|
||||
|
@@ -46,9 +46,9 @@ following fields:</p>
|
||||
<li>level: the error level, usually VIR_ERR_ERROR, though there is room for
|
||||
warnings like VIR_ERR_WARNING</li>
|
||||
<li>message: the full human-readable formatted string of the error</li>
|
||||
<li>conn: if available a pointer to the <a href="html/libvirt-libvirt-host.html#virConnectPtr">virConnectPtr</a>
|
||||
<li>conn: if available a pointer to the <a href="html/libvirt-libvirt.html#virConnectPtr">virConnectPtr</a>
|
||||
connection to the hypervisor where this happened</li>
|
||||
<li>dom: if available a pointer to the <a href="html/libvirt-libvirt-domain.html#virDomainPtr">virDomainPtr</a> domain
|
||||
<li>dom: if available a pointer to the <a href="html/libvirt-libvirt.html#virDomainPtr">virDomainPtr</a> domain
|
||||
targeted in the operation</li>
|
||||
</ul>
|
||||
<p>and then extra raw information about the error which may be initialized
|
||||
|
@@ -4,147 +4,19 @@
|
||||
<body>
|
||||
<h1>Driver capabilities XML format</h1>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<h2><a name="elements">Element and attribute overview</a></h2>
|
||||
|
||||
<p>As new virtualization engine support gets added to libvirt, and to
|
||||
handle cases like QEMU supporting a variety of emulations, a query
|
||||
interface has been added in 0.2.1 allowing to list the set of supported
|
||||
virtualization capabilities on the host:</p>
|
||||
|
||||
<pre> char * virConnectGetCapabilities (virConnectPtr conn);</pre>
|
||||
|
||||
<p>The value returned is an XML document listing the virtualization
|
||||
capabilities of the host and virtualization engine to which
|
||||
<code>@conn</code> is connected. One can test it using <code>virsh</code>
|
||||
command line tool command '<code>capabilities</code>', it dumps the XML
|
||||
associated to the current connection. </p>
|
||||
|
||||
<p>As can be seen seen in the <a href="#elementExamples">example</a>, the
|
||||
capabilities XML consists of the <code>capabilities</code> element which
|
||||
have exactly one <code>host</code> child element to report information on
|
||||
host capabilities, and zero or more <code>guest</code> element to express
|
||||
the set of architectures the host can run at the moment.</p>
|
||||
|
||||
|
||||
<h3><a name="elementHost">Host capabilities</a></h3>
|
||||
|
||||
<p>The <code><host/></code> element consists of the following child
|
||||
elements:</p>
|
||||
<dl>
|
||||
<dt><code>uuid</code></dt>
|
||||
<dd>The host UUID.</dd>
|
||||
|
||||
<dt><code>cpu</code></dt>
|
||||
<dd>The host CPU architecture and features.</dd>
|
||||
|
||||
<dt><code>power_management</code></dt>
|
||||
<dd>whether host is capable of memory suspend, disk hibernation, or
|
||||
hybrid suspend.</dd>
|
||||
|
||||
<dt><code>migration</code></dt>
|
||||
<dd>This element exposes information on the hypervisor's migration
|
||||
capabilities, like live migration, supported URI transports, and so
|
||||
on.</dd>
|
||||
|
||||
<dt><code>topology</code></dt>
|
||||
<dd>This element embodies the host internal topology. Management
|
||||
applications may want to learn this information when orchestrating new
|
||||
guests - e.g. due to reduce inter-NUMA node transfers.</dd>
|
||||
|
||||
<dt><code>secmodel</code></dt>
|
||||
<dd>To find out default security labels for different security models you
|
||||
need to parse this element. In contrast with the former elements, this is
|
||||
repeated for each security model the libvirt daemon currently supports.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<h3><a name="elementGuest">Guest capabilities</a></h3>
|
||||
|
||||
<p>While the <a href="#elementHost">previous section</a> aims at host
|
||||
capabilities, this one focuses on capabilities available to a guest
|
||||
using a given hypervisor. The <code><guest/></code> element will
|
||||
typically wrap up the following elements:</p>
|
||||
|
||||
<dl>
|
||||
<dt><code>os_type</code></dt>
|
||||
<dd>This expresses what kind of operating system the hypervisor
|
||||
is able to run. Possible values are:
|
||||
<dl>
|
||||
<dt>xen</dt>
|
||||
<dd>for XEN</dd>
|
||||
|
||||
<dt>linux</dt>
|
||||
<dd>legacy alias for <code>xen</code></dd>
|
||||
|
||||
<dt>hvm</dt>
|
||||
<dd>Unmodified operating system</dd>
|
||||
|
||||
<dt>exe</dt>
|
||||
<dd>Container based virtualization</dd>
|
||||
|
||||
<dt>uml</dt>
|
||||
<dd>User Mode Linux</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
|
||||
<dt><code>arch</code></dt>
|
||||
<dd>This element brings some information on supported guest architecture.</dd>
|
||||
|
||||
<dt><code>features</code></dt>
|
||||
<dd>This optional element encases possible features that can be used
|
||||
with a guest of described type. Possible subelements are:
|
||||
<dl>
|
||||
<dt>pae</dt><dd>If present, 32-bit guests can use PAE
|
||||
address space extensions, <span class="since">since
|
||||
0.4.1</span></dd>
|
||||
<dt>nonpae</dt><dd>If present, 32-bit guests can be run
|
||||
without requiring PAE, <span class="since">since
|
||||
0.4.1</span></dd>
|
||||
<dt>ia64_be</dt><dd>If present, IA64 guests can be run in
|
||||
big-endian mode, <span class="since">since 0.4.1</span></dd>
|
||||
<dt>acpi</dt><dd>If this element is present,
|
||||
the <code>default</code> attribute describes whether the
|
||||
hypervisor exposes ACPI to the guest by default, and
|
||||
the <code>toggle</code> attribute describes whether the
|
||||
user can override this
|
||||
default. <span class="since">Since 0.4.1</span></dd>
|
||||
<dt>apic</dt><dd>If this element is present,
|
||||
the <code>default</code> attribute describes whether the
|
||||
hypervisor exposes APIC to the guest by default, and
|
||||
the <code>toggle</code> attribute describes whether the
|
||||
user can override this
|
||||
default. <span class="since">Since 0.4.1</span></dd>
|
||||
<dt>cpuselection</dt><dd>If this element is present, the
|
||||
hypervisor supports the <code><cpu></code> element
|
||||
within a domain definition for fine-grained control over
|
||||
the CPU presented to the
|
||||
guest. <span class="since">Since 0.7.5</span></dd>
|
||||
<dt>deviceboot</dt><dd>If this element is present,
|
||||
the <code><boot order='...'/></code> element can
|
||||
be used inside devices, rather than the older boot
|
||||
specification by category. <span class="since">Since
|
||||
0.8.8</span></dd>
|
||||
<dt>disksnapshot</dt><dd>If this element is present,
|
||||
the <code>default</code> attribute describes whether
|
||||
external disk snapshots are supported. If absent,
|
||||
external snapshots may still be supported, but it
|
||||
requires attempting the API and checking for an error to
|
||||
find out for sure. <span class="since">Since
|
||||
1.2.3</span></dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h3><a name="elementExamples">Examples</a></h3>
|
||||
|
||||
<p>For example, in the case of a 64-bit machine with hardware
|
||||
virtualization capabilities enabled in the chip and
|
||||
BIOS you will see:</p>
|
||||
|
||||
<pre><capabilities>
|
||||
<p>As new virtualization engine support gets added to libvirt, and to handle
|
||||
cases like QEmu supporting a variety of emulations, a query interface has
|
||||
been added in 0.2.1 allowing to list the set of supported virtualization
|
||||
capabilities on the host:</p>
|
||||
<pre> char * virConnectGetCapabilities (virConnectPtr conn);</pre>
|
||||
<p>The value returned is an XML document listing the virtualization
|
||||
capabilities of the host and virtualization engine to which
|
||||
<code>@conn</code> is connected. One can test it using <code>virsh</code>
|
||||
command line tool command '<code>capabilities</code>', it dumps the XML
|
||||
associated to the current connection. For example in the case of a 64 bits
|
||||
machine with hardware virtualization capabilities enabled in the chip and
|
||||
BIOS you will see</p>
|
||||
<pre><capabilities>
|
||||
<span style="color: #E50000"><host>
|
||||
<cpu>
|
||||
<arch>x86_64</arch>
|
||||
@@ -195,5 +67,30 @@
|
||||
</guest></span>
|
||||
...
|
||||
</capabilities></pre>
|
||||
<p>The first block (in red) indicates the host hardware
|
||||
capabilities, such as CPU properties and the power
|
||||
management features of the host platform. CPU models are
|
||||
shown as additional features relative to the closest base
|
||||
model, within a feature block (the block is similar to what
|
||||
you will find in a Xen fully virtualized domain
|
||||
description). Further, the power management features
|
||||
supported by the host are shown, such as Suspend-to-RAM (S3),
|
||||
Suspend-to-Disk (S4) and Hybrid-Suspend (a combination of S3
|
||||
and S4). In case the host does not support
|
||||
any such feature, then an empty <power_management/>
|
||||
tag will be shown. </p>
|
||||
<p>The second block (in blue) indicates the paravirtualization
|
||||
support of the Xen support, you will see the os_type of xen
|
||||
to indicate a paravirtual kernel, then architecture
|
||||
information and potential features.</p>
|
||||
<p>The third block (in green) gives similar information but
|
||||
when running a 32 bit OS fully virtualized with Xen using
|
||||
the hvm support.</p>
|
||||
<p>This section is likely to be updated and augmented in the
|
||||
future,
|
||||
see <a href="https://www.redhat.com/archives/libvir-list/2007-March/msg00215.html">the
|
||||
discussion</a> which led to the capabilities format in the
|
||||
mailing-list archives.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,281 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1>Domain capabilities XML format</h1>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<h2><a name="Overview">Overview</a></h2>
|
||||
|
||||
<p>Sometimes, when a new domain is to be created it may come handy to know
|
||||
the capabilities of the hypervisor so the correct combination of devices and
|
||||
drivers is used. For example, when management application is considering the
|
||||
mode for a host device's passthrough there are several options depending not
|
||||
only on host, but on hypervisor in question too. If the hypervisor is qemu
|
||||
then it needs to be more recent to support VFIO, while legacy KVM is
|
||||
achievable just fine with older qemus.</p>
|
||||
|
||||
<p>The main difference between
|
||||
<a href="/html/libvirt-libvirt-host.html#virConnectGetCapabilities">
|
||||
<code>virConnectGetCapabilities</code>
|
||||
</a>
|
||||
and the emulator capabilities API is, the former one aims more on
|
||||
the host capabilities (e.g. NUMA topology, security models in
|
||||
effect, etc.) while the latter one specializes on the hypervisor
|
||||
capabilities.</p>
|
||||
|
||||
<p>While the <a href="formatcaps.html">Driver Capabilities</a> provides the
|
||||
host capabilities (e.g NUMA topology, security models in effect, etc.), the
|
||||
Domain Capabilities provides the hypervisor specific capabilities for
|
||||
Management Applications to query and make decisions regarding what to
|
||||
utilize.</p>
|
||||
|
||||
<p>The Domain Capabilities can provide information such as the correct
|
||||
combination of devices and drivers that are supported. Knowing which host
|
||||
and hypervisor specific options are available or supported would allow the
|
||||
management application to choose an appropriate mode for a pass-through
|
||||
host device as well as which adapter to utilize.</p>
|
||||
|
||||
<h2><a name="elements">Element and attribute overview</a></h2>
|
||||
|
||||
<p> A new query interface was added to the virConnect API's to retrieve the
|
||||
XML listing of the set of domain capabilities (<span class="since">Since
|
||||
1.2.7</span>):</p>
|
||||
|
||||
<pre>
|
||||
<a href="/html/libvirt-libvirt-domain.html#virConnectGetDomainCapabilities">virConnectGetDomainCapabilities</a>
|
||||
</pre>
|
||||
|
||||
<p>The root element that emulator capability XML document starts with has
|
||||
name <code>domainCapabilities</code>. It contains at least four direct
|
||||
child elements:</p>
|
||||
|
||||
<pre>
|
||||
<domainCapabilities>
|
||||
<path>/usr/bin/qemu-system-x86_64</path>
|
||||
<domain>kvm</domain>
|
||||
<machine>pc-i440fx-2.1</machine>
|
||||
<arch>x86_64</arch>
|
||||
...
|
||||
</domainCapabilities>
|
||||
</pre>
|
||||
<dl>
|
||||
<dt>path</dt>
|
||||
<dd>The full path to the emulator binary.</dd>
|
||||
|
||||
<dt>domain</dt>
|
||||
<dd>Describes the <a href="formatdomain.html#elements">virtualization
|
||||
type</a> (or so called domain type).</dd>
|
||||
|
||||
<dt>machine</dt>
|
||||
<dd>The domain's <a href="formatdomain.html#elementsOSBIOS">machine
|
||||
type</a>.</dd>
|
||||
|
||||
<dt>arch</dt>
|
||||
<dd>The domain's <a href="formatdomain.html#elementsOSBIOS">
|
||||
architecture</a>.</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
<h3><a name="elementsCPUAllocation">CPU Allocation</a></h3>
|
||||
|
||||
<p>Before any devices capability occurs, there might be a info on domain
|
||||
wide capabilities, e.g. virtual CPUs:</p>
|
||||
|
||||
<pre>
|
||||
<domainCapabilities>
|
||||
...
|
||||
<vcpu max='255'/>
|
||||
...
|
||||
</domainCapabilities>
|
||||
</pre>
|
||||
|
||||
<dl>
|
||||
<dt>vcpu</dt>
|
||||
<dd>The maximum number of supported virtual CPUs</dd>
|
||||
</dl>
|
||||
|
||||
<h3><a name="elementsOSBIOS">BIOS bootloader</a></h3>
|
||||
|
||||
<p>Sometimes users might want to tweak some BIOS knobs or use
|
||||
UEFI. For cases like that, <a
|
||||
href="formatdomain.html#elementsOSBIOS"><code>os</code></a>
|
||||
element exposes what values can be passed to its children.</p>
|
||||
|
||||
<pre>
|
||||
<domainCapabilities>
|
||||
...
|
||||
<os supported='yes'>
|
||||
<loader supported='yes'>
|
||||
<value>/usr/share/OVMF/OVMF_CODE.fd</value>
|
||||
<enum name='type'>
|
||||
<value>rom</value>
|
||||
<value>pflash</value>
|
||||
</enum>
|
||||
<enum name='readonly'>
|
||||
<value>yes</value>
|
||||
<value>no</value>
|
||||
</enum>
|
||||
</loader>
|
||||
</os>
|
||||
...
|
||||
<domainCapabilities>
|
||||
</pre>
|
||||
|
||||
<p>For the <code>loader</code> element, the following can occur:</p>
|
||||
|
||||
<dl>
|
||||
<dt>value</dt>
|
||||
<dd>List of known loader paths. Currently this is only used
|
||||
to advertise known locations of OVMF binaries for qemu. Binaries
|
||||
will only be listed if they actually exist on disk.</dd>
|
||||
|
||||
<dt>type</dt>
|
||||
<dd>Whether loader is a typical BIOS (<code>rom</code>) or
|
||||
an UEFI binary (<code>pflash</code>). This refers to
|
||||
<code>type</code> attribute of the <loader/>
|
||||
element.</dd>
|
||||
|
||||
<dt>readonly</dt>
|
||||
<dd>Options for the <code>readonly</code> attribute of the
|
||||
<loader/> element.</dd>
|
||||
</dl>
|
||||
|
||||
<h3><a name="elementsDevices">Devices</a></h3>
|
||||
|
||||
<p>
|
||||
The final set of XML elements describe the supported devices and their
|
||||
capabilities. All devices occur as children of the main
|
||||
<code>devices</code> element.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<domainCapabilities>
|
||||
...
|
||||
<devices>
|
||||
<disk supported='yes'>
|
||||
<enum name='diskDevice'>
|
||||
<value>disk</value>
|
||||
<value>cdrom</value>
|
||||
<value>floppy</value>
|
||||
<value>lun</value>
|
||||
</enum>
|
||||
...
|
||||
</disk>
|
||||
<hostdev supported='no'/>
|
||||
</devices>
|
||||
</domainCapabilities>
|
||||
</pre>
|
||||
|
||||
<p>Reported capabilities are expressed as an enumerated list of available
|
||||
options for each of the element or attribute. For example, the
|
||||
<disk/> element has an attribute <code>device</code> which can
|
||||
support the values <code>disk</code>, <code>cdrom</code>,
|
||||
<code>floppy</code>, or <code>lun</code>.</p>
|
||||
|
||||
<h4><a name="elementsDisks">Hard drives, floppy disks, CDROMs</a></h4>
|
||||
<p>Disk capabilities are exposed under <code>disk</code> element. For
|
||||
instance:</p>
|
||||
|
||||
<pre>
|
||||
<domainCapabilities>
|
||||
...
|
||||
<devices>
|
||||
<disk supported='yes'>
|
||||
<enum name='diskDevice'>
|
||||
<value>disk</value>
|
||||
<value>cdrom</value>
|
||||
<value>floppy</value>
|
||||
<value>lun</value>
|
||||
</enum>
|
||||
<enum name='bus'>
|
||||
<value>ide</value>
|
||||
<value>fdc</value>
|
||||
<value>scsi</value>
|
||||
<value>virtio</value>
|
||||
<value>xen</value>
|
||||
<value>usb</value>
|
||||
<value>uml</value>
|
||||
<value>sata</value>
|
||||
<value>sd</value>
|
||||
</enum>
|
||||
</disk>
|
||||
...
|
||||
</devices>
|
||||
</domainCapabilities>
|
||||
</pre>
|
||||
|
||||
<dl>
|
||||
<dt>diskDevice</dt>
|
||||
<dd>Options for the <code>device</code> attribute of the <disk/>
|
||||
element.</dd>
|
||||
|
||||
<dt>bus</dt>
|
||||
<dd>Options for the <code>bus</code> attribute of the <target/>
|
||||
element for a <disk/>.</dd>
|
||||
</dl>
|
||||
|
||||
<h4><a name="elementsHostDev">Host device assignment</a></h4>
|
||||
<p>Some host devices can be passed through to a guest (e.g. USB, PCI and
|
||||
SCSI). Well, only if the following is enabled:</p>
|
||||
|
||||
<pre>
|
||||
<domainCapabilities>
|
||||
...
|
||||
<devices>
|
||||
<hostdev supported='yes'>
|
||||
<enum name='mode'>
|
||||
<value>subsystem</value>
|
||||
<value>capabilities</value>
|
||||
</enum>
|
||||
<enum name='startupPolicy'>
|
||||
<value>default</value>
|
||||
<value>mandatory</value>
|
||||
<value>requisite</value>
|
||||
<value>optional</value>
|
||||
</enum>
|
||||
<enum name='subsysType'>
|
||||
<value>usb</value>
|
||||
<value>pci</value>
|
||||
<value>scsi</value>
|
||||
</enum>
|
||||
<enum name='capsType'>
|
||||
<value>storage</value>
|
||||
<value>misc</value>
|
||||
<value>net</value>
|
||||
</enum>
|
||||
<enum name='pciBackend'>
|
||||
<value>default</value>
|
||||
<value>kvm</value>
|
||||
<value>vfio</value>
|
||||
<value>xen</value>
|
||||
</enum>
|
||||
</hostdev>
|
||||
</devices>
|
||||
</domainCapabilities>
|
||||
</pre>
|
||||
|
||||
<dl>
|
||||
<dt>mode</dt>
|
||||
<dd>Options for the <code>mode</code> attribute of the <hostdev/>
|
||||
element.</dd>
|
||||
|
||||
<dt>startupPolicy</dt>
|
||||
<dd>Options for the <code>startupPolicy</code> attribute of the
|
||||
<hostdev/> element.</dd>
|
||||
|
||||
<dt>subsysType</dt>
|
||||
<dd>Options for the <code>type</code> attribute of the <hostdev/>
|
||||
element in case of <code>mode="subsystem"</code>.</dd>
|
||||
|
||||
<dt>capsType</dt>
|
||||
<dd>Options for the <code>type</code> attribute of the <hostdev/>
|
||||
element in case of <code>mode="capabilities"</code>.</dd>
|
||||
|
||||
<dt>pciBackend</dt>
|
||||
<dd>Options for the <code>name</code> attribute of the <driver/>
|
||||
element.</dd>
|
||||
</dl>
|
||||
</body>
|
||||
</html>
|
@@ -35,7 +35,7 @@
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<network ipv6='yes' trustGuestRxFilters='no'>
|
||||
<network ipv6='yes'>
|
||||
<name>default</name>
|
||||
<uuid>3e3fce45-4f53-4fa7-bb32-11f34168b82b</uuid>
|
||||
...</pre>
|
||||
@@ -60,16 +60,6 @@
|
||||
to have guest-to-guest communications. For further information,
|
||||
see the example below for the example with no gateway addresses.
|
||||
<span class="since">Since 1.0.1</span></dd>
|
||||
<dt><code>trustGuestRxFilters='yes'</code></dt>
|
||||
<dd>The optional parameter <code>trustGuestRxFilters</code> can
|
||||
be used to set that attribute of the same name for each domain
|
||||
interface connected to this network (<span class="since">since
|
||||
1.2.10</span>). See
|
||||
the <a href="formatdomain.html#elementSNICS">Network
|
||||
interfaces</a> section of the domain XML documentation for
|
||||
more details. Note that an explicit setting of this attribute
|
||||
in a portgroup or the individual domain interface will
|
||||
override the setting in the network.</dd>
|
||||
</dl>
|
||||
|
||||
<h3><a name="elementsConnect">Connectivity</a></h3>
|
||||
@@ -81,8 +71,8 @@
|
||||
|
||||
<pre>
|
||||
...
|
||||
<bridge name="virbr0" stp="on" delay="5" macTableManager="libvirt"/>
|
||||
<domain name="example.com" localOnly="no"/>
|
||||
<bridge name="virbr0" stp="on" delay="5"/>
|
||||
<domain name="example.com"/>
|
||||
<forward mode="nat" dev="eth0"/>
|
||||
...</pre>
|
||||
|
||||
@@ -92,56 +82,18 @@
|
||||
defines the name of a bridge device which will be used to construct
|
||||
the virtual network. The virtual machines will be connected to this
|
||||
bridge device allowing them to talk to each other. The bridge device
|
||||
may also be connected to the LAN. When defining
|
||||
may also be connected to the LAN. It is recommended that bridge
|
||||
device names started with the prefix <code>vir</code>, but the name
|
||||
<code>virbr0</code> is reserved for the "default" virtual
|
||||
network. This element should always be provided when defining
|
||||
a new network with a <code><forward></code> mode of
|
||||
|
||||
"nat" or "route" (or an isolated network with
|
||||
no <code><forward></code> element), libvirt will
|
||||
automatically generate a unique name for the bridge device if
|
||||
none is given, and this name will be permanently stored in the
|
||||
network configuration so that that the same name will be used
|
||||
every time the network is started. For these types of networks
|
||||
(nat, routed, and isolated), a bridge name beginning with the
|
||||
prefix "virbr" is recommended (and that is what is
|
||||
auto-generated), but not enforced.
|
||||
no <code><forward></code> element).
|
||||
Attribute <code>stp</code> specifies if Spanning Tree Protocol
|
||||
is 'on' or 'off' (default is
|
||||
'on'). Attribute <code>delay</code> sets the bridge's forward
|
||||
delay value in seconds (default is 0).
|
||||
<span class="since">Since 0.3.0</span>
|
||||
|
||||
<p>
|
||||
The <code>macTableManager</code> attribute of the bridge
|
||||
element is used to tell libvirt how the bridge's MAC address
|
||||
table (used to determine the correct egress port for packets
|
||||
based on destination MAC address) will be managed. In the
|
||||
default <code>kernel</code> setting, the kernel
|
||||
automatically adds and removes entries, typically using
|
||||
learning, flooding, and promiscuous mode on the bridge's
|
||||
ports in order to determine the proper egress port for
|
||||
packets. When <code>macTableManager</code> is set
|
||||
to <code>libvirt</code>, libvirt disables kernel management
|
||||
of the MAC table (in the case of the Linux host bridge, this
|
||||
means enabling vlan_filtering on the bridge, and disabling
|
||||
learning and unicast_filter for all bridge ports), and
|
||||
explicitly adds/removes entries to the table according to
|
||||
the MAC addresses in the domain interface configurations.
|
||||
Allowing libvirt to manage the MAC table can improve
|
||||
performance - with a Linux host bridge, for example, turning
|
||||
off learning and unicast_flood on ports has its own
|
||||
performance advantage, and can also lead to an additional
|
||||
boost by permitting the kernel to automatically turn off
|
||||
promiscuous mode on some ports of the bridge (in particular,
|
||||
the port attaching the bridge to the physical
|
||||
network). However, it can also cause some networking setups
|
||||
to stop working (e.g. vlan tagging, multicast,
|
||||
guest-initiated changes to MAC address) and is not supported
|
||||
by older kernels.
|
||||
<span class="since">Since 1.2.11, requires kernel 3.17 or
|
||||
newer</span>
|
||||
</p>
|
||||
|
||||
|
||||
</dd>
|
||||
<dt><code>domain</code></dt>
|
||||
<dd>
|
||||
@@ -151,16 +103,6 @@
|
||||
a <code><forward></code> mode of "nat" or "route" (or an
|
||||
isolated network with no <code><forward></code>
|
||||
element). <span class="since">Since 0.4.5</span>
|
||||
|
||||
<p>
|
||||
If the optional <code>localOnly</code> attribute on the
|
||||
<code>domain</code> element is "yes", then DNS requests under
|
||||
this domain will only be resolved by the virtual network's own
|
||||
DNS server - they will not be forwarded to the host's upstream
|
||||
DNS server. If <code>localOnly</code> is "no", and by
|
||||
default, unresolved requests <b>will</b> be forwarded.
|
||||
<span class="since">Since 1.2.12</span>
|
||||
</p>
|
||||
</dd>
|
||||
<dt><code>forward</code></dt>
|
||||
<dd>Inclusion of the <code>forward</code> element indicates that
|
||||
@@ -200,8 +142,6 @@
|
||||
<p><span class="since">Since 1.0.3</span> it is possible to
|
||||
specify a public IPv4 address and port range to be used for
|
||||
the NAT by using the <code><nat></code> subelement.
|
||||
Note that all addresses from the range are used, not just those
|
||||
that are in use on the host.
|
||||
The address range is set with the <code><address></code>
|
||||
subelements and <code>start</code> and <code>stop</code>
|
||||
attributes:
|
||||
@@ -338,33 +278,28 @@
|
||||
(Single Root I/O Virtualization) virtual function (VF)
|
||||
devices can be assigned in this manner; to assign a
|
||||
standard single-port PCI or PCIe ethernet card to a guest,
|
||||
use the traditional <code><hostdev></code> device
|
||||
use the traditional <code>< hostdev></code> device
|
||||
definition. <span class="since"> Since 0.10.0</span>
|
||||
|
||||
<p>
|
||||
To force use of a particular type of device assignment,
|
||||
a <forward type='hostdev'> interface can have an
|
||||
optional <code>driver</code> sub-element with
|
||||
a <code>name</code> attribute set to either "vfio" (VFIO
|
||||
is a new method of device assignment that is compatible
|
||||
with UEFI Secure Boot) or "kvm" (the legacy device
|
||||
assignment handled directly by the KVM kernel module)
|
||||
<span class="since">Since 1.0.5 (QEMU and KVM only,
|
||||
requires kernel 3.6 or newer)</span>. When specified,
|
||||
device assignment will fail if the requested method of
|
||||
device assignment isn't available on the host. When not
|
||||
specified, the default is "vfio" on systems where the
|
||||
VFIO driver is available and loaded, and "kvm" on older
|
||||
systems, or those where the VFIO driver hasn't been
|
||||
loaded <span class="since">Since 1.1.3</span> (prior to
|
||||
that the default was always "kvm").
|
||||
To use VFIO device assignment rather than
|
||||
traditional/legacy KVM device assignment (VFIO is a new
|
||||
method of device assignment that is compatible with UEFI
|
||||
Secure Boot), a <forward type='hostdev'> interface
|
||||
can have an optional <code>driver</code> sub-element
|
||||
with a <code>name</code> attribute set to "vfio". To use
|
||||
legacy KVM device assignment you can
|
||||
set <code>name</code> to "kvm" (or simply omit the
|
||||
<driver> element, since "kvm" is currently the
|
||||
default).
|
||||
<span class="since">Since 1.0.5 (QEMU and KVM only, requires kernel 3.6 or newer)</span>
|
||||
</p>
|
||||
|
||||
<p>Note that this "intelligent passthrough" of network
|
||||
devices is very similar to the functionality of a
|
||||
standard <code><hostdev></code> device, the
|
||||
standard <code>< hostdev></code> device, the
|
||||
difference being that this method allows specifying a MAC
|
||||
address, vlan tag, and <code><virtualport></code>
|
||||
address, vlan tag, and <code><virtualport ></code>
|
||||
for the passed-through device. If these capabilities are
|
||||
not required, if you have a standard single-port PCI,
|
||||
PCIe, or USB network card that doesn't support SR-IOV (and
|
||||
@@ -433,9 +368,9 @@
|
||||
<span class="since">since 0.10.0</span> When using forward
|
||||
mode 'hostdev', the interface pool is specified with a list
|
||||
of <code><address></code> elements, each of which has
|
||||
<code><type></code> (must always be <code>'pci'</code>),
|
||||
<code>< type></code> (must always be <code>'pci'</code>,
|
||||
<code><domain></code>, <code><bus></code>,
|
||||
<code><slot></code>and <code><function></code>
|
||||
<code><slot></code>, and <code><function></code>
|
||||
attributes.
|
||||
</p>
|
||||
<pre>
|
||||
@@ -666,7 +601,7 @@
|
||||
<outbound average='1000' peak='5000' burst='5120'/>
|
||||
</bandwidth>
|
||||
</portgroup></b>
|
||||
<b><portgroup name='sales' trustGuestRxFilters='no'>
|
||||
<b><portgroup name='sales'>
|
||||
<virtualport type='802.1Qbh'>
|
||||
<parameters profileid='salestest'/>
|
||||
</virtualport>
|
||||
@@ -686,7 +621,7 @@
|
||||
network can have multiple portgroup elements (and one of those
|
||||
can optionally be designated as the 'default' portgroup for the
|
||||
network), and each portgroup has a name, as well as various
|
||||
attributes and subelements associated with it. The currently supported
|
||||
subelements associated with it. The currently supported
|
||||
subelements are <code><bandwidth></code>
|
||||
(described <a href="formatnetwork.html#elementQoS">here</a>)
|
||||
and <code><virtualport></code>
|
||||
@@ -710,19 +645,6 @@
|
||||
considered an error, and will prevent the interface from
|
||||
starting.
|
||||
</p>
|
||||
<p>
|
||||
portgroups also support the optional
|
||||
parameter <code>trustGuestRxFilters</code> which can be used to
|
||||
set that attribute of the same name for each domain interface
|
||||
using this portgroup (<span class="since">since
|
||||
1.2.10</span>). See
|
||||
the <a href="formatdomain.html#elementSNICS">Network
|
||||
interfaces</a> section of the domain XML documentation for more
|
||||
details. Note that an explicit setting of this attribute in the
|
||||
portgroup overrides the network-wide setting, and an explicit
|
||||
setting in the individual domain interface will override the
|
||||
setting in the portgroup.
|
||||
</p>
|
||||
|
||||
<h5><a name="elementsStaticroute">Static Routes</a></h5>
|
||||
<p>
|
||||
|
@@ -110,28 +110,6 @@
|
||||
have a list of <code>address</code> subelements, one
|
||||
for each VF on this PF.
|
||||
</dd>
|
||||
<dt><code>numa</code></dt>
|
||||
<dd>
|
||||
This optional element contains information on the PCI device
|
||||
with respect to NUMA. For example, the optional
|
||||
<code>node</code> attribute tells which NUMA node is the PCI
|
||||
device associated with.
|
||||
</dd>
|
||||
<dt><code>pci-express</code></dt>
|
||||
<dd>
|
||||
This optional element contains information on PCI Express part of
|
||||
the device. For example, it can contain a child element
|
||||
<code>link</code> which addresses the PCI Express device's link.
|
||||
While a device has it's own capabilities
|
||||
(<code>validity='cap'</code>), the actual run time capabilities
|
||||
are negotiated on the device initialization
|
||||
(<code>validity='sta'</code>). The <code>link</code> element then
|
||||
contains three attributes: <code>port</code> which says in which
|
||||
port is the device plugged in, <code>speed</code> (in
|
||||
GigaTransfers per second) and <code>width</code> for the number
|
||||
of lanes used. Since the port can't be negotiated, it's not
|
||||
exposed in <code>./pci-express/link/[@validity='sta']</code>.
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt><code>usb_device</code></dt>
|
||||
@@ -176,13 +154,6 @@
|
||||
<dd>The interface name tied to this device.</dd>
|
||||
<dt><code>address</code></dt>
|
||||
<dd>If present, the MAC address of the device.</dd>
|
||||
<dt><code>link</code></dt>
|
||||
<dd>Optional to reflect the status of the link. It has
|
||||
two optional attributes: <code>speed</code> in Mbits per
|
||||
second and <code>state</code> to tell the state of the
|
||||
link. So far, the whole element is just for output,
|
||||
not setting.
|
||||
</dd>
|
||||
<dt><code>capability</code></dt>
|
||||
<dd>A network protocol exposed by the device, where the
|
||||
attribute <code>type</code> can be "80203" for IEEE
|
||||
@@ -195,17 +166,6 @@
|
||||
<dl>
|
||||
<dt><code>host</code></dt>
|
||||
<dd>The SCSI host number.</dd>
|
||||
<dt><code>unique_id</code></dt>
|
||||
<dd>On input, this optionally provides the value from the
|
||||
'unique_id' file found in the scsi_host's directory. To
|
||||
view the values of all 'unique_id' files, use <code>find -H
|
||||
/sys/class/scsi_host/host{0..9}/unique_id |
|
||||
xargs grep '[0-9]'</code>. On output, if the unique_id
|
||||
file exists, the value from the file will be displayed.
|
||||
This can be used in order to help uniquely identify the
|
||||
scsi_host adapter in a <a href="formatstorage.html">
|
||||
Storage Pool</a>. <span class="since">Since 1.2.7</span>
|
||||
</dd>
|
||||
<dt><code>capability</code></dt>
|
||||
<dd>Current capabilities include "vports_ops" (indicates
|
||||
vport operations are supported) and "fc_host". "vport_ops"
|
||||
@@ -331,10 +291,6 @@
|
||||
<address domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
|
||||
<address domain='0x0000' bus='0x02' slot='0x00' function='0x1'/>
|
||||
</iommuGroup>
|
||||
<pci-express>
|
||||
<link validity='cap' port='1' speed='2.5' width='1'/>
|
||||
<link validity='sta' speed='2.5' width='1'/>
|
||||
</pci-express>
|
||||
</capability>
|
||||
</device>
|
||||
</pre>
|
||||
|
@@ -765,7 +765,7 @@
|
||||
<td>Mask applied to MAC address of destination</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>vlanid</td>
|
||||
<td>vlan-id</td>
|
||||
<td>UINT16 (0x0-0xfff, 0 - 4095)</td>
|
||||
<td>VLAN ID</td>
|
||||
</tr>
|
||||
@@ -1100,11 +1100,6 @@
|
||||
<td>UINT16</td>
|
||||
<td>End of range of valid destination ports; requires <code>protocol</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>dscp</td>
|
||||
<td>UINT8 (0x0-0x3f, 0 - 63)</td>
|
||||
<td>Differentiated Services Code Point</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>comment <span class="since">(Since 0.8.5)</span></td>
|
||||
<td>STRING</td>
|
||||
@@ -1196,26 +1191,6 @@
|
||||
<td>UINT16</td>
|
||||
<td>End of range of valid destination ports; requires <code>protocol</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>type<span class="since">(Since 1.2.12)</span></td>
|
||||
<td>UINT8</td>
|
||||
<td>ICMPv6 type; requires <code>protocol</code> to be set to <code>icmpv6</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>typeend<span class="since">(Since 1.2.12)</span></td>
|
||||
<td>UINT8</td>
|
||||
<td>ICMPv6 type end of range; requires <code>protocol</code> to be set to <code>icmpv6</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>code<span class="since">(Since 1.2.12)</span></td>
|
||||
<td>UINT8</td>
|
||||
<td>ICMPv6 code; requires <code>protocol</code> to be set to <code>icmpv6</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>code<span class="since">(Since 1.2.12)</span></td>
|
||||
<td>UINT8</td>
|
||||
<td>ICMPv6 code end of range; requires <code>protocol</code> to be set to <code>icmpv6</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>comment <span class="since">(Since 0.8.5)</span></td>
|
||||
<td>STRING</td>
|
||||
@@ -1308,11 +1283,6 @@
|
||||
<td>UINT16</td>
|
||||
<td>End of range of valid destination ports</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>dscp</td>
|
||||
<td>UINT8 (0x0-0x3f, 0 - 63)</td>
|
||||
<td>Differentiated Services Code Point</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>comment <span class="since">(Since 0.8.5)</span></td>
|
||||
<td>STRING</td>
|
||||
@@ -1428,11 +1398,6 @@
|
||||
<td>UINT16</td>
|
||||
<td>ICMP code</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>dscp</td>
|
||||
<td>UINT8 (0x0-0x3f, 0 - 63)</td>
|
||||
<td>Differentiated Services Code Point</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>comment <span class="since">(Since 0.8.5)</span></td>
|
||||
<td>STRING</td>
|
||||
@@ -1532,11 +1497,6 @@
|
||||
<td>IP_ADDR</td>
|
||||
<td>End of range of destination IP address</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>dscp</td>
|
||||
<td>UINT8 (0x0-0x3f, 0 - 63)</td>
|
||||
<td>Differentiated Services Code Point</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>comment <span class="since">(Since 0.8.5)</span></td>
|
||||
<td>STRING</td>
|
||||
@@ -1643,11 +1603,6 @@
|
||||
<td>UINT16</td>
|
||||
<td>End of range of valid destination ports</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>dscp</td>
|
||||
<td>UINT8 (0x0-0x3f, 0 - 63)</td>
|
||||
<td>Differentiated Services Code Point</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>comment <span class="since">(Since 0.8.5)</span></td>
|
||||
<td>STRING</td>
|
||||
@@ -1749,11 +1704,6 @@
|
||||
<td>UINT16</td>
|
||||
<td>ICMPv6 code</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>dscp</td>
|
||||
<td>UINT8 (0x0-0x3f, 0 - 63)</td>
|
||||
<td>Differentiated Services Code Point</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>comment <span class="since">(Since 0.8.5)</span></td>
|
||||
<td>STRING</td>
|
||||
@@ -1838,11 +1788,6 @@
|
||||
<td>IPV6_ADDR</td>
|
||||
<td>End of range of destination IP address</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>dscp</td>
|
||||
<td>UINT8 (0x0-0x3f, 0 - 63)</td>
|
||||
<td>Differentiated Services Code Point</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>comment <span class="since">(Since 0.8.5)</span></td>
|
||||
<td>STRING</td>
|
||||
|
@@ -164,11 +164,9 @@
|
||||
attribute <code>type</code> giving the driver type (such
|
||||
as qcow2), of the new file created by the external
|
||||
snapshot of the new file. If <code>source</code> is not
|
||||
given and the disk is backed by a local image file (not
|
||||
a block device or remote storage), a file name is
|
||||
generated that consists of the existing file name
|
||||
with anything after the trailing dot replaced by the
|
||||
snapshot name. Remember that with external
|
||||
given, a file name is generated that consists of the
|
||||
existing file name with anything after the trailing dot
|
||||
replaced by the snapshot name. Remember that with external
|
||||
snapshots, the original file name becomes the read-only
|
||||
snapshot, and the new file name contains the read-write
|
||||
delta of all disk changes since the snapshot.
|
||||
|
@@ -23,9 +23,8 @@
|
||||
(<span class="since">since 0.7.1</span>), <code>rbd</code>
|
||||
(<span class="since">since 0.9.13</span>), <code>sheepdog</code>
|
||||
(<span class="since">since 0.10.0</span>),
|
||||
<code>gluster</code> (<span class="since">since
|
||||
1.2.0</span>) or <code>zfs</code> (<span class="since">since
|
||||
1.2.8</span>). This corresponds to the
|
||||
or <code>gluster</code> (<span class="since">since
|
||||
1.2.0</span>). This corresponds to the
|
||||
storage backend drivers listed further along in this document.
|
||||
</p>
|
||||
<h3><a name="StoragePoolFirst">General metadata</a></h3>
|
||||
@@ -80,31 +79,13 @@
|
||||
<host name="iscsi.example.com"/>
|
||||
<device path="demo-target"/>
|
||||
<auth type='chap' username='myname'>
|
||||
<secret usage='mycluster_myname'/>
|
||||
<secret type='iscsi' usage='mycluster_myname'/>
|
||||
</auth>
|
||||
<vendor name="Acme"/>
|
||||
<product name="model"/>
|
||||
</source>
|
||||
...</pre>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<source>
|
||||
<adapter type='scsi_host' name='scsi_host1'/>
|
||||
</source>
|
||||
...</pre>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<source>
|
||||
<adapter type='scsi_host'>
|
||||
<parentaddr unique_id='1'>
|
||||
<address domain='0x0000' bus='0x00' slot='0x1f' addr='0x2'/>
|
||||
</parentaddr>
|
||||
</adapter>
|
||||
</source>
|
||||
...</pre>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<source>
|
||||
@@ -116,7 +97,7 @@
|
||||
<dt><code>device</code></dt>
|
||||
<dd>Provides the source for pools backed by physical devices
|
||||
(pool types <code>fs</code>, <code>logical</code>, <code>disk</code>,
|
||||
<code>iscsi</code>, <code>zfs</code>).
|
||||
<code>iscsi</code>).
|
||||
May be repeated multiple times depending on backend driver. Contains
|
||||
a single attribute <code>path</code> which is the fully qualified
|
||||
path to the block device node. <span class="since">Since 0.4.1</span></dd>
|
||||
@@ -130,160 +111,25 @@
|
||||
<span class="since">Since 0.4.1</span></dd>
|
||||
<dt><code>adapter</code></dt>
|
||||
<dd>Provides the source for pools backed by SCSI adapters (pool
|
||||
type <code>scsi</code>). May only occur once.
|
||||
<dl>
|
||||
<dt><code>name</code></dt>
|
||||
<dd>The SCSI adapter name (e.g. "scsi_host1", although a name
|
||||
such as "host1" is still supported for backwards compatibility,
|
||||
it is not recommended). The scsi_host name to be used can be
|
||||
determined from the output of a <code>virsh nodedev-list
|
||||
scsi_host</code> command followed by a combination of
|
||||
<code>lspci</code> and <code>virsh nodedev-dumpxml
|
||||
scsi_hostN</code> commands to find the <code>scsi_hostN</code>
|
||||
to be used. <span class="since">Since 0.6.2</span>
|
||||
<p>
|
||||
It is further recommended to utilize the
|
||||
<code>parentaddr</code> element since it's possible to have
|
||||
the path to which the scsi_hostN uses change between system
|
||||
reboots. <span class="since">Since 1.2.7</span>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><code>type</code></dt>
|
||||
<dd>Specifies the adapter type. Valid values are "scsi_host" or
|
||||
"fc_host". If omitted and the <code>name</code> attribute is
|
||||
specified, then it defaults to "scsi_host". To keep backwards
|
||||
compatibility, this attribute is optional <b>only</b> for the
|
||||
"scsi_host" adapter, but is mandatory for the "fc_host" adapter.
|
||||
<span class="since">Since 1.0.5</span>
|
||||
A "fc_host" capable scsi_hostN can be determined by using
|
||||
<code>virsh nodedev-list --cap fc_host</code>.
|
||||
<span class="since">Since 1.2.8</span>
|
||||
<p>
|
||||
Note: Regardless of whether a "scsi_host" adapter type is defined
|
||||
using a <code>name</code> or a <code>parentaddr</code>, it
|
||||
should refer to a real scsi_host adapter as found through a
|
||||
<code>virsh nodedev-list scsi_host</code> and <code>virsh
|
||||
nodedev-dumpxml scsi_hostN</code> on one of the scsi_host's
|
||||
displayed. It should not refer to a "fc_host" capable scsi_hostN
|
||||
nor should it refer to the vHBA created for some "fc_host"
|
||||
adapter. For a vHBA the <code>nodedev-dumpxml</code>
|
||||
output parent setting will be the "fc_host" capable scsi_hostN
|
||||
value. Additionally, do not refer to an iSCSI scsi_hostN for the
|
||||
"scsi_host" source. An iSCSI scsi_hostN's
|
||||
<code>nodedev-dumpxml</code> output parent field is generally
|
||||
"computer". This is a libvirt created parent value indicating
|
||||
no parent was defined for the node device.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><code>wwnn</code> and <code>wwpn</code></dt>
|
||||
<dd>The "World Wide Node Name" (<code>wwnn</code>) and "World Wide
|
||||
Port Name" (<code>wwpn</code>) are used by the "fc_host" adapter
|
||||
to uniquely identify the device in the Fibre Channel storage fabric
|
||||
(the device can be either a HBA or vHBA). Both wwnn and wwpn should
|
||||
be specified. Use the command 'virsh nodedev-dumpxml' to determine
|
||||
how to set the values for the wwnn/wwpn of a (v)HBA. The wwnn and
|
||||
wwpn have very specific numerical format requirements based on the
|
||||
hypervisor being used, thus care should be taken if you decide to
|
||||
generate your own to follow the standards; otherwise, the pool
|
||||
will fail to start with an opaque error message indicating failure
|
||||
to write to the vport_create file during vport create/delete due
|
||||
to "No such file or directory".
|
||||
<span class="since">Since 1.0.4</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><code>parent</code></dt>
|
||||
<dd>Used by the "fc_host" adapter type to optionally specify the
|
||||
parent scsi_host device defined in the
|
||||
<a href="formatnode.html">Node Device</a> database as the
|
||||
<a href="http://wiki.libvirt.org/page/NPIV_in_libvirt">NPIV</a>
|
||||
virtual Host Bus Adapter (vHBA). The value provided must be
|
||||
a vport capable scsi_host. The value is not the scsi_host of
|
||||
the vHBA created by 'virsh nodedev-create', rather it is
|
||||
the parent of that vHBA. If the value is not provided, libvirt
|
||||
will determine the parent based either finding the wwnn,wwpn
|
||||
defined for an existing scsi_host or by creating a vHBA. Providing
|
||||
the parent attribute is also useful for the duplicate pool
|
||||
definition checks. This is more important in environments where
|
||||
both the "fc_host" and "scsi_host" source adapter pools are being
|
||||
used in order to ensure a new definition doesn't duplicate using
|
||||
the scsi_hostN of some existing storage pool.
|
||||
<span class="since">Since 1.0.4</span>
|
||||
</dd>
|
||||
<dt><code>managed</code></dt>
|
||||
<dd>An optional attribute to instruct the SCSI storage backend to
|
||||
manage destroying the vHBA when the pool is destroyed. For
|
||||
configurations that do not provide an already created vHBA
|
||||
from a 'virsh nodedev-create', libvirt will set this property
|
||||
to "yes". For configurations that have already created a vHBA
|
||||
via 'virsh nodedev-create' and are using the wwnn/wwpn from
|
||||
that vHBA and optionally the scsi_host parent, setting this
|
||||
attribute to "yes" will allow libvirt to destroy the node device
|
||||
when the pool is destroyed. If this attribute is set to "no" or
|
||||
not defined in the XML, then libvirt will not destroy the vHBA.
|
||||
<span class="since">Since 1.2.11</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><code>parentaddr</code></dt>
|
||||
<dd>Used by the "scsi_host" adapter type instead of the
|
||||
<code>name</code> attribute to more uniquely identify the
|
||||
SCSI host. Using a combination of the <code>unique_id</code>
|
||||
attribute and the <code>address</code> element to formulate
|
||||
a PCI address, a search will be performed of the
|
||||
<code>/sys/class/scsi_host/hostNN</code> links for a
|
||||
matching PCI address with a matching <code>unique_id</code>
|
||||
value in the <code>/sys/class/scsi_host/hostNN/unique_id</code>
|
||||
file. The value in the "unique_id" file will be unique enough
|
||||
for the specific PCI address. The <code>hostNN</code> will be
|
||||
used by libvirt as the basis to define which SCSI host is to
|
||||
be used for the currently booted system.
|
||||
<span class="since">Since 1.2.7</span>
|
||||
<dl>
|
||||
<dt><code>address</code></dt>
|
||||
<dd>The PCI address of the scsi_host device to be used. Using
|
||||
a PCI address provides consistent naming across system reboots
|
||||
and kernel reloads. The address will have four attributes:
|
||||
<code>domain</code> (a 2-byte hex integer, not currently used
|
||||
by qemu), <code>bus</code> (a hex value between 0 and 0xff,
|
||||
inclusive), <code>slot</code> (a hex value between 0x0 and
|
||||
0x1f, inclusive), and <code>function</code> (a value between
|
||||
0 and 7, inclusive). The PCI address can be determined by
|
||||
listing the <code>/sys/bus/pci/devices</code> and the
|
||||
<code>/sys/class/scsi_host</code> directories in order to
|
||||
find the expected scsi_host device. The address will be
|
||||
provided in a format such as "0000:00:1f:2" which can be
|
||||
used to generate the expected PCI address
|
||||
"domain='0x0000' bus='0x00' slot='0x1f' function='0x0'".
|
||||
Optionally, using the combination of the commands 'virsh
|
||||
nodedev-list scsi_host' and 'virsh nodedev-dumpxml' for a
|
||||
specific list entry and converting the resulting
|
||||
<code>path</code> element as the basis to formulate the
|
||||
correctly formatted PCI address.
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><code>unique_id</code></dt>
|
||||
<dd>Required <code>parentaddr</code> attribute used to determine
|
||||
which of the scsi_host adapters for the provided PCI address
|
||||
should be used. The value is determine by contents of the
|
||||
<code>unique_id</code> file for the specific scsi_host adapter.
|
||||
For a PCI address of "0000:00:1f:2", the unique identifer files
|
||||
can be found using the command
|
||||
<code>find -H /sys/class/scsi_host/host*/unique_id |
|
||||
xargs grep '[0-9]'</code>. Optionally, the
|
||||
<code>virsh nodedev-dumpxml scsi_hostN</code>' of a
|
||||
specific scsi_hostN list entry will list the
|
||||
<code>unique_id</code> value.
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
type <code>scsi</code>). May
|
||||
only occur once. Attribute <code>name</code> is the SCSI adapter
|
||||
name (ex. "scsi_host1". NB, although a name such as "host1" is
|
||||
still supported for backwards compatibility, it is not recommended).
|
||||
Attribute <code>type</code> (<span class="since">1.0.5</span>)
|
||||
specifies the adapter type. Valid values are "fc_host" and "scsi_host".
|
||||
If omitted and the <code>name</code> attribute is specified, then it
|
||||
defaults to "scsi_host". To keep backwards compatibility, the attribute
|
||||
<code>type</code> is optional for the "scsi_host" adapter, but
|
||||
mandatory for the "fc_host" adapter. Attributes <code>wwnn</code>
|
||||
(Word Wide Node Name) and <code>wwpn</code> (Word Wide Port Name)
|
||||
(<span class="since">1.0.4</span>) are used by the "fc_host" adapter
|
||||
to uniquely identify the device in the Fibre Channel storage fabric
|
||||
(the device can be either a HBA or vHBA). Both wwnn and wwpn should
|
||||
be specified (See command 'virsh nodedev-dumpxml' to known how to get
|
||||
wwnn/wwpn of a (v)HBA). The optional attribute <code>parent</code>
|
||||
(<span class="since">1.0.4</span>) specifies the parent device for
|
||||
the "fc_host" adapter.
|
||||
<span class="since">Since 0.6.2</span></dd>
|
||||
<dt><code>host</code></dt>
|
||||
<dd>Provides the source for pools backed by storage from a
|
||||
remote server (pool types <code>netfs</code>, <code>iscsi</code>,
|
||||
@@ -386,7 +232,7 @@
|
||||
like the logical choice, however, devices nodes there are not
|
||||
guaranteed stable across reboots, since they are allocated on
|
||||
demand. It is preferable to use a stable location such as one
|
||||
of the <code>/dev/disk/by-{path|id|uuid|label}</code> locations.
|
||||
of the <code>/dev/disk/by-{path,id,uuid,label</code> locations.
|
||||
<span class="since">Since 0.4.1</span>
|
||||
</dd>
|
||||
<dt><code>permissions</code></dt>
|
||||
@@ -463,13 +309,7 @@
|
||||
<dl>
|
||||
<dt><code>name</code></dt>
|
||||
<dd>Providing a name for the volume which is unique to the pool.
|
||||
This is mandatory when defining a volume. For a disk pool, the
|
||||
name must be combination of the <code>source</code> device path
|
||||
device and next partition number to be created. For example, if
|
||||
the <code>source</code> device path is /dev/sdb and there are no
|
||||
partitions on the disk, then the name must be sdb1 with the next
|
||||
name being sdb2 and so on.
|
||||
<span class="since">Since 0.4.1</span></dd>
|
||||
This is mandatory when defining a volume. <span class="since">Since 0.4.1</span></dd>
|
||||
<dt><code>key</code></dt>
|
||||
<dd>Providing an identifier for the volume which identifies a
|
||||
single volume. In some cases it's possible to have two distinct keys
|
||||
@@ -545,7 +385,6 @@
|
||||
<label>virt_image_t</label>
|
||||
</permissions>
|
||||
<compat>1.1</compat>
|
||||
<nocow/>
|
||||
<features>
|
||||
<lazy_refcounts/>
|
||||
</features>
|
||||
@@ -559,18 +398,12 @@
|
||||
<span class="since">Since 0.4.1</span></dd>
|
||||
<dt><code>format</code></dt>
|
||||
<dd>Provides information about the pool specific volume format.
|
||||
For disk pools it will provide the partition table format type, but is
|
||||
not preserved after a pool refresh or libvirtd restart. Use extended
|
||||
in order to create an extended disk extent partition. For filesystem
|
||||
For disk pools it will provide the partition type. For filesystem
|
||||
or directory pools it will provide the file format type, eg cow,
|
||||
qcow, vmdk, raw. If omitted when creating a volume, the pool's
|
||||
default format will be used. The actual format is specified via
|
||||
the <code>type</code> attribute. Consult the
|
||||
<a href="storage.html">storage driver page</a> for the list of valid
|
||||
volume format type values for each specific pool. The
|
||||
<code>format</code> will be ignored on input for pools without a
|
||||
volume format type value and the default pool format will be used.
|
||||
<span class="since">Since 0.4.1</span></dd>
|
||||
the <code>type</code> attribute. Consult the pool-specific docs for
|
||||
the list of valid values. <span class="since">Since 0.4.1</span></dd>
|
||||
<dt><code>permissions</code></dt>
|
||||
<dd>Provides information about the default permissions to use
|
||||
when creating volumes. This is currently only useful for directory
|
||||
@@ -591,12 +424,6 @@
|
||||
1.1 is used. If omitted, qemu-img default is used.
|
||||
<span class="since">Since 1.1.0</span>
|
||||
</dd>
|
||||
<dt><code>nocow</code></dt>
|
||||
<dd>Turn off COW of the newly created volume. So far, this is only valid
|
||||
for a file image in btrfs file system. It will improve performance when
|
||||
the file image is used in VM. To create non-raw file images, it
|
||||
requires QEMU version since 2.1. <span class="since">Since 1.2.7</span>
|
||||
</dd>
|
||||
<dt><code>features</code></dt>
|
||||
<dd>Format-specific features. Only used for <code>qcow2</code> now.
|
||||
Valid sub-elements are:
|
||||
|
@@ -35,7 +35,7 @@
|
||||
</p>
|
||||
<h3><a name="StorageEncryptionDefault">"default" format</a></h3>
|
||||
<p>
|
||||
<code><encryption format="default"/></code> can be specified only
|
||||
<code><encryption type="default"/></code> can be specified only
|
||||
when creating a volume. If the volume is successfully created, the
|
||||
encryption formats, parameters and secrets will be auto-generated by
|
||||
libvirt and the attached <code>encryption</code> tag will be updated.
|
||||
|
@@ -1,3 +1,4 @@
|
||||
|
||||
body {
|
||||
margin: 0em;
|
||||
padding: 0px;
|
||||
|
@@ -11,11 +11,6 @@
|
||||
<li>Discuss any large changes on the mailing list first. Post patches
|
||||
early and listen to feedback.</li>
|
||||
|
||||
<li>Official upstream repository is kept in git
|
||||
(<code>git://libvirt.org/libvirt.git</code>) and is browsable
|
||||
along with other libvirt-related repositories
|
||||
(e.g. libvirt-python) <a href="http://libvirt.org/git/">online</a>.</li>
|
||||
|
||||
<li><p>Post patches in unified diff format, with git rename
|
||||
detection enabled. You need a one-time setup of:</p>
|
||||
<pre>
|
||||
@@ -65,7 +60,7 @@
|
||||
review your patch set. One should avoid sending patches as attachments,
|
||||
but rather send them in email body along with commit message. If a
|
||||
developer is sending another version of the patch (e.g. to address
|
||||
review comments), they are advised to note differences to previous
|
||||
review comments), he is advised to note differences to previous
|
||||
versions after the <code>---</code> line in the patch so that it helps
|
||||
reviewers but doesn't become part of git history. Moreover, such patch
|
||||
needs to be prefixed correctly with
|
||||
@@ -127,7 +122,7 @@
|
||||
Some tests are skipped by default in a development environment,
|
||||
based on the time they take in comparison to the likelihood
|
||||
that those tests will turn up problems during incremental builds.
|
||||
These tests default to being run when building from a
|
||||
These tests default to being run when when building from a
|
||||
tarball or with the configure option --enable-expensive-tests;
|
||||
you can also force a one-time toggle of these tests by
|
||||
setting VIR_TEST_EXPENSIVE to 0 or 1 at make time, as in:
|
||||
@@ -265,7 +260,7 @@
|
||||
<p>
|
||||
There is more on this subject, including lots of links to background
|
||||
reading on the subject, on
|
||||
<a href="http://people.redhat.com/rjones/how-to-supply-code-to-open-source-projects/">
|
||||
<a href="http://et.redhat.com/~rjones/how-to-supply-code-to-open-source-projects/">
|
||||
Richard Jones' guide to working with open source projects</a>.
|
||||
</p>
|
||||
|
||||
@@ -462,30 +457,20 @@
|
||||
|
||||
<p>
|
||||
Omit the curly braces around an <code>if</code>, <code>while</code>,
|
||||
<code>for</code> etc. body only when both that body and the condition
|
||||
itself occupy a single line. In every other case we require
|
||||
<code>for</code> etc. body only
|
||||
when that body occupies a single line. In every other case we require
|
||||
the braces. This ensures that it is trivially easy to identify a
|
||||
single-<i>statement</i> loop: each has only one <i>line</i> in its body.
|
||||
</p>
|
||||
<p>
|
||||
Omitting braces with a single-line body is fine:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
while (expr) // single line body; {} is forbidden
|
||||
while (expr) // one-line body -> omitting curly braces is ok
|
||||
single_line_stmt();
|
||||
</pre>
|
||||
|
||||
<pre>
|
||||
while (expr(arg1,
|
||||
arg2)) // indentation makes it obvious it is single line,
|
||||
single_line_stmt(); // {} is optional (not enforced either way)
|
||||
</pre>
|
||||
|
||||
<pre>
|
||||
while (expr1 &&
|
||||
expr2) { // multi-line, at same indentation, {} required
|
||||
single_line_stmt();
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
However, the moment your loop/if/else body extends on to a second
|
||||
line, for whatever reason (even if it's just an added comment), then
|
||||
@@ -608,37 +593,6 @@
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>Use hanging braces for compound statements: the opening brace
|
||||
of a compound statement should be on the same line as the
|
||||
condition being tested. Only top-level function bodies, nested
|
||||
scopes, and compound structure declarations should ever have {
|
||||
on a line by itself.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
void
|
||||
foo(int a, int b)
|
||||
{ // correct - function body
|
||||
int 2d[][] = {
|
||||
{ // correct - complex initialization
|
||||
1, 2,
|
||||
},
|
||||
};
|
||||
if (a)
|
||||
{ // BAD: compound brace on its own line
|
||||
do_stuff();
|
||||
}
|
||||
{ // correct - nested scope
|
||||
int tmp;
|
||||
if (a < b) { // correct - hanging brace
|
||||
tmp = b;
|
||||
b = a;
|
||||
a = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h2><a name="preprocessor">Preprocessor</a></h2>
|
||||
|
||||
<p>Macros defined with an ALL_CAPS name should generally be
|
||||
@@ -660,7 +614,7 @@
|
||||
</p>
|
||||
<pre>
|
||||
#if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE)
|
||||
# define fallocate(a, ignored, b, c) posix_fallocate(a, b, c)
|
||||
# define fallocate(a,ignored,b,c) posix_fallocate(a,b,c)
|
||||
#endif
|
||||
</pre>
|
||||
|
||||
@@ -994,7 +948,7 @@
|
||||
<p>
|
||||
If there is a need for complex string concatenations, avoid using
|
||||
the usual sequence of malloc/strcpy/strcat/snprintf functions and
|
||||
make use of the virBuffer API described in virbuffer.h
|
||||
make use of the virBuffer API described in buf.h
|
||||
</p>
|
||||
|
||||
<p>Typical usage is as follows:</p>
|
||||
@@ -1014,8 +968,11 @@
|
||||
|
||||
...
|
||||
|
||||
if (virBufferCheckError(&buf) < 0)
|
||||
if (virBufferError(&buf)) {
|
||||
virBufferFreeAndReset(&buf);
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return virBufferContentAndReset(&buf);
|
||||
}
|
||||
|
@@ -177,17 +177,6 @@
|
||||
script returns failure or the output XML is not valid, incoming
|
||||
migration will be canceled. This hook may be used, e.g., to change
|
||||
location of disk images for incoming domains.</li>
|
||||
<li><span class="since">Since 1.2.9</span>, the qemu hook script is
|
||||
also called when restoring a saved image either via the API or
|
||||
automatically when restoring a managed save machine. It is called
|
||||
as: <pre>/etc/libvirt/hooks/qemu guest_name restore begin -</pre>
|
||||
with domain XML sent to standard input of the script. In this case,
|
||||
the script acts as a filter and is supposed to modify the domain
|
||||
XML and print it out on its standard output. Empty output is
|
||||
identical to copying the input XML without changing it. In case the
|
||||
script returns failure or the output XML is not valid, restore of the
|
||||
image will be aborted. This hook may be used, e.g., to change
|
||||
location of disk images for restored domains.</li>
|
||||
<li><span class="since">Since 0.9.13</span>, the qemu hook script
|
||||
is also called when the libvirtd daemon restarts and reconnects
|
||||
to previously running QEMU processes. If the script fails, the
|
||||
|
@@ -4,8 +4,6 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use File::Find;
|
||||
use XML::XPath;
|
||||
use XML::XPath::XMLParser;
|
||||
|
||||
die "syntax: $0 SRCDIR\n" unless int(@ARGV) == 1;
|
||||
|
||||
@@ -14,20 +12,10 @@ my $srcdir = shift @ARGV;
|
||||
my $symslibvirt = "$srcdir/libvirt_public.syms";
|
||||
my $symsqemu = "$srcdir/libvirt_qemu.syms";
|
||||
my $symslxc = "$srcdir/libvirt_lxc.syms";
|
||||
my @drivertable = (
|
||||
"$srcdir/driver-hypervisor.h",
|
||||
"$srcdir/driver-interface.h",
|
||||
"$srcdir/driver-network.h",
|
||||
"$srcdir/driver-nodedev.h",
|
||||
"$srcdir/driver-nwfilter.h",
|
||||
"$srcdir/driver-secret.h",
|
||||
"$srcdir/driver-state.h",
|
||||
"$srcdir/driver-storage.h",
|
||||
"$srcdir/driver-stream.h",
|
||||
);
|
||||
my $drivertable = "$srcdir/driver.h";
|
||||
|
||||
my %groupheaders = (
|
||||
"virHypervisorDriver" => "Hypervisor APIs",
|
||||
"virDriver" => "Hypervisor APIs",
|
||||
"virNetworkDriver" => "Virtual Network APIs",
|
||||
"virInterfaceDriver" => "Host Interface APIs",
|
||||
"virNodeDeviceDriver" => "Host Device APIs",
|
||||
@@ -40,7 +28,7 @@ my %groupheaders = (
|
||||
my @srcs;
|
||||
find({
|
||||
wanted => sub {
|
||||
if (m!$srcdir/.*/\w+_(driver|common|tmpl|monitor|hal|udev)\.c$!) {
|
||||
if (m!$srcdir/.*/\w+_(driver|tmpl|monitor|hal|udev)\.c$!) {
|
||||
push @srcs, $_ if $_ !~ /vbox_driver\.c/;
|
||||
}
|
||||
}, no_chdir => 1}, $srcdir);
|
||||
@@ -54,7 +42,6 @@ open FILE, "<$symslibvirt"
|
||||
|
||||
my $vers;
|
||||
my $prevvers;
|
||||
my $apixpath = XML::XPath->new(filename => "$srcdir/../docs/libvirt-api.xml");
|
||||
while (defined($line = <FILE>)) {
|
||||
chomp $line;
|
||||
next if $line =~ /^\s*#/;
|
||||
@@ -78,10 +65,7 @@ while (defined($line = <FILE>)) {
|
||||
$prevvers = $vers;
|
||||
$vers = undef;
|
||||
} elsif ($line =~ /\s*(\w+)\s*;\s*$/) {
|
||||
my $file = $apixpath->find("/api/symbols/function[\@name='$1']/\@file");
|
||||
$apis{$1} = {};
|
||||
$apis{$1}->{vers} = $vers;
|
||||
$apis{$1}->{file} = $file;
|
||||
$apis{$1} = $vers;
|
||||
} else {
|
||||
die "unexpected data $line\n";
|
||||
}
|
||||
@@ -97,7 +81,6 @@ open FILE, "<$symsqemu"
|
||||
|
||||
$prevvers = undef;
|
||||
$vers = undef;
|
||||
$apixpath = XML::XPath->new(filename => "$srcdir/../docs/libvirt-qemu-api.xml");
|
||||
while (defined($line = <FILE>)) {
|
||||
chomp $line;
|
||||
next if $line =~ /^\s*#/;
|
||||
@@ -121,10 +104,7 @@ while (defined($line = <FILE>)) {
|
||||
$prevvers = $vers;
|
||||
$vers = undef;
|
||||
} elsif ($line =~ /\s*(\w+)\s*;\s*$/) {
|
||||
my $file = $apixpath->find("/api/symbols/function[\@name='$1']/\@file");
|
||||
$apis{$1} = {};
|
||||
$apis{$1}->{vers} = $vers;
|
||||
$apis{$1}->{file} = $file;
|
||||
$apis{$1} = $vers;
|
||||
} else {
|
||||
die "unexpected data $line\n";
|
||||
}
|
||||
@@ -140,7 +120,6 @@ open FILE, "<$symslxc"
|
||||
|
||||
$prevvers = undef;
|
||||
$vers = undef;
|
||||
$apixpath = XML::XPath->new(filename => "$srcdir/../docs/libvirt-lxc-api.xml");
|
||||
while (defined($line = <FILE>)) {
|
||||
chomp $line;
|
||||
next if $line =~ /^\s*#/;
|
||||
@@ -164,10 +143,7 @@ while (defined($line = <FILE>)) {
|
||||
$prevvers = $vers;
|
||||
$vers = undef;
|
||||
} elsif ($line =~ /\s*(\w+)\s*;\s*$/) {
|
||||
my $file = $apixpath->find("/api/symbols/function[\@name='$1']/\@file");
|
||||
$apis{$1} = {};
|
||||
$apis{$1}->{vers} = $vers;
|
||||
$apis{$1}->{file} = $file;
|
||||
$apis{$1} = $vers;
|
||||
} else {
|
||||
die "unexpected data $line\n";
|
||||
}
|
||||
@@ -178,27 +154,27 @@ close FILE;
|
||||
|
||||
# Some special things which aren't public APIs,
|
||||
# but we want to report
|
||||
$apis{virConnectSupportsFeature}->{vers} = "0.3.2";
|
||||
$apis{virDomainMigratePrepare}->{vers} = "0.3.2";
|
||||
$apis{virDomainMigratePerform}->{vers} = "0.3.2";
|
||||
$apis{virDomainMigrateFinish}->{vers} = "0.3.2";
|
||||
$apis{virDomainMigratePrepare2}->{vers} = "0.5.0";
|
||||
$apis{virDomainMigrateFinish2}->{vers} = "0.5.0";
|
||||
$apis{virDomainMigratePrepareTunnel}->{vers} = "0.7.2";
|
||||
$apis{virConnectSupportsFeature} = "0.3.2";
|
||||
$apis{virDomainMigratePrepare} = "0.3.2";
|
||||
$apis{virDomainMigratePerform} = "0.3.2";
|
||||
$apis{virDomainMigrateFinish} = "0.3.2";
|
||||
$apis{virDomainMigratePrepare2} = "0.5.0";
|
||||
$apis{virDomainMigrateFinish2} = "0.5.0";
|
||||
$apis{virDomainMigratePrepareTunnel} = "0.7.2";
|
||||
|
||||
$apis{virDomainMigrateBegin3}->{vers} = "0.9.2";
|
||||
$apis{virDomainMigratePrepare3}->{vers} = "0.9.2";
|
||||
$apis{virDomainMigratePrepareTunnel3}->{vers} = "0.9.2";
|
||||
$apis{virDomainMigratePerform3}->{vers} = "0.9.2";
|
||||
$apis{virDomainMigrateFinish3}->{vers} = "0.9.2";
|
||||
$apis{virDomainMigrateConfirm3}->{vers} = "0.9.2";
|
||||
$apis{virDomainMigrateBegin3} = "0.9.2";
|
||||
$apis{virDomainMigratePrepare3} = "0.9.2";
|
||||
$apis{virDomainMigratePrepareTunnel3} = "0.9.2";
|
||||
$apis{virDomainMigratePerform3} = "0.9.2";
|
||||
$apis{virDomainMigrateFinish3} = "0.9.2";
|
||||
$apis{virDomainMigrateConfirm3} = "0.9.2";
|
||||
|
||||
$apis{virDomainMigrateBegin3Params}->{vers} = "1.1.0";
|
||||
$apis{virDomainMigratePrepare3Params}->{vers} = "1.1.0";
|
||||
$apis{virDomainMigratePrepareTunnel3Params}->{vers} = "1.1.0";
|
||||
$apis{virDomainMigratePerform3Params}->{vers} = "1.1.0";
|
||||
$apis{virDomainMigrateFinish3Params}->{vers} = "1.1.0";
|
||||
$apis{virDomainMigrateConfirm3Params}->{vers} = "1.1.0";
|
||||
$apis{virDomainMigrateBegin3Params} = "1.1.0";
|
||||
$apis{virDomainMigratePrepare3Params} = "1.1.0";
|
||||
$apis{virDomainMigratePrepareTunnel3Params} = "1.1.0";
|
||||
$apis{virDomainMigratePerform3Params} = "1.1.0";
|
||||
$apis{virDomainMigrateFinish3Params} = "1.1.0";
|
||||
$apis{virDomainMigrateConfirm3Params} = "1.1.0";
|
||||
|
||||
|
||||
|
||||
@@ -206,44 +182,42 @@ $apis{virDomainMigrateConfirm3Params}->{vers} = "1.1.0";
|
||||
# and driver struct fields. This lets us later match
|
||||
# update the driver impls with the public APis.
|
||||
|
||||
open FILE, "<$drivertable"
|
||||
or die "cannot read $drivertable: $!";
|
||||
|
||||
# Group name -> hash of APIs { fields -> api name }
|
||||
my %groups;
|
||||
my $ingrp;
|
||||
foreach my $drivertable (@drivertable) {
|
||||
open FILE, "<$drivertable"
|
||||
or die "cannot read $drivertable: $!";
|
||||
while (defined($line = <FILE>)) {
|
||||
if ($line =~ /struct _(vir\w*Driver)/) {
|
||||
my $grp = $1;
|
||||
if ($grp ne "virStateDriver" &&
|
||||
$grp ne "virStreamDriver") {
|
||||
$ingrp = $grp;
|
||||
$groups{$ingrp} = { apis => {}, drivers => {} };
|
||||
}
|
||||
} elsif ($ingrp) {
|
||||
if ($line =~ /^\s*vir(?:Drv)(\w+)\s+(\w+);\s*$/) {
|
||||
my $field = $2;
|
||||
my $name = $1;
|
||||
|
||||
while (defined($line = <FILE>)) {
|
||||
if ($line =~ /struct _(vir\w*Driver)/) {
|
||||
my $grp = $1;
|
||||
if ($grp ne "virStateDriver" &&
|
||||
$grp ne "virStreamDriver") {
|
||||
$ingrp = $grp;
|
||||
$groups{$ingrp} = { apis => {}, drivers => {} };
|
||||
}
|
||||
} elsif ($ingrp) {
|
||||
if ($line =~ /^\s*vir(?:Drv)(\w+)\s+(\w+);\s*$/) {
|
||||
my $field = $2;
|
||||
my $name = $1;
|
||||
|
||||
my $api;
|
||||
if (exists $apis{"vir$name"}) {
|
||||
$api = "vir$name";
|
||||
} elsif ($name =~ /\w+(Open|Close)/) {
|
||||
next;
|
||||
} else {
|
||||
die "driver $name does not have a public API";
|
||||
}
|
||||
$groups{$ingrp}->{apis}->{$field} = $api;
|
||||
} elsif ($line =~ /};/) {
|
||||
$ingrp = undef;
|
||||
my $api;
|
||||
if (exists $apis{"vir$name"}) {
|
||||
$api = "vir$name";
|
||||
} elsif ($name =~ /\w+(Open|Close)/) {
|
||||
next;
|
||||
} else {
|
||||
die "driver $name does not have a public API";
|
||||
}
|
||||
$groups{$ingrp}->{apis}->{$field} = $api;
|
||||
} elsif ($line =~ /};/) {
|
||||
$ingrp = undef;
|
||||
}
|
||||
}
|
||||
|
||||
close FILE;
|
||||
}
|
||||
|
||||
close FILE;
|
||||
|
||||
|
||||
# Finally, we read all the primary driver files and extract
|
||||
# the driver API tables from each one.
|
||||
@@ -316,43 +290,43 @@ foreach my $src (@srcs) {
|
||||
# have a bit of manual fixup todo with the per-driver versioning
|
||||
# and support matrix
|
||||
|
||||
$groups{virHypervisorDriver}->{apis}->{"openAuth"} = "virConnectOpenAuth";
|
||||
$groups{virHypervisorDriver}->{apis}->{"openReadOnly"} = "virConnectOpenReadOnly";
|
||||
$groups{virHypervisorDriver}->{apis}->{"domainMigrate"} = "virDomainMigrate";
|
||||
$groups{virDriver}->{apis}->{"openAuth"} = "virConnectOpenAuth";
|
||||
$groups{virDriver}->{apis}->{"openReadOnly"} = "virConnectOpenReadOnly";
|
||||
$groups{virDriver}->{apis}->{"domainMigrate"} = "virDomainMigrate";
|
||||
|
||||
my $openAuthVers = (0 * 1000 * 1000) + (4 * 1000) + 0;
|
||||
|
||||
foreach my $drv (keys %{$groups{"virHypervisorDriver"}->{drivers}}) {
|
||||
my $openVersStr = $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpen"};
|
||||
foreach my $drv (keys %{$groups{"virDriver"}->{drivers}}) {
|
||||
my $openVersStr = $groups{"virDriver"}->{drivers}->{$drv}->{"connectOpen"};
|
||||
my $openVers;
|
||||
if ($openVersStr =~ /(\d+)\.(\d+)\.(\d+)/) {
|
||||
$openVers = ($1 * 1000 * 1000) + ($2 * 1000) + $3;
|
||||
}
|
||||
|
||||
# virConnectOpenReadOnly always matches virConnectOpen version
|
||||
$groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpenReadOnly"} =
|
||||
$groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpen"};
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"connectOpenReadOnly"} =
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"connectOpen"};
|
||||
|
||||
# virConnectOpenAuth is always 0.4.0 if the driver existed
|
||||
# before this time, otherwise it matches the version of
|
||||
# the driver's virConnectOpen entry
|
||||
if ($openVersStr eq "Y" ||
|
||||
$openVers >= $openAuthVers) {
|
||||
$groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpenAuth"} = $openVersStr;
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"connectOpenAuth"} = $openVersStr;
|
||||
} else {
|
||||
$groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpenAuth"} = "0.4.0";
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"connectOpenAuth"} = "0.4.0";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Another special case for the virDomainCreateLinux which was replaced
|
||||
# with virDomainCreateXML
|
||||
$groups{virHypervisorDriver}->{apis}->{"domainCreateLinux"} = "virDomainCreateLinux";
|
||||
$groups{virDriver}->{apis}->{"domainCreateLinux"} = "virDomainCreateLinux";
|
||||
|
||||
my $createAPIVers = (0 * 1000 * 1000) + (0 * 1000) + 3;
|
||||
|
||||
foreach my $drv (keys %{$groups{"virHypervisorDriver"}->{drivers}}) {
|
||||
my $createVersStr = $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"domainCreateXML"};
|
||||
foreach my $drv (keys %{$groups{"virDriver"}->{drivers}}) {
|
||||
my $createVersStr = $groups{"virDriver"}->{drivers}->{$drv}->{"domainCreateXML"};
|
||||
next unless defined $createVersStr;
|
||||
my $createVers;
|
||||
if ($createVersStr =~ /(\d+)\.(\d+)\.(\d+)/) {
|
||||
@@ -364,9 +338,9 @@ foreach my $drv (keys %{$groups{"virHypervisorDriver"}->{drivers}}) {
|
||||
# the driver's virCreateXML entry
|
||||
if ($createVersStr eq "Y" ||
|
||||
$createVers >= $createAPIVers) {
|
||||
$groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"domainCreateLinux"} = $createVersStr;
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"domainCreateLinux"} = $createVersStr;
|
||||
} else {
|
||||
$groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"domainCreateLinux"} = "0.0.3";
|
||||
$groups{"virDriver"}->{drivers}->{$drv}->{"domainCreateLinux"} = "0.0.3";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,7 +367,7 @@ in.
|
||||
|
||||
EOF
|
||||
|
||||
foreach my $grp (sort { $a cmp $b } keys %groups) {
|
||||
foreach my $grp (sort { $a cmp $b } keys %groups) {
|
||||
print "<h2><a name=\"$grp\">", $groupheaders{$grp}, "</a></h2>\n";
|
||||
print <<EOF;
|
||||
<table class="top_table">
|
||||
@@ -420,23 +394,10 @@ EOF
|
||||
$groups{$grp}->{apis}->{$b}
|
||||
} keys %{$groups{$grp}->{apis}}) {
|
||||
my $api = $groups{$grp}->{apis}->{$field};
|
||||
my $vers = $apis{$api}->{vers};
|
||||
my $htmlgrp = $apis{$api}->{file};
|
||||
my $vers = $apis{$api};
|
||||
print <<EOF;
|
||||
<tr>
|
||||
<td>
|
||||
EOF
|
||||
|
||||
if (defined $htmlgrp) {
|
||||
print <<EOF;
|
||||
<a href=\"html/libvirt-$htmlgrp.html#$api\">$api</a>
|
||||
EOF
|
||||
|
||||
} else {
|
||||
print $api;
|
||||
}
|
||||
print <<EOF;
|
||||
</td>
|
||||
<td><a href=\"html/libvirt-libvirt.html#$api\">$api</a></td>
|
||||
<td>$vers</td>
|
||||
EOF
|
||||
|
||||
|
@@ -597,7 +597,7 @@
|
||||
<h4><a name="apiclientdispatchex1">Example with buck passing</a></h4>
|
||||
|
||||
<p>
|
||||
In the first example, a second thread issues an API call
|
||||
In the first example, a second thread issues a API call
|
||||
while the first thread holds the buck. The reply to the
|
||||
first call arrives first, so the buck is passed to the
|
||||
second thread.
|
||||
|
@@ -98,18 +98,18 @@ the code you can build the code with</p>
|
||||
<p>The bindings are articulated around a few
|
||||
classes in the <code>org/libvirt</code> package, notably the
|
||||
<code>Connect</code>, <code>Domain</code> and <code>Network</code>
|
||||
ones. Functions in the <a href="html/index.html">C API</a>
|
||||
ones. Functions in the <a href="html/libvirt-libvirt.html">C API</a>
|
||||
taking <code>virConnectPtr</code>, <code>virDomainPtr</code> or
|
||||
<code>virNetworkPtr</code> as their first argument usually become
|
||||
methods for the classes, their name is just stripped from the
|
||||
virConnect or virDomain(Get) prefix and the first letter gets converted to
|
||||
lower case, for example the C functions:</p>
|
||||
<p>
|
||||
<code>int <a href="html/libvirt-libvirt-domain.html#virConnectNumOfDomains">virConnectNumOfDomains</a>
|
||||
<code>int <a href="html/libvirt-libvirt.html#virConnectNumOfDomains">virConnectNumOfDomains</a>
|
||||
(virConnectPtr conn);</code>
|
||||
</p>
|
||||
<p>
|
||||
<code>int <a href="html/libvirt-libvirt-domain.html#virDomainSetMaxMemory">virDomainSetMaxMemory</a>
|
||||
<code>int <a href="html/libvirt-libvirt.html#virDomainSetMaxMemory">virDomainSetMaxMemory</a>
|
||||
(virDomainPtr domain, unsigned long memory);</code>
|
||||
</p>
|
||||
<p>become</p>
|
||||
@@ -130,7 +130,7 @@ public class minitest {
|
||||
Connect conn=null;
|
||||
try{
|
||||
conn = new <span style="color: #0071FF; background-color: #FFFFFF">Connect</span>("test:///default", true);
|
||||
} catch (<span style="color: #0071FF; background-color: #FFFFFF">LibvirtException</span> e) {
|
||||
} catch (<span style="color: #0071FF; background-color: #FFFFFF">LibvirtException</span> e){
|
||||
System.out.println("exception caught:"+e);
|
||||
System.out.println(e.getError());
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public class minitest {
|
||||
System.out.println("Domain:" + testDomain.<span style="color: #E50073; background-color: #FFFFFF">getName</span>() + " id " +
|
||||
testDomain.<span style="color: #E50073; background-color: #FFFFFF">getID</span>() + " running " +
|
||||
testDomain.<span style="color: #E50073; background-color: #FFFFFF">getOSType</span>());
|
||||
} catch (<span style="color: #0071FF; background-color: #FFFFFF">LibvirtException</span> e) {
|
||||
} catch (<span style="color: #0071FF; background-color: #FFFFFF">LibvirtException</span> e){
|
||||
System.out.println("exception caught:"+e);
|
||||
System.out.println(e.getError());
|
||||
}
|
||||
|
@@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
h1 {
|
||||
font-weight: normal;
|
||||
color: #3c857c;
|
||||
|
@@ -1,160 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1>Virtual machine lock manager, virtlockd plugin</h1>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<p>
|
||||
This page describes use of the <code>virtlockd</code>
|
||||
service as a <a href="locking.html">lock driver</a>
|
||||
plugin for virtual machine disk mutual exclusion.
|
||||
</p>
|
||||
|
||||
<h2><a name="background">virtlockd background</a></h2>
|
||||
|
||||
<p>
|
||||
The virtlockd daemon is a single purpose binary which
|
||||
focuses exclusively on the task of acquiring and holding
|
||||
locks on behalf of running virtual machines. It is
|
||||
designed to offer a low overhead, portable locking
|
||||
scheme can be used out of the box on virtualization
|
||||
hosts with minimal configuration overheads. It makes
|
||||
use of the POSIX fcntl advisory locking capability
|
||||
to hold locks, which is supported by the majority of
|
||||
commonly used filesystems.
|
||||
</p>
|
||||
|
||||
<h2><a name="sanlock">virtlockd daemon setup</a></h2>
|
||||
|
||||
<p>
|
||||
In most OS, the virtlockd daemon itself will not require
|
||||
any upfront configuration work. It is installed by default
|
||||
when libvirtd is present, and a systemd socket unit is
|
||||
registered such that the daemon will be automatically
|
||||
started when first required. With OS that predate systemd
|
||||
though, it will be necessary to start it at boot time,
|
||||
prior to libvirtd being started. On RHEL/Fedora distros,
|
||||
this can be achieved as follows
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# chkconfig virtlockd on
|
||||
# service virtlockd start
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The above instructions apply to the instance of virtlockd
|
||||
that runs privileged, and is used by the libvirtd daemon
|
||||
that runs privileged. If running libvirtd as an unprivileged
|
||||
user, it will always automatically spawn an instance of
|
||||
the virtlockd daemon unprivileged too. This requires no
|
||||
setup at all.
|
||||
</p>
|
||||
|
||||
<h2><a name="lockdplugin">libvirt lockd plugin configuration</a></h2>
|
||||
|
||||
<p>
|
||||
Once the virtlockd daemon is running, or setup to autostart,
|
||||
the next step is to configure the libvirt lockd plugin.
|
||||
There is a separate configuration file for each libvirt
|
||||
driver that is using virtlockd. For QEMU, we will edit
|
||||
<code>/etc/libvirt/qemu-lockd.conf</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The default behaviour of the lockd plugin is to acquire locks
|
||||
directly on the virtual disk images associated with the guest
|
||||
<disk> elements. This ensures it can run out of the box
|
||||
with no configuration, providing locking for disk images on
|
||||
shared filesystems such as NFS. It does not provide any cross
|
||||
host protection for storage that is backed by block devices,
|
||||
since locks acquired on device nodes in /dev only apply within
|
||||
the host. It may also be the case that the filesystem holding
|
||||
the disk images is not capable of supporting fcntl locks.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To address these problems it is possible to tell lockd to
|
||||
acquire locks on an indirect file. Essentially lockd will
|
||||
calculate the SHA256 checksum of the fully qualified path,
|
||||
and create a zero length file in a given directory whose
|
||||
filename is the checksum. It will then acquire a lock on
|
||||
that file. Assuming the block devices assigned to the guest
|
||||
are using stable paths (eg /dev/disk/by-path/XXXXXXX) then
|
||||
this will allow for locks to apply across hosts. This
|
||||
feature can be enabled by setting a configuration setting
|
||||
that specifies the directory in which to create the lock
|
||||
files. The directory referred to should of course be
|
||||
placed on a shared filesystem (eg NFS) that is accessible
|
||||
to all hosts which can see the shared block devices.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ su - root
|
||||
# augtool -s set \
|
||||
/files/etc/libvirt/qemu-lockd.conf/file_lockspace_dir \
|
||||
"/var/lib/libvirt/lockd/files"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
If the guests are using either LVM and SCSI block devices
|
||||
for their virtual disks, there is a unique identifier
|
||||
associated with each device. It is possible to tell lockd
|
||||
to use this UUID as the basis for acquiring locks, rather
|
||||
than the SHA256 sum of the filename. The benefit of this
|
||||
is that the locking protection will work even if the file
|
||||
paths to the given block device are different on each
|
||||
host.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ su - root
|
||||
# augtool -s set \
|
||||
/files/etc/libvirt/qemu-lockd.conf/scsi_lockspace_dir \
|
||||
"/var/lib/libvirt/lockd/scsi"
|
||||
# augtool -s set \
|
||||
/files/etc/libvirt/qemu-lockd.conf/lvm_lockspace_dir \
|
||||
"/var/lib/libvirt/lockd/lvm"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
It is important to remember that the changes made to the
|
||||
<code>/etc/libvirt/qemu-lockd.conf</code> file must be
|
||||
propagated to all hosts before any virtual machines are
|
||||
launched on them. This ensures that all hosts are using
|
||||
the same locking mechanism
|
||||
</p>
|
||||
|
||||
<h2><a name="qemuconfig">QEMU/KVM driver configuration</a></h2>
|
||||
|
||||
<p>
|
||||
The QEMU driver is capable of using the virtlockd plugin
|
||||
since the release <span>1.0.2</span>.
|
||||
The out of the box configuration, however, currently
|
||||
uses the <strong>nop</strong> lock manager plugin.
|
||||
To get protection for disks, it is thus necessary
|
||||
to reconfigure QEMU to activate the <strong>lockd</strong>
|
||||
driver. This is achieved by editing the QEMU driver
|
||||
configuration file (<code>/etc/libvirt/qemu.conf</code>)
|
||||
and changing the <code>lock_manager</code> configuration
|
||||
tunable.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ su - root
|
||||
# augtool -s set /files/etc/libvirt/qemu.conf/lock_manager lockd
|
||||
# service libvirtd restart
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Every time you start a guest, the virtlockd daemon will acquire
|
||||
locks on the disk files directly, or in one of the configured
|
||||
lookaside directories based on SHA256 sum. To check that locks
|
||||
are being acquired as expected, the <code>lslocks</code> tool
|
||||
can be run.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -1,247 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1>Virtual machine lock manager, sanlock plugin</h1>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<p>
|
||||
This page describes use of the
|
||||
<a href="https://fedorahosted.org/sanlock/">sanlock</a>
|
||||
service as a <a href="locking.html">lock driver</a>
|
||||
plugin for virtual machine disk mutual exclusion.
|
||||
</p>
|
||||
|
||||
<h2><a name="sanlock">Sanlock daemon setup</a></h2>
|
||||
|
||||
<p>
|
||||
On many operating systems, the <strong>sanlock</strong> plugin
|
||||
is distributed in a sub-package which needs to be installed
|
||||
separately from the main libvirt RPM. On a Fedora/RHEL host
|
||||
this can be done with the <code>yum</code> command
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ su - root
|
||||
# yum install libvirt-lock-sanlock
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The next step is to start the sanlock daemon. For maximum
|
||||
safety sanlock prefers to have a connection to a watchdog
|
||||
daemon. This will cause the entire host to be rebooted in
|
||||
the event that sanlock crashes / terminates abnormally.
|
||||
To start the watchdog daemon on a Fedora/RHEL host
|
||||
the following commands can be run:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ su - root
|
||||
# chkconfig wdmd on
|
||||
# service wdmd start
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Once the watchdog is running, sanlock can be started
|
||||
as follows
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# chkconfig sanlock on
|
||||
# service sanlock start
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<em>Note:</em> if you wish to avoid the use of the
|
||||
watchdog, add the following line to <code>/etc/sysconfig/sanlock</code>
|
||||
before starting it
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
SANLOCKOPTS="-w 0"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The sanlock daemon must be started on every single host
|
||||
that will be running virtual machines. So repeat these
|
||||
steps as necessary.
|
||||
</p>
|
||||
|
||||
<h2><a name="sanlockplugin">libvirt sanlock plugin configuration</a></h2>
|
||||
|
||||
<p>
|
||||
Once the sanlock daemon is running, the next step is to
|
||||
configure the libvirt sanlock plugin. There is a separate
|
||||
configuration file for each libvirt driver that is using
|
||||
sanlock. For QEMU, we will edit <code>/etc/libvirt/qemu-sanlock.conf</code>
|
||||
There is one mandatory parameter that needs to be set,
|
||||
the <code>host_id</code>. This is a integer between
|
||||
1 and 2000, which must be set to a <strong>unique</strong>
|
||||
value on each host running virtual machines.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ su - root
|
||||
# augtool -s set /files/etc/libvirt/qemu-sanlock.conf/host_id 1
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Repeat this on every host, changing <strong>1</strong> to a
|
||||
unique value for the host.
|
||||
</p>
|
||||
|
||||
<h2><a name="sanlockstorage">libvirt sanlock storage configuration</a></h2>
|
||||
|
||||
<p>
|
||||
The sanlock plugin needs to create leases in a directory
|
||||
that is on a filesystem shared between all hosts running
|
||||
virtual machines. Obvious choices for this include NFS
|
||||
or GFS2. The libvirt sanlock plugin expects its lease
|
||||
directory be at <code>/var/lib/libvirt/sanlock</code>
|
||||
so update the host's <code>/etc/fstab</code> to mount
|
||||
a suitable shared/cluster filesystem at that location
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ su - root
|
||||
# echo "some.nfs.server:/export/sanlock /var/lib/libvirt/sanlock nfs hard,nointr 0 0" >> /etc/fstab
|
||||
# mount /var/lib/libvirt/sanlock
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
If your sanlock daemon happen to run under non-root
|
||||
privileges, you need to tell this to libvirt so it
|
||||
chowns created files correctly. This can be done by
|
||||
setting <code>user</code> and/or <code>group</code>
|
||||
variables in the configuration file. Accepted values
|
||||
range is specified in description to the same
|
||||
variables in <code>/etc/libvirt/qemu.conf</code>. For
|
||||
example:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
augtool -s set /files/etc/libvirt/qemu-sanlock.conf/user sanlock
|
||||
augtool -s set /files/etc/libvirt/qemu-sanlock.conf/group sanlock
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
But remember, that if this is NFS share, you need a
|
||||
no_root_squash-ed one for chown (and chmod possibly)
|
||||
to succeed.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In terms of storage requirements, if the filesystem
|
||||
uses 512 byte sectors, you need to allow for <code>1MB</code>
|
||||
of storage for each guest disk. So if you have a network
|
||||
with 20 virtualization hosts, each running 50 virtual
|
||||
machines and an average of 2 disks per guest, you will
|
||||
need <code>20*50*2 == 2000 MB</code> of storage for
|
||||
sanlock.
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
On one of the hosts on the network is it wise to setup
|
||||
a cron job which runs the <code>virt-sanlock-cleanup</code>
|
||||
script periodically. This scripts deletes any lease
|
||||
files which are not currently in use by running virtual
|
||||
machines, freeing up disk space on the shared filesystem.
|
||||
Unless VM disks are very frequently created + deleted
|
||||
it should be sufficient to run the cleanup once a week.
|
||||
</p>
|
||||
|
||||
<h2><a name="qemuconfig">QEMU/KVM driver configuration</a></h2>
|
||||
|
||||
<p>
|
||||
The QEMU/KVM driver is fully integrated with the lock
|
||||
manager framework as of release <span>0.9.3</span>.
|
||||
The out of the box configuration, however, currently
|
||||
uses the <strong>nop</strong> lock manager plugin.
|
||||
To get protection for disks, it is thus necessary
|
||||
to reconfigure QEMU to activate the <strong>sanlock</strong>
|
||||
driver. This is achieved by editing the QEMU driver
|
||||
configuration file (<code>/etc/libvirt/qemu.conf</code>)
|
||||
and changing the <code>lock_manager</code> configuration
|
||||
tunable.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ su - root
|
||||
# augtool -s set /files/etc/libvirt/qemu.conf/lock_manager sanlock
|
||||
# service libvirtd restart
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
If all went well, libvirtd will have talked to sanlock
|
||||
and created the basic lockspace. This can be checked
|
||||
by looking for existence of the following file
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# ls /var/lib/libvirt/sanlock/
|
||||
__LIBVIRT__DISKS__
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Every time you start a guest, additional lease files will appear
|
||||
in this directory, one for each virtual disk. The lease
|
||||
files are named based on the MD5 checksum of the fully qualified
|
||||
path of the virtual disk backing file. So if the guest is given
|
||||
a disk backed by <code>/var/lib/libvirt/images/demo.img</code>
|
||||
expect to see a lease <code>/var/lib/libvirt/sanlock/bfa0240911bc17753e0b473688822159</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It should be obvious that for locking to work correctly, every
|
||||
host running virtual machines should have storage configured
|
||||
in the same way. The easiest way to do this is to use the libvirt
|
||||
storage pool capability to configure any NFS volumes, iSCSI targets,
|
||||
or SCSI HBAs used for guest storage. Simply replicate the same
|
||||
storage pool XML across every host. It is important that any
|
||||
storage pools exposing block devices are configured to create
|
||||
volume paths under <code>/dev/disks/by-path</code> to ensure
|
||||
stable paths across hosts. An example iSCSI configuration
|
||||
which ensures this is:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<pool type='iscsi'>
|
||||
<name>myiscsipool</name>
|
||||
<source>
|
||||
<host name='192.168.254.8'/>
|
||||
<device path='your-iscsi-target-iqn'/>
|
||||
</source>
|
||||
<target>
|
||||
<path>/dev/disk/by-path</path>
|
||||
</target>
|
||||
</pool>
|
||||
</pre>
|
||||
|
||||
<h2><a name="domainconfig">Domain configuration</a></h2>
|
||||
|
||||
<p>
|
||||
In case sanlock loses access to disk locks for some reason, it will
|
||||
kill all domains that lost their locks. This default behavior may
|
||||
be changed using
|
||||
<a href="formatdomain.html#elementsEvents">on_lockfailure
|
||||
element</a> in domain XML. When this element is present, sanlock
|
||||
will call <code>sanlock_helper</code> (provided by libvirt) with
|
||||
the specified action. This helper binary will connect to libvirtd
|
||||
and thus it may need to authenticate if libvirtd was configured to
|
||||
require that on the read-write UNIX socket. To provide the
|
||||
appropriate credentials to sanlock_helper, a
|
||||
<a href="auth.html#Auth_client_config">client authentication
|
||||
file</a> needs to contain something like the following:
|
||||
</p>
|
||||
<pre>
|
||||
[auth-libvirt-localhost]
|
||||
credentials=sanlock
|
||||
|
||||
[credentials-sanlock]
|
||||
authname=login
|
||||
password=password
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@@ -2,47 +2,258 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1>Virtual machine lock manager</h1>
|
||||
<h1>Virtual machine disk locking</h1>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<p>
|
||||
Libvirt includes a framework for ensuring mutual exclusion
|
||||
between virtual machines using host resources. Typically
|
||||
this is used to prevent two VM processes from having concurrent
|
||||
write access to the same disk image, as this would result in
|
||||
data corruption if the guest was not using a cluster
|
||||
aware filesystem.
|
||||
This page describes how to ensure a single disk cannot be
|
||||
used by more than one running VM at a time, across any
|
||||
host in a network. This is critical to avoid data corruption
|
||||
of guest files systems that are not cluster aware.
|
||||
</p>
|
||||
|
||||
<h2><a name="plugins">Lock manager plugins</a></h2>
|
||||
|
||||
<p>
|
||||
The lock manager framework has a pluggable architecture,
|
||||
to allow different locking technologies to be used.
|
||||
libvirt includes a pluggable framework for lock managers,
|
||||
which hypervisor drivers can use to ensure safety for
|
||||
guest domain disks, and potentially other resources.
|
||||
At this time there are only two plugin implementations,
|
||||
a "no op" implementation which does absolutely nothing,
|
||||
and a <a href="https://fedorahosted.org/sanlock/">sanlock</a> implementation which uses
|
||||
the Disk Paxos algorithm to ensure safety.
|
||||
</p>
|
||||
|
||||
<dl>
|
||||
<dt>nop</dt>
|
||||
<dd>This is a "no op" implementation which does absolutely
|
||||
nothing. This can be used if mutual exclusion between
|
||||
virtual machines is not required, or if it is being
|
||||
solved at another level in the management stack.</dd>
|
||||
<dt><a href="locking-lockd.html">lockd</a></dt>
|
||||
<dd>This is the current preferred implementation shipped
|
||||
with libvirt. It uses the <code>virtlockd</code> daemon
|
||||
to manage locks using the POSIX fcntl() advisory locking
|
||||
capability. As such it requires a shared filesystem of
|
||||
some kind be accessible to all hosts which share the
|
||||
same image storage.</dd>
|
||||
<dt><a href="locking-sanlock.html">sanlock</a></dt>
|
||||
<dd>This is an alternative implementation preferred by
|
||||
the oVirt project. It uses a disk paxos algorithm for
|
||||
maintaining continuously renewed leases. In the default
|
||||
setup it requires some shared filesystem, but it is
|
||||
possible to use it in a manual mode where the management
|
||||
application creates leases in SAN storage volumes.
|
||||
</dd>
|
||||
</dl>
|
||||
<h2><a name="sanlock">Sanlock daemon setup</a></h2>
|
||||
|
||||
<p>
|
||||
On many operating systems, the <strong>sanlock</strong> plugin
|
||||
is distributed in a sub-package which needs to be installed
|
||||
separately from the main libvirt RPM. On a Fedora/RHEL host
|
||||
this can be done with the <code>yum</code> command
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ su - root
|
||||
# yum install libvirt-lock-sanlock
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The next step is to start the sanlock daemon. For maximum
|
||||
safety sanlock prefers to have a connection to a watchdog
|
||||
daemon. This will cause the entire host to be rebooted in
|
||||
the event that sanlock crashes / terminates abnormally.
|
||||
To start the watchdog daemon on a Fedora/RHEL host
|
||||
the following commands can be run:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ su - root
|
||||
# chkconfig wdmd on
|
||||
# service wdmd start
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Once the watchdog is running, sanlock can be started
|
||||
as follows
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# chkconfig sanlock on
|
||||
# service sanlock start
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<em>Note:</em> if you wish to avoid the use of the
|
||||
watchdog, add the following line to <code>/etc/sysconfig/sanlock</code>
|
||||
before starting it
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
SANLOCKOPTS="-w 0"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The sanlock daemon must be started on every single host
|
||||
that will be running virtual machines. So repeat these
|
||||
steps as necessary.
|
||||
</p>
|
||||
|
||||
<h2><a name="sanlockplugin">libvirt sanlock plugin configuration</a></h2>
|
||||
|
||||
<p>
|
||||
Once the sanlock daemon is running, the next step is to
|
||||
configure the libvirt sanlock plugin. There is a separate
|
||||
configuration file for each libvirt driver that is using
|
||||
sanlock. For QEMU, we will edit <code>/etc/libvirt/qemu-sanlock.conf</code>
|
||||
There is one mandatory parameter that needs to be set,
|
||||
the <code>host_id</code>. This is a integer between
|
||||
1 and 2000, which must be set to a <strong>unique</strong>
|
||||
value on each host running virtual machines.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ su - root
|
||||
# augtool -s set /files/etc/libvirt/qemu-sanlock.conf/host_id 1
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Repeat this on every host, changing <strong>1</strong> to a
|
||||
unique value for the host.
|
||||
</p>
|
||||
|
||||
<h2><a name="sanlockstorage">libvirt sanlock storage configuration</a></h2>
|
||||
|
||||
<p>
|
||||
The sanlock plugin needs to create leases in a directory
|
||||
that is on a filesystem shared between all hosts running
|
||||
virtual machines. Obvious choices for this include NFS
|
||||
or GFS2. The libvirt sanlock plugin expects its lease
|
||||
directory be at <code>/var/lib/libvirt/sanlock</code>
|
||||
so update the host's <code>/etc/fstab</code> to mount
|
||||
a suitable shared/cluster filesystem at that location
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ su - root
|
||||
# echo "some.nfs.server:/export/sanlock /var/lib/libvirt/sanlock nfs hard,nointr 0 0" >> /etc/fstab
|
||||
# mount /var/lib/libvirt/sanlock
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
If your sanlock daemon happen to run under non-root
|
||||
privileges, you need to tell this to libvirt so it
|
||||
chowns created files correctly. This can be done by
|
||||
setting <code>user</code> and/or <code>group</code>
|
||||
variables in the configuration file. Accepted values
|
||||
range is specified in description to the same
|
||||
variables in <code>/etc/libvirt/qemu.conf</code>. For
|
||||
example:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
augtool -s set /files/etc/libvirt/qemu-sanlock.conf/user sanlock
|
||||
augtool -s set /files/etc/libvirt/qemu-sanlock.conf/group sanlock
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
But remember, that if this is NFS share, you need a
|
||||
no_root_squash-ed one for chown (and chmod possibly)
|
||||
to succeed.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In terms of storage requirements, if the filesystem
|
||||
uses 512 byte sectors, you need to allow for <code>1MB</code>
|
||||
of storage for each guest disk. So if you have a network
|
||||
with 20 virtualization hosts, each running 50 virtual
|
||||
machines and an average of 2 disks per guest, you will
|
||||
need <code>20*50*2 == 2000 MB</code> of storage for
|
||||
sanlock.
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
On one of the hosts on the network is it wise to setup
|
||||
a cron job which runs the <code>virt-sanlock-cleanup</code>
|
||||
script periodically. This scripts deletes any lease
|
||||
files which are not currently in use by running virtual
|
||||
machines, freeing up disk space on the shared filesystem.
|
||||
Unless VM disks are very frequently created + deleted
|
||||
it should be sufficient to run the cleanup once a week.
|
||||
</p>
|
||||
|
||||
<h2><a name="qemuconfig">QEMU/KVM driver configuration</a></h2>
|
||||
|
||||
<p>
|
||||
The QEMU/KVM driver is fully integrated with the lock
|
||||
manager framework as of release <span>0.9.3</span>.
|
||||
The out of the box configuration, however, currently
|
||||
uses the <strong>nop</strong> lock manager plugin.
|
||||
To get protection for disks, it is thus necessary
|
||||
to reconfigure QEMU to activate the <strong>sanlock</strong>
|
||||
driver. This is achieved by editing the QEMU driver
|
||||
configuration file (<code>/etc/libvirt/qemu.conf</code>)
|
||||
and changing the <code>lock_manager</code> configuration
|
||||
tunable.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ su - root
|
||||
# augtool -s set /files/etc/libvirt/qemu.conf/lock_manager sanlock
|
||||
# service libvirtd restart
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
If all went well, libvirtd will have talked to sanlock
|
||||
and created the basic lockspace. This can be checked
|
||||
by looking for existence of the following file
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
# ls /var/lib/libvirt/sanlock/
|
||||
__LIBVIRT__DISKS__
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
Every time you start a guest, additional lease files will appear
|
||||
in this directory, one for each virtual disk. The lease
|
||||
files are named based on the MD5 checksum of the fully qualified
|
||||
path of the virtual disk backing file. So if the guest is given
|
||||
a disk backed by <code>/var/lib/libvirt/images/demo.img</code>
|
||||
expect to see a lease <code>/var/lib/libvirt/sanlock/bfa0240911bc17753e0b473688822159</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It should be obvious that for locking to work correctly, every
|
||||
host running virtual machines should have storage configured
|
||||
in the same way. The easiest way to do this is to use the libvirt
|
||||
storage pool capability to configure any NFS volumes, iSCSI targets,
|
||||
or SCSI HBAs used for guest storage. Simply replicate the same
|
||||
storage pool XML across every host. It is important that any
|
||||
storage pools exposing block devices are configured to create
|
||||
volume paths under <code>/dev/disks/by-path</code> to ensure
|
||||
stable paths across hosts. An example iSCSI configuration
|
||||
which ensures this is:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<pool type='iscsi'>
|
||||
<name>myiscsipool</name>
|
||||
<source>
|
||||
<host name='192.168.254.8'/>
|
||||
<device path='your-iscsi-target-iqn'/>
|
||||
</source>
|
||||
<target>
|
||||
<path>/dev/disk/by-path</path>
|
||||
</target>
|
||||
</pool>
|
||||
</pre>
|
||||
|
||||
<h2><a name="domainconfig">Domain configuration</a></h2>
|
||||
|
||||
<p>
|
||||
In case sanlock loses access to disk locks for some reason, it will
|
||||
kill all domains that lost their locks. This default behavior may
|
||||
be changed using
|
||||
<a href="formatdomain.html#elementsEvents">on_lockfailure
|
||||
element</a> in domain XML. When this element is present, sanlock
|
||||
will call <code>sanlock_helper</code> (provided by libvirt) with
|
||||
the specified action. This helper binary will connect to libvirtd
|
||||
and thus it may need to authenticate if libvirtd was configured to
|
||||
require that on the read-write UNIX socket. To provide the
|
||||
appropriate credentials to sanlock_helper, a
|
||||
<a href="auth.html#Auth_client_config">client authentication
|
||||
file</a> needs to contain something like the following:
|
||||
</p>
|
||||
<pre>
|
||||
[auth-libvirt-localhost]
|
||||
credentials=sanlock
|
||||
|
||||
[credentials-sanlock]
|
||||
authname=login
|
||||
password=password
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
2765
docs/news.html.in
2765
docs/news.html.in
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,11 @@
|
||||
<!-- The sitemap.html.in page contains the master navigation structure -->
|
||||
<xsl:variable name="sitemap" select="document('sitemap.html.in')/html:html/html:body/html:div[@id='sitemap']"/>
|
||||
|
||||
<xsl:template match="html:code[@class='docref']" mode="content">
|
||||
<xsl:variable name="name"><xsl:value-of select="."/></xsl:variable>
|
||||
<a href="html/libvirt-libvirt.html#{$name}"><code><xsl:value-of select="$name"/></code></a>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="node() | @*" mode="content">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="node() | @*" mode="content"/>
|
||||
|
@@ -12,11 +12,11 @@ becomes methods for the classes, their name is just stripped from the
|
||||
virConnect or virDomain(Get) prefix and the first letter gets converted to
|
||||
lower case, for example the C functions:</p>
|
||||
<p>
|
||||
<code>int <a href="html/libvirt-libvirt-domain.html#virConnectNumOfDomains">virConnectNumOfDomains</a>
|
||||
<code>int <a href="html/libvirt-libvirt.html#virConnectNumOfDomains">virConnectNumOfDomains</a>
|
||||
(virConnectPtr conn);</code>
|
||||
</p>
|
||||
<p>
|
||||
<code>int <a href="html/libvirt-libvirt-domain.html#virDomainSetMaxMemory">virDomainSetMaxMemory</a>
|
||||
<code>int <a href="html/libvirt-libvirt.html#virDomainSetMaxMemory">virDomainSetMaxMemory</a>
|
||||
(virDomainPtr domain, unsigned long memory);</code>
|
||||
</p>
|
||||
<p>become</p>
|
||||
@@ -31,10 +31,10 @@ in the file libvirtclass.txt present in the python dir or in the docs.There
|
||||
is a couple of function who don't map directly to their C counterparts due to
|
||||
specificities in their argument conversions:</p>
|
||||
<ul>
|
||||
<li><code><a href="html/libvirt-libvirt-domain.html#virConnectListDomains">virConnectListDomains</a></code>
|
||||
<li><code><a href="html/libvirt-libvirt.html#virConnectListDomains">virConnectListDomains</a></code>
|
||||
is replaced by <code>virDomain::listDomainsID(self)</code> which returns
|
||||
a list of the integer ID for the currently running domains</li>
|
||||
<li><code><a href="html/libvirt-libvirt-domain.html#virDomainGetInfo">virDomainGetInfo</a></code>
|
||||
<li><code><a href="html/libvirt-libvirt.html#virDomainGetInfo">virDomainGetInfo</a></code>
|
||||
is replaced by <code>virDomain::info()</code> which returns a list of
|
||||
<ol><li>state: one of the state values (virDomainState)</li><li>maxMemory: the maximum memory used by the domain</li><li>memory: the current amount of memory used by the domain</li><li>nbVirtCPU: the number of virtual CPU</li><li>cpuTime: the time used by the domain in nanoseconds</li></ol></li>
|
||||
</ul>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
## Copyright (C) 2005-2011, 2013-2014 Red Hat, Inc.
|
||||
## Copyright (C) 2005-2011, 2013 Red Hat, Inc.
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU Lesser General Public
|
||||
@@ -19,7 +19,6 @@ schema_DATA = \
|
||||
basictypes.rng \
|
||||
capability.rng \
|
||||
domain.rng \
|
||||
domaincaps.rng \
|
||||
domaincommon.rng \
|
||||
domainsnapshot.rng \
|
||||
interface.rng \
|
||||
@@ -28,7 +27,8 @@ schema_DATA = \
|
||||
nodedev.rng \
|
||||
nwfilter.rng \
|
||||
secret.rng \
|
||||
storagecommon.rng \
|
||||
storageencryption.rng \
|
||||
storagefilefeatures.rng \
|
||||
storagepool.rng \
|
||||
storagevol.rng
|
||||
|
||||
|
@@ -14,12 +14,6 @@
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name='hexuint'>
|
||||
<data type='string'>
|
||||
<param name="pattern">(0x)?[0-9a-f]+</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name="positiveInteger">
|
||||
<data type="positiveInteger">
|
||||
<param name="pattern">[0-9]+</param>
|
||||
@@ -83,7 +77,10 @@
|
||||
</attribute>
|
||||
<optional>
|
||||
<attribute name="multifunction">
|
||||
<ref name="virOnOff"/>
|
||||
<choice>
|
||||
<value>on</value>
|
||||
<value>off</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
</define>
|
||||
@@ -180,7 +177,7 @@
|
||||
<define name="ipv6Addr">
|
||||
<data type="string">
|
||||
<!-- To understand this better, take apart the toplevel "|"s -->
|
||||
<param name="pattern">(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(([0-9A-Fa-f]{1,4}:){0,5}:(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(::([0-9A-Fa-f]{1,4}:){0,5}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:)|(::)</param>
|
||||
<param name="pattern">(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(([0-9A-Fa-f]{1,4}:){0,5}:(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|(::([0-9A-Fa-f]{1,4}:){0,5}(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9])))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:)</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
@@ -234,12 +231,6 @@
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name="dirPath">
|
||||
<data type="string">
|
||||
<param name="pattern">[a-zA-Z0-9_\.\+\-\\&"'<>/%]+</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name="absFilePath">
|
||||
<data type="string">
|
||||
<param name="pattern">/[a-zA-Z0-9_\.\+\-\\&"'<>/%,]+</param>
|
||||
@@ -364,27 +355,9 @@
|
||||
<value>scsi_host</value>
|
||||
</attribute>
|
||||
</optional>
|
||||
<choice>
|
||||
<group>
|
||||
<attribute name='name'>
|
||||
<text/>
|
||||
</attribute>
|
||||
</group>
|
||||
<group>
|
||||
<interleave>
|
||||
<element name="parentaddr">
|
||||
<optional>
|
||||
<attribute name='unique_id'>
|
||||
<ref name='positiveInteger'/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<element name="address">
|
||||
<ref name="pciaddress"/>
|
||||
</element>
|
||||
</element>
|
||||
</interleave>
|
||||
</group>
|
||||
</choice>
|
||||
<attribute name='name'>
|
||||
<text/>
|
||||
</attribute>
|
||||
</group>
|
||||
<group>
|
||||
<attribute name='type'>
|
||||
@@ -395,11 +368,6 @@
|
||||
<text/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name='managed'>
|
||||
<ref name="virYesNo"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<attribute name='wwnn'>
|
||||
<ref name='wwn'/>
|
||||
</attribute>
|
||||
@@ -429,43 +397,4 @@
|
||||
</optional>
|
||||
</define>
|
||||
|
||||
<define name="link-speed-state">
|
||||
<optional>
|
||||
<element name="link">
|
||||
<optional>
|
||||
<attribute name="speed">
|
||||
<ref name="unsignedInt"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="state">
|
||||
<choice>
|
||||
<value>unknown</value>
|
||||
<value>notpresent</value>
|
||||
<value>down</value>
|
||||
<value>lowerlayerdown</value>
|
||||
<value>testing</value>
|
||||
<value>dormant</value>
|
||||
<value>up</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
</define>
|
||||
|
||||
<define name="virYesNo">
|
||||
<choice>
|
||||
<value>yes</value>
|
||||
<value>no</value>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
<define name="virOnOff">
|
||||
<choice>
|
||||
<value>on</value>
|
||||
<value>off</value>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
</grammar>
|
||||
|
@@ -118,9 +118,6 @@
|
||||
<empty/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
<zeroOrMore>
|
||||
<ref name='pagesElem'/>
|
||||
</zeroOrMore>
|
||||
</define>
|
||||
|
||||
<define name='power_management'>
|
||||
@@ -191,25 +188,6 @@
|
||||
<ref name='memory'/>
|
||||
</optional>
|
||||
|
||||
<zeroOrMore>
|
||||
<ref name='pagesElem'/>
|
||||
</zeroOrMore>
|
||||
|
||||
<optional>
|
||||
<element name='distances'>
|
||||
<zeroOrMore>
|
||||
<element name='sibling'>
|
||||
<attribute name='id'>
|
||||
<ref name='unsignedInt'/>
|
||||
</attribute>
|
||||
<attribute name='value'>
|
||||
<ref name='unsignedInt'/>
|
||||
</attribute>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name='cpus'>
|
||||
<attribute name='num'>
|
||||
@@ -405,10 +383,16 @@
|
||||
|
||||
<define name='featuretoggle'>
|
||||
<attribute name='toggle'>
|
||||
<ref name="virYesNo"/>
|
||||
<choice>
|
||||
<value>yes</value>
|
||||
<value>no</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<attribute name='default'>
|
||||
<ref name="virOnOff"/>
|
||||
<choice>
|
||||
<value>on</value>
|
||||
<value>off</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</define>
|
||||
|
||||
@@ -417,18 +401,4 @@
|
||||
<param name='pattern'>[a-zA-Z0-9\-_]+</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name='pagesElem'>
|
||||
<element name='pages'>
|
||||
<optional>
|
||||
<attribute name='unit'>
|
||||
<ref name='unit'/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<attribute name='size'>
|
||||
<ref name='unsignedInt'/>
|
||||
</attribute>
|
||||
<ref name='unsignedInt'/>
|
||||
</element>
|
||||
</define>
|
||||
</grammar>
|
||||
|
@@ -1,21 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
<!-- Grammar for accepting a domain element, both as top level, and
|
||||
also suitable for inclusion in domainsnapshot.rng -->
|
||||
<!-- We handle only document defining a domain -->
|
||||
<start>
|
||||
<ref name="domain"/>
|
||||
</start>
|
||||
|
||||
<include href='domaincommon.rng'/>
|
||||
|
||||
<define name='storageStartupPolicy' combine='choice'>
|
||||
<!-- overrides the no-op version in storagecommon.rng -->
|
||||
<ref name='startupPolicy'/>
|
||||
</define>
|
||||
|
||||
<define name='storageSourceExtra' combine='choice'>
|
||||
<!-- overrides the no-op version in storagecommon.rng -->
|
||||
<ref name='diskspec'/>
|
||||
</define>
|
||||
|
||||
</grammar>
|
||||
|
@@ -1,115 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- A Relax NG schema for the libvirt domain capabilities XML format -->
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
<include href='basictypes.rng'/>
|
||||
<start>
|
||||
<ref name='domainCapabilities'/>
|
||||
</start>
|
||||
|
||||
|
||||
<define name='domainCapabilities'>
|
||||
<element name='domainCapabilities'>
|
||||
<interleave>
|
||||
<element name='path'>
|
||||
<ref name="absFilePath"/>
|
||||
</element>
|
||||
<element name='domain'>
|
||||
<text/>
|
||||
</element>
|
||||
<element name='machine'>
|
||||
<text/>
|
||||
</element>
|
||||
<element name='arch'>
|
||||
<text/>
|
||||
</element>
|
||||
<optional>
|
||||
<ref name='vcpu'/>
|
||||
</optional>
|
||||
<optional>
|
||||
<ref name='os'/>
|
||||
</optional>
|
||||
<optional>
|
||||
<ref name='devices'/>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='vcpu'>
|
||||
<element name='vcpu'>
|
||||
<attribute name='max'>
|
||||
<ref name='unsignedInt'/>
|
||||
</attribute>
|
||||
<empty/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='loader'>
|
||||
<element name='loader'>
|
||||
<ref name='supported'/>
|
||||
<optional>
|
||||
<ref name='value'/>
|
||||
</optional>
|
||||
<ref name='enum'/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='os'>
|
||||
<element name='os'>
|
||||
<interleave>
|
||||
<ref name='supported'/>
|
||||
<optional>
|
||||
<ref name='loader'/>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='devices'>
|
||||
<element name='devices'>
|
||||
<interleave>
|
||||
<ref name='disk'/>
|
||||
<ref name='hostdev'/>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='disk'>
|
||||
<element name='disk'>
|
||||
<ref name='supported'/>
|
||||
<ref name='enum'/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='hostdev'>
|
||||
<element name='hostdev'>
|
||||
<ref name='supported'/>
|
||||
<ref name='enum'/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='value'>
|
||||
<zeroOrMore>
|
||||
<element name='value'>
|
||||
<text/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
</define>
|
||||
|
||||
<define name='supported'>
|
||||
<attribute name='supported'>
|
||||
<ref name="virYesNo"/>
|
||||
</attribute>
|
||||
</define>
|
||||
|
||||
<define name='enum'>
|
||||
<zeroOrMore>
|
||||
<element name='enum'>
|
||||
<attribute name='name'>
|
||||
<text/>
|
||||
</attribute>
|
||||
<ref name='value'/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
</define>
|
||||
</grammar>
|
File diff suppressed because it is too large
Load Diff
@@ -75,12 +75,7 @@
|
||||
<ref name="UUID"/>
|
||||
</element>
|
||||
</element>
|
||||
<!-- Nested grammar ensures that any of our overrides of
|
||||
storagecommon/domaincommon defines do not conflict
|
||||
with any domain.rng overrides. -->
|
||||
<grammar>
|
||||
<include href='domain.rng'/>
|
||||
</grammar>
|
||||
<ref name='domain'/>
|
||||
</choice>
|
||||
</optional>
|
||||
<optional>
|
||||
@@ -107,11 +102,6 @@
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
<define name='storageSourceExtra' combine='choice'>
|
||||
<!-- overrides the no-op version in storagecommon.rng -->
|
||||
<ref name='disksnapshotdriver'/>
|
||||
</define>
|
||||
|
||||
<define name='disksnapshot'>
|
||||
<element name='disk'>
|
||||
<attribute name='name'>
|
||||
@@ -148,13 +138,10 @@
|
||||
<ref name='absFilePath'/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<ref name='storageStartupPolicy'/>
|
||||
</optional>
|
||||
<empty/>
|
||||
</element>
|
||||
</optional>
|
||||
<ref name='storageSourceExtra'/>
|
||||
<ref name='disksnapshotdriver'/>
|
||||
</interleave>
|
||||
</group>
|
||||
<group>
|
||||
@@ -170,10 +157,22 @@
|
||||
<empty/>
|
||||
</element>
|
||||
</optional>
|
||||
<ref name='storageSourceExtra'/>
|
||||
<ref name='disksnapshotdriver'/>
|
||||
</interleave>
|
||||
</group>
|
||||
<group>
|
||||
<attribute name="type">
|
||||
<value>network</value>
|
||||
</attribute>
|
||||
<interleave>
|
||||
<optional>
|
||||
<element name="source">
|
||||
<ref name='diskSourceNetwork'/>
|
||||
</element>
|
||||
</optional>
|
||||
<ref name='disksnapshotdriver'/>
|
||||
</interleave>
|
||||
</group>
|
||||
<ref name='diskSourceNetwork'/>
|
||||
</choice>
|
||||
</group>
|
||||
</choice>
|
||||
@@ -185,7 +184,7 @@
|
||||
<element name='driver'>
|
||||
<optional>
|
||||
<attribute name='type'>
|
||||
<ref name='storageFormatBacking'/>
|
||||
<ref name='storageFormat'/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<empty/>
|
||||
|
@@ -29,41 +29,34 @@
|
||||
Ethernet adapter
|
||||
-->
|
||||
<define name="basic-ethernet-content">
|
||||
<interleave>
|
||||
<attribute name="type">
|
||||
<value>ethernet</value>
|
||||
</attribute>
|
||||
<ref name="name-attr"/>
|
||||
<!-- If no MAC is given when the interface is defined, it is determined
|
||||
by using the device name.
|
||||
FIXME: What if device name and MAC don't specify the same NIC ? -->
|
||||
<optional>
|
||||
<element name="mac">
|
||||
<attribute name="address"><ref name="macAddr"/></attribute>
|
||||
</element>
|
||||
</optional>
|
||||
<ref name="link-speed-state"/>
|
||||
<!-- FIXME: Allow (some) ethtool options -->
|
||||
</interleave>
|
||||
<attribute name="type">
|
||||
<value>ethernet</value>
|
||||
</attribute>
|
||||
<ref name="name-attr"/>
|
||||
<!-- If no MAC is given when the interface is defined, it is determined
|
||||
by using the device name.
|
||||
FIXME: What if device name and MAC don't specify the same NIC ? -->
|
||||
<optional>
|
||||
<element name="mac">
|
||||
<attribute name="address"><ref name="macAddr"/></attribute>
|
||||
</element>
|
||||
</optional>
|
||||
<!-- FIXME: Allow (some) ethtool options -->
|
||||
</define>
|
||||
|
||||
<!-- Ethernet adapter without IP addressing, e.g. for a bridge -->
|
||||
<define name="bare-ethernet-interface">
|
||||
<element name="interface">
|
||||
<interleave>
|
||||
<ref name="basic-ethernet-content"/>
|
||||
</interleave>
|
||||
<ref name="basic-ethernet-content"/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="ethernet-interface">
|
||||
<element name="interface">
|
||||
<interleave>
|
||||
<ref name="startmode"/>
|
||||
<ref name="basic-ethernet-content"/>
|
||||
<ref name="mtu"/>
|
||||
<ref name="interface-addressing"/>
|
||||
</interleave>
|
||||
<ref name="startmode"/>
|
||||
<ref name="basic-ethernet-content"/>
|
||||
<ref name="mtu"/>
|
||||
<ref name="interface-addressing"/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
@@ -78,7 +71,6 @@
|
||||
of the form DEVICE.VLAN
|
||||
-->
|
||||
<optional><ref name="name-attr"/></optional>
|
||||
<ref name="link-speed-state"/>
|
||||
</define>
|
||||
|
||||
<define name="vlan-device">
|
||||
@@ -92,22 +84,18 @@
|
||||
|
||||
<define name="bare-vlan-interface">
|
||||
<element name="interface">
|
||||
<interleave>
|
||||
<ref name="vlan-interface-common"/>
|
||||
<ref name="vlan-device"/>
|
||||
</interleave>
|
||||
<ref name="vlan-interface-common"/>
|
||||
<ref name="vlan-device"/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="vlan-interface">
|
||||
<element name="interface">
|
||||
<interleave>
|
||||
<ref name="vlan-interface-common"/>
|
||||
<ref name="startmode"/>
|
||||
<ref name="mtu"/>
|
||||
<ref name="interface-addressing"/>
|
||||
<ref name="vlan-device"/>
|
||||
</interleave>
|
||||
<ref name="vlan-interface-common"/>
|
||||
<ref name="startmode"/>
|
||||
<ref name="mtu"/>
|
||||
<ref name="interface-addressing"/>
|
||||
<ref name="vlan-device"/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
@@ -116,33 +104,31 @@
|
||||
-->
|
||||
<define name="bridge-interface">
|
||||
<element name="interface">
|
||||
<interleave>
|
||||
<attribute name="type">
|
||||
<value>bridge</value>
|
||||
</attribute>
|
||||
<ref name="name-attr"/>
|
||||
<ref name="startmode"/>
|
||||
<ref name="mtu"/>
|
||||
<ref name="interface-addressing"/>
|
||||
<element name="bridge">
|
||||
<optional>
|
||||
<attribute name="stp">
|
||||
<ref name="virOnOff"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<!-- Bridge forward delay (see 'brctl setfd') -->
|
||||
<optional v:since="2">
|
||||
<attribute name="delay"><ref name="timeval"/></attribute>
|
||||
</optional>
|
||||
<zeroOrMore>
|
||||
<choice>
|
||||
<ref name="bare-ethernet-interface"/>
|
||||
<ref name="bare-vlan-interface"/>
|
||||
<ref v:since="2" name="bare-bond-interface"/>
|
||||
</choice>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</interleave>
|
||||
<attribute name="type">
|
||||
<value>bridge</value>
|
||||
</attribute>
|
||||
<ref name="name-attr"/>
|
||||
<ref name="startmode"/>
|
||||
<ref name="mtu"/>
|
||||
<ref name="interface-addressing"/>
|
||||
<element name="bridge">
|
||||
<optional>
|
||||
<attribute name="stp">
|
||||
<ref name="on-or-off"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<!-- Bridge forward delay (see 'brctl setfd') -->
|
||||
<optional v:since="2">
|
||||
<attribute name="delay"><ref name="timeval"/></attribute>
|
||||
</optional>
|
||||
<zeroOrMore>
|
||||
<choice>
|
||||
<ref name="bare-ethernet-interface"/>
|
||||
<ref name="bare-vlan-interface"/>
|
||||
<ref v:since="2" name="bare-bond-interface"/>
|
||||
</choice>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</element>
|
||||
</define>
|
||||
<!-- Jim Fehlig would like support for other bridge attributes, in
|
||||
@@ -157,7 +143,6 @@
|
||||
<value>bond</value>
|
||||
</attribute>
|
||||
<ref name="name-attr"/>
|
||||
<ref name="link-speed-state"/>
|
||||
</define>
|
||||
|
||||
<define name="bond-element">
|
||||
@@ -194,73 +179,67 @@
|
||||
xmit_hash_policy (since 2.6.3/3.2.2)
|
||||
-->
|
||||
|
||||
<interleave>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="miimon">
|
||||
<!-- miimon frequency in ms -->
|
||||
<attribute name="freq"><ref name="unsignedInt"/></attribute>
|
||||
<optional>
|
||||
<attribute name="downdelay"><ref name="unsignedInt"/></attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="updelay"><ref name="unsignedInt"/></attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<!-- use_carrier -->
|
||||
<attribute name="carrier">
|
||||
<choice>
|
||||
<!-- use MII/ETHTOOL ioctl -->
|
||||
<value>ioctl</value>
|
||||
<!-- use netif_carrier_ok() -->
|
||||
<value>netif</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
<element name="arpmon">
|
||||
<attribute name="interval"><ref name="unsignedInt"/></attribute>
|
||||
<attribute name="target"><ref name="ipv4Addr"/></attribute>
|
||||
<optional>
|
||||
<attribute name="validate">
|
||||
<choice>
|
||||
<value>none</value>
|
||||
<value>active</value>
|
||||
<value>backup</value>
|
||||
<value>all</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</choice>
|
||||
</optional>
|
||||
<optional>
|
||||
<choice>
|
||||
<element name="miimon">
|
||||
<!-- miimon frequency in ms -->
|
||||
<attribute name="freq"><ref name="unsignedInt"/></attribute>
|
||||
<optional>
|
||||
<attribute name="downdelay"><ref name="unsignedInt"/></attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="updelay"><ref name="unsignedInt"/></attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<!-- use_carrier -->
|
||||
<attribute name="carrier">
|
||||
<choice>
|
||||
<!-- use MII/ETHTOOL ioctl -->
|
||||
<value>ioctl</value>
|
||||
<!-- use netif_carrier_ok() -->
|
||||
<value>netif</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
<element name="arpmon">
|
||||
<attribute name="interval"><ref name="unsignedInt"/></attribute>
|
||||
<attribute name="target"><ref name="ipv4Addr"/></attribute>
|
||||
<optional>
|
||||
<attribute name="validate">
|
||||
<choice>
|
||||
<value>none</value>
|
||||
<value>active</value>
|
||||
<value>backup</value>
|
||||
<value>all</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</choice>
|
||||
</optional>
|
||||
|
||||
<oneOrMore>
|
||||
<!-- The slave interfaces -->
|
||||
<ref name="bare-ethernet-interface"/>
|
||||
</oneOrMore>
|
||||
</interleave>
|
||||
<oneOrMore>
|
||||
<!-- The slave interfaces -->
|
||||
<ref name="bare-ethernet-interface"/>
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="bare-bond-interface">
|
||||
<element name="interface">
|
||||
<interleave>
|
||||
<ref name="bond-interface-common"/>
|
||||
<ref name="bond-element"/>
|
||||
</interleave>
|
||||
<ref name="bond-interface-common"/>
|
||||
<ref name="bond-element"/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="bond-interface">
|
||||
<element name="interface">
|
||||
<interleave>
|
||||
<ref name="bond-interface-common"/>
|
||||
<ref name="startmode"/>
|
||||
<ref name="mtu"/>
|
||||
<ref name="interface-addressing"/>
|
||||
<ref name="bond-element"/>
|
||||
</interleave>
|
||||
<ref name="bond-interface-common"/>
|
||||
<ref name="startmode"/>
|
||||
<ref name="mtu"/>
|
||||
<ref name="interface-addressing"/>
|
||||
<ref name="bond-element"/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
@@ -322,24 +301,22 @@
|
||||
<attribute name="family">
|
||||
<value>ipv4</value>
|
||||
</attribute>
|
||||
<interleave>
|
||||
<choice>
|
||||
<ref name="dhcp-element"/>
|
||||
<group>
|
||||
<element name="ip">
|
||||
<attribute name="address"><ref name="ipv4Addr"/></attribute>
|
||||
<optional>
|
||||
<attribute name="prefix"><ref name="ipv4Prefix"/></attribute>
|
||||
</optional>
|
||||
</element>
|
||||
<choice>
|
||||
<ref name="dhcp-element"/>
|
||||
<group>
|
||||
<element name="ip">
|
||||
<attribute name="address"><ref name="ipv4Addr"/></attribute>
|
||||
<optional>
|
||||
<element name="route">
|
||||
<attribute name="gateway"><ref name="ipv4Addr"/></attribute>
|
||||
</element>
|
||||
<attribute name="prefix"><ref name="ipv4Prefix"/></attribute>
|
||||
</optional>
|
||||
</group>
|
||||
</choice>
|
||||
</interleave>
|
||||
</element>
|
||||
<optional>
|
||||
<element name="route">
|
||||
<attribute name="gateway"><ref name="ipv4Addr"/></attribute>
|
||||
</element>
|
||||
</optional>
|
||||
</group>
|
||||
</choice>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
@@ -348,27 +325,25 @@
|
||||
<attribute name="family">
|
||||
<value>ipv6</value>
|
||||
</attribute>
|
||||
<interleave>
|
||||
<optional>
|
||||
<element name="autoconf"><empty/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<ref name="dhcp-element"/>
|
||||
</optional>
|
||||
<zeroOrMore>
|
||||
<element name="ip">
|
||||
<attribute name="address"><ref name="ipv6Addr"/></attribute>
|
||||
<optional>
|
||||
<attribute name="prefix"><ref name="ipv6Prefix"/></attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
<optional>
|
||||
<element name="route">
|
||||
<attribute name="gateway"><ref name="ipv6Addr"/></attribute>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
<optional>
|
||||
<element name="autoconf"><empty/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<ref name="dhcp-element"/>
|
||||
</optional>
|
||||
<zeroOrMore>
|
||||
<element name="ip">
|
||||
<attribute name="address"><ref name="ipv6Addr"/></attribute>
|
||||
<optional>
|
||||
<attribute name="prefix"><ref name="ipv6Prefix"/></attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
<optional>
|
||||
<element name="route">
|
||||
<attribute name="gateway"><ref name="ipv6Addr"/></attribute>
|
||||
</element>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
@@ -376,7 +351,7 @@
|
||||
<element name="dhcp">
|
||||
<optional>
|
||||
<attribute name="peerdns">
|
||||
<ref name="virYesNo"/>
|
||||
<ref name="yes-or-no"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
@@ -415,6 +390,21 @@
|
||||
instead of destination and nexthop instead of gateway.
|
||||
-->
|
||||
|
||||
<!-- Auxiliary definitions -->
|
||||
<define name="on-or-off">
|
||||
<choice>
|
||||
<value>on</value>
|
||||
<value>off</value>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
<define name="yes-or-no">
|
||||
<choice>
|
||||
<value>yes</value>
|
||||
<value>no</value>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
<!-- Type library -->
|
||||
|
||||
<define name="timeval">
|
||||
@@ -425,7 +415,7 @@
|
||||
|
||||
<define name='vlan-id'>
|
||||
<data type="unsignedInt">
|
||||
<param name="maxInclusive">4095</param>
|
||||
<param name="maxInclusive">4096</param>
|
||||
</data>
|
||||
</define>
|
||||
</grammar>
|
||||
|
@@ -21,14 +21,12 @@
|
||||
with no gateways addresses specified -->
|
||||
<optional>
|
||||
<attribute name="ipv6">
|
||||
<ref name="virYesNo"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="trustGuestRxFilters">
|
||||
<ref name="virYesNo"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<choice>
|
||||
<value>yes</value>
|
||||
<value>no</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
<interleave>
|
||||
|
||||
<!-- The name of the network, used to refer to it through the API
|
||||
@@ -55,22 +53,16 @@
|
||||
|
||||
<optional>
|
||||
<attribute name="stp">
|
||||
<ref name="virOnOff"/>
|
||||
<choice>
|
||||
<value>on</value>
|
||||
<value>off</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="delay">
|
||||
<data type="unsignedLong"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="macTableManager">
|
||||
<choice>
|
||||
<value>kernel</value>
|
||||
<value>libvirt</value>
|
||||
</choice>
|
||||
<data type="integer"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
@@ -112,7 +104,10 @@
|
||||
|
||||
<optional>
|
||||
<attribute name="managed">
|
||||
<ref name="virYesNo"/>
|
||||
<choice>
|
||||
<value>yes</value>
|
||||
<value>no</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
<interleave>
|
||||
@@ -208,12 +203,10 @@
|
||||
</attribute>
|
||||
<optional>
|
||||
<attribute name="default">
|
||||
<ref name="virYesNo"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="trustGuestRxFilters">
|
||||
<ref name="virYesNo"/>
|
||||
<choice>
|
||||
<value>yes</value>
|
||||
<value>no</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
<interleave>
|
||||
@@ -234,9 +227,6 @@
|
||||
<optional>
|
||||
<element name="domain">
|
||||
<attribute name="name"><ref name="dnsName"/></attribute>
|
||||
<optional>
|
||||
<attribute name="localOnly"><ref name="virYesNo"/></attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
@@ -246,7 +236,10 @@
|
||||
<element name="dns">
|
||||
<optional>
|
||||
<attribute name="forwardPlainNames">
|
||||
<ref name="virYesNo"/>
|
||||
<choice>
|
||||
<value>yes</value>
|
||||
<value>no</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
<interleave>
|
||||
@@ -374,7 +367,25 @@
|
||||
</zeroOrMore>
|
||||
<!-- <route> element -->
|
||||
<zeroOrMore>
|
||||
<ref name="route"/>
|
||||
<!-- The (static) route element specifies a network address and gateway
|
||||
address to access that network. Both the network address and
|
||||
the gateway address must be specified. -->
|
||||
<element name="route">
|
||||
<optional>
|
||||
<attribute name="family"><ref name="addr-family"/></attribute>
|
||||
</optional>
|
||||
<attribute name="address"><ref name="ipAddr"/></attribute>
|
||||
<optional>
|
||||
<choice>
|
||||
<attribute name="netmask"><ref name="ipv4Addr"/></attribute>
|
||||
<attribute name="prefix"><ref name="ipPrefix"/></attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
<attribute name="gateway"><ref name="ipAddr"/></attribute>
|
||||
<optional>
|
||||
<attribute name="metric"><ref name="unsignedInt"/></attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
</interleave>
|
||||
</element>
|
||||
|
@@ -224,26 +224,4 @@
|
||||
<param name='maxInclusive'>65535</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<!-- The (static) route element specifies a network address and gateway
|
||||
address to access that network. Both the network address and
|
||||
the gateway address must be specified. -->
|
||||
<define name='route'>
|
||||
<element name="route">
|
||||
<optional>
|
||||
<attribute name="family"><ref name="addr-family"/></attribute>
|
||||
</optional>
|
||||
<attribute name="address"><ref name="ipAddr"/></attribute>
|
||||
<optional>
|
||||
<choice>
|
||||
<attribute name="netmask"><ref name="ipv4Addr"/></attribute>
|
||||
<attribute name="prefix"><ref name="ipPrefix"/></attribute>
|
||||
</choice>
|
||||
</optional>
|
||||
<attribute name="gateway"><ref name="ipAddr"/></attribute>
|
||||
<optional>
|
||||
<attribute name="metric"><ref name="unsignedInt"/></attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
</grammar>
|
||||
|
@@ -158,45 +158,6 @@
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name='numa'>
|
||||
<optional>
|
||||
<attribute name='node'>
|
||||
<data type='int'/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name='pci-express'>
|
||||
<zeroOrMore>
|
||||
<element name='link'>
|
||||
<attribute name='validity'>
|
||||
<choice>
|
||||
<value>cap</value>
|
||||
<value>sta</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<optional>
|
||||
<attribute name='port'>
|
||||
<ref name='unsignedInt'/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name='speed'>
|
||||
<data type="string">
|
||||
<param name="pattern">[0-9]+(.[0-9]+)?</param>
|
||||
</data>
|
||||
</attribute>
|
||||
</optional>
|
||||
<attribute name='width'>
|
||||
<ref name='unsignedInt'/>
|
||||
</attribute>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
</define>
|
||||
|
||||
<define name='capusbdev'>
|
||||
@@ -272,7 +233,6 @@
|
||||
<ref name='mac'/>
|
||||
</element>
|
||||
</optional>
|
||||
<ref name="link-speed-state"/>
|
||||
|
||||
<zeroOrMore>
|
||||
<ref name='subcapnet'/>
|
||||
@@ -339,12 +299,6 @@
|
||||
<ref name='unsignedLong'/>
|
||||
</element>
|
||||
|
||||
<optional>
|
||||
<element name='unique_id'>
|
||||
<ref name='positiveInteger'/>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<zeroOrMore>
|
||||
<element name='capability'>
|
||||
@@ -467,6 +421,12 @@
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='hexuint'>
|
||||
<data type='string'>
|
||||
<param name="pattern">(0x)?[0-9a-f]+</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<define name='mac'>
|
||||
<data type='string'>
|
||||
<param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param>
|
||||
|
@@ -90,7 +90,6 @@
|
||||
<ref name="common-ipv6-attributes-p1"/>
|
||||
<ref name="common-port-attributes"/>
|
||||
<ref name="ip-attributes"/>
|
||||
<ref name="icmp-attribute-ranges"/>
|
||||
<ref name="comment-attribute"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
@@ -378,7 +377,10 @@
|
||||
<interleave>
|
||||
<optional>
|
||||
<attribute name="match">
|
||||
<ref name="virYesNo"/>
|
||||
<choice>
|
||||
<value>yes</value>
|
||||
<value>no</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
</interleave>
|
||||
@@ -589,31 +591,6 @@
|
||||
</interleave>
|
||||
</define>
|
||||
|
||||
<define name="icmp-attribute-ranges">
|
||||
<interleave>
|
||||
<optional>
|
||||
<attribute name="type">
|
||||
<ref name="uint8range"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="typeend">
|
||||
<ref name="uint8range"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="code">
|
||||
<ref name="uint8range"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="codeend">
|
||||
<ref name="uint8range"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</interleave>
|
||||
</define>
|
||||
|
||||
<define name="mac-attributes">
|
||||
<interleave>
|
||||
<optional>
|
||||
|
@@ -11,12 +11,18 @@
|
||||
<element name='secret'>
|
||||
<optional>
|
||||
<attribute name='ephemeral'>
|
||||
<ref name="virYesNo"/>
|
||||
<choice>
|
||||
<value>yes</value>
|
||||
<value>no</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name='private'>
|
||||
<ref name="virYesNo"/>
|
||||
<choice>
|
||||
<value>yes</value>
|
||||
<value>no</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
<interleave>
|
||||
|
@@ -1,126 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- A Relax NG schema for common libvirt XML storage elements -->
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
|
||||
<!-- This schema is not designed for standalone use; another file
|
||||
must include both this file and basictypes.rng -->
|
||||
|
||||
<define name='encryption'>
|
||||
<element name='encryption'>
|
||||
<attribute name='format'>
|
||||
<choice>
|
||||
<value>default</value>
|
||||
<value>qcow</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<zeroOrMore>
|
||||
<ref name='secret'/>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='secret'>
|
||||
<element name='secret'>
|
||||
<attribute name='type'>
|
||||
<choice>
|
||||
<value>passphrase</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<attribute name='uuid'>
|
||||
<ref name="UUID"/>
|
||||
</attribute>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='compat'>
|
||||
<element name='compat'>
|
||||
<data type='string'>
|
||||
<param name='pattern'>[0-9]+\.[0-9]+</param>
|
||||
</data>
|
||||
</element>
|
||||
</define>
|
||||
<define name='fileFormatFeatures'>
|
||||
<element name='features'>
|
||||
<interleave>
|
||||
<optional>
|
||||
<element name='lazy_refcounts'>
|
||||
<empty/>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<!-- split the list of known storage formats into two, those where
|
||||
we know how to follow backing chains, and all others -->
|
||||
<define name='storageFormatBacking'>
|
||||
<choice>
|
||||
<value>cow</value>
|
||||
<value>qcow</value>
|
||||
<value>qcow2</value>
|
||||
<value>qed</value>
|
||||
<value>vmdk</value>
|
||||
</choice>
|
||||
</define>
|
||||
<define name='storageFormat'>
|
||||
<choice>
|
||||
<value>raw</value>
|
||||
<value>dir</value>
|
||||
<value>bochs</value>
|
||||
<value>cloop</value>
|
||||
<value>dmg</value>
|
||||
<value>iso</value>
|
||||
<value>vpc</value>
|
||||
<value>vdi</value>
|
||||
<value>fat</value>
|
||||
<value>vhd</value>
|
||||
<value>ploop</value>
|
||||
<ref name='storageFormatBacking'/>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
<define name='storageStartupPolicy'>
|
||||
<!-- Use a combine='choice' override in client files that want to
|
||||
add additional attributes to a <source> sub-element
|
||||
associated with a storage source -->
|
||||
<notAllowed/>
|
||||
</define>
|
||||
|
||||
<define name='storageSourceExtra'>
|
||||
<!-- Use a combine='choice' override in client files that want to
|
||||
add additional elements as siblings of a <source> sub-element
|
||||
associated with a storage source -->
|
||||
<notAllowed/>
|
||||
</define>
|
||||
|
||||
<define name='permissions'>
|
||||
<optional>
|
||||
<element name='permissions'>
|
||||
<interleave>
|
||||
<element name='mode'>
|
||||
<ref name='octalMode'/>
|
||||
</element>
|
||||
<element name='owner'>
|
||||
<choice>
|
||||
<ref name='unsignedInt'/>
|
||||
<value>-1</value>
|
||||
</choice>
|
||||
</element>
|
||||
<element name='group'>
|
||||
<choice>
|
||||
<ref name='unsignedInt'/>
|
||||
<value>-1</value>
|
||||
</choice>
|
||||
</element>
|
||||
<optional>
|
||||
<element name='label'>
|
||||
<text/>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
</define>
|
||||
|
||||
</grammar>
|
33
docs/schemas/storageencryption.rng
Normal file
33
docs/schemas/storageencryption.rng
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- A Relax NG schema for the libvirt volume encryption XML format -->
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
|
||||
<define name='encryption'>
|
||||
<element name='encryption'>
|
||||
<attribute name='format'>
|
||||
<choice>
|
||||
<value>default</value>
|
||||
<value>qcow</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<zeroOrMore>
|
||||
<ref name='secret'/>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='secret'>
|
||||
<element name='secret'>
|
||||
<attribute name='type'>
|
||||
<choice>
|
||||
<value>passphrase</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<attribute name='uuid'>
|
||||
<ref name="UUID"/>
|
||||
</attribute>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
</grammar>
|
24
docs/schemas/storagefilefeatures.rng
Normal file
24
docs/schemas/storagefilefeatures.rng
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- A Relax NG schema for the libvirt volume features XML format -->
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
|
||||
<define name='compat'>
|
||||
<element name='compat'>
|
||||
<data type='string'>
|
||||
<param name='pattern'>[0-9]+\.[0-9]+</param>
|
||||
</data>
|
||||
</element>
|
||||
</define>
|
||||
<define name='fileFormatFeatures'>
|
||||
<element name='features'>
|
||||
<interleave>
|
||||
<optional>
|
||||
<element name='lazy_refcounts'>
|
||||
<empty/>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
</grammar>
|
@@ -3,7 +3,6 @@
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
<include href='basictypes.rng'/>
|
||||
<include href='storagecommon.rng'/>
|
||||
<start>
|
||||
<ref name='pool'/>
|
||||
</start>
|
||||
@@ -23,7 +22,6 @@
|
||||
<ref name='poolrbd'/>
|
||||
<ref name='poolsheepdog'/>
|
||||
<ref name='poolgluster'/>
|
||||
<ref name='poolzfs'/>
|
||||
</choice>
|
||||
</element>
|
||||
</define>
|
||||
@@ -159,20 +157,6 @@
|
||||
</interleave>
|
||||
</define>
|
||||
|
||||
<define name='poolzfs'>
|
||||
<attribute name='type'>
|
||||
<value>zfs</value>
|
||||
</attribute>
|
||||
<interleave>
|
||||
<ref name='commonmetadata'/>
|
||||
<ref name='sizing'/>
|
||||
<ref name='sourcezfs'/>
|
||||
<optional>
|
||||
<ref name='target'/>
|
||||
</optional>
|
||||
</interleave>
|
||||
</define>
|
||||
|
||||
<define name='sourceinfovendor'>
|
||||
<interleave>
|
||||
<optional>
|
||||
@@ -225,6 +209,35 @@
|
||||
</interleave>
|
||||
</define>
|
||||
|
||||
<define name='permissions'>
|
||||
<optional>
|
||||
<element name='permissions'>
|
||||
<interleave>
|
||||
<element name='mode'>
|
||||
<ref name='octalMode'/>
|
||||
</element>
|
||||
<element name='owner'>
|
||||
<choice>
|
||||
<ref name='unsignedInt'/>
|
||||
<value>-1</value>
|
||||
</choice>
|
||||
</element>
|
||||
<element name='group'>
|
||||
<choice>
|
||||
<ref name='unsignedInt'/>
|
||||
<value>-1</value>
|
||||
</choice>
|
||||
</element>
|
||||
<optional>
|
||||
<element name='label'>
|
||||
<text/>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
</define>
|
||||
|
||||
<define name='target'>
|
||||
<element name='target'>
|
||||
<interleave>
|
||||
@@ -314,15 +327,6 @@
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='sourceinfonetfsgluster'>
|
||||
<element name='dir'>
|
||||
<attribute name='path'>
|
||||
<ref name='dirPath'/>
|
||||
</attribute>
|
||||
<empty/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='sourceinfoname'>
|
||||
<element name='name'>
|
||||
<text/>
|
||||
@@ -357,17 +361,6 @@
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='sourcezfs'>
|
||||
<element name='source'>
|
||||
<interleave>
|
||||
<ref name='sourceinfoname'/>
|
||||
<optional>
|
||||
<ref name='sourceinfodev'/>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='sourcefmtfs'>
|
||||
<optional>
|
||||
<element name='format'>
|
||||
@@ -401,6 +394,7 @@
|
||||
<value>auto</value>
|
||||
<value>nfs</value>
|
||||
<value>cifs</value>
|
||||
<value>glusterfs</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</element>
|
||||
@@ -437,7 +431,7 @@
|
||||
<element name='format'>
|
||||
<attribute name='type'>
|
||||
<choice>
|
||||
<value>unknown</value> <!-- back-compat requires keeping 'unknown' not 'auto' -->
|
||||
<value>auto</value>
|
||||
<value>lvm2</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
@@ -474,32 +468,14 @@
|
||||
|
||||
<define name='sourcenetfs'>
|
||||
<element name='source'>
|
||||
<choice>
|
||||
<group>
|
||||
<interleave>
|
||||
<ref name='sourceinfohost'/>
|
||||
<ref name='sourceinfodir'/>
|
||||
<ref name='sourcefmtnetfs'/>
|
||||
<optional>
|
||||
<ref name='sourceinfovendor'/>
|
||||
</optional>
|
||||
</interleave>
|
||||
</group>
|
||||
<group>
|
||||
<interleave>
|
||||
<ref name='sourceinfohost'/>
|
||||
<ref name='sourceinfonetfsgluster'/>
|
||||
<element name='format'>
|
||||
<attribute name='type'>
|
||||
<value>glusterfs</value>
|
||||
</attribute>
|
||||
</element>
|
||||
<optional>
|
||||
<ref name='sourceinfovendor'/>
|
||||
</optional>
|
||||
</interleave>
|
||||
</group>
|
||||
</choice>
|
||||
<interleave>
|
||||
<ref name='sourceinfohost'/>
|
||||
<ref name='sourceinfodir'/>
|
||||
<ref name='sourcefmtnetfs'/>
|
||||
<optional>
|
||||
<ref name='sourceinfovendor'/>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
|
@@ -7,7 +7,8 @@
|
||||
<ref name='vol'/>
|
||||
</start>
|
||||
|
||||
<include href='storagecommon.rng'/>
|
||||
<include href='storageencryption.rng'/>
|
||||
<include href='storagefilefeatures.rng'/>
|
||||
|
||||
|
||||
<define name='vol'>
|
||||
@@ -59,6 +60,29 @@
|
||||
</interleave>
|
||||
</define>
|
||||
|
||||
<define name='permissions'>
|
||||
<optional>
|
||||
<element name='permissions'>
|
||||
<interleave>
|
||||
<element name='mode'>
|
||||
<ref name='octalMode'/>
|
||||
</element>
|
||||
<element name='owner'>
|
||||
<ref name='unsignedInt'/>
|
||||
</element>
|
||||
<element name='group'>
|
||||
<ref name='unsignedInt'/>
|
||||
</element>
|
||||
<optional>
|
||||
<element name='label'>
|
||||
<text/>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
</define>
|
||||
|
||||
<define name='timestamps'>
|
||||
<optional>
|
||||
<element name='timestamps'>
|
||||
@@ -114,11 +138,6 @@
|
||||
<optional>
|
||||
<ref name='compat'/>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name='nocow'>
|
||||
<empty/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<ref name='fileFormatFeatures'/>
|
||||
</optional>
|
||||
@@ -194,7 +213,18 @@
|
||||
<define name='formatfile'>
|
||||
<choice>
|
||||
<value>unknown</value>
|
||||
<ref name='storageFormat'/>
|
||||
<value>raw</value>
|
||||
<value>dir</value>
|
||||
<value>bochs</value>
|
||||
<value>cloop</value>
|
||||
<value>cow</value>
|
||||
<value>dmg</value>
|
||||
<value>iso</value>
|
||||
<value>qcow</value>
|
||||
<value>qcow2</value>
|
||||
<value>qed</value>
|
||||
<value>vmdk</value>
|
||||
<value>vpc</value>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
|
@@ -101,16 +101,6 @@
|
||||
<li>
|
||||
<a href="locking.html">Disk locking</a>
|
||||
<span>Ensuring exclusive guest access to disks</span>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="locking-lockd.html">virtlockd</a>
|
||||
<span>virtlockd lock manager plugin</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="locking-sanlock.html">Sanlock</a>
|
||||
<span>Sanlock lock manager plugin</span>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="cgroups.html">CGroups</a>
|
||||
@@ -184,10 +174,6 @@
|
||||
<a href="formatcaps.html">Capabilities</a>
|
||||
<span>The driver capabilities XML format</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="formatdomaincaps.html">Domain capabilities</a>
|
||||
<span>The domain capabilities XML format</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="formatnode.html">Node Devices</a>
|
||||
<span>The host device XML format</span>
|
||||
@@ -301,52 +287,12 @@
|
||||
-->
|
||||
<ul>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain.html">Domain</a>
|
||||
<span>domain APIs for the libvirt library</span>
|
||||
<a href="html/libvirt-libvirt.html">libvirt</a>
|
||||
<span>core interfaces for the libvirt library</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-domain-snapshot.html">Domain snapshot</a>
|
||||
<span>domain snapshot APIs for the libvirt library</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-virterror.html">Error</a>
|
||||
<span>error handling APIs for the libvirt library</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-event.html">Event</a>
|
||||
<span>event APIs for the libvirt library</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-host.html">Host</a>
|
||||
<span>host APIs for the libvirt library</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-interface.html">Interface</a>
|
||||
<span>interface APIs for the libvirt library</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-network.html">Network</a>
|
||||
<span>network APIs for the libvirt library</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-nodedev.html">Node device</a>
|
||||
<span>node device APIs for the libvirt library</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-nwfilter.html">Network filter</a>
|
||||
<span>network filter APIs for the libvirt library</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-secret.html">Secret</a>
|
||||
<span>secret APIs for the libvirt library</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-storage.html">Storage</a>
|
||||
<span>storage APIs for the libvirt library</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="html/libvirt-libvirt-stream.html">Stream</a>
|
||||
<span>stream APIs for the libvirt library</span>
|
||||
<a href="html/libvirt-virterror.html">virterror</a>
|
||||
<span>error handling interfaces for the libvirt library</span>
|
||||
</li>
|
||||
<li>
|
||||
<a href="hvsupport.html">Driver support</a>
|
||||
|
@@ -117,9 +117,6 @@
|
||||
<li>
|
||||
<a href="#StorageBackendGluster">Gluster backend</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#StorageBackendZFS">ZFS backend</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2><a name="StorageBackendDir">Directory pool</a></h2>
|
||||
@@ -328,10 +325,14 @@
|
||||
|
||||
<h3>Valid pool format types</h3>
|
||||
<p>
|
||||
The logical volume pool supports only the <code>lvm2</code> format,
|
||||
although not supplying a format value will result in automatic
|
||||
selection of the<code>lvm2</code> format.
|
||||
The logical volume pool supports the following formats:
|
||||
</p>
|
||||
<ul>
|
||||
<li><code>auto</code> - automatically determine format</li>
|
||||
<li>
|
||||
<code>lvm2</code>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Valid volume format types</h3>
|
||||
<p>
|
||||
@@ -551,12 +552,12 @@
|
||||
<name>myrbdpool</name>
|
||||
<source>
|
||||
<name>rbdpool</name>
|
||||
<host name='1.2.3.4' port='6789'/>
|
||||
<host name='my.ceph.monitor' port='6789'/>
|
||||
<host name='third.ceph.monitor' port='6789'/>
|
||||
<auth username='admin' type='ceph'>
|
||||
<secret uuid='2ec115d7-3a88-3ceb-bc12-0ac909a6fd87'/>
|
||||
</auth>
|
||||
<host name='1.2.3.4' port='6789'/>
|
||||
<host name='my.ceph.monitor' port='6789'/>
|
||||
<host name='third.ceph.monitor' port='6789'/>
|
||||
<auth username='admin' type='ceph'>
|
||||
<secret uuid='2ec115d7-3a88-3ceb-bc12-0ac909a6fd87'/>
|
||||
</auth>
|
||||
</source>
|
||||
</pool></pre>
|
||||
|
||||
@@ -742,42 +743,5 @@
|
||||
pool type.
|
||||
</p>
|
||||
|
||||
<h2><a name="StorageBackendZFS">ZFS pools</a></h2>
|
||||
<p>
|
||||
This provides a pool based on the ZFS filesystem. It is currently
|
||||
supported on FreeBSD only.
|
||||
</p>
|
||||
|
||||
<p>A pool could either be created manually using the <code>zpool create</code>
|
||||
command and its name specified in the source section or <span class="since">
|
||||
since 1.2.9</span> source devices could be specified to create a pool using
|
||||
libvirt.
|
||||
</p>
|
||||
|
||||
<p>Please refer to the ZFS documentation for details on a pool creation.</p>
|
||||
|
||||
<p><span class="since">Since 1.2.8</span></p>.
|
||||
|
||||
<h3>Example pool input</h3>
|
||||
<pre>
|
||||
<pool type="zfs">
|
||||
<name>myzfspool</name>
|
||||
<source>
|
||||
<name>zpoolname</name>
|
||||
<device path="/dev/ada1"/>
|
||||
<device path="/dev/ada2"/>
|
||||
</source>
|
||||
</pool></pre>
|
||||
|
||||
<h3>Valid pool format types</h3>
|
||||
<p>
|
||||
The ZFS volume pool does not use the pool format type element.
|
||||
</p>
|
||||
|
||||
<h3>Valid pool format types</h3>
|
||||
<p>
|
||||
The ZFS volume pool does not use the volume format type element.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -19,15 +19,7 @@ documents libvirt URIs.
|
||||
<h2><a name="URI_libvirt">Specifying URIs to libvirt</a></h2>
|
||||
|
||||
<p>
|
||||
The URI is passed as the <code>name</code> parameter to
|
||||
<a href="html/libvirt-libvirt-host.html#virConnectOpen">
|
||||
<code>virConnectOpen</code>
|
||||
</a>
|
||||
or
|
||||
<a href="html/libvirt-libvirt-host.html#virConnectOpenReadOnly">
|
||||
<code>virConnectOpenReadOnly</code>
|
||||
</a>.
|
||||
For example:
|
||||
The URI is passed as the <code>name</code> parameter to <a href="html/libvirt-libvirt.html#virConnectOpen"><code>virConnectOpen</code></a> or <a href="html/libvirt-libvirt.html#virConnectOpenReadOnly"><code>virConnectOpenReadOnly</code></a>. For example:
|
||||
</p>
|
||||
<pre>
|
||||
virConnectPtr conn = virConnectOpenReadOnly (<b>"test:///default"</b>);
|
||||
@@ -299,7 +291,7 @@ Notes:
|
||||
<ol>
|
||||
<li> The HTTP client does not fully support IPv6. </li>
|
||||
<li> Many features do not work as expected across HTTP connections, in
|
||||
particular, <a href="html/libvirt-libvirt-host.html#virConnectGetCapabilities">virConnectGetCapabilities</a>.
|
||||
particular, <a href="html/libvirt-libvirt.html#virConnectGetCapabilities">virConnectGetCapabilities</a>.
|
||||
The <a href="remote.html">remote support</a> however does work
|
||||
correctly. </li>
|
||||
<li> XenD's new-style XMLRPC interface is not supported by
|
||||
|
@@ -15,8 +15,7 @@
|
||||
## <http://www.gnu.org/licenses/>.
|
||||
|
||||
EXTRA_DIST= \
|
||||
TEMPLATE.qemu \
|
||||
TEMPLATE.lxc \
|
||||
TEMPLATE \
|
||||
libvirt-qemu \
|
||||
libvirt-lxc \
|
||||
usr.lib.libvirt.virt-aa-helper \
|
||||
@@ -37,7 +36,6 @@ abstractions_DATA = \
|
||||
|
||||
templatesdir = $(apparmordir)/libvirt
|
||||
templates_DATA = \
|
||||
TEMPLATE.qemu \
|
||||
TEMPLATE.lxc \
|
||||
TEMPLATE \
|
||||
$(NULL)
|
||||
endif WITH_APPARMOR_PROFILES
|
||||
|
@@ -5,5 +5,5 @@
|
||||
#include <tunables/global>
|
||||
|
||||
profile LIBVIRT_TEMPLATE {
|
||||
#include <abstractions/libvirt-qemu>
|
||||
#include <abstractions/libvirt-driver>
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
#
|
||||
# This profile is for the domain whose UUID matches this file.
|
||||
#
|
||||
|
||||
#include <tunables/global>
|
||||
|
||||
profile LIBVIRT_TEMPLATE {
|
||||
#include <abstractions/libvirt-lxc>
|
||||
|
||||
# Globally allows everything to run under this profile
|
||||
# These can be narrowed depending on the container's use.
|
||||
file,
|
||||
capability,
|
||||
network,
|
||||
}
|
@@ -2,115 +2,16 @@
|
||||
|
||||
#include <abstractions/base>
|
||||
|
||||
umount,
|
||||
# Needed for lxc-enter-namespace
|
||||
capability sys_admin,
|
||||
capability sys_chroot,
|
||||
|
||||
# ignore DENIED message on / remount
|
||||
deny mount options=(ro, remount) -> /,
|
||||
# Added for lxc-enter-namespace --cmd /bin/bash
|
||||
/bin/bash PUx,
|
||||
|
||||
# allow tmpfs mounts everywhere
|
||||
mount fstype=tmpfs,
|
||||
/usr/sbin/cron PUx,
|
||||
/usr/lib/systemd/systemd PUx,
|
||||
|
||||
# allow mqueue mounts everywhere
|
||||
mount fstype=mqueue,
|
||||
|
||||
# allow fuse mounts everywhere
|
||||
mount fstype=fuse.*,
|
||||
|
||||
# deny writes in /proc/sys/fs but allow binfmt_misc to be mounted
|
||||
mount fstype=binfmt_misc -> /proc/sys/fs/binfmt_misc/,
|
||||
deny @{PROC}/sys/fs/** wklx,
|
||||
|
||||
# allow efivars to be mounted, writing to it will be blocked though
|
||||
mount fstype=efivarfs -> /sys/firmware/efi/efivars/,
|
||||
|
||||
# block some other dangerous paths
|
||||
deny @{PROC}/sysrq-trigger rwklx,
|
||||
deny @{PROC}/mem rwklx,
|
||||
deny @{PROC}/kmem rwklx,
|
||||
|
||||
# deny writes in /sys except for /sys/fs/cgroup, also allow
|
||||
# fusectl, securityfs and debugfs to be mounted there (read-only)
|
||||
mount fstype=fusectl -> /sys/fs/fuse/connections/,
|
||||
mount fstype=securityfs -> /sys/kernel/security/,
|
||||
mount fstype=debugfs -> /sys/kernel/debug/,
|
||||
mount fstype=proc -> /proc/,
|
||||
mount fstype=sysfs -> /sys/,
|
||||
deny /sys/firmware/efi/efivars/** rwklx,
|
||||
deny /sys/kernel/security/** rwklx,
|
||||
|
||||
# generated by: lxc-generate-aa-rules.py container-rules.base
|
||||
deny /proc/sys/[^kn]*{,/**} wklx,
|
||||
deny /proc/sys/k[^e]*{,/**} wklx,
|
||||
deny /proc/sys/ke[^r]*{,/**} wklx,
|
||||
deny /proc/sys/ker[^n]*{,/**} wklx,
|
||||
deny /proc/sys/kern[^e]*{,/**} wklx,
|
||||
deny /proc/sys/kerne[^l]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/[^smhd]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/d[^o]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/do[^m]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/dom[^a]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/doma[^i]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/domai[^n]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/domain[^n]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/domainn[^a]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/domainna[^m]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/domainnam[^e]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/domainname?*{,/**} wklx,
|
||||
deny /proc/sys/kernel/h[^o]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/ho[^s]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/hos[^t]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/host[^n]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/hostn[^a]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/hostna[^m]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/hostnam[^e]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/hostname?*{,/**} wklx,
|
||||
deny /proc/sys/kernel/m[^s]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/ms[^g]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/msg*/** wklx,
|
||||
deny /proc/sys/kernel/s[^he]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/se[^m]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/sem*/** wklx,
|
||||
deny /proc/sys/kernel/sh[^m]*{,/**} wklx,
|
||||
deny /proc/sys/kernel/shm*/** wklx,
|
||||
deny /proc/sys/kernel?*{,/**} wklx,
|
||||
deny /proc/sys/n[^e]*{,/**} wklx,
|
||||
deny /proc/sys/ne[^t]*{,/**} wklx,
|
||||
deny /proc/sys/net?*{,/**} wklx,
|
||||
deny /sys/[^fdc]*{,/**} wklx,
|
||||
deny /sys/c[^l]*{,/**} wklx,
|
||||
deny /sys/cl[^a]*{,/**} wklx,
|
||||
deny /sys/cla[^s]*{,/**} wklx,
|
||||
deny /sys/clas[^s]*{,/**} wklx,
|
||||
deny /sys/class/[^n]*{,/**} wklx,
|
||||
deny /sys/class/n[^e]*{,/**} wklx,
|
||||
deny /sys/class/ne[^t]*{,/**} wklx,
|
||||
deny /sys/class/net?*{,/**} wklx,
|
||||
deny /sys/class?*{,/**} wklx,
|
||||
deny /sys/d[^e]*{,/**} wklx,
|
||||
deny /sys/de[^v]*{,/**} wklx,
|
||||
deny /sys/dev[^i]*{,/**} wklx,
|
||||
deny /sys/devi[^c]*{,/**} wklx,
|
||||
deny /sys/devic[^e]*{,/**} wklx,
|
||||
deny /sys/device[^s]*{,/**} wklx,
|
||||
deny /sys/devices/[^v]*{,/**} wklx,
|
||||
deny /sys/devices/v[^i]*{,/**} wklx,
|
||||
deny /sys/devices/vi[^r]*{,/**} wklx,
|
||||
deny /sys/devices/vir[^t]*{,/**} wklx,
|
||||
deny /sys/devices/virt[^u]*{,/**} wklx,
|
||||
deny /sys/devices/virtu[^a]*{,/**} wklx,
|
||||
deny /sys/devices/virtua[^l]*{,/**} wklx,
|
||||
deny /sys/devices/virtual/[^n]*{,/**} wklx,
|
||||
deny /sys/devices/virtual/n[^e]*{,/**} wklx,
|
||||
deny /sys/devices/virtual/ne[^t]*{,/**} wklx,
|
||||
deny /sys/devices/virtual/net?*{,/**} wklx,
|
||||
deny /sys/devices/virtual?*{,/**} wklx,
|
||||
deny /sys/devices?*{,/**} wklx,
|
||||
deny /sys/f[^s]*{,/**} wklx,
|
||||
deny /sys/fs/[^c]*{,/**} wklx,
|
||||
deny /sys/fs/c[^g]*{,/**} wklx,
|
||||
deny /sys/fs/cg[^r]*{,/**} wklx,
|
||||
deny /sys/fs/cgr[^o]*{,/**} wklx,
|
||||
deny /sys/fs/cgro[^u]*{,/**} wklx,
|
||||
deny /sys/fs/cgrou[^p]*{,/**} wklx,
|
||||
deny /sys/fs/cgroup?*{,/**} wklx,
|
||||
deny /sys/fs?*{,/**} wklx,
|
||||
/usr/lib/libsystemd-*.so.* mr,
|
||||
/usr/lib/libudev-*.so.* mr,
|
||||
/etc/ld.so.cache mr,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Last Modified: Wed Sep 3 21:52:03 2014
|
||||
# Last Modified: Fri Mar 9 14:43:22 2012
|
||||
|
||||
#include <abstractions/base>
|
||||
#include <abstractions/consoles>
|
||||
@@ -21,7 +21,6 @@
|
||||
/dev/ptmx rw,
|
||||
/dev/kqemu rw,
|
||||
@{PROC}/*/status r,
|
||||
@{PROC}/sys/kernel/cap_last_cap r,
|
||||
|
||||
# For hostdev access. The actual devices will be added dynamically
|
||||
/sys/bus/usb/devices/ r,
|
||||
@@ -111,7 +110,7 @@
|
||||
/usr/bin/qemu-sparc32plus rmix,
|
||||
/usr/bin/qemu-sparc64 rmix,
|
||||
/usr/bin/qemu-x86_64 rmix,
|
||||
/usr/{lib,lib64}/qemu/block-curl.so mr,
|
||||
/usr/lib/qemu/block-curl.so mr,
|
||||
|
||||
# for save and resume
|
||||
/bin/dash rmix,
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# Last Modified: Mon Apr 5 15:10:27 2010
|
||||
#include <tunables/global>
|
||||
|
||||
profile virt-aa-helper /usr/{lib,lib64}/libvirt/virt-aa-helper {
|
||||
/usr/lib/libvirt/virt-aa-helper {
|
||||
#include <abstractions/base>
|
||||
|
||||
# needed for searching directories
|
||||
@@ -20,7 +20,7 @@ profile virt-aa-helper /usr/{lib,lib64}/libvirt/virt-aa-helper {
|
||||
/sys/devices/ r,
|
||||
/sys/devices/** r,
|
||||
|
||||
/usr/{lib,lib64}/libvirt/virt-aa-helper mr,
|
||||
/usr/lib/libvirt/virt-aa-helper mr,
|
||||
/sbin/apparmor_parser Ux,
|
||||
|
||||
/etc/apparmor.d/libvirt/* r,
|
||||
|
@@ -13,7 +13,6 @@
|
||||
capability sys_admin,
|
||||
capability sys_module,
|
||||
capability sys_ptrace,
|
||||
capability sys_pacct,
|
||||
capability sys_nice,
|
||||
capability sys_chroot,
|
||||
capability setuid,
|
||||
@@ -25,7 +24,6 @@
|
||||
capability mknod,
|
||||
capability fsetid,
|
||||
capability audit_write,
|
||||
capability ipc_lock,
|
||||
|
||||
# Needed for vfio
|
||||
capability sys_resource,
|
||||
@@ -35,7 +33,6 @@
|
||||
network inet6 stream,
|
||||
network inet6 dgram,
|
||||
network packet dgram,
|
||||
network packet raw,
|
||||
|
||||
# Very lenient profile for libvirtd since we want to first focus on confining
|
||||
# the guests. Guests will have a very restricted profile.
|
||||
@@ -47,8 +44,7 @@
|
||||
/usr/bin/* PUx,
|
||||
/usr/sbin/* PUx,
|
||||
/lib/udev/scsi_id PUx,
|
||||
/usr/{lib,lib64}/xen-common/bin/xen-toolstack PUx,
|
||||
/usr/{lib,lib64}/xen/bin/* Ux,
|
||||
/usr/lib/xen-common/bin/xen-toolstack PUx,
|
||||
|
||||
# force the use of virt-aa-helper
|
||||
audit deny /sbin/apparmor_parser rwxl,
|
||||
@@ -57,9 +53,7 @@
|
||||
audit deny /sys/kernel/security/apparmor/matching rwxl,
|
||||
audit deny /sys/kernel/security/apparmor/.* rwxl,
|
||||
/sys/kernel/security/apparmor/profiles r,
|
||||
/usr/{lib,lib64}/libvirt/* PUxr,
|
||||
/usr/{lib,lib64}/libvirt/libvirt_parthelper ix,
|
||||
/usr/{lib,lib64}/libvirt/libvirt_iohelper ix,
|
||||
/usr/lib/libvirt/* PUxr,
|
||||
/etc/libvirt/hooks/** rmix,
|
||||
/etc/xen/scripts/** rmix,
|
||||
|
||||
|
@@ -1,5 +0,0 @@
|
||||
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)
|
||||
noinst_PROGRAMS = dommigrate
|
||||
dommigrate_CFLAGS = $(WARN_CFLAGS)
|
||||
dommigrate_SOURCES = dommigrate.c
|
||||
dommigrate_LDADD = $(top_builddir)/src/libvirt.la
|
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* dommigrate.c: This file is largely inspired from hellolibvirt and
|
||||
* contains a trivial example that illustrate p2p domain
|
||||
* migration with libvirt.
|
||||
*
|
||||
* Copyright (C) 2014 Cloudwatt
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Sahid Orentino Ferdjaoui <sahid.ferdjaoui@cloudwatt.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <libvirt/libvirt.h>
|
||||
#include <libvirt/virterror.h>
|
||||
|
||||
|
||||
static int
|
||||
usage(char *prgn, int ret)
|
||||
{
|
||||
printf("Usage: %s <src uri> <dst uri> <domain name>\n", prgn);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *src_uri, *dst_uri, *domname;
|
||||
int ret = 0;
|
||||
virConnectPtr conn = NULL;
|
||||
virDomainPtr dom = NULL;
|
||||
|
||||
if (argc < 4) {
|
||||
ret = usage(argv[0], 1);
|
||||
goto out;
|
||||
}
|
||||
|
||||
src_uri = argv[1];
|
||||
dst_uri = argv[2];
|
||||
domname = argv[3];
|
||||
|
||||
printf("Attempting to connect to the source hypervisor...\n");
|
||||
conn = virConnectOpenAuth(src_uri, virConnectAuthPtrDefault, 0);
|
||||
if (!conn) {
|
||||
ret = 1;
|
||||
fprintf(stderr, "No connection to the source hypervisor: %s.\n",
|
||||
virGetLastErrorMessage());
|
||||
goto out;
|
||||
}
|
||||
|
||||
printf("Attempting to retrieve domain %s...\n", domname);
|
||||
dom = virDomainLookupByName(conn, domname);
|
||||
if (!dom) {
|
||||
fprintf(stderr, "Failed to find domain %s.\n", domname);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
printf("Attempting to migrate %s to %s...\n", domname, dst_uri);
|
||||
if ((ret = virDomainMigrateToURI(dom, dst_uri,
|
||||
VIR_MIGRATE_PEER2PEER,
|
||||
NULL, 0)) != 0) {
|
||||
fprintf(stderr, "Failed to migrate domain %s.\n", domname);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
printf("Migration finished with success.\n");
|
||||
|
||||
cleanup:
|
||||
if (dom != NULL)
|
||||
virDomainFree(dom);
|
||||
if (conn != NULL)
|
||||
virConnectClose(conn);
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
## Copyright (C) 2014 Red Hat, Inc.
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU Lesser General Public
|
||||
## License as published by the Free Software Foundation; either
|
||||
## version 2.1 of the License, or (at your option) any later version.
|
||||
##
|
||||
## This library is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## Lesser General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU Lesser General Public
|
||||
## License along with this library. If not, see
|
||||
## <http://www.gnu.org/licenses/>.
|
||||
|
||||
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
|
||||
-I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib \
|
||||
-I$(top_srcdir)
|
||||
LDADDS = $(STATIC_BINARIES) $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la \
|
||||
$(top_builddir)/gnulib/lib/libgnu.la $(COVERAGE_LDFLAGS)
|
||||
|
||||
noinst_PROGRAMS=domtop
|
||||
|
||||
domtop_SOURCES=domtop.c
|
||||
domtop_LDFLAGS=
|
||||
domtop_LDADD= $(LDADDS)
|
@@ -1,406 +0,0 @@
|
||||
/*
|
||||
* domtop.c: Demo program showing how to calculate CPU usage
|
||||
*
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Michal Privoznik <mprivozn@redhat.com>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <libvirt/libvirt.h>
|
||||
#include <libvirt/virterror.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static bool debug;
|
||||
static bool run_top;
|
||||
|
||||
/* On mingw, there's a header file that poisons the well:
|
||||
*
|
||||
*
|
||||
* CC domtop.o
|
||||
*domtop.c:40:0: warning: "ERROR" redefined [enabled by default]
|
||||
* #define ERROR(...) \
|
||||
* ^
|
||||
*In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:71:0,
|
||||
* from /usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:23,
|
||||
* from ../../gnulib/lib/unistd.h:48,
|
||||
* from domtop.c:35:
|
||||
* /usr/i686-w64-mingw32/sys-root/mingw/include/wingdi.h:75:0: note: this is the location of the previous definition
|
||||
* #define ERROR 0
|
||||
*/
|
||||
#undef ERROR
|
||||
#define ERROR(...) \
|
||||
do { \
|
||||
fprintf(stderr, "ERROR %s:%d : ", __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
} while (0)
|
||||
|
||||
#define DEBUG(...) \
|
||||
do { \
|
||||
if (!debug) \
|
||||
break; \
|
||||
fprintf(stderr, "DEBUG %s:%d : ", __FUNCTION__, __LINE__); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
fprintf(stderr, "\n"); \
|
||||
} while (0)
|
||||
|
||||
#define STREQ(a, b) (strcmp(a, b) == 0)
|
||||
|
||||
static void
|
||||
print_usage(const char *progname)
|
||||
{
|
||||
const char *unified_progname;
|
||||
|
||||
if (!(unified_progname = strrchr(progname, '/')))
|
||||
unified_progname = progname;
|
||||
else
|
||||
unified_progname++;
|
||||
|
||||
printf("\n%s [options] [domain name]\n\n"
|
||||
" options:\n"
|
||||
" -d | --debug enable debug messages\n"
|
||||
" -h | --help print this help\n"
|
||||
" -c | --connect=URI hypervisor connection URI\n"
|
||||
" -D | --delay=X delay between updates in milliseconds "
|
||||
"(default is 500ms)\n"
|
||||
"\n"
|
||||
"Print the cumulative usage of each host CPU.\n"
|
||||
"Without any domain name specified the list of\n"
|
||||
"all running domains is printed out.\n",
|
||||
unified_progname);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_argv(int argc, char *argv[],
|
||||
const char **uri,
|
||||
const char **dom_name,
|
||||
unsigned int *milliseconds)
|
||||
{
|
||||
int arg;
|
||||
unsigned long val;
|
||||
char *p;
|
||||
struct option opt[] = {
|
||||
{"debug", no_argument, NULL, 'd'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"connect", required_argument, NULL, 'c'},
|
||||
{"delay", required_argument, NULL, 'D'},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
while ((arg = getopt_long(argc, argv, "+:dhc:D:", opt, NULL)) != -1) {
|
||||
switch (arg) {
|
||||
case 'd':
|
||||
debug = true;
|
||||
break;
|
||||
case 'h':
|
||||
print_usage(argv[0]);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
case 'c':
|
||||
*uri = optarg;
|
||||
break;
|
||||
case 'D':
|
||||
/* strtoul man page suggests clearing errno prior to call */
|
||||
errno = 0;
|
||||
val = strtoul(optarg, &p, 10);
|
||||
if (errno || *p || p == optarg) {
|
||||
ERROR("Invalid number: '%s'", optarg);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
*milliseconds = val;
|
||||
if (*milliseconds != val) {
|
||||
ERROR("Integer overflow: %ld", val);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
case ':':
|
||||
ERROR("option '-%c' requires an argument", optopt);
|
||||
exit(EXIT_FAILURE);
|
||||
case '?':
|
||||
if (optopt)
|
||||
ERROR("unsupported option '-%c'. See --help.", optopt);
|
||||
else
|
||||
ERROR("unsupported option '%s'. See --help.", argv[optind - 1]);
|
||||
exit(EXIT_FAILURE);
|
||||
default:
|
||||
ERROR("unknown option");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if (argc > optind)
|
||||
*dom_name = argv[optind];
|
||||
}
|
||||
|
||||
static int
|
||||
fetch_domains(virConnectPtr conn)
|
||||
{
|
||||
int num_domains, ret = -1;
|
||||
virDomainPtr *domains = NULL;
|
||||
size_t i;
|
||||
const int list_flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE;
|
||||
|
||||
DEBUG("Fetching list of running domains");
|
||||
num_domains = virConnectListAllDomains(conn, &domains, list_flags);
|
||||
|
||||
DEBUG("num_domains=%d", num_domains);
|
||||
if (num_domains < 0) {
|
||||
ERROR("Unable to fetch list of running domains");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
printf("Running domains:\n");
|
||||
printf("----------------\n");
|
||||
for (i = 0; i < num_domains; i++) {
|
||||
virDomainPtr dom = domains[i];
|
||||
const char *dom_name = virDomainGetName(dom);
|
||||
printf("%s\n", dom_name);
|
||||
virDomainFree(dom);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
free(domains);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
print_cpu_usage(const char *dom_name,
|
||||
size_t cpu,
|
||||
size_t ncpus,
|
||||
unsigned long long then,
|
||||
virTypedParameterPtr then_params,
|
||||
size_t then_nparams,
|
||||
unsigned long long now,
|
||||
virTypedParameterPtr now_params,
|
||||
size_t now_nparams)
|
||||
{
|
||||
size_t i, j;
|
||||
size_t nparams = now_nparams;
|
||||
bool delim = false;
|
||||
|
||||
if (then_nparams != now_nparams) {
|
||||
/* this should not happen (TM) */
|
||||
ERROR("parameters counts don't match");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < ncpus; i++) {
|
||||
size_t pos;
|
||||
double usage;
|
||||
|
||||
/* check if the vCPU is in the maps */
|
||||
if (now_params[i * nparams].type == 0 ||
|
||||
then_params[i * then_nparams].type == 0)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < nparams; j++) {
|
||||
pos = i * nparams + j;
|
||||
if (STREQ(then_params[pos].field, VIR_DOMAIN_CPU_STATS_CPUTIME) ||
|
||||
STREQ(then_params[pos].field, VIR_DOMAIN_CPU_STATS_VCPUTIME))
|
||||
break;
|
||||
}
|
||||
|
||||
if (j == nparams) {
|
||||
ERROR("unable to find %s", VIR_DOMAIN_CPU_STATS_CPUTIME);
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG("now_params=%llu then_params=%llu now=%llu then=%llu",
|
||||
now_params[pos].value.ul, then_params[pos].value.ul, now, then);
|
||||
|
||||
/* @now_params and @then_params are in nanoseconds, @now and @then are
|
||||
* in microseconds. In ideal world, we would translate them both into
|
||||
* the same scale, divide one by another and multiply by factor of 100
|
||||
* to get percentage. However, the count of floating point operations
|
||||
* performed has a bad effect on the precision, so instead of dividing
|
||||
* @now_params and @then_params by 1000 and then multiplying again by
|
||||
* 100, we divide only once by 10 and get the same result. */
|
||||
usage = (now_params[pos].value.ul - then_params[pos].value.ul) /
|
||||
(now - then) / 10;
|
||||
|
||||
if (delim)
|
||||
printf("\t");
|
||||
printf("CPU%zu: %.2lf", cpu + i, usage);
|
||||
delim = true;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
stop(int sig)
|
||||
{
|
||||
DEBUG("Exiting on signal %d\n", sig);
|
||||
run_top = false;
|
||||
}
|
||||
|
||||
static int
|
||||
do_top(virConnectPtr conn,
|
||||
const char *dom_name,
|
||||
unsigned int milliseconds)
|
||||
{
|
||||
int ret = -1;
|
||||
virDomainPtr dom;
|
||||
int max_id = 0;
|
||||
int nparams = 0, then_nparams = 0, now_nparams = 0;
|
||||
virTypedParameterPtr then_params = NULL, now_params = NULL;
|
||||
struct sigaction action_stop;
|
||||
|
||||
memset(&action_stop, 0, sizeof(action_stop));
|
||||
action_stop.sa_handler = stop;
|
||||
|
||||
/* Lookup the domain */
|
||||
if (!(dom = virDomainLookupByName(conn, dom_name))) {
|
||||
ERROR("Unable to find domain '%s'", dom_name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* and see how many vCPUs can we fetch stats for */
|
||||
if ((max_id = virDomainGetCPUStats(dom, NULL, 0, 0, 0, 0)) < 0) {
|
||||
ERROR("Unable to get cpu stats");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* how many stats can we get for a vCPU? */
|
||||
if ((nparams = virDomainGetCPUStats(dom, NULL, 0, 0, 1, 0)) < 0) {
|
||||
ERROR("Unable to get cpu stats");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(now_params = calloc(nparams * max_id, sizeof(*now_params))) ||
|
||||
!(then_params = calloc(nparams * max_id, sizeof(*then_params)))) {
|
||||
ERROR("Unable to allocate memory");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
sigaction(SIGTERM, &action_stop, NULL);
|
||||
sigaction(SIGINT, &action_stop, NULL);
|
||||
|
||||
run_top = true;
|
||||
while (run_top) {
|
||||
struct timeval then, now;
|
||||
|
||||
/* Get current time */
|
||||
if (gettimeofday(&then, NULL) < 0) {
|
||||
ERROR("unable to get time");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* And current stats */
|
||||
if ((then_nparams = virDomainGetCPUStats(dom, then_params,
|
||||
nparams, 0, max_id, 0)) < 0) {
|
||||
ERROR("Unable to get cpu stats");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Now sleep some time */
|
||||
usleep(milliseconds * 1000); /* usleep expects microseconds */
|
||||
|
||||
/* And get current time */
|
||||
if (gettimeofday(&now, NULL) < 0) {
|
||||
ERROR("unable to get time");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* And current stats */
|
||||
if ((now_nparams = virDomainGetCPUStats(dom, now_params,
|
||||
nparams, 0, max_id, 0)) < 0) {
|
||||
ERROR("Unable to get cpu stats");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
print_cpu_usage(dom_name, 0, max_id,
|
||||
then.tv_sec * 1000000 + then.tv_usec,
|
||||
then_params, then_nparams,
|
||||
now.tv_sec * 1000000 + now.tv_usec,
|
||||
now_params, now_nparams);
|
||||
|
||||
virTypedParamsClear(now_params, now_nparams * max_id);
|
||||
virTypedParamsClear(then_params, then_nparams * max_id);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
virTypedParamsFree(now_params, now_nparams * max_id);
|
||||
virTypedParamsFree(then_params, then_nparams * max_id);
|
||||
if (dom)
|
||||
virDomainFree(dom);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ret = EXIT_FAILURE;
|
||||
virConnectPtr conn = NULL;
|
||||
const char *uri = NULL;
|
||||
const char *dom_name = NULL;
|
||||
unsigned int milliseconds = 500; /* Sleep this long between two API calls */
|
||||
const int connect_flags = 0; /* No connect flags for now */
|
||||
|
||||
parse_argv(argc, argv, &uri, &dom_name, &milliseconds);
|
||||
|
||||
DEBUG("Proceeding with uri=%s dom_name=%s milliseconds=%u",
|
||||
uri, dom_name, milliseconds);
|
||||
|
||||
if (!(conn = virConnectOpenAuth(uri,
|
||||
virConnectAuthPtrDefault,
|
||||
connect_flags))) {
|
||||
ERROR("Failed to connect to hypervisor");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
DEBUG("Successfully connected");
|
||||
|
||||
if (!dom_name) {
|
||||
if (fetch_domains(conn) == 0)
|
||||
ret = EXIT_SUCCESS;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (do_top(conn, dom_name, milliseconds) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = EXIT_SUCCESS;
|
||||
cleanup:
|
||||
if (conn) {
|
||||
int tmp;
|
||||
tmp = virConnectClose(conn);
|
||||
if (tmp < 0) {
|
||||
ERROR("Failed to disconnect from the hypervisor");
|
||||
ret = EXIT_FAILURE;
|
||||
} else if (tmp > 0) {
|
||||
ERROR("One or more references were leaked after "
|
||||
"disconnect from the hypervisor");
|
||||
ret = EXIT_FAILURE;
|
||||
} else {
|
||||
DEBUG("Connection successfully closed");
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
## Copyright (C) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU Lesser General Public
|
||||
## License as published by the Free Software Foundation; either
|
||||
## version 2.1 of the License, or (at your option) any later version.
|
||||
##
|
||||
## This library is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## Lesser General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU Lesser General Public
|
||||
## License along with this library. If not, see
|
||||
## <http://www.gnu.org/licenses/>.
|
||||
|
||||
EXTRA_DIST= \
|
||||
virt-lxc-convert
|
@@ -1,127 +0,0 @@
|
||||
#!/bin/sh
|
||||
# lxc_native.c: LXC native configuration import
|
||||
#
|
||||
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: Cedric Bosdonnat <cbosdonnat@suse.com>
|
||||
|
||||
handler_cleanup()
|
||||
{
|
||||
if test "$conf_dir"; then
|
||||
# Remove the temporary config
|
||||
rm -r "$conf_dir"
|
||||
fi
|
||||
}
|
||||
trap handler_cleanup INT EXIT
|
||||
|
||||
show_help()
|
||||
{
|
||||
cat << EOF
|
||||
$0 /path/to/lxc/config/file
|
||||
|
||||
Wrapper around virsh domxml-from-native to ease conversion of LXC
|
||||
containers configuration to libvirt domain XML.
|
||||
EOF
|
||||
}
|
||||
|
||||
if test $# != 1; then
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test "$1" = "--help" || test "$1" = "-h"; then
|
||||
show_help
|
||||
exit $?
|
||||
fi
|
||||
|
||||
conf=$1
|
||||
|
||||
conf_dir=$(mktemp --tmpdir -d virt-lxc-convert-XXX)
|
||||
conf_new=$conf_dir/config
|
||||
|
||||
cp "$conf" "$conf_new"
|
||||
|
||||
# Do we have lxc.mount, and is it pointing to a readable file?
|
||||
fstab=$(sed -n '/lxc.mount[[:space:]]*=/ s/[[:space:]]*=[[:space:]]*/=/p' \
|
||||
"$conf_new" | cut -f 2 -d '=')
|
||||
if test -r "$fstab"; then
|
||||
sed 's/^lxc.mount[[:space:]]*=.*$//' "$conf_new" >"${conf_new}.tmp"
|
||||
mv "${conf_new}.tmp" "${conf_new}"
|
||||
sed 's/^\([^#]\)/lxc.mount.entry = \1/' "$fstab" >>"${conf_new}"
|
||||
fi
|
||||
|
||||
memory=$(free -b | sed -n '/Mem:/s/ \+/ /gp' | cut -f 2 -d ' ')
|
||||
default_tmpfs="size=$((memory/2))"
|
||||
|
||||
# Do we have tmpfs without size param?
|
||||
lineno=0
|
||||
while read line; do
|
||||
lineno=$(expr $lineno + 1)
|
||||
has_rel_size=false
|
||||
case $line in
|
||||
lxc.mount.entry[[:space:]]*=[[:space:]]*tmpfs[[:space:]]*)
|
||||
is_tmpfs=true
|
||||
;;
|
||||
*)
|
||||
is_tmpfs=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# We only care about tmpfs mount entries here
|
||||
if ! $is_tmpfs; then
|
||||
continue
|
||||
fi
|
||||
|
||||
case $line in
|
||||
*size=[0-9][0-9]*%*)
|
||||
has_rel_size=true
|
||||
has_size=true
|
||||
;;
|
||||
*size=*)
|
||||
has_size=true
|
||||
;;
|
||||
*)
|
||||
has_size=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# Add the default size here (50%) if no size is given
|
||||
if ! $has_size; then
|
||||
last_option_match="\([[:space:]]*[0-9][[:space:]]*[0-9][::space::]*$\)"
|
||||
sed "${lineno}s/$last_option_match/,$default_tmpfs\1/" \
|
||||
"$conf_new" >"${conf_new}.tmp"
|
||||
mv "${conf_new}.tmp" "${conf_new}"
|
||||
fi
|
||||
|
||||
# Convert relative sizes
|
||||
if $has_rel_size; then
|
||||
percent=$(echo "$line" | sed 's/.*size=\([0-9][0-9]*\)%.*/\1/')
|
||||
size="$((memory*percent/100))"
|
||||
sed "${lineno}s/size=[0-9]*%/size=${size}/" \
|
||||
"$conf_new" >"${conf_new}.tmp"
|
||||
mv "${conf_new}.tmp" "${conf_new}"
|
||||
fi
|
||||
done < "$conf_new"
|
||||
|
||||
# Do we have any memory limit set?
|
||||
mem_limit=$(grep 'lxc.cgroup.memory.limit_in_bytes[[:space:]]*=' $conf_new)
|
||||
if test -z "$mem_limit"; then
|
||||
echo "lxc.cgroup.memory.limit_in_bytes = $memory" >> "$conf_new"
|
||||
fi
|
||||
|
||||
virsh -c lxc:/// domxml-from-native lxc-tools $conf_new
|
||||
exit $?
|
@@ -10,7 +10,7 @@
|
||||
#include <libvirt/virterror.h>
|
||||
|
||||
#define VIR_DEBUG(fmt) printf("%s:%d: " fmt "\n", __func__, __LINE__)
|
||||
#define STREQ(a, b) (strcmp(a, b) == 0)
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_UNUSED __attribute__((__unused__))
|
||||
@@ -244,47 +244,6 @@ networkEventToString(int event)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const char *
|
||||
guestAgentLifecycleEventStateToString(int event)
|
||||
{
|
||||
const char *ret = "";
|
||||
|
||||
switch ((virConnectDomainEventAgentLifecycleState) event) {
|
||||
case VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED:
|
||||
ret = "Disconnected";
|
||||
break;
|
||||
|
||||
case VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_CONNECTED:
|
||||
ret = "Connected";
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const char *
|
||||
guestAgentLifecycleEventReasonToString(int event)
|
||||
{
|
||||
const char *ret = "";
|
||||
|
||||
switch ((virConnectDomainEventAgentLifecycleReason) event) {
|
||||
case VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN:
|
||||
ret = "Unknown";
|
||||
break;
|
||||
|
||||
case VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED:
|
||||
ret = "Domain started";
|
||||
break;
|
||||
|
||||
case VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL:
|
||||
ret = "Channel event";
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int myDomainEventCallback1(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virDomainPtr dom,
|
||||
int event,
|
||||
@@ -505,65 +464,6 @@ static int myNetworkEventCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
myDomainEventTunableCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virDomainPtr dom,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
printf("%s EVENT: Domain %s(%d) tunable updated:\n",
|
||||
__func__, virDomainGetName(dom), virDomainGetID(dom));
|
||||
|
||||
for (i = 0; i < nparams; i++) {
|
||||
switch (params[i].type) {
|
||||
case VIR_TYPED_PARAM_INT:
|
||||
printf("\t%s: %d\n", params[i].field, params[i].value.i);
|
||||
break;
|
||||
case VIR_TYPED_PARAM_UINT:
|
||||
printf("\t%s: %u\n", params[i].field, params[i].value.ui);
|
||||
break;
|
||||
case VIR_TYPED_PARAM_LLONG:
|
||||
printf("\t%s: %" PRId64 "\n", params[i].field,
|
||||
(int64_t) params[i].value.l);
|
||||
break;
|
||||
case VIR_TYPED_PARAM_ULLONG:
|
||||
printf("\t%s: %" PRIu64 "\n", params[i].field,
|
||||
(uint64_t) params[i].value.ul);
|
||||
break;
|
||||
case VIR_TYPED_PARAM_DOUBLE:
|
||||
printf("\t%s: %g\n", params[i].field, params[i].value.d);
|
||||
break;
|
||||
case VIR_TYPED_PARAM_BOOLEAN:
|
||||
printf("\t%s: %d\n", params[i].field, params[i].value.b);
|
||||
break;
|
||||
case VIR_TYPED_PARAM_STRING:
|
||||
printf("\t%s: %s\n", params[i].field, params[i].value.s);
|
||||
break;
|
||||
default:
|
||||
printf("\t%s: unknown type\n", params[i].field);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
myDomainEventAgentLifecycleCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virDomainPtr dom,
|
||||
int state,
|
||||
int reason,
|
||||
void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
printf("%s EVENT: Domain %s(%d) guest agent state changed: %s reason: %s\n",
|
||||
__func__, virDomainGetName(dom), virDomainGetID(dom),
|
||||
guestAgentLifecycleEventStateToString(state),
|
||||
guestAgentLifecycleEventReasonToString(reason));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void myFreeFunc(void *opaque)
|
||||
{
|
||||
@@ -606,8 +506,6 @@ int main(int argc, char **argv)
|
||||
int callback14ret = -1;
|
||||
int callback15ret = -1;
|
||||
int callback16ret = -1;
|
||||
int callback17ret = -1;
|
||||
int callback18ret = -1;
|
||||
struct sigaction action_stop;
|
||||
|
||||
memset(&action_stop, 0, sizeof(action_stop));
|
||||
@@ -726,16 +624,6 @@ int main(int argc, char **argv)
|
||||
VIR_NETWORK_EVENT_ID_LIFECYCLE,
|
||||
VIR_NETWORK_EVENT_CALLBACK(myNetworkEventCallback),
|
||||
strdup("net callback"), myFreeFunc);
|
||||
callback17ret = virConnectDomainEventRegisterAny(dconn,
|
||||
NULL,
|
||||
VIR_DOMAIN_EVENT_ID_TUNABLE,
|
||||
VIR_DOMAIN_EVENT_CALLBACK(myDomainEventTunableCallback),
|
||||
strdup("tunable"), myFreeFunc);
|
||||
callback18ret = virConnectDomainEventRegisterAny(dconn,
|
||||
NULL,
|
||||
VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE,
|
||||
VIR_DOMAIN_EVENT_CALLBACK(myDomainEventAgentLifecycleCallback),
|
||||
strdup("guest agent lifecycle"), myFreeFunc);
|
||||
|
||||
if ((callback1ret != -1) &&
|
||||
(callback2ret != -1) &&
|
||||
@@ -751,9 +639,7 @@ int main(int argc, char **argv)
|
||||
(callback13ret != -1) &&
|
||||
(callback14ret != -1) &&
|
||||
(callback15ret != -1) &&
|
||||
(callback16ret != -1) &&
|
||||
(callback17ret != -1) &&
|
||||
(callback18ret != -1)) {
|
||||
(callback16ret != -1)) {
|
||||
if (virConnectSetKeepAlive(dconn, 5, 3) < 0) {
|
||||
virErrorPtr err = virGetLastError();
|
||||
fprintf(stderr, "Failed to start keepalive protocol: %s\n",
|
||||
@@ -785,9 +671,6 @@ int main(int argc, char **argv)
|
||||
virConnectDomainEventDeregisterAny(dconn, callback14ret);
|
||||
virConnectDomainEventDeregisterAny(dconn, callback15ret);
|
||||
virConnectNetworkEventDeregisterAny(dconn, callback16ret);
|
||||
virConnectDomainEventDeregisterAny(dconn, callback17ret);
|
||||
virConnectDomainEventDeregisterAny(dconn, callback18ret);
|
||||
|
||||
if (callback8ret != -1)
|
||||
virConnectDomainEventDeregisterAny(dconn, callback8ret);
|
||||
}
|
||||
@@ -795,8 +678,9 @@ int main(int argc, char **argv)
|
||||
virConnectUnregisterCloseCallback(dconn, connectClose);
|
||||
|
||||
VIR_DEBUG("Closing connection");
|
||||
if (dconn && virConnectClose(dconn) < 0)
|
||||
if (dconn && virConnectClose(dconn) < 0) {
|
||||
printf("error closing\n");
|
||||
}
|
||||
|
||||
printf("done\n");
|
||||
return 0;
|
||||
|
@@ -132,8 +132,9 @@ showDomains(virConnectPtr conn)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (numNames > 0)
|
||||
if (numNames > 0) {
|
||||
printf("Inactive domains:\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < numNames; i++) {
|
||||
printf(" %s\n", *(nameList + i));
|
||||
@@ -180,8 +181,9 @@ authCallback(virConnectCredentialPtr cred, unsigned int ncred, void *cbdata)
|
||||
case VIR_CRED_AUTHNAME:
|
||||
cred[i].result = strdup(authData->username);
|
||||
|
||||
if (cred[i].result == NULL)
|
||||
if (cred[i].result == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
cred[i].resultlen = strlen(cred[i].result);
|
||||
break;
|
||||
@@ -189,8 +191,9 @@ authCallback(virConnectCredentialPtr cred, unsigned int ncred, void *cbdata)
|
||||
case VIR_CRED_PASSPHRASE:
|
||||
cred[i].result = strdup(authData->password);
|
||||
|
||||
if (cred[i].result == NULL)
|
||||
if (cred[i].result == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
cred[i].resultlen = strlen(cred[i].result);
|
||||
break;
|
||||
|
@@ -1,118 +0,0 @@
|
||||
#!/usr/bin/stap --ldd -d /usr/sbin/libvirtd -c libvirtd
|
||||
#
|
||||
# Usage with installed libvirt daemon:
|
||||
# stap --ldd -d /usr/sbin/libvirtd -c libvirtd \
|
||||
# lock-debug.stp /usr/lib/libvirt.so
|
||||
#
|
||||
# If made executable; simple './lock-debug.stp' should work too.
|
||||
#
|
||||
# TODOs:
|
||||
#
|
||||
# Document usage with uninstalled daemon and libs. Assuming CWD is toplevel
|
||||
# source git directory, it should be only slight modification to the following:
|
||||
#
|
||||
# ./run stap --ldd -c daemon/libvirtd -d daemon/libvirtd
|
||||
# examples/systemtap/lock-debug.stp src/.libs/libvirt.so
|
||||
#
|
||||
# Debug RWLock mechanisms as well.
|
||||
#
|
||||
# Author: Martin Kletzander <mkletzan@redhat.com>
|
||||
|
||||
|
||||
global mx_tolock
|
||||
global mx_locked
|
||||
|
||||
|
||||
function filter()
|
||||
{
|
||||
if (pid() != target())
|
||||
return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
probe library = process( %( $# > 0 %? @1 %: "/usr/lib/libvirt.so" %) )
|
||||
{
|
||||
if (filter()) next
|
||||
}
|
||||
|
||||
probe lock = library.function("virMutexLock")
|
||||
{
|
||||
lockname = usymdata($m)
|
||||
}
|
||||
|
||||
probe unlock = library.function("virMutexUnlock")
|
||||
{
|
||||
lockname = usymdata($m)
|
||||
}
|
||||
|
||||
probe begin
|
||||
{
|
||||
%( $# > 1 %? println("error: Too many parameters"); exit();
|
||||
%: print("Started, press ^C when the proccess hangs\n"); %)
|
||||
}
|
||||
|
||||
probe lock.call
|
||||
{
|
||||
mx_tolock[lockname, tid()] = sprint_usyms(ubacktrace())
|
||||
}
|
||||
|
||||
probe lock.return
|
||||
{
|
||||
if ([lockname, tid()] in mx_tolock) {
|
||||
mx_locked[lockname, tid()] = mx_tolock[lockname, tid()]
|
||||
delete mx_tolock[lockname, tid()]
|
||||
} else {
|
||||
printf("internal error: lock acquired unwillingly?\n")
|
||||
}
|
||||
}
|
||||
|
||||
probe unlock.call
|
||||
{
|
||||
found = 0
|
||||
|
||||
foreach ([lock, tid] in mx_locked) {
|
||||
if (lock != lockname)
|
||||
continue
|
||||
if (tid != tid()) {
|
||||
printf("Warning: lock released on different thread that locked it.\n")
|
||||
printf("Lock trace:\n%s\n", mx_locked[lock, tid])
|
||||
printf("Unlock trace:\n%s\n", sprint_usyms(ubacktrace()))
|
||||
}
|
||||
|
||||
found = tid
|
||||
break
|
||||
}
|
||||
|
||||
if (found && [lockname, found] in mx_locked)
|
||||
delete mx_locked[lockname, found]
|
||||
}
|
||||
|
||||
probe end
|
||||
{
|
||||
tmp = 0
|
||||
|
||||
printf("\n=============\n")
|
||||
|
||||
foreach (bt1 = [lock1, tid1] in mx_tolock) {
|
||||
deadlock = 0
|
||||
|
||||
foreach (bt2 = [lock2, tid2] in mx_tolock) {
|
||||
if (lock1 == lock2) {
|
||||
if (!tmp++)
|
||||
printf("The following locks cannot be acquired:\n")
|
||||
|
||||
if (!deadlock++)
|
||||
printf("Lock %s was locked in thread %d with this trace:\n%s\n",
|
||||
lock1, tid1, bt1)
|
||||
|
||||
printf("and is waiting to be locked by thread %d here:\n%s\n",
|
||||
tid2, bt2)
|
||||
}
|
||||
}
|
||||
if (deadlock)
|
||||
printf("---\n")
|
||||
}
|
||||
if (!tmp)
|
||||
printf("No deadlocks found, sorry.\n")
|
||||
}
|
@@ -7,6 +7,7 @@
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<memory>524288</memory>
|
||||
<maxMemory>1524288</maxMemory>
|
||||
<vcpu>4</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
|
@@ -17,6 +17,7 @@
|
||||
<boot dev="hd"/>
|
||||
</os>
|
||||
<memory>524288</memory>
|
||||
<maxMemory>1524288</maxMemory>
|
||||
<vcpu>4</vcpu>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
|
@@ -5,7 +5,7 @@ index 209d64c..5ea72a1 100644
|
||||
@@ -1,4 +1,4 @@
|
||||
-# ssize_t.m4 serial 5 (gettext-0.18.2)
|
||||
+# ssize_t.m4 serial 6 (gettext-0.18.2)
|
||||
dnl Copyright (C) 2001-2003, 2006, 2010-2015 Free Software Foundation, Inc.
|
||||
dnl Copyright (C) 2001-2003, 2006, 2010-2014 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
@@ -17,7 +17,21 @@ AC_DEFUN([gt_TYPE_SSIZE_T],
|
||||
|
@@ -19,17 +19,6 @@
|
||||
virincdir = $(includedir)/libvirt
|
||||
|
||||
virinc_HEADERS = libvirt.h \
|
||||
libvirt-domain.h \
|
||||
libvirt-domain-snapshot.h \
|
||||
libvirt-event.h \
|
||||
libvirt-host.h \
|
||||
libvirt-interface.h \
|
||||
libvirt-network.h \
|
||||
libvirt-nodedev.h \
|
||||
libvirt-nwfilter.h \
|
||||
libvirt-secret.h \
|
||||
libvirt-storage.h \
|
||||
libvirt-stream.h \
|
||||
libvirt-lxc.h \
|
||||
libvirt-qemu.h \
|
||||
virterror.h
|
||||
|
@@ -1,212 +0,0 @@
|
||||
/*
|
||||
* libvirt-domain-snapshot.h
|
||||
* Summary: APIs for management of domain snapshots
|
||||
* Description: Provides APIs for the management of domain snapshots
|
||||
* Author: Daniel Veillard <veillard@redhat.com>
|
||||
*
|
||||
* Copyright (C) 2006-2014 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __VIR_LIBVIRT_DOMAIN_SNAPSHOT_H__
|
||||
# define __VIR_LIBVIRT_DOMAIN_SNAPSHOT_H__
|
||||
|
||||
# ifndef __VIR_LIBVIRT_H_INCLUDES__
|
||||
# error "Don't include this file directly, only use libvirt/libvirt.h"
|
||||
# endif
|
||||
|
||||
/**
|
||||
* virDomainSnapshot:
|
||||
*
|
||||
* a virDomainSnapshot is a private structure representing a snapshot of
|
||||
* a domain.
|
||||
*/
|
||||
typedef struct _virDomainSnapshot virDomainSnapshot;
|
||||
|
||||
/**
|
||||
* virDomainSnapshotPtr:
|
||||
*
|
||||
* a virDomainSnapshotPtr is pointer to a virDomainSnapshot private structure,
|
||||
* and is the type used to reference a domain snapshot in the API.
|
||||
*/
|
||||
typedef virDomainSnapshot *virDomainSnapshotPtr;
|
||||
|
||||
const char *virDomainSnapshotGetName(virDomainSnapshotPtr snapshot);
|
||||
virDomainPtr virDomainSnapshotGetDomain(virDomainSnapshotPtr snapshot);
|
||||
virConnectPtr virDomainSnapshotGetConnect(virDomainSnapshotPtr snapshot);
|
||||
|
||||
typedef enum {
|
||||
VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE = (1 << 0), /* Restore or alter
|
||||
metadata */
|
||||
VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT = (1 << 1), /* With redefine, make
|
||||
snapshot current */
|
||||
VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA = (1 << 2), /* Make snapshot without
|
||||
remembering it */
|
||||
VIR_DOMAIN_SNAPSHOT_CREATE_HALT = (1 << 3), /* Stop running guest
|
||||
after snapshot */
|
||||
VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY = (1 << 4), /* disk snapshot, not
|
||||
system checkpoint */
|
||||
VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT = (1 << 5), /* reuse any existing
|
||||
external files */
|
||||
VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE = (1 << 6), /* use guest agent to
|
||||
quiesce all mounted
|
||||
file systems within
|
||||
the domain */
|
||||
VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC = (1 << 7), /* atomically avoid
|
||||
partial changes */
|
||||
VIR_DOMAIN_SNAPSHOT_CREATE_LIVE = (1 << 8), /* create the snapshot
|
||||
while the guest is
|
||||
running */
|
||||
} virDomainSnapshotCreateFlags;
|
||||
|
||||
/* Take a snapshot of the current VM state */
|
||||
virDomainSnapshotPtr virDomainSnapshotCreateXML(virDomainPtr domain,
|
||||
const char *xmlDesc,
|
||||
unsigned int flags);
|
||||
|
||||
/* Dump the XML of a snapshot */
|
||||
char *virDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
|
||||
unsigned int flags);
|
||||
|
||||
/**
|
||||
* virDomainSnapshotListFlags:
|
||||
*
|
||||
* Flags valid for virDomainSnapshotNum(),
|
||||
* virDomainSnapshotListNames(), virDomainSnapshotNumChildren(), and
|
||||
* virDomainSnapshotListChildrenNames(), virDomainListAllSnapshots(),
|
||||
* and virDomainSnapshotListAllChildren(). Note that the interpretation
|
||||
* of flag (1<<0) depends on which function it is passed to; but serves
|
||||
* to toggle the per-call default of whether the listing is shallow or
|
||||
* recursive. Remaining bits come in groups; if all bits from a group are
|
||||
* 0, then that group is not used to filter results. */
|
||||
typedef enum {
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_ROOTS = (1 << 0), /* Filter by snapshots
|
||||
with no parents, when
|
||||
listing a domain */
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS = (1 << 0), /* List all descendants,
|
||||
not just children, when
|
||||
listing a snapshot */
|
||||
|
||||
/* For historical reasons, groups do not use contiguous bits. */
|
||||
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_LEAVES = (1 << 2), /* Filter by snapshots
|
||||
with no children */
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES = (1 << 3), /* Filter by snapshots
|
||||
that have children */
|
||||
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_METADATA = (1 << 1), /* Filter by snapshots
|
||||
which have metadata */
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA = (1 << 4), /* Filter by snapshots
|
||||
with no metadata */
|
||||
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE = (1 << 5), /* Filter by snapshots
|
||||
taken while guest was
|
||||
shut off */
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE = (1 << 6), /* Filter by snapshots
|
||||
taken while guest was
|
||||
active, and with
|
||||
memory state */
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY = (1 << 7), /* Filter by snapshots
|
||||
taken while guest was
|
||||
active, but without
|
||||
memory state */
|
||||
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL = (1 << 8), /* Filter by snapshots
|
||||
stored internal to
|
||||
disk images */
|
||||
VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL = (1 << 9), /* Filter by snapshots
|
||||
that use files external
|
||||
to disk images */
|
||||
} virDomainSnapshotListFlags;
|
||||
|
||||
/* Return the number of snapshots for this domain */
|
||||
int virDomainSnapshotNum(virDomainPtr domain, unsigned int flags);
|
||||
|
||||
/* Get the names of all snapshots for this domain */
|
||||
int virDomainSnapshotListNames(virDomainPtr domain, char **names, int nameslen,
|
||||
unsigned int flags);
|
||||
|
||||
/* Get all snapshot objects for this domain */
|
||||
int virDomainListAllSnapshots(virDomainPtr domain,
|
||||
virDomainSnapshotPtr **snaps,
|
||||
unsigned int flags);
|
||||
|
||||
/* Return the number of child snapshots for this snapshot */
|
||||
int virDomainSnapshotNumChildren(virDomainSnapshotPtr snapshot,
|
||||
unsigned int flags);
|
||||
|
||||
/* Get the names of all child snapshots for this snapshot */
|
||||
int virDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot,
|
||||
char **names, int nameslen,
|
||||
unsigned int flags);
|
||||
|
||||
/* Get all snapshot object children for this snapshot */
|
||||
int virDomainSnapshotListAllChildren(virDomainSnapshotPtr snapshot,
|
||||
virDomainSnapshotPtr **snaps,
|
||||
unsigned int flags);
|
||||
|
||||
/* Get a handle to a named snapshot */
|
||||
virDomainSnapshotPtr virDomainSnapshotLookupByName(virDomainPtr domain,
|
||||
const char *name,
|
||||
unsigned int flags);
|
||||
|
||||
/* Check whether a domain has a snapshot which is currently used */
|
||||
int virDomainHasCurrentSnapshot(virDomainPtr domain, unsigned int flags);
|
||||
|
||||
/* Get a handle to the current snapshot */
|
||||
virDomainSnapshotPtr virDomainSnapshotCurrent(virDomainPtr domain,
|
||||
unsigned int flags);
|
||||
|
||||
/* Get a handle to the parent snapshot, if one exists */
|
||||
virDomainSnapshotPtr virDomainSnapshotGetParent(virDomainSnapshotPtr snapshot,
|
||||
unsigned int flags);
|
||||
|
||||
/* Determine if a snapshot is the current snapshot of its domain. */
|
||||
int virDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
|
||||
unsigned int flags);
|
||||
|
||||
/* Determine if a snapshot has associated libvirt metadata that would
|
||||
* prevent the deletion of its domain. */
|
||||
int virDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
|
||||
unsigned int flags);
|
||||
|
||||
typedef enum {
|
||||
VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING = 1 << 0, /* Run after revert */
|
||||
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED = 1 << 1, /* Pause after revert */
|
||||
VIR_DOMAIN_SNAPSHOT_REVERT_FORCE = 1 << 2, /* Allow risky reverts */
|
||||
} virDomainSnapshotRevertFlags;
|
||||
|
||||
/* Revert the domain to a point-in-time snapshot. The
|
||||
* state of the guest after this call will be the state
|
||||
* of the guest when the snapshot in question was taken
|
||||
*/
|
||||
int virDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
|
||||
unsigned int flags);
|
||||
|
||||
/* Delete a snapshot */
|
||||
typedef enum {
|
||||
VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN = (1 << 0), /* Also delete children */
|
||||
VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY = (1 << 1), /* Delete just metadata */
|
||||
VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY = (1 << 2), /* Delete just children */
|
||||
} virDomainSnapshotDeleteFlags;
|
||||
|
||||
int virDomainSnapshotDelete(virDomainSnapshotPtr snapshot,
|
||||
unsigned int flags);
|
||||
|
||||
int virDomainSnapshotRef(virDomainSnapshotPtr snapshot);
|
||||
int virDomainSnapshotFree(virDomainSnapshotPtr snapshot);
|
||||
|
||||
#endif /* __VIR_LIBVIRT_DOMAIN_SNAPSHOT_H__ */
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user