1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-09-20 05:44:53 +03:00

Compare commits

..

9 Commits

Author SHA1 Message Date
Ján Tomko
e433008df4 api: disallow virConnectGetDomainCapabilities on read-only connections
This API can be used to execute arbitrary emulators.
Forbid it on read-only connections.

Fixes: CVE-2019-10167
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 8afa68bac0)
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-24 10:26:37 +02:00
Ján Tomko
221397df7a api: disallow virDomainSaveImageGetXMLDesc on read-only connections
The virDomainSaveImageGetXMLDesc API is taking a path parameter,
which can point to any path on the system. This file will then be
read and parsed by libvirtd running with root privileges.

Forbid it on read-only connections.

Fixes: CVE-2019-10161
Reported-by: Matthias Gerstner <mgerstner@suse.de>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit aed6a032ce)
Signed-off-by: Ján Tomko <jtomko@redhat.com>

Conflicts:
  src/libvirt-domain.c
  src/remote/remote_protocol.x

Upstream commit 12a51f372 which introduced the VIR_DOMAIN_SAVE_IMAGE_XML_SECURE
alias for VIR_DOMAIN_XML_SECURE is not backported.
Just skip the commit since we now disallow the whole API on read-only
connections, regardless of the flag.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-24 10:26:37 +02:00
Pavel Hrdina
69acd088d6 build: add GCC 6.0 -Wlogical-op workaround
fdstream.c: In function 'virFDStreamWrite':
fdstream.c:390:29: error: logical 'or' of equal expressions [-Werror=logical-op]
        if (errno == EAGAIN || errno == EWOULDBLOCK) {
                            ^~

Fedora rawhide now uses gcc 6.0 and there is a bug with -Wlogical-op
producing false warnings.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602

Use GCC pragma push/pop and ignore -Wlogical-op for GCC that supports
push/pop pragma and also has this bug.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit d713a6b120)
2016-10-03 18:30:26 +02:00
Michal Privoznik
b1bae2976d Initialize couple of variables.
While trying to build with -Os couple of compile errors showed
up.

conf/domain_conf.c: In function 'virDomainChrRemove':
conf/domain_conf.c:13666:24: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     virDomainChrDefPtr ret, **arrPtr = NULL;
                        ^
Compiler fails to see that @ret is used only if set in the loop,
but whatever, there's no harm in initializing the variable.

In vboxAttachDrivesNew and _vboxAttachDrivesOld compiler thinks
that @rc may be used uninitialized. Well, not directly, but maybe
after some optimization. Yet again, no harm in initializing a
variable.

In file included from ./util/virthread.h:26:0,
                 from ./datatypes.h:28,
                 from vbox/vbox_tmpl.c:43,
                 from vbox/vbox_V3_1.c:37:
vbox/vbox_tmpl.c: In function '_vboxAttachDrivesOld':
./util/virerror.h:181:5: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     virReportErrorHelper(VIR_FROM_THIS, code, __FILE__,              \
     ^
In file included from vbox/vbox_V3_1.c:37:0:
vbox/vbox_tmpl.c:1041:14: note: 'rc' was declared here
     nsresult rc;
              ^
Yet again, one uninitialized variable:

qemu/qemu_driver.c: In function 'qemuDomainBlockCommit':
qemu/qemu_driver.c:17194:9: error: 'baseSource' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         qemuDomainPrepareDiskChainElement(driver, vm, baseSource,
         ^

And another one:

storage/storage_backend_logical.c: In function 'virStorageBackendLogicalMatchPoolSource.isra.2':
storage/storage_backend_logical.c:618:33: error: 'thisSource' may be used uninitialized in this function [-Werror=maybe-uninitialized]
                       thisSource->devices[j].path))
                                 ^

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit bde6e002b5)
2016-10-03 18:30:24 +02:00
Pavel Hrdina
34807c1f4e maint: fix syntax-check sc_prohibit_int_ijk exclude rule
Fix the regex for excluding files for this syntax-rule.  The rule "include/"
will not work, because we are matching the whole line like this
"^(...|include/|...)$ so we need to use "include/libvirt/libvirt.+".  The second
issue is that we are using only one '$' but there should be two of those at the
end.  The last small adjustment is to escape dots '.' so it match only dot.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit a94efa50e2)
2016-10-03 18:30:19 +02:00
Marc Hartmayer
b18d0b4e43 util: bitmap: clarify virBitmapLastSetBit() behavior for empty bitmaps
Before the variable 'bits' was initialized with 0 (commit
3470cd860d), the following bug was
possible.

A function call with an empty bitmap leads to undefined
behavior. Because if 'bitmap->map_len == 0' 'unusedBits' will be <= 0
and 'sz == 1'. So the non global and non static variable 'bits' would
have never been set. Consequently the check 'bits == 0' results in
undefined behavior.

This patch clarifies the current version of the function by handling the
empty bitmap explicitly. Also, for an empty bitmap there is obviously no
bit set so we can just return -1 (indicating no bit set) right away. The
explicit check for 'bits == 0' after the loop is unnecessary because we
only get to this point if no set bit was found.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
(cherry picked from commit 7cd01a248b)
2016-10-03 18:30:16 +02:00
Martin Kletzander
409362b048 Fix building with -Og
When building using -Og, gcc sees that some variables can be used
uninitialized  It can be debatable whether it is possible with our
codeflow, but functions should be self-contained and initializations are
always good.  The return instead of goto is due to actualType being used
in the cleanup.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 3470cd860d)
2016-10-03 18:29:29 +02:00
Martin Kletzander
756f518213 qemu: Only use memory-backend-file with NUMA if needed
If this reminds you of a commit message from around a year ago, it's
41c2aa729f and yes, we're dealing with
"the same thing" again.  Or f309db1f4d and
it's similar.

There is a logic in place that if there is no real need for
memory-backend-file, qemuBuildMemoryBackendStr() returns 0.  However
that wasn't the case with hugepage backing.  The reason for that was
that we abused the 'pagesize' variable for storing that information, but
we should rather have a separate one that specifies whether we really
need the new object for hugepage backing.  And that variable should be
set only if this particular NUMA cell needs special treatment WRT
hugepages.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1372153

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 4372a7845acbc6974f6027ef68e7dd3eeb47f425)
2016-10-03 18:29:18 +02:00
Jiri Denemark
c9317fcdd4 qemu: Let empty default VNC password work as documented
CVE-2016-5008

Setting an empty graphics password is documented as a way to disable
VNC/SPICE access, but QEMU does not always behaves like that. VNC would
happily accept the empty password. Let's enforce the behavior by setting
password expiration to "now".

https://bugzilla.redhat.com/show_bug.cgi?id=1180092

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit bb848feec0)
2016-07-04 10:16:18 +01:00
5047 changed files with 891709 additions and 2446225 deletions

37
.gitignore vendored
View File

@@ -1,7 +1,5 @@
*#*#
*.#*#
*.[18]
*.[18].in
*.a
*.cov
*.exe
@@ -11,7 +9,6 @@
*.gcov
*.html
*.i
*.init
*.la
*.lo
*.loT
@@ -21,8 +18,6 @@
*.pyc
*.rej
*.s
*.service
*.socket
*.swp
*~
.#*
@@ -43,6 +38,7 @@
/NEWS
/aclocal.m4
/autom4te.cache
/build-aux
/build-aux/
/build/
/confdefs.h
@@ -61,7 +57,13 @@
/daemon/libvirt_qemud
/daemon/libvirtd
/daemon/libvirtd*.logrotate
/daemon/libvirtd.8
/daemon/libvirtd.8.in
/daemon/libvirtd.init
/daemon/libvirtd.pod
/daemon/libvirtd.policy
/daemon/libvirtd.service
/daemon/libvirtd.socket
/daemon/test_libvirtd.aug
/docs/aclperms.htmlinc
/docs/apibuild.py.stamp
@@ -74,12 +76,6 @@
/docs/libvirt-refs.xml
/docs/search.php
/docs/todo.html.in
/examples/admin/client_close
/examples/admin/client_info
/examples/admin/client_limits
/examples/admin/list_clients
/examples/admin/list_servers
/examples/admin/threadpool_params
/examples/object-events/event-test
/examples/dominfo/info1
/examples/domsuspend/suspend
@@ -93,7 +89,7 @@
/gnulib/tests/*
/include/libvirt/libvirt-common.h
/libtool
/libvirt-*.tar.xz
/libvirt-*.tar.gz
/libvirt-[0-9]*
/libvirt*.pc
/libvirt.spec
@@ -160,23 +156,29 @@
/src/util/virkeymaps.h
/src/virt-aa-helper
/src/virtlockd
/src/virtlockd.8
/src/virtlockd.8.in
/src/virtlockd.init
/src/virtlogd
/src/virtlogd.8
/src/virtlogd.8.in
/src/virtlogd.init
/tests/*.log
/tests/*.pid
/tests/*.trs
/tests/*test
/tests/commandhelper
/tests/qemucapsprobe
!/tests/virsh-self-test
/tests/*test
!/tests/*schematest
!/tests/virt-aa-helper-test
!/tests/virt-admin-self-test
/tests/objectlocking
/tests/objectlocking-files.txt
/tests/objectlocking.cm[ix]
/tests/reconnect
/tests/ssh
/tests/test_file_access.txt
/tests/test_conf
/tools/*.[18]
/tools/libvirt-guests.init
/tools/libvirt-guests.service
/tools/libvirt-guests.sh
/tools/virt-login-shell
/tools/virsh
@@ -203,7 +205,6 @@ stamp-h
stamp-h.in
stamp-h1
tags
!/build-aux/*.pl
!/gnulib/lib/Makefile.am
!/gnulib/tests/Makefile.am
!/m4/virt-*.m4

Submodule .gnulib updated: e89b4a7aef...6cc32c63e8

21
HACKING
View File

@@ -23,11 +23,19 @@ libvirt-python) online <http://libvirt.org/git/>.
join the appropriate language team. The libvirt release process automatically
pulls the latest version of each translation file from zanata.
(4) Post patches using "git send-email", with git rename detection enabled. You
(4) Post patches in unified diff format, with git rename detection enabled. You
need a one-time setup of:
git config diff.renames true
After that, a command similar to this should work:
diff -urp libvirt.orig/ libvirt.modified/ > libvirt-myfeature.patch
or:
git diff > libvirt-myfeature.patch
Also, for code motion patches, you may find that "git diff --patience"
provides an easier-to-read patch. However, the usual workflow of libvirt
developer is:
@@ -144,17 +152,6 @@ There is also a "./run" script at the top level, to make it easier to run
programs that have not yet been installed, as well as to wrap invocations of
various tests under gdb or Valgrind.
When running our test suite it may happen that the test result is
nondeterministic because of the test suite relying on a particular file in the
system being accessible or having some specific value. To catch this kind of
errors, the test suite has a module for that prints any path touched that
fulfils constraints described above into a file. To enable it just set
"VIR_TEST_FILE_ACCESS" environment variable. Then
"VIR_TEST_FILE_ACCESS_OUTPUT" environment variable can alter location where
the file is stored.
VIR_TEST_FILE_ACCESS=1 VIR_TEST_FILE_ACCESS_OUTPUT="/tmp/file_access.txt" ./qemuxml2argvtest
(9) The Valgrind test should produce similar output to "make check". If the output

View File

@@ -19,12 +19,9 @@
LCOV = lcov
GENHTML = genhtml
SUBDIRS = . gnulib/lib include/libvirt src daemon tools docs gnulib/tests \
SUBDIRS = . gnulib/lib include src daemon tools docs gnulib/tests \
tests po examples
XZ_OPT ?= -v -T0
export XZ_OPT
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = \
@@ -44,7 +41,7 @@ EXTRA_DIST = \
AUTHORS.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc libvirt-admin.pc
pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc
NEWS: $(top_srcdir)/docs/news.xsl $(top_srcdir)/docs/news.html.in
$(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \
@@ -66,15 +63,12 @@ $(top_srcdir)/HACKING: $(top_srcdir)/docs/hacking1.xsl \
> $@-t && mv $@-t $@ ; fi;
rpm: clean
@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.xz)
@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz)
check-local: all tests
check-access:
@($(MAKE) $(AM_MAKEFLAGS) -C tests check-access)
cov: clean-cov
$(MKDIR_P) $(top_builddir)/coverage
mkdir $(top_builddir)/coverage
$(LCOV) -c -o $(top_builddir)/coverage/libvirt.info.tmp \
-d $(top_builddir)/src -d $(top_builddir)/daemon \
-d $(top_builddir)/tests
@@ -89,6 +83,9 @@ clean-cov:
MAINTAINERCLEANFILES = .git-module-status
# disable this check
distuninstallcheck:
dist-hook: gen-ChangeLog gen-AUTHORS
# Generate the ChangeLog file (with all entries since the switch to git)

View File

@@ -113,11 +113,3 @@ NON_REENTRANT += inet_nsap_ntoa
NON_REENTRANT += inet_ntoa
NON_REENTRANT += inet_ntop
NON_REENTRANT += inet_pton
# Separate two nothings by space to get one space in a variable
space =
space +=
# The space needs to be in a variable otherwise it would be ignored.
# And there must be no spaces around the commas because they would
# not be ignored, logically.
NON_REENTRANT_RE=$(subst $(space),|,$(NON_REENTRANT))

View File

@@ -56,7 +56,7 @@ exec 3>&-
test "$st" = 0
test -x /usr/bin/lcov && make cov
rm -f *.tar.xz
rm -f *.tar.gz
make dist
if test -n "$AUTOBUILD_COUNTER" ; then

View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
scriptversion=2016-01-24.06; # UTC
scriptversion=2014-12-08.12; # UTC
# Bootstrap this package from checked-out sources.
@@ -42,7 +42,7 @@ export LC_ALL
local_gl_dir=gl
# Honor $PERL, but work even if there is none.
# Honour $PERL, but work even if there is none
PERL="${PERL-perl}"
me=$0
@@ -1021,6 +1021,6 @@ echo "$0: done. Now you can run './configure'."
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@@ -54,7 +54,6 @@ func
getaddrinfo
getcwd-lgpl
gethostname
getopt-posix
getpass
getpeername
getsockname
@@ -121,7 +120,6 @@ time_r
timegm
ttyname_r
uname
unsetenv
useless-if-before-free
usleep
vasprintf
@@ -209,6 +207,7 @@ gzip -
libtool -
patch -
perl 5.5
perl::XML::XPath -
pkg-config -
rpcgen -
tar -

View File

@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# check-spacing.pl: Report any usage of 'function (..args..)'
# bracket-spacing.pl: Report any usage of 'function (..args..)'
# Also check for other syntax issues, such as correct use of ';'
#
# This library is free software; you can redistribute it and/or
@@ -43,7 +43,7 @@ foreach my $file (@ARGV) {
$data =~ s/'[";,=]'/'X'/g;
# Kill any quoted strings
$data =~ s,"(?:[^\\\"]|\\.)*","XXX",g;
$data =~ s,"([^\\\"]|\\.)*","XXX",g;
# Kill any C++ style comments
$data =~ s,//.*$,//,;
@@ -91,8 +91,8 @@ foreach my $file (@ARGV) {
my $kw = $1;
# Allow space after keywords only
if ($kw =~ /^(?:if|for|while|switch|return)$/) {
$tmpdata =~ s/(?:$kw\s\()/XXX(/;
if ($kw =~ /^(if|for|while|switch|return)$/) {
$tmpdata =~ s/($kw\s\()/XXX(/;
} else {
print "Whitespace after non-keyword:\n";
print "$file:$.: $line";
@@ -101,8 +101,10 @@ foreach my $file (@ARGV) {
}
}
# Require whitespace immediately after keywords
if ($data =~ /\b(?:if|for|while|switch|return)\(/) {
# 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";
print "$file:$.: $line";
$ret = 1;
@@ -116,10 +118,8 @@ foreach my $file (@ARGV) {
}
# Forbid whitespace following ( or prior to )
# but allow whitespace before ) on a single line
# (optionally followed by a semicolon)
if (($data =~ /\s\)/ && not $data =~ /^\s+\);?$/) ||
$data =~ /\((?!$)\s/) {
if ($data =~ /\S\s+\)/ ||
$data =~ /\(\s+\S/) {
print "Whitespace after '(' or before ')':\n";
print "$file:$.: $line";
$ret = 1;
@@ -135,13 +135,10 @@ foreach my $file (@ARGV) {
# errno == EINTR)
# ;
#
if ($data =~ /\s[;,]/) {
unless ($data =~ /\S; ; / ||
$data =~ /^\s+;/) {
print "Whitespace before semicolon or comma:\n";
print "$file:$.: $line";
$ret = 1;
}
if ($data =~ /[^;\s]\s+[;,]/) {
print "Whitespace before (semi)colon:\n";
print "$file:$.: $line";
$ret = 1;
}
# Require EOL, macro line continuation, or whitespace after ";".
@@ -160,8 +157,11 @@ foreach my $file (@ARGV) {
}
# Require spaces around assignment '=', compounds and '=='
if ($data =~ /[^ ]\b[!<>&|\-+*\/%\^=]?=/ ||
$data =~ /=[^= \\\n]/) {
# with the exception of virAssertCmpInt()
$tmpdata = $data;
$tmpdata =~ s/(virAssertCmpInt\(.* ).?=,/$1op,/;
if ($tmpdata =~ /[^ ]\b[!<>&|\-+*\/%\^=]?=[^=]/ ||
$tmpdata =~ /=[^= \\\n]/) {
print "Spacing around '=' or '==':\n";
print "$file:$.: $line";
$ret = 1;

View File

@@ -1,26 +0,0 @@
#!/usr/bin/perl
use strict;
my $file = " ";
my $ret = 0;
my %includes = ( );
my $lineno = 0;
while (<>) {
if (not $file eq $ARGV) {
%includes = ( );
$file = $ARGV;
$lineno = 0;
}
$lineno++;
if (/^# *include *[<"]([^>"]*\.h)[">]/) {
$includes{$1}++;
if ($includes{$1} == 2) {
$ret = 1;
print STDERR "$ARGV:$lineno: $_";
print STDERR "Do not include a header more than once per file\n";
}
}
}
exit $ret;

202
cfg.mk
View File

@@ -64,7 +64,6 @@ local-checks-to-skip = \
sc_prohibit_quote_without_use \
sc_prohibit_quotearg_without_use \
sc_prohibit_stat_st_blocks \
sc_prohibit_undesirable_word_seq \
sc_root_tests \
sc_space_tab \
sc_sun_os_names \
@@ -309,7 +308,7 @@ sc_flags_usage:
| grep -c '\(long\|unsigned\) flags')" != 4 && \
{ echo '$(ME): new API should use "unsigned int flags"' 1>&2; \
exit 1; } || :
@prohibit=' flags ATTRIBUTE_UNUSED' \
@prohibit=' flags ''ATTRIBUTE_UNUSED' \
halt='flags should be checked with virCheckFlags' \
$(_sc_search_regexp)
@prohibit='^[^@]*([^d] (int|long long)|[^dg] long) flags[;,)]' \
@@ -352,8 +351,8 @@ sc_prohibit_mkstemp:
# access with X_OK accepts directories, but we can't exec() those.
# access with F_OK or R_OK is okay, though.
sc_prohibit_access_xok:
@prohibit='access(at)? *\(.*X_OK' \
halt='use virFileIsExecutable instead of access(,X_OK)' \
@prohibit='access''(at)? *\(.*X_OK' \
halt='use virFileIsExecutable instead of access''(,X_OK)' \
$(_sc_search_regexp)
# Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
@@ -362,7 +361,7 @@ snp_ = strncmp *\(.+\)
sc_prohibit_strncmp:
@prohibit='! *strncmp *\(|\<$(snp_) *[!=]=|[!=]= *$(snp_)' \
exclude=':# *define STR(N?EQLEN|PREFIX)\(' \
halt='use STREQLEN or STRPREFIX instead of strncmp' \
halt='use STREQLEN or STRPREFIX instead of str''ncmp' \
$(_sc_search_regexp)
# strtol and friends are too easy to misuse
@@ -380,7 +379,7 @@ sc_prohibit_strtol:
# But for plain %s, virAsprintf is overkill compared to strdup.
sc_prohibit_asprintf:
@prohibit='\<v?a[s]printf\>' \
halt='use virAsprintf, not asprintf' \
halt='use virAsprintf, not as'printf \
$(_sc_search_regexp)
@prohibit='virAsprintf.*, *"%s",' \
halt='use VIR_STRDUP instead of virAsprintf with "%s"' \
@@ -407,7 +406,7 @@ sc_prohibit_risky_id_promotion:
# since gnulib has more guarantees for snprintf portability
sc_prohibit_sprintf:
@prohibit='\<[s]printf\>' \
halt='use snprintf, not sprintf' \
halt='use snprintf, not s'printf \
$(_sc_search_regexp)
sc_prohibit_readlink:
@@ -421,9 +420,9 @@ sc_prohibit_gethostname:
$(_sc_search_regexp)
sc_prohibit_readdir:
@prohibit='\b(read|close|open)dir *\(' \
@prohibit='\breaddir *\(' \
exclude='exempt from syntax-check' \
halt='use virDirOpen, virDirRead and VIR_DIR_CLOSE' \
halt='use virDirRead, not readdir' \
$(_sc_search_regexp)
sc_prohibit_gettext_noop:
@@ -432,36 +431,43 @@ sc_prohibit_gettext_noop:
$(_sc_search_regexp)
sc_prohibit_VIR_ERR_NO_MEMORY:
@prohibit='\<VIR_ERR_NO_MEMORY\>' \
halt='use virReportOOMError, not VIR_ERR_NO_MEMORY' \
@prohibit='\<V''IR_ERR_NO_MEMORY\>' \
halt='use virReportOOMError, not V'IR_ERR_NO_MEMORY \
$(_sc_search_regexp)
sc_prohibit_PATH_MAX:
@prohibit='\<PATH_MAX\>' \
halt='dynamically allocate paths, do not use PATH_MAX' \
@prohibit='\<P''ATH_MAX\>' \
halt='dynamically allocate paths, do not use P'ATH_MAX \
$(_sc_search_regexp)
# Use a subshell for each function, to give the optimal warning message.
include $(srcdir)/Makefile.nonreentrant
sc_prohibit_nonreentrant:
@prohibit="\\<(${NON_REENTRANT_RE}) *\\(" \
halt="use re-entrant functions (usually ending with _r)" \
$(_sc_search_regexp)
@fail=0 ; \
for i in $(NON_REENTRANT) ; \
do \
(prohibit="\\<$$i *\\(" \
halt="use $${i}_r, not $$i" \
$(_sc_search_regexp) \
) || fail=1; \
done ; \
exit $$fail
sc_prohibit_select:
@prohibit='\<select *\(' \
halt='use poll(), not select()' \
@prohibit="\\<select *\\(" \
halt="use poll(), not se""lect()" \
$(_sc_search_regexp)
# Prohibit the inclusion of <ctype.h>.
sc_prohibit_ctype_h:
@prohibit='^# *include *<ctype\.h>' \
halt='use c-ctype.h instead of ctype.h' \
halt="don't use ctype.h; instead, use c-ctype.h" \
$(_sc_search_regexp)
# Insist on correct types for [pug]id.
sc_correct_id_types:
@prohibit='\<(int|long) *[pug]id\>' \
halt='use pid_t for pid, uid_t for uid, gid_t for gid' \
halt="use pid_t for pid, uid_t for uid, gid_t for gid" \
$(_sc_search_regexp)
# "const fooPtr a" is the same as "foo * const a", even though it is
@@ -497,12 +503,12 @@ ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
sc_avoid_ctype_macros:
@prohibit='\b($(ctype_re)) *\(' \
halt='use c-ctype.h instead of ctype macros' \
halt="don't use ctype macros (use c-ctype.h)" \
$(_sc_search_regexp)
sc_avoid_strcase:
@prohibit='\bstrn?case(cmp|str) *\(' \
halt='use c-strcase.h instead of raw strcase functions' \
halt="don't use raw strcase functions (use c-strcase instead)" \
$(_sc_search_regexp)
sc_prohibit_virBufferAdd_with_string_literal:
@@ -520,6 +526,13 @@ sc_forbid_manual_xml_indent:
halt='use virBufferAdjustIndent instead of spaces when indenting xml' \
$(_sc_search_regexp)
# Not only do they fail to deal well with ipv6, but the gethostby*
# functions are also not thread-safe.
sc_prohibit_gethostby:
@prohibit='\<gethostby(addr|name2?) *\(' \
halt='use getaddrinfo, not gethostby*' \
$(_sc_search_regexp)
# dirname and basename from <libgen.h> are not required to be thread-safe
sc_prohibit_libgen:
@prohibit='( (base|dir)name *\(|include .libgen\.h)' \
@@ -565,7 +578,7 @@ sc_prohibit_int_ijk:
sc_prohibit_loop_iijjkk:
@prohibit='\<(int|unsigned) ([^=]+ )*(ii|jj|kk)\>(\s|,|;)' \
halt='use i, j, k for loop iterators, not ii, jj, kk' \
halt='use i, j, k for loop iterators, not ii, jj, kk' \
$(_sc_search_regexp)
# RHEL 5 gcc can't grok "for (int i..."
@@ -607,9 +620,8 @@ msg_gen_function += xenapiSessionErrorHandler
# msg_gen_function += vshPrint
# msg_gen_function += vshError
space =
space +=
func_re= ($(subst $(space),|,$(msg_gen_function)))
func_or := $(shell echo $(msg_gen_function)|tr -s ' ' '|')
func_re := ($(func_or))
# Look for diagnostics that aren't marked for translation.
# This won't find any for which error's format string is on a separate line.
@@ -731,7 +743,7 @@ sc_copyright_format:
@prohibit='Copyright [^(].*Red 'Hat \
halt='consistently use (C) in Red Hat copyright' \
$(_sc_search_regexp)
@prohibit='\<RedHat\>' \
@prohibit='\<Red''Hat\>' \
halt='spell Red Hat as two words' \
$(_sc_search_regexp)
@@ -798,7 +810,7 @@ sc_require_enum_last_marker:
sc_prohibit_semicolon_at_eol_in_python:
@prohibit='^[^#].*\;$$' \
in_vc_files='\.py$$' \
halt='python does not require to end lines with a semicolon' \
halt="Don't use semicolon at eol in python files" \
$(_sc_search_regexp)
# mymain() in test files should use return, not exit, for nicer output
@@ -808,6 +820,30 @@ sc_prohibit_exit_in_tests:
halt='use return, not exit(), in tests' \
$(_sc_search_regexp)
# Don't include duplicate header in the source (either *.c or *.h)
sc_prohibit_duplicate_header:
@fail=0; for i in $$($(VC_LIST_EXCEPT) | grep '\.[chx]$$'); do \
awk '/# *include.*\.h/ { \
match($$0, /[<"][^>"]*[">]/); \
arr[substr($$0, RSTART + 1, RLENGTH - 2)]++; \
} \
END { \
for (key in arr) { \
if (arr[key] > 1) { \
fail=1; \
printf("%d %s are included\n", arr[key], key); \
} \
} \
if (fail == 1) { \
printf("duplicate header(s) in " FILENAME "\n"); \
exit 1; \
} \
}' $$i || fail=1; \
done; \
if test $$fail -eq 1; then \
{ echo '$(ME): avoid duplicate headers' 1>&2; exit 1; } \
fi;
# Don't include "libvirt/*.h" in "" form.
sc_prohibit_include_public_headers_quote:
@prohibit='# *include *"libvirt/.*\.h"' \
@@ -881,7 +917,7 @@ sc_prohibit_virConnectOpen_in_virsh:
sc_require_space_before_label:
@prohibit='^( ?)?[_a-zA-Z0-9]+:$$' \
in_vc_files='\.[ch]$$' \
halt='Top-level labels should be indented by one space' \
halt="Top-level labels should be indented by one space" \
$(_sc_search_regexp)
# Allow for up to three spaces before the label: this is to avoid running
@@ -890,14 +926,14 @@ sc_require_space_before_label:
sc_prohibit_space_in_label:
@prohibit='^ {0,3}[_a-zA-Z0-9]+ +:$$' \
in_vc_files='\.[ch]$$' \
halt='There should be no space between label name and colon' \
halt="There should be no space between label name and colon" \
$(_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' \
halt="if one side of if-else uses {}, both sides must use it" \
$(_sc_search_regexp)
sc_curly_braces_style:
@@ -957,7 +993,7 @@ sc_prohibit_static_zero_init:
sc_prohibit_devname:
@prohibit='\bdevname\b' \
exclude='sc_prohibit_devname' \
halt='avoid using devname as FreeBSD exports the symbol' \
halt='avoid using 'devname' as FreeBSD exports the symbol' \
$(_sc_search_regexp)
sc_prohibit_system_error_with_vir_err:
@@ -971,7 +1007,7 @@ sc_prohibit_system_error_with_vir_err:
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' \
halt='avoid using 'virXXXFree', use 'virObjectUnref' instead' \
$(_sc_search_regexp)
sc_prohibit_sysconf_pagesize:
@@ -982,12 +1018,17 @@ sc_prohibit_sysconf_pagesize:
sc_prohibit_pthread_create:
@prohibit='\bpthread_create\b' \
exclude='sc_prohibit_pthread_create' \
halt='avoid using pthread_create, use virThreadCreate instead' \
halt="avoid using 'pthread_create', use 'virThreadCreate' instead" \
$(_sc_search_regexp)
sc_prohibit_not_streq:
@prohibit='! *STRN?EQ *\(.*\)' \
halt='Use STRNEQ instead of !STREQ and STREQ instead of !STRNEQ' \
@prohibit='! *STREQ *\(.*\)' \
halt='Use STRNEQ instead of !STREQ' \
$(_sc_search_regexp)
sc_prohibit_not_strneq:
@prohibit='! *STRNEQ *\(.*\)' \
halt='Use STREQ instead of !STRNEQ' \
$(_sc_search_regexp)
sc_prohibit_verbose_strcat:
@@ -996,26 +1037,6 @@ sc_prohibit_verbose_strcat:
halt='Use strcat(a, b) instead of strncat(a, b, strlen(b))' \
$(_sc_search_regexp)
# Ensure that each .c file containing a "main" function also
# calls virGettextInitialize
sc_gettext_init:
@require='virGettextInitialize *\(' \
in_vc_files='\.c$$' \
containing='\<main *(' \
halt='the above files do not call virGettextInitialize' \
$(_sc_search_regexp)
# <dt> is mostly used to document symbols, in which case it should contain
# a <code> element. The regular expression below trades speed and readability
# for accuracy, and won't catch someone trying to stick a <canvas> inside a
# <dt>, but that's what code reviews are for :)
sc_prohibit_dt_without_code:
@prohibit='<dt>([^<]|<[^c])' \
exclude='exempt from syntax-check' \
in_vc_files='docs/.*$$' \
halt='Use <code> inside <dt> when documenting symbols' \
$(_sc_search_regexp)
# We don't use this feature of maint.mk.
prev_version_file = /dev/null
@@ -1063,24 +1084,28 @@ _autogen:
# regenerate HACKING as part of the syntax-check
ifneq ($(_gl-Makefile),)
syntax-check: $(top_srcdir)/HACKING spacing-check test-wrap-argv \
prohibit-duplicate-header
syntax-check: $(top_srcdir)/HACKING bracket-spacing-check test-wrap-argv
endif
# Don't include duplicate header in the source (either *.c or *.h)
prohibit-duplicate-header:
$(AM_V_GEN)files=$$($(VC_LIST_EXCEPT) | grep '\.[chx]$$'); \
$(PERL) -W $(top_srcdir)/build-aux/prohibit-duplicate-header.pl $$files
spacing-check:
bracket-spacing-check:
$(AM_V_GEN)files=`$(VC_LIST) | grep '\.c$$'`; \
$(PERL) $(top_srcdir)/build-aux/check-spacing.pl $$files || \
$(PERL) $(top_srcdir)/build-aux/bracket-spacing.pl $$files || \
{ echo '$(ME): incorrect formatting, see HACKING for rules' 1>&2; \
exit 1; }
test-wrap-argv:
$(AM_V_GEN)files=`$(VC_LIST) | grep -E '\.(ldargs|args)'`; \
$(PERL) $(top_srcdir)/tests/test-wrap-argv.pl --check $$files
for file in $$files ; \
do \
$(PERL) $(top_srcdir)/tests/test-wrap-argv.pl $$file > $${file}-t ; \
diff $$file $${file}-t; \
res=$$? ; \
rm $${file}-t ; \
test $$res == 0 || { \
echo "$(ME): Incorrect line wrapping in $$file" 1>&2; \
echo "$(ME): Use test-wrap-argv.pl to wrap test data files" 1>&2; \
exit 1; } \
done
# sc_po_check can fail if generated files are not built first
sc_po_check: \
@@ -1108,18 +1133,13 @@ _test1=shunloadtest|virnettlscontexttest|virnettlssessiontest|vircgroupmock
exclude_file_name_regexp--sc_avoid_write = \
^(src/($(_src1))|daemon/libvirtd|tools/virsh-console|tests/($(_test1)))\.c$$
exclude_file_name_regexp--sc_bindtextdomain = .*
exclude_file_name_regexp--sc_gettext_init = ^(tests|examples)/
exclude_file_name_regexp--sc_copyright_format = \
^cfg\.mk$$
exclude_file_name_regexp--sc_bindtextdomain = ^(tests|examples)/
exclude_file_name_regexp--sc_copyright_usage = \
^COPYING(|\.LESSER)$$
exclude_file_name_regexp--sc_flags_usage = \
^(cfg\.mk|docs/|src/util/virnetdevtap\.c$$|tests/(vir(cgroup|pci|test|usb)|nss|qemuxml2argv)mock\.c$$)
^(docs/|src/util/virnetdevtap\.c$$|tests/vir(cgroup|pci|usb)mock\.c$$)
exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics = \
^(src/rpc/gendispatch\.pl$$|tests/)
@@ -1127,16 +1147,12 @@ exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics = \
exclude_file_name_regexp--sc_po_check = ^(docs/|src/rpc/gendispatch\.pl$$)
exclude_file_name_regexp--sc_prohibit_VIR_ERR_NO_MEMORY = \
^(cfg\.mk|include/libvirt/virterror\.h|daemon/dispatch\.c|src/util/virerror\.c|docs/internals/oomtesting\.html\.in)$$
^(include/libvirt/virterror\.h|daemon/dispatch\.c|src/util/virerror\.c|docs/internals/oomtesting\.html\.in)$$
exclude_file_name_regexp--sc_prohibit_PATH_MAX = \
^cfg\.mk$$
exclude_file_name_regexp--sc_prohibit_access_xok = \
^(cfg\.mk|src/util/virutil\.c)$$
exclude_file_name_regexp--sc_prohibit_access_xok = ^src/util/virutil\.c$$
exclude_file_name_regexp--sc_prohibit_asprintf = \
^(cfg\.mk|bootstrap.conf$$|examples/|src/util/virstring\.[ch]$$|tests/vircgroupmock\.c$$)
^(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$$)
@@ -1145,7 +1161,7 @@ exclude_file_name_regexp--sc_prohibit_close = \
(\.p[yl]$$|\.spec\.in$$|^docs/|^(src/util/virfile\.c|src/libvirt-stream\.c|tests/vir.+mock\.c)$$)
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
(^tests/(qemuhelp|virhostcpu|virpcitest)data/|\.diff|tests/virconfdata/no-newline\.conf$$)
(^tests/(qemuhelp|nodeinfo|virpcitest)data/|\.diff$$)
_src2=src/(util/vircommand|libvirt|lxc/lxc_controller|locking/lock_daemon|logging/log_daemon)
exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
@@ -1162,9 +1178,6 @@ exclude_file_name_regexp--sc_prohibit_newline_at_end_of_diagnostic = \
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_select = \
^cfg\.mk$$
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)$$
@@ -1174,11 +1187,11 @@ 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 = \
^(cfg\.mk|docs/hacking\.html\.in|.*\.stp|.*\.pl)$$
(^docs/hacking\.html\.in|\.stp|\.pl)$$
exclude_file_name_regexp--sc_prohibit_strncpy = ^src/util/virstring\.c$$
exclude_file_name_regexp--sc_prohibit_strtol = ^examples/.*$$
exclude_file_name_regexp--sc_prohibit_strtol = ^examples/dom.*/.*\.c$$
exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/virxml\.c$$
@@ -1193,7 +1206,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|/virhostcpudata/.*\.cpuinfo$$
/qemuhelpdata/|/sysinfodata/.*\.data|/nodeinfodata/.*\.cpuinfo$$
exclude_file_name_regexp--sc_unmarked_diagnostics = \
^(docs/apibuild.py|tests/virt-aa-helper-test)$$
@@ -1212,7 +1225,7 @@ exclude_file_name_regexp--sc_prohibit_include_public_headers_brackets = \
^(tools/|examples/|include/libvirt/(virterror|libvirt(-(admin|qemu|lxc))?)\.h$$)
exclude_file_name_regexp--sc_prohibit_int_ijk = \
^(src/remote_protocol-structs|src/remote/remote_protocol\.x|cfg\.mk|include/libvirt/libvirt.+|src/admin_protocol-structs|src/admin/admin_protocol\.x)$$
^(src/remote_protocol-structs|src/remote/remote_protocol\.x|cfg\.mk|include/libvirt/libvirt.+)$$
exclude_file_name_regexp--sc_prohibit_getenv = \
^tests/.*\.[ch]$$
@@ -1224,7 +1237,7 @@ 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/(vmwarever|virhostcpu)data/.*)$$
^(README|daemon/THREADS\.txt|src/esx/README|docs/library.xen|tests/(vmwarever|nodeinfo)data/.*)$$
exclude_file_name_regexp--sc_prohibit_useless_translation = \
^tests/virpolkittest.c
@@ -1241,11 +1254,8 @@ exclude_file_name_regexp--sc_prohibit_sysconf_pagesize = \
exclude_file_name_regexp--sc_prohibit_pthread_create = \
^(cfg\.mk|src/util/virthread\.c|tests/.*)$$
exclude_file_name_regexp--sc_prohibit_dt_without_code = \
^docs/(newapi\.xsl|(apps|contact)\.html\.in)$$
exclude_file_name_regexp--sc_prohibit_not_streq = \
^tests/.*\.[ch]$$
exclude_file_name_regexp--sc_prohibit_always-defined_macros = \
^tests/virtestmock.c$$
exclude_file_name_regexp--sc_prohibit_readdir = \
^tests/.*mock\.c$$
exclude_file_name_regexp--sc_prohibit_not_strneq = \
^tests/.*\.[ch]$$

View File

@@ -20,7 +20,7 @@
* Since virt-login-shell will be setuid, we must do everything
* we can to avoid linking to other libraries. Many of them do
* unsafe things in functions marked __atttribute__((constructor)).
* The only way to avoid such deps is to re-compile the
* The only way avoid to avoid such deps is to re-compile the
* functions with the code in question disabled, and for that we
* must override the main config.h rules. Hence this file :-(
*/
@@ -32,7 +32,6 @@
# undef HAVE_LIBSASL2
# undef WITH_CAPNG
# undef WITH_CURL
# undef WITH_DBUS
# undef WITH_DTRACE_PROBES
# undef WITH_GNUTLS
# undef WITH_GNUTLS_GCRYPT
@@ -40,50 +39,7 @@
# undef WITH_NUMACTL
# undef WITH_SASL
# undef WITH_SSH2
# undef WITH_SYSTEMD_DAEMON
# undef WITH_VIRTUALPORT
# undef WITH_YAJL
# undef WITH_YAJL2
#endif
/*
* With the NSS module it's the same story as virt-login-shell. See the
* explanation above.
*/
#ifdef LIBVIRT_NSS
# undef HAVE_LIBDEVMAPPER_H
# undef HAVE_LIBNL
# undef HAVE_LIBNL3
# undef HAVE_LIBSASL2
# undef WITH_CAPNG
# undef WITH_CURL
# undef WITH_DTRACE_PROBES
# undef WITH_GNUTLS
# undef WITH_GNUTLS_GCRYPT
# undef WITH_MACVTAP
# undef WITH_NUMACTL
# undef WITH_SASL
# undef WITH_SSH2
# undef WITH_VIRTUALPORT
# undef WITH_SECDRIVER_SELINUX
# undef WITH_SECDRIVER_APPARMOR
# undef WITH_CAPNG
#endif /* LIBVIRT_NSS */
/*
* Define __GNUC__ to a sane default if it isn't yet defined.
* This is done here so that it's included as early as possible; gnulib relies
* on this to be defined in features.h, which should be included from ctype.h.
* This doesn't happen on many non-glibc systems.
* When __GNUC__ is not defined, gnulib defines it to 0, which breaks things.
*/
#ifdef __GNUC__
# ifndef __GNUC_PREREQ
# if defined __GNUC__ && defined __GNUC_MINOR__
# define __GNUC_PREREQ(maj, min) \
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
# else
# define __GNUC_PREREQ(maj, min) 0
# endif
# endif
#endif

View File

@@ -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], [2.3.0], [libvir-list@redhat.com], [], [http://libvirt.org])
AC_INIT([libvirt], [1.3.2], [libvir-list@redhat.com], [], [http://libvirt.org])
AC_CONFIG_SRCDIR([src/libvirt.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
@@ -24,7 +24,7 @@ AH_BOTTOM([#include <config-post.h>])
AC_CONFIG_MACRO_DIR([m4])
dnl Make automake keep quiet about wildcards & other GNUmake-isms; also keep
dnl quiet about the fact that we intentionally cater to automake 1.9
AM_INIT_AUTOMAKE([-Wno-portability -Wno-obsolete tar-pax no-dist-gzip dist-xz subdir-objects])
AM_INIT_AUTOMAKE([-Wno-portability -Wno-obsolete tar-ustar subdir-objects])
dnl older automake's default of ARFLAGS=cru is noisy on newer binutils;
dnl we don't really need the 'u' even in older toolchains. Then there is
dnl older libtool, which spelled it AR_FLAGS
@@ -117,7 +117,7 @@ fi
dnl Required minimum versions of all libs we depend on
LIBXML_REQUIRED="2.6.0"
GNUTLS_REQUIRED="2.2.0"
GNUTLS_REQUIRED="1.0.25"
POLKIT_REQUIRED="0.6"
PARTED_REQUIRED="1.8.0"
DEVMAPPER_REQUIRED=1.0.0
@@ -144,8 +144,6 @@ AC_TYPE_UID_T
dnl Support building Win32 DLLs (must appear *before* AM_PROG_LIBTOOL)
AC_LIBTOOL_WIN32_DLL
AC_HEADER_MAJOR
m4_ifndef([LT_INIT], [
AM_PROG_LIBTOOL
], [
@@ -256,9 +254,9 @@ LIBVIRT_CHECK_SANLOCK
LIBVIRT_CHECK_SASL
LIBVIRT_CHECK_SELINUX
LIBVIRT_CHECK_SSH2
LIBVIRT_CHECK_SYSTEMD_DAEMON
LIBVIRT_CHECK_UDEV
LIBVIRT_CHECK_WIRESHARK
LIBVIRT_CHECK_NSS
LIBVIRT_CHECK_YAJL
AC_MSG_CHECKING([for CPUID instruction])
@@ -322,16 +320,15 @@ if test "x$lv_cv_pthread_sigmask_works" != xyes; then
AC_DEFINE([FUNC_PTHREAD_SIGMASK_BROKEN], [1],
[Define to 1 if pthread_sigmask is not a real function])
fi
LIBS=$old_LIBS
LIBS=$old_libs
dnl Availability of various common headers (non-fatal if missing).
AC_CHECK_HEADERS([pwd.h regex.h sys/un.h \
AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/un.h \
sys/poll.h syslog.h mntent.h net/ethernet.h linux/magic.h \
sys/un.h sys/syscall.h sys/sysctl.h netinet/tcp.h ifaddrs.h \
libtasn1.h sys/ucred.h sys/mount.h])
dnl Check whether endian provides handy macros.
AC_CHECK_DECLS([htole64], [], [], [[#include <endian.h>]])
AC_CHECK_FUNCS([stat stat64 __xstat __xstat64 lstat lstat64 __lxstat __lxstat64])
dnl We need to decide at configure time if libvirt will use real atomic
dnl operations ("lock free") or emulated ones with a mutex.
@@ -417,6 +414,10 @@ AC_CHECK_LIB([intl],[gettext],[])
dnl Do we have rpcgen?
AC_PATH_PROGS([RPCGEN], [rpcgen portable-rpcgen], [no])
AM_CONDITIONAL([HAVE_RPCGEN], [test "x$ac_cv_path_RPCGEN" != "xno"])
dnl Is this GLIBC's buggy rpcgen?
AM_CONDITIONAL([HAVE_GLIBC_RPCGEN],
[test "x$ac_cv_path_RPCGEN" != "xno" &&
$ac_cv_path_RPCGEN -t </dev/null >/dev/null 2>&1])
dnl Miscellaneous external programs.
AC_PATH_PROG([XMLLINT], [xmllint], [/usr/bin/xmllint])
@@ -424,7 +425,6 @@ AC_PATH_PROG([XMLCATALOG], [xmlcatalog], [/usr/bin/xmlcatalog])
AC_PATH_PROG([XSLTPROC], [xsltproc], [/usr/bin/xsltproc])
AC_PATH_PROG([AUGPARSE], [augparse], [/usr/bin/augparse])
AC_PROG_MKDIR_P
AC_PROG_LN_S
dnl External programs that we can use if they are available.
dnl We will hard-code paths to these programs unless we cannot
@@ -533,6 +533,10 @@ AC_ARG_WITH([qemu],
[AS_HELP_STRING([--with-qemu],
[add QEMU/KVM support @<:@default=yes@:>@])])
m4_divert_text([DEFAULTS], [with_qemu=yes])
AC_ARG_WITH([uml],
[AS_HELP_STRING([--with-uml],
[add UML support @<:@default=check@:>@])])
m4_divert_text([DEFAULTS], [with_uml=check])
AC_ARG_WITH([openvz],
[AS_HELP_STRING([--with-openvz],
[add OpenVZ support @<:@default=check@:>@])])
@@ -608,7 +612,51 @@ if test x"$enable_debug" = x"yes"; then
AC_DEFINE([ENABLE_DEBUG], [], [whether debugging is enabled])
fi
LIBVIRT_CHECK_INIT_SCRIPT
dnl
dnl init script flavor
dnl
AC_MSG_CHECKING([for init script flavor])
AC_ARG_WITH([init-script],
[AS_HELP_STRING([--with-init-script@<:@=STYLE@:>@],
[Style of init script to install: redhat, systemd, systemd+redhat,
upstart, check, none @<:@default=check@:>@])],
[],[with_init_script=check])
init_redhat=no
init_systemd=no
init_upstart=no
case "$with_init_script" in
systemd+redhat)
init_redhat=yes
init_systemd=yes
;;
systemd)
init_systemd=yes
;;
upstart)
init_upstart=yes
;;
redhat)
init_redhat=yes
;;
none)
;;
check)
if test "$cross_compiling" != yes && test -f /etc/redhat-release; then
init_redhat=yes
with_init_script=redhat
fi
;;
*)
AC_MSG_ERROR([Unknown initscript flavour $with_init_script])
;;
esac
AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_RED_HAT], test "$init_redhat" = "yes")
AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_UPSTART], test "$init_upstart" = "yes")
AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_SYSTEMD], test "$init_systemd" = "yes")
AC_MSG_RESULT($with_init_script)
AC_MSG_CHECKING([for whether to install sysctl config])
AC_ARG_WITH([sysctl],
@@ -867,11 +915,6 @@ if test "$with_libxl" != "no" ; then
fi
fi
# LIBXL_API_VERSION 4.4.0 introduced a new parameter to
# libxl_domain_create_restore for specifying restore parameters.
# The libxl driver will make use of this new parameter for specifying
# the Xen migration stream version.
LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040400"
LIBS="$old_LIBS"
CFLAGS="$old_CFLAGS"
@@ -1054,12 +1097,6 @@ dnl
LIBVIRT_CHECK_LOGIN_SHELL
dnl
dnl Check for virt-host-validate
dnl
LIBVIRT_CHECK_HOST_VALIDATE
AM_CONDITIONAL([WITH_SETUID_RPC_CLIENT], [test "$with_lxc$with_login_shell" != "nono"])
dnl
@@ -1160,15 +1197,15 @@ AC_SUBST([LIBXML_CFLAGS])
AC_SUBST([LIBXML_LIBS])
dnl xmlURI structure has query_raw?
old_CFLAGS="$CFLAGS"
old_LIBS="$LIBS"
old_cflags="$CFLAGS"
old_libs="$LIBS"
CFLAGS="$CFLAGS $LIBXML_CFLAGS"
LIBS="$LIBS $LIBXML_LIBS"
AC_CHECK_MEMBER([struct _xmlURI.query_raw],
[AC_DEFINE([HAVE_XMLURI_QUERY_RAW], [], [Have query_raw field in libxml2 xmlURI structure])],,
[#include <libxml/uri.h>])
CFLAGS="$old_CFLAGS"
LIBS="$old_LIBS"
CFLAGS="$old_cflags"
LIBS="$old_libs"
dnl GnuTLS library
AC_ARG_WITH([gnutls],
@@ -1184,8 +1221,8 @@ if test "x$with_gnutls" != "xno"; then
GNUTLS_LIBS="-L$with_gnutls/lib"
fi
fail=0
old_CFLAGS="$CFLAGS"
old_LIBS="$LIBS"
old_cflags="$CFLAGS"
old_libs="$LIBS"
CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
LIBS="$LIBS $GNUTLS_LIBS"
@@ -1243,24 +1280,16 @@ if test "x$with_gnutls" != "xno"; then
[set to 1 if it is known or assumed that GNUTLS uses gcrypt])
fi
dnl gnutls 3.x moved some declarations to a new header
AC_CHECK_HEADERS([gnutls/crypto.h], [], [], [[
#include <gnutls/gnutls.h>
]])
with_gnutls=yes
fi
dnl GNUTLS_CFLAGS and GNUTLS_LIBS have probably been updated above,
dnl and we need the final values for function probing to work
CFLAGS="$old_CFLAGS $GNUTLS_CFLAGS"
LIBS="$old_LIBS $GNUTLS_LIBS"
dnl gnutls 3.x moved some declarations to a new header
AC_CHECK_HEADERS([gnutls/crypto.h], [], [], [[
#include <gnutls/gnutls.h>
]])
AC_CHECK_FUNCS([gnutls_rnd])
AC_CHECK_FUNCS([gnutls_cipher_encrypt])
LIBS="$old_libs"
CFLAGS="$old_CFLAGS"
LIBS="$old_LIBS"
fi
if test "x$with_gnutls" = "xyes" ; then
@@ -1272,16 +1301,6 @@ AC_SUBST([GNUTLS_CFLAGS])
AC_SUBST([GNUTLS_LIBS])
AC_ARG_WITH([tls-priority],
[AS_HELP_STRING([--with-tls-priority],
[set the default TLS session priority string @<:@default=NORMAL@:>@])],
[],
[with_tls_priority=NORMAL])
AC_DEFINE_UNQUOTED([TLS_PRIORITY], ["$with_tls_priority"],
[TLS default priority string])
dnl PolicyKit library
POLKIT_CFLAGS=
POLKIT_LIBS=
@@ -1411,8 +1430,8 @@ if test "$with_selinux" != "yes" ; then
AC_MSG_ERROR([You must install the libselinux development package and enable SELinux with the --with-selinux=yes in order to compile libvirt --with-secdriver-selinux=yes])
fi
elif test "$with_secdriver_selinux" != "no"; then
old_CFLAGS="$CFLAGS"
old_LIBS="$LIBS"
old_cflags="$CFLAGS"
old_libs="$LIBS"
CFLAGS="$CFLAGS $SELINUX_CFLAGS"
LIBS="$CFLAGS $SELINUX_LIBS"
@@ -1420,8 +1439,8 @@ elif test "$with_secdriver_selinux" != "no"; then
AC_CHECK_FUNC([selinux_virtual_domain_context_path], [], [fail=1])
AC_CHECK_FUNC([selinux_virtual_image_context_path], [], [fail=1])
AC_CHECK_FUNCS([selinux_lxc_contexts_path])
CFLAGS="$old_CFLAGS"
LIBS="$old_LIBS"
CFLAGS="$old_cflags"
LIBS="$old_libs"
if test "$fail" = "1" ; then
if test "$with_secdriver_selinux" = "check" ; then
@@ -1565,7 +1584,27 @@ dnl
dnl Checks for the UML driver
dnl
LIBVIRT_DRIVER_CHECK_UML
if test "$with_libvirtd" = "no" ; then
with_uml=no
fi
if test "$with_uml" = "yes" || test "$with_uml" = "check"; then
AC_CHECK_HEADER([sys/inotify.h], [
with_uml=yes
], [
if test "$with_uml" = "check"; then
with_uml=no
AC_MSG_NOTICE([<sys/inotify.h> is required for the UML driver, disabling it])
else
AC_MSG_ERROR([The <sys/inotify.h> is required for the UML driver. Upgrade your libc6.])
fi
])
fi
if test "$with_uml" = "yes" ; then
AC_DEFINE_UNQUOTED([WITH_UML], 1, [whether UML driver is enabled])
fi
AM_CONDITIONAL([WITH_UML], [test "$with_uml" = "yes"])
dnl
dnl check for PHYP
@@ -1847,7 +1886,7 @@ else
fi
AM_CONDITIONAL([WITH_STORAGE_ISCSI], [test "$with_storage_iscsi" = "yes"])
if test "$with_storage_scsi" = "check" || test "$with_storage_scsi" = "yes"; then
if test "$with_storage_scsi" = "check"; then
with_storage_scsi=yes
AC_DEFINE_UNQUOTED([WITH_STORAGE_SCSI], 1,
@@ -1855,16 +1894,13 @@ if test "$with_storage_scsi" = "check" || test "$with_storage_scsi" = "yes"; the
fi
AM_CONDITIONAL([WITH_STORAGE_SCSI], [test "$with_storage_scsi" = "yes"])
if test "$with_storage_mpath" = "check" || test "$with_storage_mpath" = "yes"; then
if test "$with_storage_mpath" = "check"; then
if test "$with_linux" = "yes"; then
with_storage_mpath=yes
AC_DEFINE_UNQUOTED([WITH_STORAGE_MPATH], 1,
[whether mpath backend for storage driver is enabled])
else
if test "$with_storage_mpath" = "yes"; then
AC_MSG_ERROR([mpath storage is only supported on Linux])
fi
with_storage_mpath=no
fi
fi
@@ -1968,12 +2004,19 @@ LIBPARTED_LIBS=
if test "$with_storage_disk" = "yes" ||
test "$with_storage_disk" = "check"; then
AC_PATH_PROG([PARTED], [parted], [], [$PATH:/sbin:/usr/sbin])
AC_PATH_PROG([DMSETUP], [dmsetup], [], [$PATH:/sbin:/usr/sbin])
if test -z "$PARTED" ; then
PARTED_FOUND=no
else
PARTED_FOUND=yes
fi
if test -z "$DMSETUP" ; then
DMSETUP_FOUND=no
else
DMSETUP_FOUND=yes
fi
if test "$PARTED_FOUND" = "yes" && test "x$PKG_CONFIG" != "x" ; then
PKG_CHECK_MODULES([LIBPARTED], [libparted >= $PARTED_REQUIRED], [],
[PARTED_FOUND=no])
@@ -1992,12 +2035,12 @@ if test "$with_storage_disk" = "yes" ||
fi
if test "$with_storage_disk" = "yes" &&
test "$PARTED_FOUND" != "yes"; then
AC_MSG_ERROR([Need parted for disk storage driver])
test "$PARTED_FOUND:$DMSETUP_FOUND" != "yes:yes"; then
AC_MSG_ERROR([Need both parted and dmsetup for disk storage driver])
fi
if test "$with_storage_disk" = "check"; then
if test "$PARTED_FOUND" != "yes"; then
if test "$PARTED_FOUND:$DMSETUP_FOUND" != "yes:yes"; then
with_storage_disk=no
else
with_storage_disk=yes
@@ -2009,6 +2052,8 @@ if test "$with_storage_disk" = "yes" ||
[whether Disk backend for storage driver is enabled])
AC_DEFINE_UNQUOTED([PARTED],["$PARTED"],
[Location or name of the parted program])
AC_DEFINE_UNQUOTED([DMSETUP],["$DMSETUP"],
[Location or name of the dmsetup program])
fi
fi
AM_CONDITIONAL([WITH_STORAGE_DISK], [test "$with_storage_disk" = "yes"])
@@ -2698,7 +2743,7 @@ AC_DEFINE_UNQUOTED([base64_encode_alloc],[libvirt_gl_base64_encode_alloc],[Hack
AC_CONFIG_FILES([run],
[chmod +x,-w run])
AC_CONFIG_FILES([\
Makefile src/Makefile include/libvirt/Makefile docs/Makefile \
Makefile src/Makefile include/Makefile docs/Makefile \
gnulib/lib/Makefile \
gnulib/tests/Makefile \
libvirt.pc \
@@ -2725,7 +2770,7 @@ AC_MSG_NOTICE([Drivers])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([ Xen: $with_xen])
AC_MSG_NOTICE([ QEMU: $with_qemu])
LIBVIRT_DRIVER_RESULT_UML
AC_MSG_NOTICE([ UML: $with_uml])
AC_MSG_NOTICE([ OpenVZ: $with_openvz])
AC_MSG_NOTICE([ VMware: $with_vmware])
AC_MSG_NOTICE([ VBox: $with_vbox])
@@ -2795,9 +2840,9 @@ LIBVIRT_RESULT_SANLOCK
LIBVIRT_RESULT_SASL
LIBVIRT_RESULT_SELINUX
LIBVIRT_RESULT_SSH2
LIBVIRT_RESULT_SYSTEMD_DAEMON
LIBVIRT_RESULT_UDEV
LIBVIRT_RESULT_WIRESHARK
LIBVIRT_RESULT_NSS
LIBVIRT_RESULT_YAJL
AC_MSG_NOTICE([ libxml: $LIBXML_CFLAGS $LIBXML_LIBS])
AC_MSG_NOTICE([ dlopen: $DLOPEN_LIBS])
@@ -2871,19 +2916,17 @@ AC_MSG_NOTICE([ Alloc OOM: $enable_oom])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Miscellaneous])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([ Debug: $enable_debug])
AC_MSG_NOTICE([ Use -Werror: $set_werror])
AC_MSG_NOTICE([ Warning Flags: $WARN_CFLAGS])
AC_MSG_NOTICE([ DTrace: $with_dtrace])
AC_MSG_NOTICE([ numad: $with_numad])
AC_MSG_NOTICE([ XML Catalog: $XML_CATALOG_FILE])
LIBVIRT_RESULT_INIT_SCRIPT
AC_MSG_NOTICE([ Char device locks: $with_chrdev_lock_files])
AC_MSG_NOTICE([ Default Editor: $DEFAULT_EDITOR])
AC_MSG_NOTICE([ Loader/NVRAM: $with_loader_nvram])
AC_MSG_NOTICE([ virt-login-shell: $with_login_shell])
AC_MSG_NOTICE([virt-host-validate: $with_host_validate])
AC_MSG_NOTICE([ TLS priority: $with_tls_priority])
AC_MSG_NOTICE([ Debug: $enable_debug])
AC_MSG_NOTICE([ Use -Werror: $set_werror])
AC_MSG_NOTICE([ Warning Flags: $WARN_CFLAGS])
AC_MSG_NOTICE([ DTrace: $with_dtrace])
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([ Loader/NVRAM: $with_loader_nvram])
AC_MSG_NOTICE([ virt-login-shell: $with_login_shell])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Developer Tools])
AC_MSG_NOTICE([])

View File

@@ -46,14 +46,6 @@ DAEMON_SOURCES = \
LIBVIRTD_CONF_SOURCES = libvirtd-config.c libvirtd-config.h
PODFILES = \
libvirtd.pod \
$(NULL)
MANINFILES = \
libvirtd.8.in \
$(NULL)
DISTCLEANFILES =
EXTRA_DIST = \
remote_dispatch.h \
@@ -67,6 +59,7 @@ EXTRA_DIST = \
libvirt.rules \
libvirtd.sasl \
libvirtd.service.in \
libvirtd.socket.in \
libvirtd.sysconf \
libvirtd.sysctl \
libvirtd.aug \
@@ -77,8 +70,8 @@ EXTRA_DIST = \
libvirtd.uml.logrotate.in \
test_libvirtd.aug.in \
THREADS.txt \
$(PODFILES) \
$(MANINFILES) \
libvirtd.pod.in \
libvirtd.8.in \
$(DAEMON_SOURCES) \
$(LIBVIRTD_CONF_SOURCES) \
$(NULL)
@@ -169,6 +162,13 @@ augeastests_DATA = test_libvirtd.aug
CLEANFILES += test_libvirtd.aug
libvirtd.8: $(srcdir)/libvirtd.8.in
$(AM_V_GEN)sed \
-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
< $< > $@-t && \
mv $@-t $@
libvirtd_SOURCES = $(DAEMON_SOURCES)
#-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
@@ -233,10 +233,6 @@ if WITH_VBOX
libvirtd_LDADD += ../src/libvirt_driver_vbox.la
endif WITH_VBOX
if WITH_VZ
libvirtd_LDADD += ../src/libvirt_driver_vz.la
endif WITH_VZ
if WITH_STORAGE
libvirtd_LDADD += ../src/libvirt_driver_storage.la
endif WITH_STORAGE
@@ -450,15 +446,18 @@ endif ! LIBVIRT_INIT_SCRIPT_UPSTART
if LIBVIRT_INIT_SCRIPT_SYSTEMD
SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
BUILT_SOURCES += libvirtd.service
BUILT_SOURCES += libvirtd.service libvirtd.socket
install-init-systemd: install-sysconfig libvirtd.service
install-init-systemd: install-sysconfig libvirtd.service libvirtd.socket
$(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:
@@ -482,6 +481,12 @@ 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
@@ -505,24 +510,12 @@ install-data-local: install-data-sasl
uninstall-local:: uninstall-data-sasl
endif ! WITH_LIBVIRTD
POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)"
POD2MAN = pod2man -c "Virtualization Support" \
-r "$(PACKAGE)-$(VERSION)" -s 8
%.8.in: %.pod
$(AM_V_GEN)$(POD2MAN) --section=8 $< $@-t1 && \
if grep 'POD ERROR' $@-t1; then rm $@-t1; exit 1; fi && \
sed \
-e 's|SYSCONFDIR|\@sysconfdir\@|g' \
-e 's|LOCALSTATEDIR|\@localstatedir\@|g' \
< $@-t1 > $@-t2 && \
rm -f $@-t1 && \
mv $@-t2 $@
%.8: %.8.in $(top_srcdir)/configure.ac
$(AM_V_GEN)sed \
-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
< $< > $@-t && \
mv $@-t $@
$(srcdir)/libvirtd.8.in: libvirtd.pod.in $(top_srcdir)/configure.ac
$(AM_V_GEN)$(POD2MAN) --name LIBVIRTD $< $@ \
&& if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi
# This is needed for clients too, so can't wrap in
# the WITH_LIBVIRTD conditional
@@ -543,4 +536,4 @@ endif ! WITH_SASL
CLEANFILES += $(BUILT_SOURCES) $(man8_MANS)
CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
MAINTAINERCLEANFILES = $(MANINFILES) $(DAEMON_GENERATED)
MAINTAINERCLEANFILES = $(srcdir)/libvirtd.8.in $(DAEMON_GENERATED)

View File

@@ -37,7 +37,6 @@
#include "virnetserver.h"
#include "virstring.h"
#include "virthreadjob.h"
#include "virtypedparam.h"
#define VIR_FROM_THIS VIR_FROM_ADMIN
@@ -81,32 +80,11 @@ remoteAdmClientInitHook(virNetServerClientPtr client ATTRIBUTE_UNUSED,
/* Helpers */
static virNetServerPtr
get_nonnull_server(virNetDaemonPtr dmn, admin_nonnull_server srv)
{
return virNetDaemonGetServer(dmn, srv.name);
}
static void
make_nonnull_server(admin_nonnull_server *srv_dst,
virNetServerPtr srv_src)
virAdmServerPtr srv_src)
{
ignore_value(VIR_STRDUP_QUIET(srv_dst->name, virNetServerGetName(srv_src)));
}
static virNetServerClientPtr
get_nonnull_client(virNetServerPtr srv, admin_nonnull_client clnt)
{
return virNetServerGetClient(srv, clnt.id);
}
static void
make_nonnull_client(admin_nonnull_client *clt_dst,
virNetServerClientPtr clt_src)
{
clt_dst->id = virNetServerClientGetID(clt_src);
clt_dst->timestamp = virNetServerClientGetTimestamp(clt_src);
clt_dst->transport = virNetServerClientGetTransport(clt_src);
ignore_value(VIR_STRDUP_QUIET(srv_dst->name, srv_src->name));
}
/* Functions */
@@ -156,231 +134,48 @@ adminConnectGetLibVersion(virNetDaemonPtr dmn ATTRIBUTE_UNUSED,
}
static int
adminDispatchServerGetThreadpoolParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
virNetServerClientPtr client,
virNetMessagePtr msg ATTRIBUTE_UNUSED,
virNetMessageErrorPtr rerr,
struct admin_server_get_threadpool_parameters_args *args,
struct admin_server_get_threadpool_parameters_ret *ret)
adminDispatchConnectListServers(virNetServerPtr server ATTRIBUTE_UNUSED,
virNetServerClientPtr client,
virNetMessagePtr msg ATTRIBUTE_UNUSED,
virNetMessageErrorPtr rerr ATTRIBUTE_UNUSED,
admin_connect_list_servers_args *args,
admin_connect_list_servers_ret *ret)
{
virAdmServerPtr *servers = NULL;
int nservers = 0;
int rv = -1;
virNetServerPtr srv = NULL;
virTypedParameterPtr params = NULL;
int nparams = 0;
size_t i;
struct daemonAdmClientPrivate *priv =
virNetServerClientGetPrivateData(client);
if (!(srv = virNetDaemonGetServer(priv->dmn, args->srv.name)))
if ((nservers =
adminDaemonListServers(priv->dmn,
args->need_results ? &servers : NULL,
args->flags)) < 0)
goto cleanup;
if (adminServerGetThreadPoolParameters(srv, &params, &nparams,
args->flags) < 0)
goto cleanup;
if (servers && nservers) {
if (VIR_ALLOC_N(ret->servers.servers_val, nservers) < 0)
goto cleanup;
if (nparams > ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Number of threadpool parameters %d exceeds max "
"allowed limit: %d"), nparams,
ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX);
goto cleanup;
ret->servers.servers_len = nservers;
for (i = 0; i < nservers; i++)
make_nonnull_server(ret->servers.servers_val + i, servers[i]);
} else {
ret->servers.servers_len = 0;
ret->servers.servers_val = NULL;
}
if (virTypedParamsSerialize(params, nparams,
(virTypedParameterRemotePtr *) &ret->params.params_val,
&ret->params.params_len, 0) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
virTypedParamsFree(params, nparams);
virObjectUnref(srv);
return rv;
}
static int
adminDispatchServerSetThreadpoolParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
virNetServerClientPtr client,
virNetMessagePtr msg ATTRIBUTE_UNUSED,
virNetMessageErrorPtr rerr,
struct admin_server_set_threadpool_parameters_args *args)
{
int rv = -1;
virNetServerPtr srv = NULL;
virTypedParameterPtr params = NULL;
int nparams = 0;
struct daemonAdmClientPrivate *priv =
virNetServerClientGetPrivateData(client);
if (!(srv = virNetDaemonGetServer(priv->dmn, args->srv.name))) {
virReportError(VIR_ERR_NO_SERVER,
_("no server with matching name '%s' found"),
args->srv.name);
goto cleanup;
}
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) args->params.params_val,
args->params.params_len,
ADMIN_SERVER_THREADPOOL_PARAMETERS_MAX,
&params,
&nparams) < 0)
goto cleanup;
if (adminServerSetThreadPoolParameters(srv, params,
nparams, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
virTypedParamsFree(params, nparams);
virObjectUnref(srv);
return rv;
}
static int
adminDispatchClientGetInfo(virNetServerPtr server ATTRIBUTE_UNUSED,
virNetServerClientPtr client,
virNetMessagePtr msg ATTRIBUTE_UNUSED,
virNetMessageErrorPtr rerr,
struct admin_client_get_info_args *args,
struct admin_client_get_info_ret *ret)
{
int rv = -1;
virNetServerPtr srv = NULL;
virNetServerClientPtr clnt = NULL;
virTypedParameterPtr params = NULL;
int nparams = 0;
struct daemonAdmClientPrivate *priv =
virNetServerClientGetPrivateData(client);
if (!(srv = virNetDaemonGetServer(priv->dmn, args->clnt.srv.name))) {
virReportError(VIR_ERR_NO_SERVER,
_("no server with matching name '%s' found"),
args->clnt.srv.name);
goto cleanup;
}
if (!(clnt = virNetServerGetClient(srv, args->clnt.id))) {
virReportError(VIR_ERR_NO_CLIENT,
_("no client with matching id '%llu' found"),
(unsigned long long) args->clnt.id);
goto cleanup;
}
if (adminClientGetInfo(clnt, &params, &nparams, args->flags) < 0)
goto cleanup;
if (nparams > ADMIN_CLIENT_INFO_PARAMETERS_MAX) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Number of client info parameters %d exceeds max "
"allowed limit: %d"), nparams,
ADMIN_CLIENT_INFO_PARAMETERS_MAX);
goto cleanup;
}
if (virTypedParamsSerialize(params, nparams,
(virTypedParameterRemotePtr *) &ret->params.params_val,
&ret->params.params_len,
VIR_TYPED_PARAM_STRING_OKAY) < 0)
goto cleanup;
ret->ret = nservers;
rv = 0;
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
virTypedParamsFree(params, nparams);
virObjectUnref(clnt);
virObjectUnref(srv);
return rv;
}
static int
adminDispatchServerGetClientLimits(virNetServerPtr server ATTRIBUTE_UNUSED,
virNetServerClientPtr client,
virNetMessagePtr msg ATTRIBUTE_UNUSED,
virNetMessageErrorPtr rerr ATTRIBUTE_UNUSED,
admin_server_get_client_limits_args *args,
admin_server_get_client_limits_ret *ret)
{
int rv = -1;
virNetServerPtr srv = NULL;
virTypedParameterPtr params = NULL;
int nparams = 0;
struct daemonAdmClientPrivate *priv =
virNetServerClientGetPrivateData(client);
if (!(srv = virNetDaemonGetServer(priv->dmn, args->srv.name)))
goto cleanup;
if (adminServerGetClientLimits(srv, &params, &nparams, args->flags) < 0)
goto cleanup;
if (nparams > ADMIN_SERVER_CLIENT_LIMITS_MAX) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Number of client processing parameters %d exceeds "
"max allowed limit: %d"), nparams,
ADMIN_SERVER_CLIENT_LIMITS_MAX);
goto cleanup;
}
if (virTypedParamsSerialize(params, nparams,
(virTypedParameterRemotePtr *) &ret->params.params_val,
&ret->params.params_len, 0) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
virTypedParamsFree(params, nparams);
virObjectUnref(srv);
return rv;
}
static int
adminDispatchServerSetClientLimits(virNetServerPtr server ATTRIBUTE_UNUSED,
virNetServerClientPtr client,
virNetMessagePtr msg ATTRIBUTE_UNUSED,
virNetMessageErrorPtr rerr ATTRIBUTE_UNUSED,
admin_server_set_client_limits_args *args)
{
int rv = -1;
virNetServerPtr srv = NULL;
virTypedParameterPtr params = NULL;
int nparams = 0;
struct daemonAdmClientPrivate *priv =
virNetServerClientGetPrivateData(client);
if (!(srv = virNetDaemonGetServer(priv->dmn, args->srv.name))) {
virReportError(VIR_ERR_NO_SERVER,
_("no server with matching name '%s' found"),
args->srv.name);
goto cleanup;
}
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) args->params.params_val,
args->params.params_len,
ADMIN_SERVER_CLIENT_LIMITS_MAX, &params, &nparams) < 0)
goto cleanup;
if (adminServerSetClientLimits(srv, params, nparams, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
virNetMessageSaveError(rerr);
virTypedParamsFree(params, nparams);
virObjectUnref(srv);
if (servers && nservers > 0)
for (i = 0; i < nservers; i++)
virObjectUnref(servers[i]);
VIR_FREE(servers);
return rv;
}
#include "admin_dispatch.h"

View File

@@ -27,364 +27,48 @@
#include "datatypes.h"
#include "viralloc.h"
#include "virerror.h"
#include "viridentity.h"
#include "virlog.h"
#include "virnetdaemon.h"
#include "virnetserver.h"
#include "virstring.h"
#include "virthreadpool.h"
#include "virtypedparam.h"
#define VIR_FROM_THIS VIR_FROM_ADMIN
VIR_LOG_INIT("daemon.admin_server");
int
adminConnectListServers(virNetDaemonPtr dmn,
virNetServerPtr **servers,
unsigned int flags)
{
int ret = -1;
virNetServerPtr *srvs = NULL;
virCheckFlags(0, -1);
if ((ret = virNetDaemonGetServers(dmn, &srvs)) < 0)
goto cleanup;
if (servers) {
*servers = srvs;
srvs = NULL;
}
cleanup:
if (ret > 0)
virObjectListFreeCount(srvs, ret);
return ret;
}
virNetServerPtr
adminConnectLookupServer(virNetDaemonPtr dmn,
const char *name,
unsigned int flags)
{
virCheckFlags(flags, NULL);
return virNetDaemonGetServer(dmn, name);
}
int
adminServerGetThreadPoolParameters(virNetServerPtr srv,
virTypedParameterPtr *params,
int *nparams,
unsigned int flags)
{
int ret = -1;
int maxparams = 0;
size_t minWorkers;
size_t maxWorkers;
size_t nWorkers;
size_t freeWorkers;
size_t nPrioWorkers;
size_t jobQueueDepth;
virTypedParameterPtr tmpparams = NULL;
virCheckFlags(0, -1);
if (virNetServerGetThreadPoolParameters(srv, &minWorkers, &maxWorkers,
&nWorkers, &freeWorkers,
&nPrioWorkers,
&jobQueueDepth) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unable to retrieve threadpool parameters"));
goto cleanup;
}
if (virTypedParamsAddUInt(&tmpparams, nparams,
&maxparams, VIR_THREADPOOL_WORKERS_MIN,
minWorkers) < 0)
goto cleanup;
if (virTypedParamsAddUInt(&tmpparams, nparams,
&maxparams, VIR_THREADPOOL_WORKERS_MAX,
maxWorkers) < 0)
goto cleanup;
if (virTypedParamsAddUInt(&tmpparams, nparams,
&maxparams, VIR_THREADPOOL_WORKERS_CURRENT,
nWorkers) < 0)
goto cleanup;
if (virTypedParamsAddUInt(&tmpparams, nparams,
&maxparams, VIR_THREADPOOL_WORKERS_FREE,
freeWorkers) < 0)
goto cleanup;
if (virTypedParamsAddUInt(&tmpparams, nparams,
&maxparams, VIR_THREADPOOL_WORKERS_PRIORITY,
nPrioWorkers) < 0)
goto cleanup;
if (virTypedParamsAddUInt(&tmpparams, nparams,
&maxparams, VIR_THREADPOOL_JOB_QUEUE_DEPTH,
jobQueueDepth) < 0)
goto cleanup;
*params = tmpparams;
tmpparams = NULL;
ret = 0;
cleanup:
virTypedParamsFree(tmpparams, *nparams);
return ret;
}
int
adminServerSetThreadPoolParameters(virNetServerPtr srv,
virTypedParameterPtr params,
int nparams,
unsigned int flags)
{
long long int minWorkers = -1;
long long int maxWorkers = -1;
long long int prioWorkers = -1;
virTypedParameterPtr param = NULL;
virCheckFlags(0, -1);
if (virTypedParamsValidate(params, nparams,
VIR_THREADPOOL_WORKERS_MIN,
VIR_TYPED_PARAM_UINT,
VIR_THREADPOOL_WORKERS_MAX,
VIR_TYPED_PARAM_UINT,
VIR_THREADPOOL_WORKERS_PRIORITY,
VIR_TYPED_PARAM_UINT,
NULL) < 0)
return -1;
if ((param = virTypedParamsGet(params, nparams,
VIR_THREADPOOL_WORKERS_MIN)))
minWorkers = param->value.ui;
if ((param = virTypedParamsGet(params, nparams,
VIR_THREADPOOL_WORKERS_MAX)))
maxWorkers = param->value.ui;
if ((param = virTypedParamsGet(params, nparams,
VIR_THREADPOOL_WORKERS_PRIORITY)))
prioWorkers = param->value.ui;
if (virNetServerSetThreadPoolParameters(srv, minWorkers,
maxWorkers, prioWorkers) < 0)
return -1;
return 0;
}
int
adminServerListClients(virNetServerPtr srv,
virNetServerClientPtr **clients,
adminDaemonListServers(virNetDaemonPtr dmn,
virAdmServerPtr **servers,
unsigned int flags)
{
int ret = -1;
virNetServerClientPtr *clts;
const char **srv_names = NULL;
virAdmServerPtr *srvs = NULL;
size_t i;
ssize_t nsrvs = 0;
virCheckFlags(0, -1);
if ((ret = virNetServerGetClients(srv, &clts)) < 0)
return -1;
if ((nsrvs = virNetDaemonGetServerNames(dmn, &srv_names)) < 0)
goto cleanup;
if (clients) {
*clients = clts;
clts = NULL;
if (servers) {
if (VIR_ALLOC_N(srvs, nsrvs) < 0)
goto cleanup;
for (i = 0; i < nsrvs; i++) {
if (!(srvs[i] = virAdmGetServer(NULL, srv_names[i])))
goto cleanup;
}
*servers = srvs;
srvs = NULL;
}
virObjectListFreeCount(clts, ret);
return ret;
}
virNetServerClientPtr
adminServerLookupClient(virNetServerPtr srv,
unsigned long long id,
unsigned int flags)
{
virCheckFlags(0, NULL);
return virNetServerGetClient(srv, id);
}
int
adminClientGetInfo(virNetServerClientPtr client,
virTypedParameterPtr *params,
int *nparams,
unsigned int flags)
{
int ret = -1;
int maxparams = 0;
bool readonly;
char *sock_addr = NULL;
const char *attr = NULL;
virTypedParameterPtr tmpparams = NULL;
virIdentityPtr identity = NULL;
virCheckFlags(0, -1);
if (virNetServerClientGetInfo(client, &readonly,
&sock_addr, &identity) < 0)
goto cleanup;
if (virTypedParamsAddBoolean(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_READONLY,
readonly) < 0)
goto cleanup;
if (virIdentityGetSASLUserName(identity, &attr) < 0 ||
(attr &&
virTypedParamsAddString(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_SASL_USER_NAME,
attr) < 0))
goto cleanup;
if (!virNetServerClientIsLocal(client)) {
if (virTypedParamsAddString(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_SOCKET_ADDR,
sock_addr) < 0)
goto cleanup;
if (virIdentityGetX509DName(identity, &attr) < 0 ||
(attr &&
virTypedParamsAddString(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_X509_DISTINGUISHED_NAME,
attr) < 0))
goto cleanup;
} else {
pid_t pid;
uid_t uid;
gid_t gid;
if (virIdentityGetUNIXUserID(identity, &uid) < 0 ||
virTypedParamsAddInt(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_UNIX_USER_ID, uid) < 0)
goto cleanup;
if (virIdentityGetUNIXUserName(identity, &attr) < 0 ||
virTypedParamsAddString(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_UNIX_USER_NAME,
attr) < 0)
goto cleanup;
if (virIdentityGetUNIXGroupID(identity, &gid) < 0 ||
virTypedParamsAddInt(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_UNIX_GROUP_ID, gid) < 0)
goto cleanup;
if (virIdentityGetUNIXGroupName(identity, &attr) < 0 ||
virTypedParamsAddString(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_UNIX_GROUP_NAME,
attr) < 0)
goto cleanup;
if (virIdentityGetUNIXProcessID(identity, &pid) < 0 ||
virTypedParamsAddInt(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_UNIX_PROCESS_ID, pid) < 0)
goto cleanup;
}
if (virIdentityGetSELinuxContext(identity, &attr) < 0 ||
(attr &&
virTypedParamsAddString(&tmpparams, nparams, &maxparams,
VIR_CLIENT_INFO_SELINUX_CONTEXT, attr) < 0))
goto cleanup;
*params = tmpparams;
tmpparams = NULL;
ret = 0;
ret = nsrvs;
cleanup:
virObjectUnref(identity);
VIR_FREE(sock_addr);
VIR_FREE(srv_names);
virObjectListFree(srvs);
return ret;
}
int adminClientClose(virNetServerClientPtr client,
unsigned int flags)
{
virCheckFlags(0, -1);
virNetServerClientClose(client);
return 0;
}
int
adminServerGetClientLimits(virNetServerPtr srv,
virTypedParameterPtr *params,
int *nparams,
unsigned int flags)
{
int ret = -1;
int maxparams = 0;
virTypedParameterPtr tmpparams = NULL;
virCheckFlags(0, -1);
if (virTypedParamsAddUInt(&tmpparams, nparams, &maxparams,
VIR_SERVER_CLIENTS_MAX,
virNetServerGetMaxClients(srv)) < 0)
goto cleanup;
if (virTypedParamsAddUInt(&tmpparams, nparams, &maxparams,
VIR_SERVER_CLIENTS_CURRENT,
virNetServerGetCurrentClients(srv)) < 0)
goto cleanup;
if (virTypedParamsAddUInt(&tmpparams, nparams, &maxparams,
VIR_SERVER_CLIENTS_UNAUTH_MAX,
virNetServerGetMaxUnauthClients(srv)) < 0)
goto cleanup;
if (virTypedParamsAddUInt(&tmpparams, nparams, &maxparams,
VIR_SERVER_CLIENTS_UNAUTH_CURRENT,
virNetServerGetCurrentUnauthClients(srv)) < 0)
goto cleanup;
*params = tmpparams;
tmpparams = NULL;
ret = 0;
cleanup:
virTypedParamsFree(tmpparams, *nparams);
return ret;
}
int
adminServerSetClientLimits(virNetServerPtr srv,
virTypedParameterPtr params,
int nparams,
unsigned int flags)
{
long long int maxClients = -1;
long long int maxClientsUnauth = -1;
virTypedParameterPtr param = NULL;
virCheckFlags(0, -1);
if (virTypedParamsValidate(params, nparams,
VIR_SERVER_CLIENTS_MAX,
VIR_TYPED_PARAM_UINT,
VIR_SERVER_CLIENTS_UNAUTH_MAX,
VIR_TYPED_PARAM_UINT,
NULL) < 0)
return -1;
if ((param = virTypedParamsGet(params, nparams,
VIR_SERVER_CLIENTS_MAX)))
maxClients = param->value.ui;
if ((param = virTypedParamsGet(params, nparams,
VIR_SERVER_CLIENTS_UNAUTH_MAX)))
maxClientsUnauth = param->value.ui;
if (virNetServerSetClientLimits(srv, maxClients,
maxClientsUnauth) < 0)
return -1;
return 0;
}

View File

@@ -25,51 +25,10 @@
# define __LIBVIRTD_ADMIN_SERVER_H__
# include "rpc/virnetdaemon.h"
# include "rpc/virnetserver.h"
int adminConnectListServers(virNetDaemonPtr dmn,
virNetServerPtr **servers,
unsigned int flags);
virNetServerPtr adminConnectLookupServer(virNetDaemonPtr dmn,
const char *name,
unsigned int flags);
int
adminServerGetThreadPoolParameters(virNetServerPtr srv,
virTypedParameterPtr *params,
int *nparams,
unsigned int flags);
int
adminServerSetThreadPoolParameters(virNetServerPtr srv,
virTypedParameterPtr params,
int nparams,
unsigned int flags);
int adminServerListClients(virNetServerPtr srv,
virNetServerClientPtr **clients,
unsigned int flags);
virNetServerClientPtr adminServerLookupClient(virNetServerPtr srv,
unsigned long long id,
unsigned int flags);
int adminClientGetInfo(virNetServerClientPtr client,
virTypedParameterPtr *params,
int *nparams,
adminDaemonListServers(virNetDaemonPtr dmn,
virAdmServerPtr **servers,
unsigned int flags);
int adminClientClose(virNetServerClientPtr client,
unsigned int flags);
int adminServerGetClientLimits(virNetServerPtr srv,
virTypedParameterPtr *params,
int *nparams,
unsigned int flags);
int adminServerSetClientLimits(virNetServerPtr srv,
virTypedParameterPtr params,
int nparams,
unsigned int flags);
#endif /* __LIBVIRTD_ADMIN_SERVER_H__ */

View File

@@ -39,38 +39,171 @@
VIR_LOG_INIT("daemon.libvirtd-config");
/* Allocate an array of malloc'd strings from the config file, filename
* (used only in diagnostics), using handle "conf". Upon error, return -1
* and free any allocated memory. Otherwise, save the array in *list_arg
* and return 0.
*/
static int
remoteConfigGetAuth(virConfPtr conf,
const char *filename,
const char *key,
int *auth)
remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
const char *filename)
{
char *authstr = NULL;
if (virConfGetValueString(conf, key, &authstr) < 0)
return -1;
if (!authstr)
char **list;
virConfValuePtr p = virConfGetValue(conf, key);
if (!p)
return 0;
if (STREQ(authstr, "none")) {
*auth = VIR_NET_SERVER_SERVICE_AUTH_NONE;
#if WITH_SASL
} else if (STREQ(authstr, "sasl")) {
*auth = VIR_NET_SERVER_SERVICE_AUTH_SASL;
#endif
} else if (STREQ(authstr, "polkit")) {
*auth = VIR_NET_SERVER_SERVICE_AUTH_POLKIT;
} else {
switch (p->type) {
case VIR_CONF_STRING:
if (VIR_ALLOC_N(list, 2) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("failed to allocate memory for %s config list"),
key);
return -1;
}
if (VIR_STRDUP(list[0], p->str) < 0) {
VIR_FREE(list);
return -1;
}
list[1] = NULL;
break;
case VIR_CONF_LIST: {
int len = 0;
size_t i;
virConfValuePtr pp;
for (pp = p->list; pp; pp = pp->next)
len++;
if (VIR_ALLOC_N(list, 1+len) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("failed to allocate memory for %s config list"),
key);
return -1;
}
for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
if (pp->type != VIR_CONF_STRING) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("remoteReadConfigFile: %s: %s:"
" must be a string or list of strings"),
filename, key);
VIR_FREE(list);
return -1;
}
if (VIR_STRDUP(list[i], pp->str) < 0) {
size_t j;
for (j = 0; j < i; j++)
VIR_FREE(list[j]);
VIR_FREE(list);
return -1;
}
}
list[i] = NULL;
break;
}
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("%s: %s: unsupported auth %s"),
filename, key, authstr);
VIR_FREE(authstr);
_("remoteReadConfigFile: %s: %s:"
" must be a string or list of strings"),
filename, key);
return -1;
}
*list_arg = list;
return 0;
}
/* A helper function used by each of the following macros. */
static int
checkType(virConfValuePtr p, const char *filename,
const char *key, virConfType required_type)
{
if (p->type != required_type) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("remoteReadConfigFile: %s: %s: invalid type:"
" got %s; expected %s"), filename, key,
virConfTypeToString(p->type),
virConfTypeToString(required_type));
return -1;
}
return 0;
}
/* If there is no config data for the key, #var_name, then do nothing.
If there is valid data of type VIR_CONF_STRING, and VIR_STRDUP succeeds,
store the result in var_name. Otherwise, (i.e. invalid type, or VIR_STRDUP
failure), give a diagnostic and "goto" the cleanup-and-fail label. */
#define GET_CONF_STR(conf, filename, var_name) \
do { \
virConfValuePtr p = virConfGetValue(conf, #var_name); \
if (p) { \
if (checkType(p, filename, #var_name, VIR_CONF_STRING) < 0) \
goto error; \
VIR_FREE(data->var_name); \
if (VIR_STRDUP(data->var_name, p->str) < 0) \
goto error; \
} \
} while (0)
/* Like GET_CONF_STR, but for signed 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) \
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,
const char *key,
int *auth,
const char *filename)
{
virConfValuePtr p;
p = virConfGetValue(conf, key);
if (!p)
return 0;
if (checkType(p, filename, key, VIR_CONF_STRING) < 0)
return -1;
if (!p->str)
return 0;
if (STREQ(p->str, "none")) {
*auth = VIR_NET_SERVER_SERVICE_AUTH_NONE;
#if WITH_SASL
} else if (STREQ(p->str, "sasl")) {
*auth = VIR_NET_SERVER_SERVICE_AUTH_SASL;
#endif
} else if (STREQ(p->str, "polkit")) {
*auth = VIR_NET_SERVER_SERVICE_AUTH_POLKIT;
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("remoteReadConfigFile: %s: %s: unsupported auth %s"),
filename, key, p->str);
return -1;
}
VIR_FREE(authstr);
return 0;
}
@@ -147,7 +280,6 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
data->min_workers = 5;
data->max_workers = 20;
data->max_clients = 5000;
data->max_queued_clients = 1000;
data->max_anonymous_clients = 20;
data->prio_workers = 5;
@@ -234,7 +366,6 @@ daemonConfigFree(struct daemonConfig *data)
tmp++;
}
VIR_FREE(data->sasl_allowed_username_list);
VIR_FREE(data->tls_priority);
VIR_FREE(data->key_file);
VIR_FREE(data->ca_file);
@@ -242,7 +373,6 @@ daemonConfigFree(struct daemonConfig *data)
VIR_FREE(data->crl_file);
VIR_FREE(data->host_uuid);
VIR_FREE(data->host_uuid_source);
VIR_FREE(data->log_filters);
VIR_FREE(data->log_outputs);
@@ -254,18 +384,13 @@ daemonConfigLoadOptions(struct daemonConfig *data,
const char *filename,
virConfPtr conf)
{
if (virConfGetValueBool(conf, "listen_tcp", &data->listen_tcp) < 0)
goto error;
if (virConfGetValueBool(conf, "listen_tls", &data->listen_tls) < 0)
goto error;
if (virConfGetValueString(conf, "tls_port", &data->tls_port) < 0)
goto error;
if (virConfGetValueString(conf, "tcp_port", &data->tcp_port) < 0)
goto error;
if (virConfGetValueString(conf, "listen_addr", &data->listen_addr) < 0)
goto error;
GET_CONF_UINT(conf, filename, listen_tcp);
GET_CONF_UINT(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);
if (remoteConfigGetAuth(conf, filename, "auth_unix_rw", &data->auth_unix_rw) < 0)
if (remoteConfigGetAuth(conf, "auth_unix_rw", &data->auth_unix_rw, filename) < 0)
goto error;
#if WITH_POLKIT
/* Change default perms to be wide-open if PolicyKit is enabled.
@@ -277,116 +402,76 @@ daemonConfigLoadOptions(struct daemonConfig *data,
goto error;
}
#endif
if (remoteConfigGetAuth(conf, filename, "auth_unix_ro", &data->auth_unix_ro) < 0)
if (remoteConfigGetAuth(conf, "auth_unix_ro", &data->auth_unix_ro, filename) < 0)
goto error;
if (remoteConfigGetAuth(conf, filename, "auth_tcp", &data->auth_tcp) < 0)
if (remoteConfigGetAuth(conf, "auth_tcp", &data->auth_tcp, filename) < 0)
goto error;
if (remoteConfigGetAuth(conf, filename, "auth_tls", &data->auth_tls) < 0)
if (remoteConfigGetAuth(conf, "auth_tls", &data->auth_tls, filename) < 0)
goto error;
if (virConfGetValueStringList(conf, "access_drivers", false,
&data->access_drivers) < 0)
if (remoteConfigGetStringList(conf, "access_drivers",
&data->access_drivers, filename) < 0)
goto error;
if (virConfGetValueString(conf, "unix_sock_group", &data->unix_sock_group) < 0)
goto error;
if (virConfGetValueString(conf, "unix_sock_admin_perms", &data->unix_sock_admin_perms) < 0)
goto error;
if (virConfGetValueString(conf, "unix_sock_ro_perms", &data->unix_sock_ro_perms) < 0)
goto error;
if (virConfGetValueString(conf, "unix_sock_rw_perms", &data->unix_sock_rw_perms) < 0)
goto error;
GET_CONF_STR(conf, filename, unix_sock_group);
GET_CONF_STR(conf, filename, unix_sock_admin_perms);
GET_CONF_STR(conf, filename, unix_sock_ro_perms);
GET_CONF_STR(conf, filename, unix_sock_rw_perms);
if (virConfGetValueString(conf, "unix_sock_dir", &data->unix_sock_dir) < 0)
goto error;
GET_CONF_STR(conf, filename, unix_sock_dir);
if (virConfGetValueBool(conf, "mdns_adv", &data->mdns_adv) < 0)
goto error;
if (virConfGetValueString(conf, "mdns_name", &data->mdns_name) < 0)
goto error;
GET_CONF_UINT(conf, filename, mdns_adv);
GET_CONF_STR(conf, filename, mdns_name);
if (virConfGetValueBool(conf, "tls_no_sanity_certificate", &data->tls_no_sanity_certificate) < 0)
goto error;
if (virConfGetValueBool(conf, "tls_no_verify_certificate", &data->tls_no_verify_certificate) < 0)
goto error;
GET_CONF_UINT(conf, filename, tls_no_sanity_certificate);
GET_CONF_UINT(conf, filename, tls_no_verify_certificate);
if (virConfGetValueString(conf, "key_file", &data->key_file) < 0)
goto error;
if (virConfGetValueString(conf, "cert_file", &data->cert_file) < 0)
goto error;
if (virConfGetValueString(conf, "ca_file", &data->ca_file) < 0)
goto error;
if (virConfGetValueString(conf, "crl_file", &data->crl_file) < 0)
goto error;
GET_CONF_STR(conf, filename, key_file);
GET_CONF_STR(conf, filename, cert_file);
GET_CONF_STR(conf, filename, ca_file);
GET_CONF_STR(conf, filename, crl_file);
if (virConfGetValueStringList(conf, "tls_allowed_dn_list", false,
&data->tls_allowed_dn_list) < 0)
if (remoteConfigGetStringList(conf, "tls_allowed_dn_list",
&data->tls_allowed_dn_list, filename) < 0)
goto error;
if (virConfGetValueStringList(conf, "sasl_allowed_username_list", false,
&data->sasl_allowed_username_list) < 0)
if (remoteConfigGetStringList(conf, "sasl_allowed_username_list",
&data->sasl_allowed_username_list, filename) < 0)
goto error;
if (virConfGetValueString(conf, "tls_priority", &data->tls_priority) < 0)
goto error;
if (virConfGetValueUInt(conf, "min_workers", &data->min_workers) < 0)
goto error;
if (virConfGetValueUInt(conf, "max_workers", &data->max_workers) < 0)
goto error;
if (virConfGetValueUInt(conf, "max_clients", &data->max_clients) < 0)
goto error;
if (virConfGetValueUInt(conf, "max_queued_clients", &data->max_queued_clients) < 0)
goto error;
if (virConfGetValueUInt(conf, "max_anonymous_clients", &data->max_anonymous_clients) < 0)
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);
if (virConfGetValueUInt(conf, "prio_workers", &data->prio_workers) < 0)
goto error;
GET_CONF_UINT(conf, filename, prio_workers);
if (virConfGetValueUInt(conf, "max_requests", &data->max_requests) < 0)
goto error;
if (virConfGetValueUInt(conf, "max_client_requests", &data->max_client_requests) < 0)
goto error;
GET_CONF_INT(conf, filename, max_requests);
GET_CONF_UINT(conf, filename, max_client_requests);
if (virConfGetValueUInt(conf, "admin_min_workers", &data->admin_min_workers) < 0)
goto error;
if (virConfGetValueUInt(conf, "admin_max_workers", &data->admin_max_workers) < 0)
goto error;
if (virConfGetValueUInt(conf, "admin_max_clients", &data->admin_max_clients) < 0)
goto error;
if (virConfGetValueUInt(conf, "admin_max_queued_clients", &data->admin_max_queued_clients) < 0)
goto error;
if (virConfGetValueUInt(conf, "admin_max_client_requests", &data->admin_max_client_requests) < 0)
goto error;
GET_CONF_UINT(conf, filename, admin_min_workers);
GET_CONF_UINT(conf, filename, admin_max_workers);
GET_CONF_UINT(conf, filename, admin_max_clients);
GET_CONF_UINT(conf, filename, admin_max_queued_clients);
GET_CONF_UINT(conf, filename, admin_max_client_requests);
if (virConfGetValueUInt(conf, "audit_level", &data->audit_level) < 0)
goto error;
if (virConfGetValueBool(conf, "audit_logging", &data->audit_logging) < 0)
goto error;
GET_CONF_UINT(conf, filename, audit_level);
GET_CONF_UINT(conf, filename, audit_logging);
if (virConfGetValueString(conf, "host_uuid", &data->host_uuid) < 0)
goto error;
if (virConfGetValueString(conf, "host_uuid_source", &data->host_uuid_source) < 0)
goto error;
GET_CONF_STR(conf, filename, host_uuid);
if (virConfGetValueUInt(conf, "log_level", &data->log_level) < 0)
goto error;
if (virConfGetValueString(conf, "log_filters", &data->log_filters) < 0)
goto error;
if (virConfGetValueString(conf, "log_outputs", &data->log_outputs) < 0)
goto error;
GET_CONF_UINT(conf, filename, log_level);
GET_CONF_STR(conf, filename, log_filters);
GET_CONF_STR(conf, filename, log_outputs);
if (virConfGetValueInt(conf, "keepalive_interval", &data->keepalive_interval) < 0)
goto error;
if (virConfGetValueUInt(conf, "keepalive_count", &data->keepalive_count) < 0)
goto error;
GET_CONF_INT(conf, filename, keepalive_interval);
GET_CONF_UINT(conf, filename, keepalive_count);
if (virConfGetValueInt(conf, "admin_keepalive_interval", &data->admin_keepalive_interval) < 0)
goto error;
if (virConfGetValueUInt(conf, "admin_keepalive_count", &data->admin_keepalive_count) < 0)
goto error;
GET_CONF_INT(conf, filename, admin_keepalive_interval);
GET_CONF_UINT(conf, filename, admin_keepalive_count);
return 0;

View File

@@ -28,10 +28,9 @@
struct daemonConfig {
char *host_uuid;
char *host_uuid_source;
bool listen_tls;
bool listen_tcp;
int listen_tls;
int listen_tcp;
char *listen_addr;
char *tls_port;
char *tcp_port;
@@ -49,46 +48,45 @@ struct daemonConfig {
char **access_drivers;
bool mdns_adv;
int mdns_adv;
char *mdns_name;
bool tls_no_verify_certificate;
bool tls_no_sanity_certificate;
int tls_no_verify_certificate;
int tls_no_sanity_certificate;
char **tls_allowed_dn_list;
char **sasl_allowed_username_list;
char *tls_priority;
char *key_file;
char *cert_file;
char *ca_file;
char *crl_file;
unsigned int min_workers;
unsigned int max_workers;
unsigned int max_clients;
unsigned int max_queued_clients;
unsigned int max_anonymous_clients;
int min_workers;
int max_workers;
int max_clients;
int max_queued_clients;
int max_anonymous_clients;
unsigned int prio_workers;
int prio_workers;
unsigned int max_requests;
unsigned int max_client_requests;
int max_requests;
int max_client_requests;
unsigned int log_level;
int log_level;
char *log_filters;
char *log_outputs;
unsigned int audit_level;
bool audit_logging;
int audit_level;
int audit_logging;
int keepalive_interval;
unsigned int keepalive_count;
unsigned int admin_min_workers;
unsigned int admin_max_workers;
unsigned int admin_max_clients;
unsigned int admin_max_queued_clients;
unsigned int admin_max_client_requests;
int admin_min_workers;
int admin_max_workers;
int admin_max_clients;
int admin_max_queued_clients;
int admin_max_client_requests;
int admin_keepalive_interval;
unsigned int admin_keepalive_count;

View File

@@ -13,7 +13,7 @@ module Libvirtd =
let str_val = del /\"/ "\"" . store /[^\"]*/ . del /\"/ "\""
let bool_val = store /0|1/
let int_val = store /-?[0-9]+/
let int_val = store /[0-9]+/
let str_array_element = [ seq "el" . str_val ] . del /[ \t\n]*/ ""
let str_array_val = counter "el" . array_start . ( str_array_element . ( array_sep . str_array_element ) * ) ? . array_end
@@ -53,7 +53,6 @@ module Libvirtd =
| str_array_entry "tls_allowed_dn_list"
| str_array_entry "sasl_allowed_username_list"
| str_array_entry "access_drivers"
| str_entry "tls_priority"
let processing_entry = int_entry "min_workers"
| int_entry "max_workers"
@@ -87,7 +86,6 @@ module Libvirtd =
| bool_entry "admin_keepalive_required"
let misc_entry = str_entry "host_uuid"
| str_entry "host_uuid_source"
(* Each enty in the config is one of the following three ... *)
let entry = network_entry

View File

@@ -30,6 +30,7 @@
#include <getopt.h>
#include <stdlib.h>
#include <grp.h>
#include <locale.h>
#include "libvirt_internal.h"
#include "virerror.h"
@@ -57,7 +58,6 @@
#include "locking/lock_manager.h"
#include "viraccessmanager.h"
#include "virutil.h"
#include "virgettext.h"
#ifdef WITH_DRIVER_MODULES
# include "driver.h"
@@ -102,9 +102,6 @@
# include "nwfilter/nwfilter_driver.h"
# endif
#endif
#ifdef WITH_VZ
# include "vz/vz_driver.h"
#endif
#include "configmake.h"
@@ -333,8 +330,6 @@ static int daemonErrorLogFilter(virErrorPtr err, int priority)
case VIR_ERR_NO_DOMAIN_SNAPSHOT:
case VIR_ERR_OPERATION_INVALID:
case VIR_ERR_NO_DOMAIN_METADATA:
case VIR_ERR_NO_SERVER:
case VIR_ERR_NO_CLIENT:
return VIR_LOG_DEBUG;
}
@@ -395,9 +390,6 @@ static void daemonInitialize(void)
# ifdef WITH_BHYVE
virDriverLoadModule("bhyve");
# endif
# ifdef WITH_VZ
virDriverLoadModule("vz");
# endif
#else
# ifdef WITH_NETWORK
networkRegister();
@@ -438,9 +430,6 @@ static void daemonInitialize(void)
# ifdef WITH_BHYVE
bhyveRegister();
# endif
# ifdef WITH_VZ
vzRegister();
# endif
#endif
}
@@ -533,7 +522,8 @@ daemonSetupNetworking(virNetServerPtr srv,
virNetServerAddService(srv, svcRO, NULL) < 0)
goto cleanup;
if (sock_path_adm) {
/* Temporarily disabled */
if (sock_path_adm && false) {
VIR_DEBUG("Registering unix socket %s", sock_path_adm);
if (!(svcAdm = virNetServerServiceNewUNIX(sock_path_adm,
unix_sock_adm_mask,
@@ -542,7 +532,7 @@ daemonSetupNetworking(virNetServerPtr srv,
#if WITH_GNUTLS
NULL,
#endif
false,
true,
config->admin_max_queued_clients,
config->admin_max_client_requests)))
goto cleanup;
@@ -584,7 +574,6 @@ daemonSetupNetworking(virNetServerPtr srv,
config->cert_file,
config->key_file,
(const char *const*)config->tls_allowed_dn_list,
config->tls_priority,
config->tls_no_sanity_certificate ? false : true,
config->tls_no_verify_certificate ? false : true)))
goto cleanup;
@@ -592,7 +581,6 @@ daemonSetupNetworking(virNetServerPtr srv,
if (!(ctxt = virNetTLSContextNewServerPath(NULL,
!privileged,
(const char *const*)config->tls_allowed_dn_list,
config->tls_priority,
config->tls_no_sanity_certificate ? false : true,
config->tls_no_verify_certificate ? false : true)))
goto cleanup;
@@ -1079,39 +1067,6 @@ static int migrateProfile(void)
return ret;
}
static int
daemonSetupHostUUID(const struct daemonConfig *config)
{
static const char *machine_id = "/etc/machine-id";
char buf[VIR_UUID_STRING_BUFLEN];
const char *uuid;
if (config->host_uuid) {
uuid = config->host_uuid;
} else if (!config->host_uuid_source ||
STREQ(config->host_uuid_source, "smbios")) {
/* smbios UUID is fetched on demand in virGetHostUUID */
return 0;
} else if (STREQ(config->host_uuid_source, "machine-id")) {
if (virFileReadBufQuiet(machine_id, buf, sizeof(buf)) < 0) {
VIR_ERROR(_("Can't read %s"), machine_id);
return -1;
}
uuid = buf;
} else {
VIR_ERROR(_("invalid UUID source: %s"), config->host_uuid_source);
return -1;
}
if (virSetHostUUIDStr(uuid)) {
VIR_ERROR(_("invalid host UUID: %s"), uuid);
return -1;
}
return 0;
}
/* Print command-line usage. */
static void
daemonUsage(const char *argv0, bool privileged)
@@ -1217,7 +1172,9 @@ int main(int argc, char **argv) {
{0, 0, 0, 0}
};
if (virGettextInitialize() < 0 ||
if (setlocale(LC_ALL, "") == NULL ||
bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
textdomain(PACKAGE) == NULL ||
virInitialize() < 0) {
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
exit(EXIT_FAILURE);
@@ -1316,8 +1273,12 @@ int main(int argc, char **argv) {
/* Read the config file if it exists*/
if (remote_config_file &&
daemonConfigLoadFile(config, remote_config_file, implicit_conf) < 0) {
VIR_ERROR(_("Can't load config file: %s: %s"),
virGetLastErrorMessage(), remote_config_file);
virErrorPtr err = virGetLastError();
if (err && err->message)
VIR_ERROR(_("Can't load config file: %s: %s"),
err->message, remote_config_file);
else
VIR_ERROR(_("Can't load config file: %s"), remote_config_file);
exit(EXIT_FAILURE);
}
@@ -1327,8 +1288,9 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
if (daemonSetupHostUUID(config) < 0) {
VIR_ERROR(_("Can't setup host uuid"));
if (config->host_uuid &&
virSetHostUUIDStr(config->host_uuid) < 0) {
VIR_ERROR(_("invalid host UUID: %s"), config->host_uuid);
exit(EXIT_FAILURE);
}
@@ -1420,8 +1382,7 @@ int main(int argc, char **argv) {
goto cleanup;
}
if (!(srv = virNetServerNew("libvirtd", 1,
config->min_workers,
if (!(srv = virNetServerNew(config->min_workers,
config->max_workers,
config->prio_workers,
config->max_clients,
@@ -1438,7 +1399,7 @@ int main(int argc, char **argv) {
}
if (!(dmn = virNetDaemonNew()) ||
virNetDaemonAddServer(dmn, srv) < 0) {
virNetDaemonAddServer(dmn, "libvirtd", srv) < 0) {
ret = VIR_DAEMON_ERR_INIT;
goto cleanup;
}
@@ -1495,8 +1456,7 @@ int main(int argc, char **argv) {
goto cleanup;
}
if (!(srvAdm = virNetServerNew("admin", 1,
config->admin_min_workers,
if (!(srvAdm = virNetServerNew(config->admin_min_workers,
config->admin_max_workers,
0,
config->admin_max_clients,
@@ -1512,7 +1472,7 @@ int main(int argc, char **argv) {
goto cleanup;
}
if (virNetDaemonAddServer(dmn, srvAdm) < 0) {
if (virNetDaemonAddServer(dmn, "admin", srvAdm) < 0) {
ret = VIR_DAEMON_ERR_INIT;
goto cleanup;
}

View File

@@ -77,6 +77,11 @@
# 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.
@@ -242,7 +247,7 @@
#tls_allowed_dn_list = ["DN1", "DN2"]
# A whitelist of allowed SASL usernames. The format for username
# A whitelist of allowed SASL usernames. The format for usernames
# depends on the SASL authentication mechanism. Kerberos usernames
# look like username@REALM
#
@@ -259,13 +264,6 @@
#sasl_allowed_username_list = ["joe@EXAMPLE.COM", "fred@EXAMPLE.COM" ]
# Override the compile time default TLS priority string. The
# default is usually "NORMAL" unless overridden at build time.
# Only set this is it is desired for libvirt to deviate from
# the global default settings.
#
#tls_priority="NORMAL"
#################################################################
#
@@ -283,8 +281,8 @@
#max_queued_clients = 1000
# The maximum length of queue of accepted but not yet
# authenticated clients. The default value is 20. Set this to
# zero to turn this feature off.
# authenticated clients. The default value is zero, meaning
# the feature is disabled.
#max_anonymous_clients = 20
# The minimum limit sets the number of workers to start up
@@ -417,16 +415,10 @@
###################################################################
# UUID of the host:
# Host UUID is read from one of the sources specified in host_uuid_source.
#
# - 'smbios': fetch the UUID from 'dmidecode -s system-uuid'
# - 'machine-id': fetch the UUID from /etc/machine-id
#
# The host_uuid_source default is 'smbios'. If 'dmidecode' does not provide
# a valid UUID a temporary UUID will be generated.
#
# Another option is to specify host UUID in host_uuid.
#
# Provide the UUID of the host here in case the command
# 'dmidecode -s system-uuid' does not provide a valid uuid. In case
# 'dmidecode' does not provide a valid UUID and none is provided here, a
# temporary UUID will be generated.
# Keep the format of the example UUID below. UUID must not have all digits
# be the same.
@@ -434,7 +426,6 @@
# it with the output of the 'uuidgen' command and then
# uncomment this entry
#host_uuid = "00000000-0000-0000-0000-000000000000"
#host_uuid_source = "smbios"
###################################################################
# Keepalive protocol:

View File

@@ -60,11 +60,6 @@ struct daemonClientPrivate {
size_t nnetworkEventCallbacks;
daemonClientEventCallbackPtr *qemuEventCallbacks;
size_t nqemuEventCallbacks;
daemonClientEventCallbackPtr *storageEventCallbacks;
size_t nstorageEventCallbacks;
daemonClientEventCallbackPtr *nodeDeviceEventCallbacks;
size_t nnodeDeviceEventCallbacks;
bool closeRegistered;
# if WITH_SASL
virNetSASLSessionPtr sasl;

View File

@@ -4,7 +4,9 @@ libvirtd - libvirtd management daemon
=head1 SYNOPSIS
B<libvirtd> [I<OPTION>]...
B<libvirtd> [ -dlv ] [ -f config_file ] [ -p pid_file ] [ -t timeout_seconds ]
B<libvirtd> --version
=head1 DESCRIPTION

View File

@@ -1,11 +1,5 @@
# 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
Requires=virtlogd.socket
Before=libvirt-guests.service
After=network.target
After=dbus.service

11
daemon/libvirtd.socket.in Normal file
View File

@@ -0,0 +1,11 @@
[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

File diff suppressed because it is too large Load Diff

View File

@@ -42,15 +42,15 @@ struct daemonClientStream {
virStreamPtr st;
int procedure;
unsigned int serial;
int serial;
bool recvEOF;
bool closed;
unsigned int recvEOF : 1;
unsigned int closed : 1;
int filterID;
virNetMessagePtr rx;
bool tx;
int tx;
daemonClientStreamPtr next;
};
@@ -76,8 +76,6 @@ static void
daemonStreamUpdateEvents(daemonClientStream *stream)
{
int newEvents = 0;
if (stream->closed)
return;
if (stream->rx)
newEvents |= VIR_STREAM_EVENT_WRITABLE;
if (stream->tx && !stream->recvEOF)
@@ -94,14 +92,14 @@ daemonStreamUpdateEvents(daemonClientStream *stream)
* fast stream, but slow client
*/
static void
daemonStreamMessageFinished(virNetMessagePtr msg,
daemonStreamMessageFinished(virNetMessagePtr msg ATTRIBUTE_UNUSED,
void *opaque)
{
daemonClientStream *stream = opaque;
VIR_DEBUG("stream=%p proc=%d serial=%u",
VIR_DEBUG("stream=%p proc=%d serial=%d",
stream, msg->header.proc, msg->header.serial);
stream->tx = true;
stream->tx = 1;
daemonStreamUpdateEvents(stream);
daemonFreeClientStream(NULL, stream);
@@ -199,8 +197,8 @@ daemonStreamEvent(virStreamPtr st, int events, void *opaque)
(events & VIR_STREAM_EVENT_HANGUP)) {
virNetMessagePtr msg;
events &= ~(VIR_STREAM_EVENT_HANGUP);
stream->tx = false;
stream->recvEOF = true;
stream->tx = 0;
stream->recvEOF = 1;
if (!(msg = virNetMessageNew(false))) {
daemonRemoveClientStream(client, stream);
virNetServerClientClose(client);
@@ -229,7 +227,7 @@ daemonStreamEvent(virStreamPtr st, int events, void *opaque)
virNetMessageError rerr;
memset(&rerr, 0, sizeof(rerr));
stream->closed = true;
stream->closed = 1;
virStreamEventRemoveCallback(stream->st);
virStreamAbort(stream->st);
if (events & VIR_STREAM_EVENT_HANGUP)
@@ -295,7 +293,7 @@ daemonStreamFilter(virNetServerClientPtr client ATTRIBUTE_UNUSED,
msg->header.serial != stream->serial)
goto cleanup;
VIR_DEBUG("Incoming client=%p, rx=%p, serial=%u, proc=%d, status=%d",
VIR_DEBUG("Incoming client=%p, rx=%p, serial=%d, proc=%d, status=%d",
client, stream->rx, msg->header.proc,
msg->header.serial, msg->header.status);
@@ -326,7 +324,7 @@ daemonCreateClientStream(virNetServerClientPtr client,
daemonClientStream *stream;
daemonClientPrivatePtr priv = virNetServerClientGetPrivateData(client);
VIR_DEBUG("client=%p, proc=%d, serial=%u, st=%p",
VIR_DEBUG("client=%p, proc=%d, serial=%d, st=%p",
client, header->proc, header->serial, st);
if (VIR_ALLOC(stream) < 0)
@@ -362,7 +360,7 @@ int daemonFreeClientStream(virNetServerClientPtr client,
if (stream->refs)
return 0;
VIR_DEBUG("client=%p, proc=%d, serial=%u",
VIR_DEBUG("client=%p, proc=%d, serial=%d",
client, stream->procedure, stream->serial);
virObjectUnref(stream->prog);
@@ -400,7 +398,7 @@ int daemonAddClientStream(virNetServerClientPtr client,
daemonClientStream *stream,
bool transmit)
{
VIR_DEBUG("client=%p, proc=%d, serial=%u, st=%p, transmit=%d",
VIR_DEBUG("client=%p, proc=%d, serial=%d, st=%p, transmit=%d",
client, stream->procedure, stream->serial, stream->st, transmit);
daemonClientPrivatePtr priv = virNetServerClientGetPrivateData(client);
@@ -424,7 +422,7 @@ int daemonAddClientStream(virNetServerClientPtr client,
}
if (transmit)
stream->tx = true;
stream->tx = 1;
virMutexLock(&priv->lock);
stream->next = priv->streams;
@@ -444,13 +442,13 @@ int daemonAddClientStream(virNetServerClientPtr client,
*
* Removes a stream from the list of active streams for the client
*
* Returns 0 if the stream was removed, -1 if it doesn't exist
* Returns 0 if the stream was removd, -1 if it doesn't exist
*/
int
daemonRemoveClientStream(virNetServerClientPtr client,
daemonClientStream *stream)
{
VIR_DEBUG("client=%p, proc=%d, serial=%u, st=%p",
VIR_DEBUG("client=%p, proc=%d, serial=%d, st=%p",
client, stream->procedure, stream->serial, stream->st);
daemonClientPrivatePtr priv = virNetServerClientGetPrivateData(client);
daemonClientStream *curr = priv->streams;
@@ -463,7 +461,6 @@ daemonRemoveClientStream(virNetServerClientPtr client,
}
if (!stream->closed) {
stream->closed = true;
virStreamEventRemoveCallback(stream->st);
virStreamAbort(stream->st);
}
@@ -494,7 +491,6 @@ daemonRemoveAllClientStreams(daemonClientStream *stream)
tmp = stream->next;
if (!stream->closed) {
stream->closed = true;
virStreamEventRemoveCallback(stream->st);
virStreamAbort(stream->st);
}
@@ -519,7 +515,7 @@ daemonStreamHandleWriteData(virNetServerClientPtr client,
{
int ret;
VIR_DEBUG("client=%p, stream=%p, proc=%d, serial=%u, len=%zu, offset=%zu",
VIR_DEBUG("client=%p, stream=%p, proc=%d, serial=%d, len=%zu, offset=%zu",
client, stream, msg->header.proc, msg->header.serial,
msg->bufferLength, msg->bufferOffset);
@@ -542,10 +538,7 @@ daemonStreamHandleWriteData(virNetServerClientPtr client,
memset(&rerr, 0, sizeof(rerr));
VIR_INFO("Stream send failed");
stream->closed = true;
virStreamEventRemoveCallback(stream->st);
virStreamAbort(stream->st);
stream->closed = 1;
return virNetServerProgramSendReplyError(stream->prog,
client,
msg,
@@ -572,10 +565,10 @@ daemonStreamHandleFinish(virNetServerClientPtr client,
{
int ret;
VIR_DEBUG("client=%p, stream=%p, proc=%d, serial=%u",
VIR_DEBUG("client=%p, stream=%p, proc=%d, serial=%d",
client, stream, msg->header.proc, msg->header.serial);
stream->closed = true;
stream->closed = 1;
virStreamEventRemoveCallback(stream->st);
ret = virStreamFinish(stream->st);
@@ -609,42 +602,31 @@ daemonStreamHandleAbort(virNetServerClientPtr client,
daemonClientStream *stream,
virNetMessagePtr msg)
{
VIR_DEBUG("client=%p, stream=%p, proc=%d, serial=%u",
VIR_DEBUG("client=%p, stream=%p, proc=%d, serial=%d",
client, stream, msg->header.proc, msg->header.serial);
int ret;
bool raise_error = false;
virNetMessageError rerr;
stream->closed = true;
memset(&rerr, 0, sizeof(rerr));
stream->closed = 1;
virStreamEventRemoveCallback(stream->st);
ret = virStreamAbort(stream->st);
virStreamAbort(stream->st);
if (msg->header.status == VIR_NET_ERROR) {
VIR_INFO("stream aborted at client request");
raise_error = (ret < 0);
virReportError(VIR_ERR_RPC,
"%s", _("stream aborted at client request"));
} else {
VIR_WARN("unexpected stream status %d", msg->header.status);
virReportError(VIR_ERR_RPC,
_("stream aborted with unexpected status %d"),
msg->header.status);
raise_error = true;
}
if (raise_error) {
virNetMessageError rerr;
memset(&rerr, 0, sizeof(rerr));
return virNetServerProgramSendReplyError(remoteProgram,
client,
msg,
&rerr,
&msg->header);
} else {
/* Send zero-length confirm */
return virNetServerProgramSendStreamData(stream->prog,
client,
msg,
stream->procedure,
stream->serial,
NULL, 0);
}
return virNetServerProgramSendReplyError(remoteProgram,
client,
msg,
&rerr,
&msg->header);
}
@@ -727,12 +709,9 @@ static int
daemonStreamHandleRead(virNetServerClientPtr client,
daemonClientStream *stream)
{
virNetMessagePtr msg = NULL;
virNetMessageError rerr;
char *buffer;
size_t bufferLen = VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX;
int ret = -1;
int rv;
int ret;
VIR_DEBUG("client=%p, stream=%p tx=%d closed=%d",
client, stream, stream->tx, stream->closed);
@@ -749,48 +728,50 @@ daemonStreamHandleRead(virNetServerClientPtr client,
if (!stream->tx)
return 0;
memset(&rerr, 0, sizeof(rerr));
if (VIR_ALLOC_N(buffer, bufferLen) < 0)
return -1;
if (!(msg = virNetMessageNew(false)))
goto cleanup;
rv = virStreamRecv(stream->st, buffer, bufferLen);
if (rv == -2) {
ret = virStreamRecv(stream->st, buffer, bufferLen);
if (ret == -2) {
/* Should never get this, since we're only called when we know
* we're readable, but hey things change... */
} else if (rv < 0) {
if (virNetServerProgramSendStreamError(remoteProgram,
client,
msg,
&rerr,
stream->procedure,
stream->serial) < 0)
goto cleanup;
msg = NULL;
} else {
stream->tx = false;
if (rv == 0)
stream->recvEOF = true;
ret = 0;
} else if (ret < 0) {
virNetMessagePtr msg;
virNetMessageError rerr;
msg->cb = daemonStreamMessageFinished;
msg->opaque = stream;
stream->refs++;
if (virNetServerProgramSendStreamData(remoteProgram,
client,
msg,
stream->procedure,
stream->serial,
buffer, rv) < 0)
goto cleanup;
msg = NULL;
memset(&rerr, 0, sizeof(rerr));
if (!(msg = virNetMessageNew(false)))
ret = -1;
else
ret = virNetServerProgramSendStreamError(remoteProgram,
client,
msg,
&rerr,
stream->procedure,
stream->serial);
} else {
virNetMessagePtr msg;
stream->tx = 0;
if (ret == 0)
stream->recvEOF = 1;
if (!(msg = virNetMessageNew(false)))
ret = -1;
if (msg) {
msg->cb = daemonStreamMessageFinished;
msg->opaque = stream;
stream->refs++;
ret = virNetServerProgramSendStreamData(remoteProgram,
client,
msg,
stream->procedure,
stream->serial,
buffer, ret);
}
}
ret = 0;
cleanup:
VIR_FREE(buffer);
virNetMessageFree(msg);
return ret;
}

View File

@@ -26,6 +26,8 @@
# include "libvirtd.h"
daemonClientStream *
daemonCreateClientStream(virNetServerClientPtr client,
virStreamPtr st,

View File

@@ -35,7 +35,6 @@ module Test_libvirtd =
{ "1" = "joe@EXAMPLE.COM" }
{ "2" = "fred@EXAMPLE.COM" }
}
{ "tls_priority" = "NORMAL" }
{ "max_clients" = "5000" }
{ "max_queued_clients" = "1000" }
{ "max_anonymous_clients" = "20" }
@@ -56,7 +55,6 @@ module Test_libvirtd =
{ "audit_level" = "2" }
{ "audit_logging" = "1" }
{ "host_uuid" = "00000000-0000-0000-0000-000000000000" }
{ "host_uuid_source" = "smbios" }
{ "keepalive_interval" = "5" }
{ "keepalive_count" = "5" }
{ "keepalive_required" = "1" }

View File

@@ -28,7 +28,6 @@ apihtml = \
$(apihtml_generated)
apihtml_generated = \
html/libvirt-libvirt-common.html \
html/libvirt-libvirt-domain.html \
html/libvirt-libvirt-domain-snapshot.html \
html/libvirt-libvirt-event.html \
@@ -71,6 +70,8 @@ devhelpxsl = devhelp/devhelp.xsl devhelp/html.xsl
png = \
32favicon.png \
footer_corner.png \
footer_pattern.png \
libvirt-header-bg.png \
libvirt-header-logo.png \
libvirtLogo.png \
@@ -80,6 +81,7 @@ png = \
libvirt-driver-arch.png \
libvirt-object-model.png \
madeWith.png \
et.png \
migration-managed-direct.png \
migration-managed-p2p.png \
migration-native.png \
@@ -132,8 +134,7 @@ apidir = $(pkgdatadir)/api
api_DATA = \
libvirt-api.xml \
libvirt-qemu-api.xml \
libvirt-lxc-api.xml \
libvirt-admin-api.xml
libvirt-lxc-api.xml
fig = \
libvirt-net-logical.fig \
@@ -152,11 +153,11 @@ schema_DATA = $(wildcard $(srcdir)/schemas/*.rng)
EXTRA_DIST= \
apibuild.py genaclperms.pl \
site.xsl subsite.xsl newapi.xsl news.xsl page.xsl \
site.xsl newapi.xsl news.xsl page.xsl \
hacking1.xsl hacking2.xsl wrapstring.xsl \
$(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \
$(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \
$(xml) $(qemu_xml) $(lxc_xml) $(admin_xml) $(fig) $(png) $(css) \
$(xml) $(qemu_xml) $(lxc_xml) $(fig) $(png) $(css) \
$(patches) $(dot_php_in) $(dot_php_code_in) $(dot_php)\
$(internals_html_in) $(internals_html) \
sitemap.html.in aclperms.htmlinc \
@@ -326,7 +327,7 @@ $(APIBUILD_STAMP): $(srcdir)/apibuild.py \
$(top_srcdir)/src/util/virerror.c \
$(top_srcdir)/src/util/virevent.c \
$(top_srcdir)/src/util/virtypedparam.c
$(AM_V_GEN)srcdir=$(srcdir) builddir=$(builddir) $(PYTHON) $(APIBUILD)
$(AM_V_GEN)srcdir=$(srcdir) $(PYTHON) $(APIBUILD)
touch $@
@@ -365,15 +366,8 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/libvirtLogo.png $(DESTDIR)$(pkgdatadir)
uninstall-local:
for f in $(css) $(dot_html) $(gif) $(png); do \
rm -f $(DESTDIR)$(HTML_DIR)/$$f; \
done
for h in $(apihtml); do rm -f $(DESTDIR)$(HTML_DIR)/$$h; done
for p in $(apipng); do rm -f $(DESTDIR)$(HTML_DIR)/$$p; done
for f in $(internals_html); do \
rm -f $(DESTDIR)$(HTML_DIR)/$$f; \
done
for f in $(devhelphtml) $(devhelppng) $(devhelpcss); do \
rm -f $(DESTDIR)$(DEVHELP_DIR)/$$(basename $$f); \
done
rm -f $(DESTDIR)$(pkgdatadir)/libvirtLogo.png

View File

@@ -224,10 +224,6 @@
<td>secret_usage_target</td>
<td>Name of the associated iSCSI target, if any</td>
</tr>
<tr>
<td>secret_usage_name</td>
<td>Name of the associated TLS secret, if any</td>
</tr>
</tbody>
</table>

View File

@@ -21,7 +21,6 @@ debugsym=None
# C parser analysis code
#
included_files = {
"libvirt-common.h": "header with general libvirt API definitions",
"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",
@@ -112,12 +111,6 @@ ignored_macros = {
"_virMemoryParameter": "backward compatibility macro for virTypedParameter",
}
# macros that should be completely skipped
hidden_macros = {
"VIR_DEPRECATED": "internal macro to mark deprecated apis",
"VIR_EXPORT_VAR": "internal macro to mark exported vars",
}
def escape(raw):
raw = string.replace(raw, '&', '&amp;')
raw = string.replace(raw, '<', '&lt;')
@@ -240,11 +233,6 @@ class index:
self.references = {}
self.info = {}
def warning(self, msg):
global warnings
warnings = warnings + 1
print msg
def add_ref(self, name, header, module, static, type, lineno, info=None, extra=None, conditionals = None):
if name[0:2] == '__':
return None
@@ -1046,11 +1034,6 @@ class CParser:
name = string.split(name, '(') [0]
except:
pass
# skip hidden macros
if name in hidden_macros:
return token
strValue = None
if len(lst) == 1 and lst[0][0] == '"' and lst[0][-1] == '"':
strValue = lst[0][1:-1]
@@ -1398,8 +1381,7 @@ class CParser:
token = self.token()
while token[0] != "sep" or (token[1] != ',' and
token[1] != '}'):
# We might be dealing with '1U << 12' here
value = value + re.sub("^(\d+)U$","\\1", token[1])
value = value + token[1]
token = self.token()
else:
try:
@@ -2267,7 +2249,6 @@ class docBuilder:
if name == debugsym and not quiet:
print "=>", id
# NB: this is consumed by a regex in 'getAPIFilenames' in hvsupport.pl
output.write(" <%s name='%s' file='%s' module='%s'>\n" % (id.type,
name, self.modulename_file(id.header),
self.modulename_file(id.module)))
@@ -2586,65 +2567,52 @@ class docBuilder:
output.close()
class app:
def warning(self, msg):
global warnings
warnings = warnings + 1
print msg
def rebuild(self, name):
if name not in ["libvirt", "libvirt-qemu", "libvirt-lxc", "libvirt-admin"]:
self.warning("rebuild() failed, unknown module %s" % name)
return None
builder = None
srcdir = os.path.abspath((os.environ["srcdir"]))
builddir = os.path.abspath((os.environ["builddir"]))
if srcdir == builddir:
builddir = None
if glob.glob(srcdir + "/../src/libvirt.c") != [] :
if not quiet:
print "Rebuilding API description for %s" % name
dirs = [srcdir + "/../src",
srcdir + "/../src/util",
srcdir + "/../include/libvirt"]
if builddir:
dirs.append(builddir + "/../include/libvirt")
if glob.glob(srcdir + "/../include/libvirt/libvirt.h") == [] :
dirs.append("../include/libvirt")
builder = docBuilder(name, srcdir, dirs, [])
elif glob.glob("src/libvirt.c") != [] :
if not quiet:
print "Rebuilding API description for %s" % name
builder = docBuilder(name, srcdir,
["src", "src/util", "include/libvirt"],
[])
else:
self.warning("rebuild() failed, unable to guess the module")
return None
builder.scan()
builder.analyze()
builder.serialize()
return builder
#
# for debugging the parser
#
def parse(self, filename):
parser = CParser(filename)
idx = parser.parse()
return idx
def rebuild(name):
if name not in ["libvirt", "libvirt-qemu", "libvirt-lxc", "libvirt-admin"]:
self.warning("rebuild() failed, unknown module %s") % name
return None
builder = None
srcdir = os.environ["srcdir"]
if glob.glob(srcdir + "/../src/libvirt.c") != [] :
if not quiet:
print "Rebuilding API description for %s" % name
dirs = [srcdir + "/../src",
srcdir + "/../src/util",
srcdir + "/../include/libvirt"]
if glob.glob(srcdir + "/../include/libvirt/libvirt.h") == [] :
dirs.append("../include/libvirt")
builder = docBuilder(name, srcdir, dirs, [])
elif glob.glob("src/libvirt.c") != [] :
if not quiet:
print "Rebuilding API description for %s" % name
builder = docBuilder(name, srcdir,
["src", "src/util", "include/libvirt"],
[])
else:
self.warning("rebuild() failed, unable to guess the module")
return None
builder.scan()
builder.analyze()
builder.serialize()
return builder
#
# for debugging the parser
#
def parse(filename):
parser = CParser(filename)
idx = parser.parse()
return idx
if __name__ == "__main__":
app = app()
if len(sys.argv) > 1:
debug = 1
app.parse(sys.argv[1])
parse(sys.argv[1])
else:
app.rebuild("libvirt")
app.rebuild("libvirt-qemu")
app.rebuild("libvirt-lxc")
app.rebuild("libvirt-admin")
rebuild("libvirt")
rebuild("libvirt-qemu")
rebuild("libvirt-lxc")
rebuild("libvirt-admin")
if warnings > 0:
sys.exit(2)
else:

View File

@@ -2,7 +2,7 @@
<!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>Applications using libvirt</h1>
<h1>Applications using <strong>libvirt</strong></h1>
<p>
This page provides an illustration of the wide variety of
@@ -404,14 +404,6 @@
infrastructure. You can deploy a new service just dragging and
dropping a VM.
</dd>
<dt><a href="https://kimchi-project.github.io/kimchi/">Kimchi</a></dt>
<dd>
Kimchi is an HTML5 based management tool for KVM. It is designed to
make it as easy as possible to get started with KVM and create your first guest.
Kimchi manages KVM guests through libvirt. The management interface is accessed
over the web using a browser that supports HTML5.
</dd>
<dt><a href="http://ovirt.org/">oVirt</a></dt>
<dd>
oVirt provides the ability to manage large numbers of virtual

View File

@@ -57,13 +57,13 @@
</p>
<dl>
<dt><code>pid</code></dt>
<dt>pid</dt>
<dd>Process ID of the libvirtd daemon generating the audit record.</dd>
<dt><code>uid</code></dt>
<dt>uid</dt>
<dd>User ID of the libvirtd daemon process generating the audit record.</dd>
<dt><code>subj</code></dt>
<dt>subj</dt>
<dd>Security context of the libvirtd daemon process generating the audit record.</dd>
<dt><code>msg</code></dt>
<dt>msg</dt>
<dd>String containing a list of key=value pairs specific to the type of audit record being reported.</dd>
</dl>
@@ -72,21 +72,21 @@
</p>
<dl>
<dt><code>virt</code></dt>
<dt>virt</dt>
<dd>Type of virtualization driver used. One of <code>qemu</code> or <code>lxc</code></dd>
<dt><code>vm</code></dt>
<dt>vm</dt>
<dd>Host driver unique name of the guest</dd>
<dt><code>uuid</code></dt>
<dt>uuid</dt>
<dd>Globally unique identifier for the guest</dd>
<dt><code>exe</code></dt>
<dt>exe</dt>
<dd>Path of the libvirtd daemon</dd>
<dt><code>hostname</code></dt>
<dt>hostname</dt>
<dd>Currently unused</dd>
<dt><code>addr</code></dt>
<dt>addr</dt>
<dd>Currently unused</dd>
<dt><code>terminal</code></dt>
<dt>terminal</dt>
<dd>Currently unused</dd>
<dt><code>res</code></dt>
<dt>res</dt>
<dd>Result of the action, either <code>success</code> or <code>failed</code></dd>
</dl>
@@ -98,15 +98,15 @@
</p>
<dl>
<dt><code>op</code></dt>
<dt>op</dt>
<dd>Type of operation performed. One of <code>start</code>, <code>stop</code> or <code>init</code></dd>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the operation to happen</dd>
<dt><code>vm-pid</code></dt>
<dt>vm-pid</dt>
<dd>ID of the primary/leading process associated with the guest</dd>
<dt><code>init-pid</code></dt>
<dt>init-pid</dt>
<dd>ID of the <code>init</code> process in a container. Only if <code>op=init</code> and <code>virt=lxc</code></dd>
<dt><code>pid-ns</code></dt>
<dt>pid-ns</dt>
<dd>Namespace ID of the <code>init</code> process in a container. Only if <code>op=init</code> and <code>virt=lxc</code></dd>
</dl>
@@ -118,11 +118,11 @@
</p>
<dl>
<dt><code>model</code></dt>
<dt>model</dt>
<dd>The security driver type. One of <code>selinux</code> or <code>apparmor</code></dd>
<dt><code>vm-ctx</code></dt>
<dt>vm-ctx</dt>
<dd>Security context for the guest process</dd>
<dt><code>img-ctx</code></dt>
<dt>img-ctx</dt>
<dd>Security context for the guest disk images and other assigned host resources</dd>
</dl>
@@ -144,13 +144,13 @@
</p>
<dl>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>resrc</code></dt>
<dt>resrc</dt>
<dd>The type of resource assigned. Set to <code>vcpu</code></dd>
<dt><code>old-vcpu</code></dt>
<dt>old-vcpu</dt>
<dd>Original vCPU count, or 0</dd>
<dt><code>new-vcpu</code></dt>
<dt>new-vcpu</dt>
<dd>Updated vCPU count</dd>
</dl>
@@ -162,13 +162,13 @@
</p>
<dl>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>resrc</code></dt>
<dt>resrc</dt>
<dd>The type of resource assigned. Set to <code>mem</code></dd>
<dt><code>old-mem</code></dt>
<dt>old-mem</dt>
<dd>Original memory size in bytes, or 0</dd>
<dt><code>new-mem</code></dt>
<dt>new-mem</dt>
<dd>Updated memory size in bytes</dd>
</dl>
@@ -178,13 +178,13 @@
</p>
<dl>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>resrc</code></dt>
<dt>resrc</dt>
<dd>The type of resource assigned. Set to <code>disk</code></dd>
<dt><code>old-disk</code></dt>
<dt>old-disk</dt>
<dd>Original host file or device path acting as the disk backing file</dd>
<dt><code>new-disk</code></dt>
<dt>new-disk</dt>
<dd>Updated host file or device path acting as the disk backing file</dd>
</dl>
@@ -195,13 +195,13 @@
</p>
<dl>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>resrc</code></dt>
<dt>resrc</dt>
<dd>The type of resource assigned. Set to <code>net</code></dd>
<dt><code>old-net</code></dt>
<dt>old-net</dt>
<dd>Original MAC address of the guest network interface</dd>
<dt><code>new-net</code></dt>
<dt>new-net</dt>
<dd>Updated MAC address of the guest network interface</dd>
</dl>
@@ -211,13 +211,13 @@
</p>
<dl>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>resrc</code></dt>
<dt>resrc</dt>
<dd>The type of resource assigned. Set to <code>net</code></dd>
<dt><code>net</code></dt>
<dt>net</dt>
<dd>MAC address of the host network interface</dd>
<dt><code>rdev</code></dt>
<dt>rdev</dt>
<dd>Name of the host network interface</dd>
</dl>
@@ -227,13 +227,13 @@
</p>
<dl>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>resrc</code></dt>
<dt>resrc</dt>
<dd>The type of resource assigned. Set to <code>fs</code></dd>
<dt><code>old-fs</code></dt>
<dt>old-fs</dt>
<dd>Original host directory, file or device path backing the filesystem </dd>
<dt><code>new-fs</code></dt>
<dt>new-fs</dt>
<dd>Updated host directory, file or device path backing the filesystem</dd>
</dl>
@@ -243,15 +243,15 @@
</p>
<dl>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>resrc</code></dt>
<dt>resrc</dt>
<dd>The type of resource assigned. Set to <code>hostdev</code> or <code>dev</code></dd>
<dt><code>dev</code></dt>
<dt>dev</dt>
<dd>The unique bus identifier of the USB, PCI or SCSI device, if <code>resrc=dev</code></dd>
<dt><code>disk</code></dt>
<dt>disk</dt>
<dd>The path of the block device assigned to the guest, if <code>resrc=hostdev</code></dd>
<dt><code>chardev</code></dt>
<dt>chardev</dt>
<dd>The path of the character device assigned to the guest, if <code>resrc=hostdev</code></dd>
</dl>
@@ -261,11 +261,11 @@
</p>
<dl>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>resrc</code></dt>
<dt>resrc</dt>
<dd>The type of resource assigned. Set to <code>tpm</code></dd>
<dt><code>device</code></dt>
<dt>device</dt>
<dd>The path of the host TPM device assigned to the guest</dd>
</dl>
@@ -275,13 +275,13 @@
</p>
<dl>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>resrc</code></dt>
<dt>resrc</dt>
<dd>The type of resource assigned. Set to <code>rng</code></dd>
<dt><code>old-rng</code></dt>
<dt>old-rng</dt>
<dd>Original path of the host entropy source for the RNG</dd>
<dt><code>new-rng</code></dt>
<dt>new-rng</dt>
<dd>Updated path of the host entropy source for the RNG</dd>
</dl>
@@ -291,13 +291,13 @@
</p>
<dl>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>resrc</code></dt>
<dt>resrc</dt>
<dd>The type of resource assigned. Set to <code>chardev</code></dd>
<dt><code>old-chardev</code></dt>
<dt>old-chardev</dt>
<dd>Original path of the backing character device for given emulated device</dd>
<dt><code>new-chardev</code></dt>
<dt>new-chardev</dt>
<dd>Updated path of the backing character device for given emulated device</dd>
</dl>
@@ -307,15 +307,15 @@
</p>
<dl>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>resrc</code></dt>
<dt>resrc</dt>
<dd>The type of resource assigned. Set to <code>smartcard</code></dd>
<dt><code>old-smartcard</code></dt>
<dt>old-smartcard</dt>
<dd>Original path of the backing character device, certificate store or
"nss-smartcard-device" for host smartcard passthrough.
</dd>
<dt><code>new-smartcard</code></dt>
<dt>new-smartcard</dt>
<dd>Updated path of the backing character device, certificate store or
"nss-smartcard-device" for host smartcard passthrough.
</dd>
@@ -327,13 +327,13 @@
</p>
<dl>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>resrc</code></dt>
<dt>resrc</dt>
<dd>The type of resource assigned. Set to <code>redir</code></dd>
<dt><code>bus</code></dt>
<dt>bus</dt>
<dd>The bus type, only <code>usb</code> allowed</dd>
<dt><code>device</code></dt>
<dt>device</dt>
<dd>The device type, only <code>USB redir</code> allowed</dd>
</dl>
@@ -344,32 +344,13 @@
</p>
<dl>
<dt><code>reason</code></dt>
<dt>reason</dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>resrc</code></dt>
<dt>resrc</dt>
<dd>The type of resource assigned. Set to <code>cgroup</code></dd>
<dt><code>cgroup</code></dt>
<dt>cgroup</dt>
<dd>The name of the cgroup controller</dd>
</dl>
<h4><a name="typeresourceshmem">Shared memory</a></h4>
<p>
The <code>msg</code> field will include the following sub-fields
</p>
<dl>
<dt><code>resrc</code></dt>
<dd>The type of resource assigned. Set to <code>shmem</code></dd>
<dt><code>reason</code></dt>
<dd>The reason which caused the resource to be assigned to happen</dd>
<dt><code>size</code></dt>
<dd>The size of the shared memory region</dd>
<dt><code>shmem</code></dt>
<dd>Name of the shared memory region</dd>
<dt><code>source</code></dt>
<dd>Path of the backing character device for given emulated device</dd>
</dl>
</body>
</html>

View File

@@ -76,11 +76,7 @@ password=letmein
[credentials-dev]
username=joe
password=hello
[credentials-defgrp]
username=defuser
password=defpw</pre>
password=hello</pre>
<p>
The second set of groups provide mappings of credentials to
@@ -94,8 +90,7 @@ credentials=$CREDENTIALS</pre>
<p>
For example, following the previous example, here is how to
map some machines. For convenience libvirt supports a default
mapping of credentials to machines:
list some machines
</p>
<pre>
@@ -111,15 +106,8 @@ credentials=test
[auth-libvirt-prod1.example.com]
credentials=prod
[auth-libvirt-default]
credentials=defgrp
[auth-esx-dev1.example.com]
credentials=dev
[auth-esx-default]
credentials=defgrp</pre>
credentials=dev</pre>
<p>
The following service types are known to libvirt

View File

@@ -14,10 +14,6 @@
<strong>C#</strong>: Arnaud Champion develops
<a href="csharp.html">C# bindings</a>.
</li>
<li>
<strong>Go</strong>: Kyle Kelley et al. are developing
<a href="https://github.com/rgbkrk/libvirt-go">Go bindings</a>.
</li>
<li>
<strong>Java</strong>: Daniel Veillard develops
<a href="java.html">Java bindings</a>.

View File

@@ -13,7 +13,7 @@
</p>
<pre>
$ xz -c libvirt-x.x.x.tar.xz | tar xvf -
$ gunzip -c libvirt-x.x.x.tar.gz | tar xvf -
$ cd libvirt-x.x.x
$ ./configure</pre>

View File

@@ -28,67 +28,24 @@
</p>
<ul>
<li><a href="ftp://libvirt.org/libvirt/libvirt-git-snapshot.tar.xz">libvirt.org FTP server</a></li>
<li><a href="http://libvirt.org/sources/libvirt-git-snapshot.tar.xz">libvirt.org HTTP server</a></li>
<li><a href="ftp://libvirt.org/libvirt/libvirt-git-snapshot.tar.gz">libvirt.org FTP server</a></li>
<li><a href="http://libvirt.org/sources/libvirt-git-snapshot.tar.gz">libvirt.org HTTP server</a></li>
</ul>
<h2><a name="schedule">Primary release schedule</a></h2>
<p>
Libvirt follows a time based plan, with releases made once a month
on the 1st of each month give or take a few days. The only exception
is at the start of the year where there are two 6 weeks gaps (first
release in the middle of Jan, then skip the Feb release), giving
a total of 11 releases a year.
</p>
<h2><a name="numbering">Release numbering</a></h2>
<p>
Since libvirt 2.0.0, a time based version numbering rule
is applied. As such, the changes in version number have
do not have any implications with respect to the scope of
features or bugfixes included, the stability of the code,
or the API / ABI compatibility (libvirt API / ABI is guaranteed
stable forever). The rules applied for changing the libvirt
version number are:
</p>
<dl>
<dt><code>major</code></dt>
<dd>incremented by 1 for the first release of the year (the
Jan 15th release)</dd>
<dt><code>minor</code></dt>
<dd>incremented by 1 for each monthly release from git master</dd>
<dt><code>micro</code></dt>
<dd>always 0 for releases from git master, incremented by 1
for each stable maintenance release</dd>
</dl>
<p>
Prior to 2.0.0, the major/minor numbers were incremented
fairly arbitrarily, and maintenance releases appended a
fourth digit.
</p>
<h2><a name="maintenance">Maintenance releases</a></h2>
<p>
In the git repository are several stable maintenance branches,
matching the
pattern <code>v<i>major</i>.<i>minor</i>-maint</code>;
pattern <code>v<i>major</i>.<i>minor</i>.<i>micro</i>-maint</code>;
these branches are forked off the corresponding
<code>v<i>major</i>.<i>minor</i>.0</code> formal
<code>v<i>major</i>.<i>minor</i>.<i>micro</i></code> formal
release, and may have further releases of the
form <code>v<i>major</i>.<i>minor</i>.<i>micro</i></code>.
form <code>v<i>major</i>.<i>minor</i>.<i>micro</i>.<i>rel</i></code>.
These maintenance branches should only contain bug fixes, and no
new features, backported from the master branch, and are
supported as long as at least one downstream distribution
expresses interest in a given branch. These maintenance
branches are considered during CVE analysis. In contrast
to the primary releases which are made once a month, there
is no formal schedule for the maintenance releases, which
are made whenever there is a need to make available key
bugfixes to downstream consumers.
branches are considered during CVE analysis.
</p>
<p>

View File

@@ -80,15 +80,15 @@ to be provided by all container technologies on Linux.
</p>
<dl>
<dt><code>container</code></dt>
<dt>container</dt>
<dd>The fixed string <code>libvirt-lxc</code> to identify libvirt as the creator</dd>
<dt><code>container_uuid</code></dt>
<dt>container_uuid</dt>
<dd>The UUID assigned to the container by libvirt</dd>
<dt><code>PATH</code></dt>
<dt>PATH</dt>
<dd>The fixed string <code>/bin:/usr/bin</code></dd>
<dt><code>TERM</code></dt>
<dt>TERM</dt>
<dd>The fixed string <code>linux</code></dd>
<dt><code>HOME</code></dt>
<dt>HOME</dt>
<dd>The fixed string <code>/</code></dd>
</dl>
@@ -98,11 +98,11 @@ environment variables are also provided
</p>
<dl>
<dt><code>LIBVIRT_LXC_NAME</code></dt>
<dt>LIBVIRT_LXC_NAME</dt>
<dd>The name assigned to the container by libvirt</dd>
<dt><code>LIBVIRT_LXC_UUID</code></dt>
<dt>LIBVIRT_LXC_UUID</dt>
<dd>The UUID assigned to the container by libvirt</dd>
<dt><code>LIBVIRT_LXC_CMDLINE</code></dt>
<dt>LIBVIRT_LXC_CMDLINE</dt>
<dd>The unparsed command line arguments specified in the container configuration.
Use of this is discouraged, in favour of passing arguments directly to the
container init process via the <code>initarg</code> config element.</dd>

BIN
docs/et.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

BIN
docs/footer_corner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
docs/footer_pattern.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

View File

@@ -73,19 +73,19 @@
<dd>This expresses what kind of operating system the hypervisor
is able to run. Possible values are:
<dl>
<dt><code>xen</code></dt>
<dt>xen</dt>
<dd>for XEN</dd>
<dt><code>linux</code></dt>
<dt>linux</dt>
<dd>legacy alias for <code>xen</code></dd>
<dt><code>hvm</code></dt>
<dt>hvm</dt>
<dd>Unmodified operating system</dd>
<dt><code>exe</code></dt>
<dt>exe</dt>
<dd>Container based virtualization</dd>
<dt><code>uml</code></dt>
<dt>uml</dt>
<dd>User Mode Linux</dd>
</dl>
</dd>
@@ -97,37 +97,37 @@
<dd>This optional element encases possible features that can be used
with a guest of described type. Possible subelements are:
<dl>
<dt><code>pae</code></dt><dd>If present, 32-bit guests can use PAE
<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><code>nonpae</code></dt><dd>If present, 32-bit guests can be run
<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><code>ia64_be</code></dt><dd>If present, IA64 guests can be run in
<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><code>acpi</code></dt><dd>If this element is present,
<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><code>apic</code></dt><dd>If this element is present,
<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><code>cpuselection</code></dt><dd>If this element is present, the
<dt>cpuselection</dt><dd>If this element is present, the
hypervisor supports the <code>&lt;cpu&gt;</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><code>deviceboot</code></dt><dd>If this element is present,
<dt>deviceboot</dt><dd>If this element is present,
the <code>&lt;boot order='...'/&gt;</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><code>disksnapshot</code></dt><dd>If this element is present,
<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

File diff suppressed because it is too large Load Diff

View File

@@ -61,18 +61,18 @@
&lt;/domainCapabilities&gt;
</pre>
<dl>
<dt><code>path</code></dt>
<dt>path</dt>
<dd>The full path to the emulator binary.</dd>
<dt><code>domain</code></dt>
<dt>domain</dt>
<dd>Describes the <a href="formatdomain.html#elements">virtualization
type</a> (or so called domain type).</dd>
<dt><code>machine</code></dt>
<dt>machine</dt>
<dd>The domain's <a href="formatdomain.html#elementsOSBIOS">machine
type</a>.</dd>
<dt><code>arch</code></dt>
<dt>arch</dt>
<dd>The domain's <a href="formatdomain.html#elementsOSBIOS">
architecture</a>.</dd>
@@ -92,7 +92,7 @@
</pre>
<dl>
<dt><code>vcpu</code></dt>
<dt>vcpu</dt>
<dd>The maximum number of supported virtual CPUs</dd>
</dl>
@@ -126,91 +126,26 @@
<p>For the <code>loader</code> element, the following can occur:</p>
<dl>
<dt><code>value</code></dt>
<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><code>type</code></dt>
<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 &lt;loader/&gt;
element.</dd>
<dt><code>readonly</code></dt>
<dt>readonly</dt>
<dd>Options for the <code>readonly</code> attribute of the
&lt;loader/&gt; element.</dd>
</dl>
<h3><a name="elementsCPU">CPU configuration</a></h3>
<p>
The <code>cpu</code> element exposes options usable for configuring
<a href="formatdomain.html#elementsCPU">guest CPUs</a>.
</p>
<pre>
&lt;domainCapabilities&gt;
...
&lt;cpu&gt;
&lt;mode name='host-passthrough' supported='yes'/&gt;
&lt;mode name='host-model' supported='yes'&gt;
&lt;model fallback='allow'&gt;Broadwell&lt;/model&gt;
&lt;vendor&gt;Intel&lt;/vendor&gt;
&lt;feature policy='disable' name='aes'/&gt;
&lt;feature policy='require' name='vmx'/&gt;
&lt;/mode&gt;
&lt;mode name='custom' supported='yes'&gt;
&lt;model usable='no'&gt;Broadwell&lt;/model&gt;
&lt;model usable='yes'&gt;Broadwell-noTSX&lt;/model&gt;
&lt;model usable='no'&gt;Haswell&lt;/model&gt;
...
&lt;/mode&gt;
&lt;/cpu&gt;
...
&lt;domainCapabilities&gt;
</pre>
<p>
Each CPU mode understood by libvirt is described with a
<code>mode</code> element which tells whether the particular mode
is supported and provides (when applicable) more details about it:
</p>
<dl>
<dt><code>host-passthrough</code></dt>
<dd>No mode specific details are provided.</dd>
<dt><code>host-model</code></dt>
<dd>
If <code>host-model</code> is supported by the hypervisor, the
<code>mode</code> describes the guest CPU which will be used when
starting a domain with <code>host-model</code> CPU. The hypervisor
specifics (such as unsupported CPU models or features, machine type,
etc.) may be accounted for in this guest CPU specification and thus
the CPU can be different from the one shown in host capabilities XML.
This is indicated by the <code>fallback</code> attribute of the
<code>model</code> sub element: <code>allow</code> means not all
specifics were accounted for and thus the CPU a guest will see may
be different; <code>forbid</code> indicates that the CPU a guest will
see should match this CPU definition.
</dd>
<dt><code>custom</code></dt>
<dd>
The <code>mode</code> element contains a list of supported CPU
models, each described by a dedicated <code>model</code> element.
The <code>usable</code> attribute specifies whether the model can
be used on the host. A special value <code>unknown</code> indicates
libvirt does not have enough information to provide the usability
data.
</dd>
</dl>
<h3><a name="elementsDevices">Devices</a></h3>
<p>
Another set of XML elements describe the supported devices and their
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>
@@ -240,7 +175,7 @@
<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 the <code>disk</code> element. For
<p>Disk capabilities are exposed under <code>disk</code> element. For
instance:</p>
<pre>
@@ -272,72 +207,15 @@
</pre>
<dl>
<dt><code>diskDevice</code></dt>
<dt>diskDevice</dt>
<dd>Options for the <code>device</code> attribute of the &lt;disk/&gt;
element.</dd>
<dt><code>bus</code></dt>
<dt>bus</dt>
<dd>Options for the <code>bus</code> attribute of the &lt;target/&gt;
element for a &lt;disk/&gt;.</dd>
</dl>
<h4><a name="elementsGraphics">Graphical framebuffers</a></h4>
<p>Graphics device capabilities are exposed under the
<code>graphics</code> element. For instance:</p>
<pre>
&lt;domainCapabilities&gt;
...
&lt;devices&gt;
&lt;graphics supported='yes'&gt;
&lt;enum name='type'&gt;
&lt;value&gt;sdl&lt;/value&gt;
&lt;value&gt;vnc&lt;/value&gt;
&lt;value&gt;spice&lt;/value&gt;
&lt;/enum&gt;
&lt;/graphics&gt;
...
&lt;/devices&gt;
&lt;/domainCapabilities&gt;
</pre>
<dl>
<dt><code>type</code></dt>
<dd>Options for the <code>type</code> attribute of the &lt;graphics/&gt;
element.</dd>
</dl>
<h4><a name="elementsVideo">Video device</a></h4>
<p>Video device capabilities are exposed under the
<code>video</code> element. For instance:</p>
<pre>
&lt;domainCapabilities&gt;
...
&lt;devices&gt;
&lt;video supported='yes'&gt;
&lt;enum name='modelType'&gt;
&lt;value&gt;vga&lt;/value&gt;
&lt;value&gt;cirrus&lt;/value&gt;
&lt;value&gt;vmvga&lt;/value&gt;
&lt;value&gt;qxl&lt;/value&gt;
&lt;value&gt;virtio&lt;/value&gt;
&lt;/enum&gt;
&lt;/video&gt;
...
&lt;/devices&gt;
&lt;/domainCapabilities&gt;
</pre>
<dl>
<dt><code>modelType</code></dt>
<dd>Options for the <code>type</code> attribute of the
&lt;video&gt;&lt;model&gt; element.</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>
@@ -379,66 +257,25 @@
</pre>
<dl>
<dt><code>mode</code></dt>
<dt>mode</dt>
<dd>Options for the <code>mode</code> attribute of the &lt;hostdev/&gt;
element.</dd>
<dt><code>startupPolicy</code></dt>
<dt>startupPolicy</dt>
<dd>Options for the <code>startupPolicy</code> attribute of the
&lt;hostdev/&gt; element.</dd>
<dt><code>subsysType</code></dt>
<dt>subsysType</dt>
<dd>Options for the <code>type</code> attribute of the &lt;hostdev/&gt;
element in case of <code>mode="subsystem"</code>.</dd>
<dt><code>capsType</code></dt>
<dt>capsType</dt>
<dd>Options for the <code>type</code> attribute of the &lt;hostdev/&gt;
element in case of <code>mode="capabilities"</code>.</dd>
<dt><code>pciBackend</code></dt>
<dt>pciBackend</dt>
<dd>Options for the <code>name</code> attribute of the &lt;driver/&gt;
element.</dd>
</dl>
<h3><a name="elementsFeatures">Features</a></h3>
<p>One more set of XML elements describe the supported features and
their capabilities. All features occur as children of the main
<code>features</code> element.</p>
<pre>
&lt;domainCapabilities&gt;
...
&lt;features&gt;
&lt;gic supported='yes'&gt;
&lt;enum name='version'&gt;
&lt;value&gt;2&lt;/value&gt;
&lt;value&gt;3&lt;/value&gt;
&lt;/enum&gt;
&lt;/gic&gt;
&lt;/features&gt;
&lt;/domainCapabilities&gt;
</pre>
<p>Reported capabilities are expressed as an enumerated list of
possible values for each of the elements or attributes. For example, the
<code>gic</code> element has an attribute <code>version</code> which can
support the values <code>2</code> or <code>3</code>.</p>
<p>For information about the purpose of each feature, see the
<a href="formatdomain.html#elementsFeatures">relevant section</a> in
the domain XML documentation.
</p>
<h4><a name="elementsGIC">GIC capabilities</a></h4>
<p>GIC capabilities are exposed under the <code>gic</code> element.</p>
<dl>
<dt><code>version</code></dt>
<dd>Options for the <code>version</code> attribute of the
<code>gic</code> element.</dd>
</dl>
</body>
</html>

View File

@@ -38,10 +38,6 @@
&lt;network ipv6='yes' trustGuestRxFilters='no'&gt;
&lt;name&gt;default&lt;/name&gt;
&lt;uuid&gt;3e3fce45-4f53-4fa7-bb32-11f34168b82b&lt;/uuid&gt;
&lt;metadata&gt;
&lt;app1:foo xmlns:app1="http://app1.org/app1/"&gt;..&lt;/app1:foo&gt;
&lt;app2:bar xmlns:app2="http://app1.org/app2/"&gt;..&lt;/app2:bar&gt;
&lt;/metadata&gt;
...</pre>
<dl>
@@ -58,20 +54,13 @@
The format must be RFC 4122 compliant, eg <code>3e3fce45-4f53-4fa7-bb32-11f34168b82b</code>.
If omitted when defining/creating a new network, a random
UUID is generated. <span class="since">Since 0.3.0</span></dd>
<dd>The <code>metadata</code> node can be used by applications to
store custom metadata in the form of XML nodes/trees. Applications
must use custom namespaces on their XML nodes/trees, with only
one top-level element per namespace (if the application needs
structure, they should have sub-elements to their namespace
element). <span class="since">Since 2.1.0</span></dd>
<dt><code>ipv6</code></dt>
<dd>When set to <code>yes</code>, the optional parameter
<code>ipv6</code> enables
<dt><code>ipv6='yes'</code></dt>
<dd>The new, optional parameter <code>ipv6='yes'</code> enables
a network definition with no IPv6 gateway addresses specified
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</code></dt>
<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
@@ -260,28 +249,6 @@
<span class="since">Since 0.4.2</span>
</dd>
<dt><code>open</code></dt>
<dd>
As with mode='route', guest network traffic will be
forwarded to the physical network via the host's IP
routing stack, but there will be no firewall rules added
to either enable or prevent any of this traffic. When
forward='open' is set, the <code>dev</code> attribute
cannot be set (because the forward dev is enforced with
firewall rules, and the purpose of forward='open' is to
have a forwarding mode where libvirt doesn't add any
firewall rules). This mode presumes that the local LAN
router has suitable routing table entries to return
traffic to this host, and that some other management
system has been used to put in place any necessary
firewall rules. Although no firewall rules will be added
for the network, it is of course still possible to add
restrictions for specific guests using
<a href="formatnwfilter.html">nwfilter rules</a> on the
guests' interfaces.)
<span class="since">Since 2.2.0</span>
</dd>
<dt><code>bridge</code></dt>
<dd>
This network describes either 1) an existing host bridge
@@ -640,47 +607,31 @@
</pre>
<p>
If (and only if) the network connection used by the guest
supports VLAN tagging transparent to the guest, an
optional <code>&lt;vlan&gt;</code> element can specify one or
more VLAN tags to apply to the guest's network
traffic <span class="since">Since 0.10.0</span>. Network
connections that support guest-transparent VLAN tagging include
1) type='bridge' interfaces connected to an Open vSwitch bridge
<span class="since">Since 0.10.0</span>, 2) SRIOV Virtual
Functions (VF) used via type='hostdev' (direct device
assignment) <span class="since">Since 0.10.0</span>, and 3)
SRIOV VFs used via type='direct' with mode='passthrough'
(macvtap "passthru" mode) <span class="since">Since
1.3.5</span>. All other connection types, including standard
If (and only if) the network type supports vlan tagging
transparent to the guest, an optional <code>&lt;vlan&gt;</code>
element can specify one or more vlan tags to apply to the
traffic of all guests using this
network <span class="since">Since 0.10.0</span>. (openvswitch
and type='hostdev' SR-IOV networks do support transparent vlan
tagging of guest traffic; everything else, including standard
linux bridges and libvirt's own virtual networks, <b>do not</b>
support it. 802.1Qbh (vn-link) and 802.1Qbg (VEPA) switches
provide their own way (outside of libvirt) to tag guest traffic
onto a specific VLAN. Each tag is given in a
separate <code>&lt;tag&gt;</code> subelement
of <code>&lt;vlan&gt;</code> (for example: <code>&lt;tag
id='42'/&gt;</code>). For VLAN trunking of multiple tags (which
is supported only on Open vSwitch connections),
multiple <code>&lt;tag&gt;</code> subelements can be specified,
which implies that the user wants to do VLAN trunking on the
interface for all the specified tags. In the case that VLAN
trunking of a single tag is desired, the optional
attribute <code>trunk='yes'</code> can be added to the toplevel
<code>&lt;vlan&gt;</code> element to differentiate trunking of a
single tag from normal tagging.
onto specific vlans.) As expected, the <code>tag</code>
attribute specifies which vlan tag to use. If a network has more
than one <code>&lt;vlan&gt;</code> element defined, it is
assumed that the user wants to do VLAN trunking using all the
specified tags. In the case that vlan trunking with a single tag
is desired, the optional attribute <code>trunk='yes'</code> can
be added to the vlan element.
</p>
<p>
For network connections using Open vSwitch it is also possible
to configure 'native-tagged' and 'native-untagged' VLAN modes
<span class="since">Since 1.1.0.</span> This is done with the
optional <code>nativeMode</code> attribute on
the <code>&lt;tag&gt;</code> subelement: <code>nativeMode</code>
may be set to 'tagged' or 'untagged'. The <code>id</code>
attribute of the <code>&lt;tag&gt;</code> subelement
containing <code>nativeMode</code> sets which VLAN is considered
to be the "native" VLAN for this interface, and
the <code>nativeMode</code> attribute determines whether or not
traffic for that VLAN will be tagged.
For network connections using openvswitch it is possible to
configure the 'native-tagged' and 'native-untagged' vlan modes
<span class="since">Since 1.1.0</span>. This uses the optional
<code>nativeMode</code> attribute on the <code>&lt;tag&gt;</code>
element: <code>nativeMode</code> may be set to 'tagged' or
'untagged'. The id attribute of the element sets the native vlan.
</p>
<p>
<code>&lt;vlan&gt;</code> elements can also be specified in
@@ -847,8 +798,7 @@
&lt;dns&gt;
&lt;txt name="example" value="example value" /&gt;
&lt;forwarder addr="8.8.8.8"/&gt;
&lt;forwarder domain='example.com' addr="8.8.4.4"/&gt;
&lt;forwarder domain='www.example.com'/&gt;
&lt;forwarder addr="8.8.4.4"/&gt;
&lt;srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10'/&gt;
&lt;host ip='192.168.122.2'&gt;
&lt;hostname&gt;myhost&lt;/hostname&gt;
@@ -886,18 +836,6 @@
information for the virtual network's DNS
server <span class="since">Since 0.9.3</span>.
<p>
The dns element can have an optional <code>enable</code>
attribute <span class="since">Since 2.2.0</span>.
If <code>enable</code> is "no", then no DNS server will be
setup by libvirt for this network (and any other
configuration in <code>&lt;dns&gt;</code> will be ignored).
If <code>enable</code> is "yes" or unspecified (including
the complete absence of any <code>&lt;dns&gt;</code>
element) then a DNS server will be setup by libvirt to
listen on all IP addresses specified in the network's
configuration.
</p>
<p>
The dns element
can have an optional <code>forwardPlainNames</code>
@@ -916,25 +854,12 @@
Currently supported sub-elements of <code>&lt;dns&gt;</code> are:
<dl>
<dt><code>forwarder</code></dt>
<dd>The dns element can have 0 or
more <code>&lt;forwarder&gt;</code> elements. Each
forwarder element defines an alternate DNS server to use
for some, or all, DNS requests sent to this network's DNS
server. There are two attributes - <code>domain</code>,
and <code>addr</code>; at least one of these must be
specified in any <code>&lt;forwarder&gt;</code>
element. If both <code>domain</code> and <code>addr</code>
are specified, then all requests that match the given
domain will be forwarded to the DNS server at addr. If
only <code>domain</code> is specified, then all matching
domains will be resolved locally (or via the host's
standard DNS forwarding if they can't be resolved
locally). If an <code>addr</code> is specified by itself,
then all DNS requests to the network's DNS server will be
forwarded to the DNS server at that address with no
exceptions. <code>addr</code> <span class="since">Since
1.1.3</span>, <code>domain</code> <span class="since">Since
2.2.0</span>.
<dd>A <code>dns</code> element can have 0 or
more <code>forwarder</code> elements. Each forwarder
element defines an IP address to be used as forwarder in
DNS server configuration. The addr attribute is required
and defines the IP address of every
forwarder. <span class="since">Since 1.1.3</span>
</dd>
<dt><code>txt</code></dt>
<dd>A <code>dns</code> element can have 0 or more <code>txt</code> elements.

View File

@@ -97,38 +97,27 @@
<dd>
This optional element can occur multiple times. If it
exists, it has a mandatory <code>type</code> attribute
which will be set to:
<dl>
<dt><code>physical_function</code></dt>
<dd>
That means there will be a single <code>address</code>
subelement which contains the PCI address of the SRIOV
Physical Function (PF) that is the parent of this device
(and this device is, by implication, an SRIOV Virtual
Function (VF)).
</dd>
<dt><code>virtual_function</code></dt>
<dd>
In this case this device is an SRIOV PF, and the capability
element will have a list of <code>address</code>
subelements, one for each VF on this PF. If the host system
supports reporting it (via the "sriov_maxvfs" file in the
device's sysfs directory) the capability element will also
have an attribute named <code>maxCount</code> which is the
maximum number of SRIOV VFs supported by this device, which
could be higher than the number of VFs that are curently
active <span class="since">since 1.3.0</span>; in this case,
even if there are currently no active VFs the
virtual_functions capabililty will still be shown.
</dd>
<dt><code>pci-bridge</code> or <code>cardbus-bridge</code></dt>
<dd>
This shows merely that the lower 7 bits of PCI header type
have either value of 1 or 2 respectively. Usually this
means such device cannot be used for PCI passthrough.
<span class="since">Since 1.3.3</span>
</dd>
</dl>
which will be set to
either <code>physical_function</code>
or <code>virtual_functions</code>. If the type
is <code>physical_function</code>, there will be a
single <code>address</code> subelement which contains
the PCI address of the SRIOV Physical Function (PF)
that is the parent of this device (and this device is,
by implication, an SRIOV Virtual Function (VF)). If
the type is <code>virtual_functions</code>, then this
device is an SRIOV PF, and the capability element will
have a list of <code>address</code> subelements, one
for each VF on this PF. If the host system supports
reporting it (via the "sriov_maxvfs" file in the
device's sysfs directory) the capability element will
also have an attribute named <code>maxCount</code>
which is the maximum number of SRIOV VFs supported by
this device, which could be higher than the number of
VFs that are curently active <span class="since">since
1.3.0</span>; in this case, even if there are
currently no active VFs the virtual_functions
capabililty will still be shown.
</dd>
<dt><code>numa</code></dt>
<dd>

View File

@@ -1779,9 +1779,9 @@
<br/><br/>
</p>
<h5><a name="nwfelemsRulesProtoMiscv6">ESP, AH, UDPLITE, 'ALL' over IPv6</a></h5>
<h5><a name="nwfelemsRulesProtoMiscv6">IGMP, ESP, AH, UDPLITE, 'ALL' over IPv6</a></h5>
<p>
Protocol ID: <code>esp-ipv6</code>, <code>ah-ipv6</code>, <code>udplite-ipv6</code>, <code>all-ipv6</code>
Protocol ID: <code>igmp-ipv6</code>, <code>esp-ipv6</code>, <code>ah-ipv6</code>, <code>udplite-ipv6</code>, <code>all-ipv6</code>
<br/>
Note: The chain parameter is ignored for this type of traffic
and should either be omitted or set to <code>root</code>.

View File

@@ -41,21 +41,18 @@
<dd>
Specifies what this secret is used for. A mandatory
<code>type</code> attribute specifies the usage category, currently
only <code>volume</code>, <code>ceph</code>, <code>iscsi</code>,
and <code>tls</code> are defined. Specific usage categories
are described below.
only <code>volume</code>, <code>ceph</code> and <code>iscsi</code>
are defined. Specific usage categories are described below.
</dd>
</dl>
<h3><a name="VolumeUsageType">Usage type "volume"</a></h3>
<p>
This secret is associated with a volume, whether the format is either
for a "qcow" or a "luks" encrypted volume. Each volume will have a
unique secret associated with it and it is safe to delete the
secret after the volume is deleted. The
<code>&lt;usage type='volume'&gt;</code> element must contain a
single <code>volume</code> element that specifies the path of the volume
This secret is associated with a volume, and it is safe to delete the
secret after the volume is deleted. The <code>&lt;usage
type='volume'&gt;</code> element must contain a
single <code>volume</code> element that specifies the key of the volume
this secret is associated with. For example, create a volume-secret.xml
file as follows:
</p>
@@ -71,7 +68,7 @@
</pre>
<p>
Define the secret and set the passphrase as follows:
Define the secret and set the pass phrase as follows:
</p>
<pre>
# virsh secret-define volume-secret.xml
@@ -84,8 +81,8 @@
</pre>
<p>
The volume type secret can be supplied in domain XML for a qcow storage
volume <a href="formatstorageencryption.html">encryption</a> as follows:
The volume type secret can then be used in the XML for a storage volume
<a href="formatstorageencryption.html">encryption</a> as follows:
</p>
<pre>
&lt;encryption format='qcow'&gt;
@@ -93,33 +90,6 @@
&lt;/encryption&gt;
</pre>
<p>
The volume type secret can be supplied either in volume XML during
creation of a <a href="formatstorage.html#StorageVol">storage volume</a>
in order to provide the passphrase to encrypt the volume or in
domain XML <a href="formatdomain.html#elementsDisks">disk device</a>
in order to provide the passphrase to decrypt the volume,
<span class="since">since 2.1.0</span>. An example follows:
</p>
<pre>
# cat luks-secret.xml
&lt;secret ephemeral='no' private='yes'&gt;
&lt;description&gt;LUKS Sample Secret&lt;/description&gt;
&lt;uuid&gt;f52a81b2-424e-490c-823d-6bd4235bc57&lt;/uuid&gt;
&lt;usage type='volume'&gt;
&lt;volume&gt;/var/lib/libvirt/images/luks-sample.img&lt;/volume&gt;
&lt;/usage&gt;
&lt;/secret&gt;
# virsh secret-define luks-secret.xml
Secret f52a81b2-424e-490c-823d-6bd4235bc57 created
#
# MYSECRET=`printf %s "letmein" | base64`
# virsh secret-set-value f52a81b2-424e-490c-823d-6bd4235bc57 $MYSECRET
Secret value set
#
</pre>
<h3><a name="CephUsageType">Usage type "ceph"</a></h3>
<p>
This secret is associated with a Ceph RBD (rados block device).
@@ -153,9 +123,9 @@
Secret 1b40a534-8301-45d5-b1aa-11894ebb1735 created
#
# virsh secret-list
UUID Usage
UUID Usage
-----------------------------------------------------------
1b40a534-8301-45d5-b1aa-11894ebb1735 cephx ceph_example
1b40a534-8301-45d5-b1aa-11894ebb1735 cephx ceph_example
#
# CEPHPHRASE=`printf %s "pass phrase" | base64`
# virsh secret-set-value 1b40a534-8301-45d5-b1aa-11894ebb1735 $CEPHPHRASE
@@ -239,9 +209,9 @@
Secret c4dbe20b-b1a3-4ac1-b6e6-2ac97852ebb6 created
# virsh secret-list
UUID Usage
UUID Usage
-----------------------------------------------------------
c4dbe20b-b1a3-4ac1-b6e6-2ac97852ebb6 iscsi libvirtiscsi
c4dbe20b-b1a3-4ac1-b6e6-2ac97852ebb6 iscsi libvirtiscsi
# MYSECRET=`printf %s "mysecret" | base64`
# virsh secret-set-value c4dbe20b-b1a3-4ac1-b6e6-2ac97852ebb6 $MYSECRET
@@ -271,60 +241,5 @@
&lt;secret usage='libvirtiscsi'/&gt;
&lt;/auth&gt;
</pre>
<h3><a name="tlsUsageType">Usage type "tls"</a></h3>
<p>
This secret may be used in order to provide the passphrase for the
private key used to provide TLS credentials.
The <code>&lt;usage type='tls'&gt;</code> element must contain a
single <code>name</code> element that specifies a usage name
for the secret.
<span class="since">Since 2.3.0</span>.
The following is an example of the expected XML and processing to
define the secret:
</p>
<pre>
# cat tls-secret.xml
&lt;secret ephemeral='no' private='yes'&gt;
&lt;description&gt;sample tls secret&lt;/description&gt;
&lt;usage type='tls'&gt;
&lt;name&gt;TLS_example&lt;/name&gt;
&lt;/usage&gt;
&lt;/secret&gt;
# virsh secret-define tls-secret.xml
Secret 718c71bd-67b5-4a2b-87ec-a24e8ca200dc created
# virsh secret-list
UUID Usage
-----------------------------------------------------------
718c71bd-67b5-4a2b-87ec-a24e8ca200dc tls TLS_example
#
</pre>
<p>
A secret may also be defined via the
<a href="html/libvirt-libvirt-secret.html#virSecretDefineXML">
<code>virSecretDefineXML</code></a> API.
Once the secret is defined, a secret value will need to be set. The
secret would be the passphrase used to access the TLS credentials.
The following is a simple example of using
<code>virsh secret-set-value</code> to set the secret value. The
<a href="html/libvirt-libvirt-secret.html#virSecretSetValue">
<code>virSecretSetValue</code></a> API may also be used to set
a more secure secret without using printable/readable characters.
</p>
<pre>
# MYSECRET=`printf %s "letmein" | base64`
# virsh secret-set-value 718c71bd-67b5-4a2b-87ec-a24e8ca200dc $MYSECRET
Secret value set
</pre>
</body>
</html>

View File

@@ -12,7 +12,7 @@
There are several types of snapshots:
</p>
<dl>
<dt>disk snapshot</dt> <!-- exempt from syntax-check -->
<dt>disk snapshot</dt>
<dd>Contents of disks (whether a subset or all disks associated
with the domain) are saved at a given point of time, and can
be restored back to that state. On a running guest, a disk
@@ -26,14 +26,14 @@
since the snapshot in a single file) and external (the
snapshot is one file, and the changes since the snapshot are
in another file).</dd>
<dt>memory state (or VM state)</dt> <!-- exempt from syntax-check -->
<dt>memory state (or VM state)</dt>
<dd>Tracks only the state of RAM and all other resources in use
by the VM. If the disks are unmodified between the time a VM
state snapshot is taken and restored, then the guest will
resume in a consistent state; but if the disks are modified
externally in the meantime, this is likely to lead to data
corruption.</dd>
<dt>system checkpoint</dt> <!-- exempt from syntax-check -->
<dt>system checkpoint</dt>
<dd>A combination of disk snapshots for all disks as well as VM
memory state, which can be used to resume the guest from where it
left off with symptoms similar to hibernation (that is, TCP

View File

@@ -134,11 +134,19 @@
<code>path</code> may be supplied. Valid values for the attribute
may be either "yes" or "no". This attribute is to be used for a
<code>disk</code> pool type using a <code>path</code> to a
device mapper multipath device. Setting the attribute to "yes"
causes libvirt to attempt to generate and find target volume path's
using a "p" separator. The default algorithm used by device mapper
is to add the "p" separator only when the source device path ends
with a number.
device mapper multipath device configured to utilize either
'user_friendly_names' or a custom 'alias' name in the
/etc/multipath.conf. The attribute directs libvirt to not
generate device volume names with the partition character "p".
By default, when libvirt generates the partition names for
device mapper multipath devices it will add a "p" path separator
to the device name before adding the partition number. For example,
a <code>device path</code> of '/dev/mapper/mpatha' libvirt would
generate partition names of '/dev/mapper/mpathap1',
'/dev/mapper/mpathap2', etc. for each partition found. With
this attribute set to "no", libvirt will not append the "p" to
the name unless it ends with a number thus generating names
of '/dev/mapper/mpatha1', '/dev/mapper/mpatha2', etc.
<span class="since">Since 1.3.1</span></p></dd>
<dt><code>dir</code></dt>
<dd>Provides the source for pools backed by directories (pool
@@ -486,7 +494,7 @@
A storage volume will generally be either a file or a device
node; <span class="since">since 1.2.0</span>, an optional
output-only attribute <code>type</code> lists the actual type
(file, block, dir, network, netdir or ploop), which is also available
(file, block, dir, network, or netdir), which is also available
from <code>virStorageVolGetInfo()</code>. The storage volume
XML format is available <span class="since">since 0.4.1</span>
</p>
@@ -752,21 +760,5 @@
&lt;/permissions&gt;
&lt;/target&gt;
&lt;/volume&gt;</pre>
<h3><a name="exampleLuks">Storage volume using LUKS</a></h3>
<pre>
&lt;volume&gt;
&lt;name&gt;MyLuks.img&lt;/name&gt;
&lt;capacity unit="G"&gt;5&lt;/capacity&gt;
&lt;target&gt;
&lt;path&gt;/var/lib/virt/images/MyLuks.img&lt;/path&gt;
&lt;format type='raw'/&gt;
&lt;encryption format='luks'&gt;
&lt;secret type='passphrase' uuid='f52a81b2-424e-490c-823d-6bd4235bc572'/&gt;
&lt;/encryption&gt;
&lt;/target&gt;
&lt;/volume&gt;
</pre>
</body>
</html>

View File

@@ -25,14 +25,10 @@
<p>
The <code>encryption</code> tag can currently contain a sequence of
<code>secret</code> tags, each with mandatory attributes <code>type</code>
and either <code>uuid</code> or <code>usage</code>
(<span class="since">since 2.1.0</span>). The only currently defined
value of <code>type</code> is <code>volume</code>. The
<code>uuid</code> is "uuid" of the <code>secret</code> while
<code>usage</code> is the "usage" subelement field.
A secret value can be set in libvirt by the
<a href="html/libvirt-libvirt-secret.html#virSecretSetValue">
<code>virSecretSetValue</code></a> API. Alternatively, if supported
and <code>uuid</code>. The only currently defined value of
<code>type</code> is <code>passphrase</code>. <code>uuid</code>
refers to a secret known to libvirt. libvirt can use a secret value
previously set using <code>virSecretSetValue()</code>, or, if supported
by the particular volume format and driver, automatically generate a
secret value at the time of volume creation, and store it using the
specified <code>uuid</code>.
@@ -40,7 +36,7 @@
<h3><a name="StorageEncryptionDefault">"default" format</a></h3>
<p>
<code>&lt;encryption format="default"/&gt;</code> can be specified only
when creating a qcow volume. If the volume is successfully created, the
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.
The unmodified contents of the <code>encryption</code> tag can be used
@@ -56,70 +52,8 @@
the <code>secret</code> element is not present during volume creation,
a secret is automatically generated and attached to the volume.
</p>
<h3><a name="StorageEncryptionLuks">"luks" format</a></h3>
<p>
The <code>luks</code> format is specific to a luks encrypted volume
and the secret is used in order to either encrypt during volume creation
or decrypt the volume for usage by the domain. A single
<code>&lt;secret type='passphrase'...&gt;</code> element is expected.
<span class="since">Since 2.1.0</span>.
</p>
<p>
For volume creation, it is possible to specify the encryption
algorithm used to encrypt the luks volume. The following two
optional elements may be provided for that purpose. It is hypervisor
dependent as to which algorithms are supported. The default algorithm
used by the storage driver backend when using qemu-img to create
the volume is 'aes-256-cbc' using 'essiv' for initialization vector
generation and 'sha256' hash algorithm for both the cipher and the
initialization vector generation.
</p>
<dl>
<dt><code>cipher</code></dt>
<dd>This element describes the cipher algorithm to be used to either
encrypt or decrypt the luks volume. This element has the following
attributes:
<dl>
<dt><code>name</code></dt>
<dd>The name of the cipher algorithm used for data encryption,
such as 'aes', 'des', 'cast5', 'serpent', 'twofish', etc.
Support of the specific algorithm is storage driver
implementation dependent.</dd>
<dt><code>size</code></dt>
<dd>The size of the cipher in bits, such as '256', '192', '128',
etc. Support of the specific size for a specific cipher is
hypervisor dependent.</dd>
<dt><code>mode</code></dt>
<dd>An optional cipher algorithm mode such as 'cbc', 'xts',
'ecb', etc. Support of the specific cipher mode is
hypervisor dependent.</dd>
<dt><code>hash</code></dt>
<dd>An optional master key hash algorithm such as 'md5', 'sha1',
'sha256', etc. Support of the specific hash algorithm is
hypervisor dependent.</dd>
</dl>
</dd>
<dt><code>ivgen</code></dt>
<dd>This optional element describes the initialization vector
generation algorithm used in conjunction with the
<code>cipher</code>. If the <code>cipher</code> is not provided,
then an error will be generated by the parser.
<dl>
<dt><code>name</code></dt>
<dd>The name of the algorithm, such as 'plain', 'plain64',
'essiv', etc. Support of the specific algorithm is hypervisor
dependent.</dd>
<dt><code>hash</code></dt>
<dd>An optional hash algorithm such as 'md5', 'sha1', 'sha256',
etc. Support of the specific ivgen hash algorithm is hypervisor
dependent.</dd>
</dl>
</dd>
</dl>
<h2><a name="example">Examples</a></h2>
<h2><a name="example">Example</a></h2>
<p>
Here is a simple example, specifying use of the <code>qcow</code> format:
@@ -129,39 +63,5 @@
&lt;encryption format='qcow'&gt;
&lt;secret type='passphrase' uuid='c1f11a6d-8c5d-4a3e-ac7a-4e171c5e0d4a' /&gt;
&lt;/encryption&gt;</pre>
<p>
Assuming a <a href="formatsecret.html#VolumeUsageType">
<code>luks volume type secret</code></a> is already defined,
a simple example specifying use of the <code>luks</code> format
for either volume creation without a specific cipher being defined or
as part of a domain volume definition:
</p>
<pre>
&lt;encryption format='luks'&gt;
&lt;secret type='passphrase' uuid='f52a81b2-424e-490c-823d-6bd4235bc572'/&gt;
&lt;/encryption&gt;
</pre>
<p>
Here is an example specifying use of the <code>luks</code> format for
a specific cipher algorithm for volume creation:
</p>
<pre>
&lt;volume&gt;
&lt;name&gt;twofish.luks&lt;/name&gt;
&lt;capacity unit='G'&gt;5&lt;/capacity&gt;
&lt;target&gt;
&lt;path&gt;/var/lib/libvirt/images/demo.luks&lt;/path&gt;
&lt;format type='raw'/&gt;
&lt;encryption format='luks'&gt;
&lt;secret type='passphrase' uuid='f52a81b2-424e-490c-823d-6bd4235bc572'/&gt;
&lt;cipher name='twofish' size='256' mode='cbc' hash='sha256'/&gt;
&lt;ivgen name='plain64' hash='sha256'/&gt;
&lt;/encryption&gt;
&lt;/target&gt;
&lt;/volume&gt;
</pre>
</body>
</html>

View File

@@ -2,75 +2,71 @@ body {
margin: 0em;
padding: 0px;
color: rgb(0,0,0);
font-family: sans-serif;
font-size: 90%;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: smaller;
background: #ffffff;
}
p, ul, ol, dl {
padding: 0px;
margin: 0px;
line-height: 150%;
}
p {
ol,ul {
margin-left: 3em;
}
ol,ul,dl,p {
margin-top: 1em;
margin-bottom: 1em;
}
ul, ol {
margin-left: 2em;
p:first-line {
margin-right: 1em;
}
dt {
div.body p:first-letter {
font-size: 1.2em;
font-weight: bold;
}
h1,h2,h3,h4,h5,h6 {
font-weight: bold;
margin: 0px;
padding: 0px;
margin-top: 0.5em;
}
div.footer {
margin-top: 1em;
}
h1 {
font-size: 2em;
}
h2 {
font-size: 1.6em;
}
h3 {
font-size: 1.4em;
}
h4 {
font-size: 1.2em;
}
h5 {
font-size: 1em;
}
h6 {
font-size: 0.8em;
}
dl dt {
margin-left: 1em;
margin-right: 2em;
}
dt code {
font-weight: bold;
}
dl dd {
margin-left: 2em;
margin-right: 2em;
margin-bottom: 0.5em;
}
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
margin: 0px;
padding: 0px;
margin-bottom: 0.25em;
border-bottom: 1px solid #aaa;
}
h1 {
margin-top: 0em;
font-size: 1.6em;
}
h2 {
margin-top: 1.0em;
font-size: 1.4em;
}
h3 {
margin-top: 1.0em;
font-size: 1.2em;
}
h4 {
margin-top: 1.0em;
font-size: 1.1em;
}
h5 {
margin-top: 0.75em;
font-size: 1em;
}
h6 {
margin-top: 0.75em;
font-size: 0.8em;
}

View File

@@ -23,10 +23,20 @@
automatically pulls the latest version of each translation
file from zanata.</li>
<li><p>Post patches using "git send-email", with git rename
<li><p>Post patches in unified diff format, with git rename
detection enabled. You need a one-time setup of:</p>
<pre>
git config diff.renames true
</pre>
<p>After that, a command similar to this should work:</p>
<pre>
diff -urp libvirt.orig/ libvirt.modified/ &gt; libvirt-myfeature.patch
</pre>
<p>
or:
</p>
<pre>
git diff &gt; libvirt-myfeature.patch
</pre>
<p>Also, for code motion patches, you may find that <code>git
diff --patience</code> provides an easier-to-read patch.
@@ -179,19 +189,6 @@
under gdb or Valgrind.
</p>
<p>When running our test suite it may happen that the test result is
nondeterministic because of the test suite relying on a particular file
in the system being accessible or having some specific value. To catch
this kind of errors, the test suite has a module for that prints any
path touched that fulfils constraints described above
into a file. To enable it just set
<code>VIR_TEST_FILE_ACCESS</code> environment variable.
Then <code>VIR_TEST_FILE_ACCESS_OUTPUT</code> environment
variable can alter location where the file is stored.</p>
<pre>
VIR_TEST_FILE_ACCESS=1 VIR_TEST_FILE_ACCESS_OUTPUT="/tmp/file_access.txt" ./qemuxml2argvtest
</pre>
</li>
<li><p>The Valgrind test should produce similar output to
<code>make check</code>. If the output has traces within libvirt

View File

@@ -17,10 +17,8 @@
(<span class="since">since 0.8.0</span>)<br/><br/></li>
<li>A QEMU guest is started or stopped
(<span class="since">since 0.8.0</span>)<br/><br/></li>
<li>An LXC guest is started or stopped
<li>An LXC guest is started or stopped
(<span class="since">since 0.8.0</span>)<br/><br/></li>
<li>A libxl-handled Xen guest is started or stopped
(<span class="since">since 2.1.0</span>)<br/><br/></li>
<li>A network is started or stopped or an interface is
plugged/unplugged to/from the network
(<span class="since">since 1.2.2</span>)<br/><br/></li>
@@ -43,7 +41,7 @@
<br/>
<h2><a name="names">Script names</a></h2>
<p>At present, there are five hook scripts that can be called:</p>
<p>At present, there are three hook scripts that can be called:</p>
<ul>
<li><code>/etc/libvirt/hooks/daemon</code><br/><br/>
Executed when the libvirt daemon is started, stopped, or reloads
@@ -52,9 +50,6 @@
Executed when a QEMU guest is started, stopped, or migrated<br/><br/></li>
<li><code>/etc/libvirt/hooks/lxc</code><br /><br/>
Executed when an LXC guest is started or stopped</li>
<li><code>/etc/libvirt/hooks/libxl</code><br/><br/>
Executed when a libxl-handled Xen guest is started, stopped, or
migrated<br/><br/></li>
<li><code>/etc/libvirt/hooks/network</code><br/><br/>
Executed when a network is started or stopped or an
interface is plugged/unplugged to/from the network</li>
@@ -240,50 +235,6 @@
</li>
</ul>
<h5><a name="libxl">/etc/libvirt/hooks/libxl</a></h5>
<ul>
<li>Before a Xen guest is started using libxl driver, the libxl hook
script is called in three locations; if any location fails, the guest
is not started. The first location, <span class="since">since
2.1.0</span>, is before libvirt performs any resource
labeling, and the hook can allocate resources not managed by
libvirt. This is called as:<br/>
<pre>/etc/libvirt/hooks/libxl guest_name prepare begin -</pre>
The second location, available <span class="since">Since
2.1.0</span>, occurs after libvirt has finished labeling
all resources, but has not yet started the guest, called as:<br/>
<pre>/etc/libvirt/hooks/libxl guest_name start begin -</pre>
The third location, <span class="since">2.1.0</span>,
occurs after the domain has successfully started up:<br/>
<pre>/etc/libvirt/hooks/libxl guest_name started begin -</pre>
</li>
<li>When a libxl-handled Xen guest is stopped, the libxl hook script
is called in two locations, to match the startup.
First, <span class="since">since 2.1.0</span>, the hook is
called before libvirt restores any labels:<br/>
<pre>/etc/libvirt/hooks/libxl guest_name stopped end -</pre>
Then, after libvirt has released all resources, the hook is
called again, <span class="since">since 2.1.0</span>, to allow
any additional resource cleanup:<br/>
<pre>/etc/libvirt/hooks/libxl guest_name release end -</pre></li>
<li><span class="since">Since 2.1.0</span>, the libxl hook script
is also called at the beginning of incoming migration. It is called
as: <pre>/etc/libvirt/hooks/libxl guest_name migrate 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, 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 2.1.0</span>, the libxl hook script
is also called when the libvirtd daemon restarts and reconnects
to previously running Xen domains. If the script fails, the
existing Xen domains will be killed off. It is called as:
<pre>/etc/libvirt/hooks/libxl guest_name reconnect begin -</pre>
</li>
</ul>
<h5><a name="network">/etc/libvirt/hooks/network</a></h5>
<ul>
<li><span class="since">Since 1.2.2</span>, before a network is started,
@@ -299,8 +250,6 @@
<pre>/etc/libvirt/hooks/network network_name plugged begin -</pre>
Please note, that in this case, the script is passed both network and
domain XMLs on its stdin.</li>
<li>When network is updated, the hook script is called as:<br/>
<pre>/etc/libvirt/hooks/network network_name updated begin -</pre></li>
<li>When the domain from previous case is shutting down, the interface
is unplugged. This leads to another script invocation:<br/>
<pre>/etc/libvirt/hooks/network network_name unplugged begin -</pre>

View File

@@ -4,6 +4,8 @@ use strict;
use warnings;
use File::Find;
use XML::XPath;
use XML::XPath::XMLParser;
die "syntax: $0 SRCDIR\n" unless int(@ARGV) == 1;
@@ -42,91 +44,136 @@ find({
push @srcs, $_ if $_ !~ /vbox_driver\.c/;
}
}, no_chdir => 1}, $srcdir);
my $line;
# Map API functions to the header and documentation files they're in
# so that we can generate proper hyperlinks to their documentation.
#
# The function names are grep'd from the XML output of apibuild.py.
sub getAPIFilenames {
my $filename = shift;
my %files;
my $line;
open FILE, "<", $filename or die "cannot read $filename: $!";
while (defined($line = <FILE>)) {
if ($line =~ /function name='([^']+)' file='([^']+)'/) {
$files{$1} = $2;
}
}
close FILE;
if (keys %files == 0) {
die "No functions found in $filename. Has the apibuild.py output changed?";
}
return \%files;
}
sub parseSymsFile {
my $apisref = shift;
my $prefix = shift;
my $filename = shift;
my $xmlfilename = shift;
my $line;
my $vers;
my $prevvers;
my $filenames = getAPIFilenames($xmlfilename);
open FILE, "<$filename"
or die "cannot read $filename: $!";
while (defined($line = <FILE>)) {
chomp $line;
next if $line =~ /^\s*#/;
next if $line =~ /^\s*$/;
next if $line =~ /^\s*(global|local):/;
if ($line =~ /^\s*${prefix}_(\d+\.\d+\.\d+)\s*{\s*$/) {
if (defined $vers) {
die "malformed syms file";
}
$vers = $1;
} elsif ($line =~ /\s*}\s*;\s*$/) {
if (defined $prevvers) {
die "malformed syms file";
}
$prevvers = $vers;
$vers = undef;
} elsif ($line =~ /\s*}\s*${prefix}_(\d+\.\d+\.\d+)\s*;\s*$/) {
if ($1 ne $prevvers) {
die "malformed syms file $1 != $vers";
}
$prevvers = $vers;
$vers = undef;
} elsif ($line =~ /\s*(\w+)\s*;\s*$/) {
$$apisref{$1} = {};
$$apisref{$1}->{vers} = $vers;
$$apisref{$1}->{file} = $$filenames{$1};
} else {
die "unexpected data $line\n";
}
}
close FILE;
}
# Get the list of all public APIs and their corresponding version
my %apis;
# Get the list of all public APIs and their corresponding version
parseSymsFile(\%apis, "LIBVIRT", $symslibvirt, "$srcdir/../docs/libvirt-api.xml");
open FILE, "<$symslibvirt"
or die "cannot read $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*#/;
next if $line =~ /^\s*$/;
next if $line =~ /^\s*(global|local):/;
if ($line =~ /^\s*LIBVIRT_(\d+\.\d+\.\d+)\s*{\s*$/) {
if (defined $vers) {
die "malformed syms file";
}
$vers = $1;
} elsif ($line =~ /\s*}\s*;\s*$/) {
if (defined $prevvers) {
die "malformed syms file";
}
$prevvers = $vers;
$vers = undef;
} elsif ($line =~ /\s*}\s*LIBVIRT_(\d+\.\d+\.\d+)\s*;\s*$/) {
if ($1 ne $prevvers) {
die "malformed syms file $1 != $vers";
}
$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;
} else {
die "unexpected data $line\n";
}
}
close FILE;
# And the same for the QEMU specific APIs
parseSymsFile(\%apis, "LIBVIRT_QEMU", $symsqemu, "$srcdir/../docs/libvirt-qemu-api.xml");
open FILE, "<$symsqemu"
or die "cannot read $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*#/;
next if $line =~ /^\s*$/;
next if $line =~ /^\s*(global|local):/;
if ($line =~ /^\s*LIBVIRT_QEMU_(\d+\.\d+\.\d+)\s*{\s*$/) {
if (defined $vers) {
die "malformed syms file";
}
$vers = $1;
} elsif ($line =~ /\s*}\s*;\s*$/) {
if (defined $prevvers) {
die "malformed syms file";
}
$prevvers = $vers;
$vers = undef;
} elsif ($line =~ /\s*}\s*LIBVIRT_QEMU_(\d+\.\d+\.\d+)\s*;\s*$/) {
if ($1 ne $prevvers) {
die "malformed syms file $1 != $vers";
}
$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;
} else {
die "unexpected data $line\n";
}
}
close FILE;
# And the same for the LXC specific APIs
parseSymsFile(\%apis, "LIBVIRT_LXC", $symslxc, "$srcdir/../docs/libvirt-lxc-api.xml");
open FILE, "<$symslxc"
or die "cannot read $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*#/;
next if $line =~ /^\s*$/;
next if $line =~ /^\s*(global|local):/;
if ($line =~ /^\s*LIBVIRT_LXC_(\d+\.\d+\.\d+)\s*{\s*$/) {
if (defined $vers) {
die "malformed syms file";
}
$vers = $1;
} elsif ($line =~ /\s*}\s*;\s*$/) {
if (defined $prevvers) {
die "malformed syms file";
}
$prevvers = $vers;
$vers = undef;
} elsif ($line =~ /\s*}\s*LIBVIRT_LXC_(\d+\.\d+\.\d+)\s*;\s*$/) {
if ($1 ne $prevvers) {
die "malformed syms file $1 != $vers";
}
$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;
} else {
die "unexpected data $line\n";
}
}
close FILE;
# Some special things which aren't public APIs,
@@ -159,8 +206,6 @@ $apis{virDomainMigrateConfirm3Params}->{vers} = "1.1.0";
# and driver struct fields. This lets us later match
# update the driver impls with the public APis.
my $line;
# Group name -> hash of APIs { fields -> api name }
my %groups;
my $ingrp;
@@ -207,30 +252,28 @@ foreach my $src (@srcs) {
open FILE, "<$src" or
die "cannot read $src: $!";
my $groups_regex = join("|", keys %groups);
$ingrp = undef;
my $impl;
while (defined($line = <FILE>)) {
if (!$ingrp) {
# skip non-matching lines early to save time
next if not $line =~ /$groups_regex/;
foreach my $grp (keys %groups) {
if ($line =~ /^\s*(?:static\s+)?$grp\s+(\w+)\s*=\s*{/ ||
$line =~ /^\s*(?:static\s+)?$grp\s+NAME\(\w+\)\s*=\s*{/) {
$ingrp = $grp;
$impl = $src;
if ($line =~ /^\s*(?:static\s+)?($groups_regex)\s+(\w+)\s*=\s*{/ ||
$line =~ /^\s*(?:static\s+)?($groups_regex)\s+NAME\(\w+\)\s*=\s*{/) {
$ingrp = $1;
$impl = $src;
if ($impl =~ m,.*/node_device_(\w+)\.c,) {
$impl = $1;
} else {
$impl =~ s,.*/(\w+?)_((\w+)_)?(\w+)\.c,$1,;
}
if ($impl =~ m,.*/node_device_(\w+)\.c,) {
$impl = $1;
} else {
$impl =~ s,.*/(\w+?)_((\w+)_)?(\w+)\.c,$1,;
if ($groups{$ingrp}->{drivers}->{$impl}) {
die "Group $ingrp already contains $impl";
}
$groups{$ingrp}->{drivers}->{$impl} = {};
}
if ($groups{$ingrp}->{drivers}->{$impl}) {
die "Group $ingrp already contains $impl";
}
$groups{$ingrp}->{drivers}->{$impl} = {};
}
} else {

View File

@@ -14,7 +14,6 @@
<li>Introduction to basic rules and guidelines for
<a href="hacking.html">hacking</a> on libvirt code</li>
<li>Guide to adding <a href="api_extension.html">public APIs</a></li>
<li>Insight into libvirt <a href="internals/eventloop.html">event loop and worker pool</a></li>
<li>Approach for <a href="internals/command.html">spawning commands</a>
from libvirt driver code</li>
<li>The libvirt <a href="internals/rpc.html">RPC infrastructure</a></li>

View File

@@ -1,106 +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>Libvirt's event loop</h1>
<ul id="toc"></ul>
<p>
This page describes the event loop approach used in
libvirt. Both server and client.
</p>
<h2><a name="event_loop">Event driven programming</a></h2>
<p>Traditionally, a program simply ran once, then terminated.
This type of program was very common in the early days of
computing, and lacked any form of user interactivity. This is
still used frequently, particularly in small one purpose
programs.</p>
<p>However, that approach is not suitable for all the types
of applications. For instance graphical applications spend
most of their run time waiting for an input from user. Only
after it happened (in our example a button was clicked, a key
pressed, etc.) an event is generated to which they respond
by executing desired function. If generalized, this is how
many long running programs (daemons) work. Even those who are
not waiting for direct user input and have no graphical
interface. Such as Libvirt.</p>
<img alt="event loop" src="http://libvirt.org/git/?p=libvirt-media.git;a=blob_plain;f=png/event_loop_simple.png;hb=HEAD"/>
<p>In Libvirt this approach is used in combination with
<code>poll(2)</code> as all the communication with its
clients (and domains it manages too) happens through sockets.
Therefore whenever new client connects, it is given exclusive
file descriptor which is then watched for incoming events,
e.g. messages. </p>
<h2><a name="api">The event loop API</a></h2>
<p>To work with event loop from our code we have plenty of
APIs.</p>
<ul>
<li><code>virEventAddHandle</code>: Registers a
callback for monitoring file handle events.</li>
<li><code>virEventUpdateHandle</code>: Change set of events
monitored file handle is being watched for.</li>
<li><code>virEventRemoveHandle</code>: Unregisters
previously registered file handle so that it is no
longer monitored for any events.</li>
<li><code>virEventAddTimeout</code>: Registers a
callback for timer event.</li>
<li><code>virEventUpdateTimeout</code>: Changes frequency
for a timer.</li>
<li><code>virEventRemoveTimeout</code>: Unregisters
a timer.</li>
</ul>
<p>For more information on these APIs continue reading <a
href="../html/libvirt-libvirt-event.html">here</a>.</p>
<h2><a name="worker_pool">Worker pool</a></h2>
<p>Looking back at the image above we can see one big
limitation. While processing a message event loop is blocked
and for an outside observer unresponsive. This is not
acceptable for Libvirt. Therefore we have came up with the
following solution.</p>
<img alt="event loop" src="http://libvirt.org/git/?p=libvirt-media.git;a=blob_plain;f=png/event_loop_worker.png;hb=HEAD"/>
<p>The event loop does only necessary minimum and hand over
message processing to another thread. In fact, there can be
as many processing threads as configured increasing
processing power.</p>
<p>To break this high level description into smaller pieces,
here is what happens when user calls an API:</p>
<ol>
<li>User (or management application) calls a Libvirt API.
Depending on the connection URI, this may or may not
involve server. Well, for the sake of our
demonstration we assume the former.</li>
<li>Remote driver encodes the API among it's arguments
into an <a href="rpc.html">RPC message</a> and sends
it to the server.</li>
<li>Here, server is waiting in <code>poll(2)</code> for
an event, like incoming message.</li>
<li>As soon as the first bytes of message are received,
even loop wakes up and server starts reading the
whole message.</li>
<li>Once fully read, the event loop notifies threads
known as worker threads from which one picks the incoming
message, decodes and process it.</li>
<li>As soon as API execution is finished, a reply is sent
to the client.</li>
</ol>
<p>In case that there's no free worker to process an incoming
message in step 5, message is placed at the end of a message
queue and is processed in next iteration.</p>
</body>
</html>

View File

@@ -1,4 +1,12 @@
h1, h2, h3, h4, h5, h6 {
h1 {
font-weight: normal;
color: #3c857c;
}
h1 strong {
font-weight: bold;
}
h2, h3, h4, h5, h6 {
color: #3c857c;
}
@@ -47,6 +55,12 @@ h1, h2, h3, h4, h5, h6 {
padding: 0px;
margin: 0px;
border: 0px;
font-weight: bold;
font-size: 1.2em;
}
#menu li ul li {
font-size: 1em;
}
#menu ul li a, #menu ul li span {
@@ -80,7 +94,6 @@ h1, h2, h3, h4, h5, h6 {
#menu ul.l1 li .inactive {
border-left: 6px solid #dfebea;
}
#menu ul.l1 li .active {
border-left: 6px solid #a5c6c2;
}
@@ -96,6 +109,7 @@ h1, h2, h3, h4, h5, h6 {
padding-left: 3em;
}
#headerLogo {
position: absolute;
top: 0px;
@@ -104,7 +118,6 @@ h1, h2, h3, h4, h5, h6 {
width: 400px;
background: url(libvirt-header-logo.png);
}
#headerSearch {
position: absolute;
top: 0px;
@@ -129,6 +142,7 @@ h1, h2, h3, h4, h5, h6 {
font-size: 1em;
}
#sitemap ul li {
list-style: none;
}
@@ -163,6 +177,7 @@ a {
color: #566866;
}
div.api {
border: 1px solid #999999;
background: #eeeeee;
@@ -188,6 +203,7 @@ div.api table td, div.variablelist table td {
padding-left: 1em;
}
h1 a, h2 a, h3 a, h4 a, h5 a {
color: inherit;
text-decoration: inherit;
@@ -227,6 +243,36 @@ p.image {
background: #c5dbd8;
}
#footer {
clear: both;
position: relative;
margin: 0px;
padding: 0px;
border: 0px;
width: 100%;
height: 180px;
background: #FFFFFF;
/* background: #757575; */
}
/* This is hidden from IE <= 6 because it can't do transparency */
/* body > #footer {
background: #757575 url(footer_pattern.png) repeat-x;
} */
#footer p {
position: absolute;
top: 0px;
left: 0px;
margin: 0px;
border: 0px solid red;
width: 220px;
text-align: center;
}
#footer p a img {
border: 0px;
}
#projects {
margin: 0px;
border: 0px;
@@ -236,6 +282,7 @@ p.image {
width: 100%;
}
#projects dl {
margin: 0px;
border: 0px solid white;
@@ -244,6 +291,10 @@ p.image {
top: 0px;
left: 0px;
}
/* This is hidden from IE <= 6 because it can't do transparency */
head:first-child+body #projects dl {
background: url(footer_corner.png) no-repeat ! important;
}
#projects #p1 {
margin-left: 25%;
@@ -268,15 +319,16 @@ p.image {
#projects #p1 dt, #projects #p1 dd {
width: 33%;
}
#projects #p2 dt, #projects #p2 dd {
width: 50%;
}
#projects #p3 dt, #projects #p3 dd {
width: 99%;
}
#projects {
}
#projects span {
font-size: 0.8em;
display: block;
@@ -300,6 +352,13 @@ p.image {
color: #ccc;
}
#sponsor {
color: #757575;
text-decoration: inherit;
font-size: 1.2em;
}
span.since {
color: #3c857c;
font-style: italic;
@@ -345,7 +404,6 @@ table.data tr.head th {
table.data tbody td {
background: rgb(240,240,240);
}
table.data tbody td.y {
background: rgb(220,255,220);
text-align: center;

View File

@@ -23,19 +23,19 @@
</p>
<dl>
<dt><code>nop</code></dt>
<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><code><a href="locking-lockd.html">lockd</a></code></dt>
<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><code><a href="locking-sanlock.html">sanlock</a></code></dt>
<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

View File

@@ -148,9 +148,8 @@
<code>virsh dumpxml</code> on source host followed by
<code>virsh define</code> on destination host, as offline migration
will run the pre-migration hook to update the domain XML on
destination host. Currently, copying non-shared storage or other file
based storages (e.g. UEFI variable storage) is not supported during
offline migration.
destination host. Currently, copying non-shared storage is not
supported during offline migration.
</p>
<h2><a name="uris">Migration URIs</a></h2>

File diff suppressed because it is too large Load Diff

View File

@@ -1,141 +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>Libvirt NSS module</h1>
<ul id="toc"></ul>
<p>
When it comes to managing guests and executing commands inside them, logging
into guest operating system and doing the job is convenient. Users are used
to ssh in this case. Ideally:
</p>
<code>ssh user@virtualMachine</code>
<p>
would be nice. But depending on virtual network configuration it might not
be always possible. For instance, when using libvirt NATed network it's
dnsmasq (spawned by libvirt) who assigns IP addresses to domains. But by
default, the dnsmasq process is then not consulted when it comes to host
name translation. Users work around this problem by configuring their
libvirt network to assign static IP addresses and maintaining
<code>/etc/hosts</code> file in sync. But this puts needless burden onto
users. This is where NSS module comes handy.
</p>
<h2><a name="Installation">Installation</a></h2>
<p>
Installing the module is really easy:
</p>
<pre>
# yum install libvirt-nss
</pre>
<h2><a name="Configuration">Configuration</a></h2>
<p>
Enabling the module is really easy. Just add <b>libvirt</b> into
<code>/etc/nsswitch.conf</code> file. For instance:
</p>
<pre>
$ cat /etc/nsswitch.conf
# /etc/nsswitch.conf:
passwd: compat
shadow: compat
group: compat
hosts: files libvirt dns
# ...
</pre>
<p>
So, in this specific case, whenever ssh program is looking up the host user
is trying to connect to, <b>files</b> module is consulted first (which
boils down to looking up the host name in <code>/etc/hosts</code> file), if
not found <b>libvirt</b> module is consulted then. The DNS is the last
effort then, if none of the previous modules matched the host in question.
Therefore users should consider the order in which they want the modules to
lookup given host name.
</p>
<h2><a name="Internals">How does it work?</a></h2>
<p>
Whenever an Unix process wants to do a host name translation
<a href="http://linux.die.net/man/3/gethostbyname"><code>gethostbyname()</code></a>
or some variant of it is called. This is a glibc function that takes a
string containing the host name, crunch it and produces a list of IP
addresses assigned to that host. Now, glibc developers made a really good
decision when implementing the internals of the function when they decided
to make the function pluggable. Since there can be several sources for the
records (e.g. <code>/etc/hosts</code> file, DNS, LDAP, etc.) it would not
make much sense to create one big implementation containing all possible
cases. What they have done instead is this pluggable mechanism. Small
plugins implementing nothing but specific technology for lookup process are
provided and the function then calls those plugins. There is just one
configuration file that instructs the lookup function in which order should
the plugins be called and which plugins should be loaded. For more info
reading <a href="https://en.wikipedia.org/wiki/Name_Service_Switch">wiki
page</a> is recommended.
</p>
<p>
And this is point where libvirt comes in. Libvirt provides plugin for the
NSS ecosystem. For some time now libvirt keeps a list of assigned IP
addresses for libvirt networks. The NSS plugin does no more than search the
list trying to find matching record for given host name. When found,
matching IP address is returned to the caller. If not found, translation
process continues with the next plugin configured. At this point it is
important to stress the order in which plugins are called. Users should be
aware that a hostname might match in multiple plugins and right after first
match, translation process is terminated and no other plugin is consulted.
Therefore, if there are two different records for the same host name users
should carefully chose the lookup order.
</p>
<h2><a name="Limitations">Limitations</a></h2>
<ol>
<li>The libvirt NSS module matches only hostnames provided by guest. If
the libvirt name and one advertised by guest differs, the latter is
matched.</li>
<li>The module works only in that cases where IP addresses are assigned by
dnsmasq spawned by libvirt. Libvirt NATed networks are typical
example.</li>
</ol>
<p>
These limitation are result of libvirt's internal implementation. While
libvirt can report IP addresses regardless of their origin, a public API
must be used to obtain those. However, for the API a connection object is
required. Doing that for every name translation request would be too
costly. Fortunately, libvirt spawns dnsmasq for NATed networks. Not only
that, it provides small executable that on each IP address space change
updates an internal list of addresses thus keeping it in sync. The NSS
module then merely consults the list trying to find the match. Users can
view the list themselves:
</p>
<pre>
virsh net-dhcp-leases $network
</pre>
<p>
where <code>$network</code> iterates through all running networks. So the module
does merely the same as
</p>
<pre>
virsh domifaddr --source lease $domain
</pre>
<p>
If there's no record for either of the aforementioned commands, it's very
likely that NSS module won't find anything and vice versa.
</p>
</body>
</html>

View File

@@ -163,6 +163,12 @@
<xsl:apply-templates select="/html:html/html:body/*" mode="content"/>
</div>
</div>
<div id="footer">
<p id="sponsor">
Sponsored by:<br/>
<a href="http://et.redhat.com/"><img src="{$href_base}et.png" alt="Project sponsored by Red Hat Emerging Technology"/></a>
</p>
</div>
</body>
</html>
</xsl:template>

View File

@@ -102,7 +102,7 @@ much slower than, say, direct hypervisor calls. </li>
Remote libvirt supports a range of transports:
</p>
<dl>
<dt><code>tls</code></dt>
<dt> tls </dt>
<dd><a href="http://en.wikipedia.org/wiki/Transport_Layer_Security" title="Transport Layer Security">TLS</a>
1.0 (SSL 3.1) authenticated and encrypted TCP/IP socket, usually
listening on a public port number. To use this you will need to
@@ -110,7 +110,7 @@ Remote libvirt supports a range of transports:
server certificates</a>.
The standard port is 16514.
</dd>
<dt><code>unix</code></dt>
<dt> unix </dt>
<dd> Unix domain socket. Since this is only accessible on the
local machine, it is not encrypted, and uses Unix permissions or
SELinux for authentication.
@@ -119,7 +119,7 @@ Remote libvirt supports a range of transports:
<code>/var/run/libvirt/libvirt-sock-ro</code> (the latter
for read-only connections).
</dd>
<dt><code>ssh</code></dt>
<dt> ssh </dt>
<dd> Transported over an ordinary
<a href="http://www.openssh.com/" title="OpenSSH homepage">ssh
(secure shell)</a> connection.
@@ -130,15 +130,15 @@ Remote libvirt supports a range of transports:
<a href="http://mah.everybody.org/docs/ssh" title="Using ssh-agent with ssh">ssh-agent</a>)
otherwise programs which use
this transport will stop to ask for a password. </dd>
<dt><code>ext</code></dt>
<dt> ext </dt>
<dd> Any external program which can make a connection to the
remote machine by means outside the scope of libvirt. </dd>
<dt><code>tcp</code></dt>
<dt> tcp </dt>
<dd> Unencrypted TCP/IP socket. Not recommended for production
use, this is normally disabled, but an administrator can enable
it for testing or use over a trusted network.
The standard port is 16509. </dd>
<dt><code>libssh2</code></dt>
<dt> libssh2 </dt>
<dd> Transport over the SSH protocol using
<a href="http://libssh2.org/" title="libssh2 homepage">libssh2</a> instead
of the OpenSSH binary. This transport uses the libvirt authentication callback for
@@ -228,19 +228,6 @@ Note that parameter values must be
<td colspan="2"/>
<td> Example: <code>name=qemu:///system</code> </td>
</tr>
<tr>
<td>
<code>tls_priority</code>
</td>
<td> tls </td>
<td>
A vaid GNUTLS priority string
</td>
</tr>
<tr>
<td colspan="2"/>
<td> Example: <code>tls_priority=NORMAL:-VERS-SSL3.0</code> </td>
</tr>
<tr>
<td>
<code>command</code>
@@ -419,21 +406,13 @@ next section.
<td>
<code>/etc/pki/CA/cacert.pem</code>
</td>
<td> Installed on the client and server </td>
<td> Installed on all clients and servers </td>
<td> CA's certificate (<a href="#Remote_TLS_CA">more info</a>)</td>
<td> n/a </td>
</tr>
<tr>
<td>
<code>$HOME/.pki/cacert.pem</code>
</td>
<td> Installed on the client </td>
<td> CA's certificate (<a href="#Remote_TLS_CA">more info</a>)</td>
<td> n/a </td>
</tr>
<tr>
<td>
<code>/etc/pki/libvirt/private/serverkey.pem</code>
<code>/etc/pki/libvirt/ private/serverkey.pem</code>
</td>
<td> Installed on the server </td>
<td> Server's private key (<a href="#Remote_TLS_server_certificates">more info</a>)</td>
@@ -441,7 +420,7 @@ next section.
</tr>
<tr>
<td>
<code>/etc/pki/libvirt/servercert.pem</code>
<code>/etc/pki/libvirt/ servercert.pem</code>
</td>
<td> Installed on the server </td>
<td> Server's certificate signed by the CA.
@@ -451,7 +430,7 @@ next section.
</tr>
<tr>
<td>
<code>/etc/pki/libvirt/private/clientkey.pem</code>
<code>/etc/pki/libvirt/ private/clientkey.pem</code>
</td>
<td> Installed on the client </td>
<td> Client's private key. (<a href="#Remote_TLS_client_certificates">more info</a>) </td>
@@ -459,26 +438,7 @@ next section.
</tr>
<tr>
<td>
<code>/etc/pki/libvirt/clientcert.pem</code>
</td>
<td> Installed on the client </td>
<td> Client's certificate signed by the CA
(<a href="#Remote_TLS_client_certificates">more info</a>) </td>
<td> Distinguished Name (DN) can be checked against an access
control list (<code>tls_allowed_dn_list</code>).
</td>
</tr>
<tr>
<td>
<code>$HOME/.pki/libvirt/clientkey.pem</code>
</td>
<td> Installed on the client </td>
<td> Client's private key. (<a href="#Remote_TLS_client_certificates">more info</a>) </td>
<td> n/a </td>
</tr>
<tr>
<td>
<code>$HOME/.pki/libvirt/clientcert.pem</code>
<code>/etc/pki/libvirt/ clientcert.pem</code>
</td>
<td> Installed on the client </td>
<td> Client's certificate signed by the CA
@@ -496,7 +456,7 @@ next section.
</p>
<ul>
<li> For a non-root user, libvirt tries to find the certificates
in $HOME/.pki/libvirt first. If the required CA certificate cannot
in $HOME/.pki/libvirt. If the required CA certificate cannot
be found, then the global default location
(/etc/pki/CA/cacert.pem) will be used.
Likewise, if either the client certificate
@@ -504,7 +464,7 @@ next section.
locations (/etc/pki/libvirt/clientcert.pem,
/etc/pki/libvirt/private/clientkey.pem) will be used.
</li>
<li> For the root user, the global default locations will always be used.</li>
<li> For the root user, the global default locations will be used.</li>
</ul>
<h4>
<a name="Remote_TLS_background">Background to TLS certificates</a>
@@ -752,7 +712,7 @@ cp clientcert.pem /etc/pki/libvirt/clientcert.pem
<a name="Remote_TLS_troubleshooting">Troubleshooting TLS certificate problems</a>
</h4>
<dl>
<dt>failed to verify client's certificate</dt> <!-- exempt from syntax-check -->
<dt> failed to verify client's certificate </dt>
<dd>
<p>
On the server side, run the libvirtd server with

View File

@@ -32,7 +32,7 @@
</data>
</define>
<define name="uint8">
<define name="uint8range">
<choice>
<data type="string">
<param name="pattern">0x[0-9a-fA-F]{1,2}</param>
@@ -43,18 +43,7 @@
</data>
</choice>
</define>
<define name="uint16">
<choice>
<data type="string">
<param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
</data>
<data type='int'>
<param name="minInclusive">0</param>
<param name="maxInclusive">65535</param>
</data>
</choice>
</define>
<define name="uint24">
<define name="uint24range">
<choice>
<data type="string">
<param name="pattern">0x[0-9a-fA-F]{1,6}</param>
@@ -83,21 +72,15 @@
<ref name="pciDomain"/>
</attribute>
</optional>
<optional>
<attribute name="bus">
<ref name="pciBus"/>
</attribute>
</optional>
<optional>
<attribute name="slot">
<ref name="pciSlot"/>
</attribute>
</optional>
<optional>
<attribute name="function">
<ref name="pciFunc"/>
</attribute>
</optional>
<attribute name="bus">
<ref name="pciBus"/>
</attribute>
<attribute name="slot">
<ref name="pciSlot"/>
</attribute>
<attribute name="function">
<ref name="pciFunc"/>
</attribute>
<optional>
<attribute name="multifunction">
<ref name="virOnOff"/>
@@ -247,25 +230,25 @@
<define name="filePath">
<data type="string">
<param name="pattern">.+</param>
<param name="pattern">[a-zA-Z0-9_\.\+\-\\&amp;&quot;&apos;&lt;&gt;/%]+</param>
</data>
</define>
<define name="dirPath">
<data type="string">
<param name="pattern">.+</param>
<param name="pattern">[a-zA-Z0-9_\.\+\-\\&amp;&quot;&apos;&lt;&gt;/%]+</param>
</data>
</define>
<define name="absFilePath">
<data type="string">
<param name="pattern">/.+</param>
<param name="pattern">/[a-zA-Z0-9_\.\+\-\\&amp;&quot;&apos;&lt;&gt;/%,:]+</param>
</data>
</define>
<define name="absDirPath">
<data type="string">
<param name="pattern">/.*</param>
<param name="pattern">/[a-zA-Z0-9_\.\+\-\\&amp;&quot;&apos;&lt;&gt;/%]*</param>
</data>
</define>
@@ -284,32 +267,24 @@
</define>
<define name="pciDomain">
<ref name="uint16"/>
<data type="string">
<param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
</data>
</define>
<define name="pciBus">
<ref name="uint8"/>
<data type="string">
<param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param>
</data>
</define>
<define name="pciSlot">
<choice>
<data type="string">
<param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
</data>
<data type="int">
<param name="minInclusive">0</param>
<param name="maxInclusive">31</param>
</data>
</choice>
<data type="string">
<param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
</data>
</define>
<define name="pciFunc">
<choice>
<data type="string">
<param name="pattern">(0x)?[0-7]</param>
</data>
<data type="int">
<param name="minInclusive">0</param>
<param name="maxInclusive">7</param>
</data>
</choice>
<data type="string">
<param name="pattern">(0x)?[0-7]</param>
</data>
</define>
<define name='wwn'>
@@ -495,27 +470,4 @@
</choice>
</define>
<define name="metadata">
<element name="metadata">
<zeroOrMore>
<ref name="customElement"/>
</zeroOrMore>
</element>
</define>
<define name="customElement">
<element>
<anyName/>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="customElement"/>
</choice>
</zeroOrMore>
</element>
</define>
</grammar>

View File

@@ -1,135 +0,0 @@
<?xml version="1.0"?>
<!-- CPU-related definitions used in multiple grammars -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<define name="cpuMode">
<attribute name="mode">
<choice>
<value>custom</value>
<value>host-model</value>
<value>host-passthrough</value>
</choice>
</attribute>
</define>
<define name="cpuMatch">
<attribute name="match">
<choice>
<value>minimum</value>
<value>exact</value>
<value>strict</value>
</choice>
</attribute>
</define>
<define name="cpuModel">
<element name="model">
<optional>
<attribute name="fallback">
<choice>
<value>allow</value>
<value>forbid</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="vendor_id">
<data type="string">
<param name='pattern'>[^,]{12}</param>
</data>
</attribute>
</optional>
<choice>
<text/>
<empty/>
</choice>
</element>
</define>
<define name="cpuVendor">
<element name="vendor">
<text/>
</element>
</define>
<define name="cpuFeature">
<element name="feature">
<attribute name="policy">
<choice>
<value>force</value>
<value>require</value>
<value>optional</value>
<value>disable</value>
<value>forbid</value>
</choice>
</attribute>
<attribute name="name">
<ref name="featureName"/>
</attribute>
<empty/>
</element>
</define>
<define name="cpuTopology">
<element name="topology">
<attribute name="sockets">
<ref name="positiveInteger"/>
</attribute>
<attribute name="cores">
<ref name="positiveInteger"/>
</attribute>
<attribute name="threads">
<ref name="positiveInteger"/>
</attribute>
</element>
</define>
<define name="cpuNuma">
<element name="numa">
<oneOrMore>
<ref name="numaCell"/>
</oneOrMore>
</element>
</define>
<define name="numaCell">
<element name="cell">
<optional>
<attribute name="id">
<ref name="unsignedInt"/>
</attribute>
</optional>
<attribute name="cpus">
<ref name="cpuset"/>
</attribute>
<attribute name="memory">
<ref name="memoryKB"/>
</attribute>
<optional>
<attribute name="unit">
<ref name="unit"/>
</attribute>
</optional>
<optional>
<attribute name="memAccess">
<choice>
<value>shared</value>
<value>private</value>
</choice>
</attribute>
</optional>
</element>
</define>
<!-- Memory as an attribute is in KiB, no way to express a unit -->
<define name="memoryKB">
<data type="unsignedLong"/>
</define>
<define name="featureName">
<data type="string">
<param name='pattern'>[a-zA-Z0-9\-_\.]+</param>
</data>
</define>
</grammar>

View File

@@ -2,7 +2,6 @@
<!-- 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'/>
<include href='cputypes.rng'/>
<start>
<ref name='domainCapabilities'/>
</start>
@@ -29,15 +28,9 @@
<optional>
<ref name='os'/>
</optional>
<optional>
<ref name='cpu'/>
</optional>
<optional>
<ref name='devices'/>
</optional>
<optional>
<ref name='features'/>
</optional>
</interleave>
</element>
</define>
@@ -72,68 +65,10 @@
</element>
</define>
<define name='cpu'>
<element name='cpu'>
<ref name='cpuHost'/>
<ref name='cpuHostModel'/>
<ref name='cpuCustom'/>
</element>
</define>
<define name='cpuHost'>
<element name='mode'>
<attribute name='name'>
<value>host-passthrough</value>
</attribute>
<ref name='supported'/>
</element>
</define>
<define name='cpuHostModel'>
<element name='mode'>
<attribute name='name'>
<value>host-model</value>
</attribute>
<ref name='supported'/>
<optional>
<ref name="cpuModel"/>
<optional>
<ref name="cpuVendor"/>
</optional>
<zeroOrMore>
<ref name="cpuFeature"/>
</zeroOrMore>
</optional>
</element>
</define>
<define name='cpuCustom'>
<element name='mode'>
<attribute name='name'>
<value>custom</value>
</attribute>
<ref name='supported'/>
<zeroOrMore>
<element name='model'>
<attribute name='usable'>
<choice>
<value>yes</value>
<value>no</value>
<value>unknown</value>
</choice>
</attribute>
<text/>
</element>
</zeroOrMore>
</element>
</define>
<define name='devices'>
<element name='devices'>
<interleave>
<ref name='disk'/>
<ref name='graphics'/>
<ref name='video'/>
<ref name='hostdev'/>
</interleave>
</element>
@@ -146,20 +81,6 @@
</element>
</define>
<define name='graphics'>
<element name='graphics'>
<ref name='supported'/>
<ref name='enum'/>
</element>
</define>
<define name='video'>
<element name='video'>
<ref name='supported'/>
<ref name='enum'/>
</element>
</define>
<define name='hostdev'>
<element name='hostdev'>
<ref name='supported'/>
@@ -167,21 +88,6 @@
</element>
</define>
<define name='features'>
<element name='features'>
<interleave>
<ref name='gic'/>
</interleave>
</element>
</define>
<define name='gic'>
<element name='gic'>
<ref name='supported'/>
<ref name='enum'/>
</element>
</define>
<define name='value'>
<zeroOrMore>
<element name='value'>

View File

@@ -4,7 +4,6 @@
<include href='basictypes.rng'/>
<include href='storagecommon.rng'/>
<include href='networkcommon.rng'/>
<include href='cputypes.rng'/>
<!--
description and title element, may be placed anywhere under the root
@@ -56,9 +55,6 @@
<optional>
<ref name="pm"/>
</optional>
<optional>
<ref name="perf"/>
</optional>
<optional>
<ref name="idmap"/>
</optional>
@@ -260,14 +256,6 @@
</choice>
</attribute>
</optional>
<optional>
<attribute name="secure">
<choice>
<value>yes</value>
<value>no</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="type">
<choice>
@@ -315,9 +303,6 @@
<optional>
<ref name="bios"/>
</optional>
<optional>
<ref name="acpiTable"/>
</optional>
</interleave>
</element>
</define>
@@ -407,36 +392,6 @@
</element>
</define>
<!--
Enable or disable perf events for the domain. For each
of the events the following rules apply:
on: the event will be forcefully enabled
off: the event will be forcefully disabled
not specified: the event will be disabled by default
-->
<define name="perf">
<element name="perf">
<oneOrMore>
<element name="event">
<attribute name="name">
<choice>
<value>cmt</value>
<value>mbmt</value>
<value>mbml</value>
<value>cpu_cycles</value>
<value>instructions</value>
<value>cache_references</value>
<value>cache_misses</value>
</choice>
</attribute>
<attribute name="enabled">
<ref name="virYesNo"/>
</attribute>
</element>
</oneOrMore>
</element>
</define>
<!--
The Identifiers can be:
- an optional id attribute with a number on the domain element
@@ -587,31 +542,6 @@
</element>
</optional>
<optional>
<element name="vcpus">
<zeroOrMore>
<element name="vcpu">
<attribute name="id">
<ref name="unsignedInt"/>
</attribute>
<attribute name="enabled">
<ref name="virYesNo"/>
</attribute>
<optional>
<attribute name="hotpluggable">
<ref name="virYesNo"/>
</attribute>
</optional>
<optional>
<attribute name="order">
<ref name="unsignedInt"/>
</attribute>
</optional>
</element>
</zeroOrMore>
</element>
</optional>
<optional>
<element name="iothreads">
<ref name="unsignedInt"/>
@@ -739,16 +669,6 @@
<ref name="cpushares"/>
</element>
</optional>
<optional>
<element name="global_period">
<ref name="cpuperiod"/>
</element>
</optional>
<optional>
<element name="global_quota">
<ref name="cpuquota"/>
</element>
</optional>
<optional>
<element name="period">
<ref name="cpuperiod"/>
@@ -769,16 +689,6 @@
<ref name="cpuquota"/>
</element>
</optional>
<optional>
<element name="iothread_period">
<ref name="cpuperiod"/>
</element>
</optional>
<optional>
<element name="iothread_quota">
<ref name="cpuquota"/>
</element>
</optional>
<zeroOrMore>
<element name="vcpupin">
<attribute name="vcpu">
@@ -1218,16 +1128,14 @@
<optional>
<element name="vendor">
<data type="string">
<!-- All printable characters -->
<param name="pattern">[&#x20;-&#x7E;]{0,8}</param>
<param name="pattern">[x20-x7E]{0,8}</param>
</data>
</element>
</optional>
<optional>
<element name="product">
<data type="string">
<!-- All printable characters -->
<param name="pattern">[&#x20;-&#x7E;]{0,16}</param>
<param name="pattern">[x20-x7E]{0,16}</param>
</data>
</element>
</optional>
@@ -1668,9 +1576,6 @@
<optional>
<ref name="driverIOThread"/>
</optional>
<optional>
<ref name="detect_zeroes"/>
</optional>
<empty/>
</element>
</define>
@@ -1691,7 +1596,6 @@
<define name="driverCache">
<attribute name="cache">
<choice>
<value>default</value>
<value>none</value>
<value>writeback</value>
<value>writethrough</value>
@@ -1755,22 +1659,11 @@
<ref name="unsignedInt"/>
</attribute>
</define>
<define name="detect_zeroes">
<attribute name='detect_zeroes'>
<choice>
<value>off</value>
<value>on</value>
<value>unmap</value>
</choice>
</attribute>
</define>
<define name="controller">
<element name="controller">
<optional>
<attribute name="index">
<ref name="unsignedInt"/>
</attribute>
</optional>
<attribute name="index">
<ref name="unsignedInt"/>
</attribute>
<interleave>
<optional>
<ref name="alias"/>
@@ -1810,8 +1703,7 @@
</attribute>
</optional>
</group>
<!-- usb has an optional attribute "model",
and optional subelements "master" and "ports" -->
<!-- usb has an optional attribute "model", and optional subelement "master" -->
<group>
<attribute name="type">
<value>usb</value>
@@ -1830,19 +1722,12 @@
<value>pci-ohci</value>
<value>nec-xhci</value>
<value>none</value>
<value>qusb1</value>
<value>qusb2</value>
</choice>
</attribute>
</optional>
<optional>
<ref name="usbmaster"/>
</optional>
<optional>
<attribute name="ports">
<ref name="unsignedInt"/>
</attribute>
</optional>
</group>
<!-- pci has an optional attribute "model" -->
<group>
@@ -1863,10 +1748,6 @@
<value>x3130-upstream</value>
<!-- implementations of 'pcie-switch-downstream-port' -->
<value>xio3130-downstream</value>
<!-- implementations of 'pci-expander-bus' -->
<value>pxb</value>
<!-- implementations of 'pcie-expander-bus' -->
<value>pxb-pcie</value>
</choice>
</attribute>
<empty/>
@@ -1876,29 +1757,20 @@
<element name="target">
<optional>
<attribute name='chassisNr'>
<ref name='uint8'/>
<ref name='uint8range'/>
</attribute>
</optional>
<optional>
<attribute name="chassis">
<ref name='uint8'/>
<ref name='uint8range'/>
</attribute>
</optional>
<optional>
<attribute name="port">
<ref name='uint8'/>
<ref name='uint8range'/>
</attribute>
</optional>
<optional>
<attribute name='busNr'>
<ref name='uint8'/>
</attribute>
</optional>
<optional>
<element name='node'>
<ref name='unsignedInt'/>
</element>
</optional>
<empty/>
</element>
</optional>
<!-- *-root controllers have an optional element "pcihole64"-->
@@ -1924,8 +1796,6 @@
<value>pcie-root-port</value>
<value>pcie-switch-upstream-port</value>
<value>pcie-switch-downstream-port</value>
<value>pci-expander-bus</value>
<value>pcie-expander-bus</value>
</choice>
</attribute>
</group>
@@ -1968,9 +1838,6 @@
<optional>
<ref name="ioeventfd"/>
</optional>
<optional>
<ref name="driverIOThread"/>
</optional>
</element>
</optional>
</interleave>
@@ -2157,28 +2024,6 @@
</element>
</define>
<define name="interface-network-attributes">
<attribute name="network">
<text/>
</attribute>
<optional>
<attribute name="portgroup">
<ref name="deviceName"/>
</attribute>
</optional>
</define>
<define name="interface-bridge-attributes">
<attribute name="bridge">
<ref name="deviceName"/>
</attribute>
<optional>
<attribute name="macTableManager">
<ref name="macTableManager"/>
</attribute>
</optional>
</define>
<!--
An interface description can either be of type bridge in which case
it will use a bridging source, or of type ethernet which uses a device
@@ -2195,10 +2040,9 @@
<interleave>
<optional>
<element name="source">
<ref name="interface-bridge-attributes"/>
<optional>
<ref name="interface-network-attributes"/>
</optional>
<attribute name="bridge">
<ref name="deviceName"/>
</attribute>
<empty/>
</element>
</optional>
@@ -2215,7 +2059,10 @@
<interleave>
<optional>
<element name="source">
<ref name="interface-ip-info"/>
<attribute name="dev">
<ref name="deviceName"/>
</attribute>
<empty/>
</element>
</optional>
<ref name="interface-options"/>
@@ -2252,9 +2099,13 @@
</attribute>
<interleave>
<element name="source">
<ref name='interface-network-attributes'/>
<attribute name="network">
<text/>
</attribute>
<optional>
<ref name="interface-bridge-attributes"/>
<attribute name="portgroup">
<ref name="deviceName"/>
</attribute>
</optional>
<empty/>
</element>
@@ -2278,9 +2129,6 @@
<ref name="bridgeMode"/>
</attribute>
</optional>
<optional>
<ref name='interface-network-attributes'/>
</optional>
<empty/>
</element>
<optional>
@@ -2492,7 +2340,27 @@
<empty/>
</element>
</optional>
<ref name="interface-ip-info"/>
<zeroOrMore>
<element name="ip">
<attribute name="address">
<ref name="ipAddr"/>
</attribute>
<optional>
<attribute name="family">
<ref name="addr-family"/>
</attribute>
</optional>
<optional>
<attribute name="prefix">
<ref name="ipPrefix"/>
</attribute>
</optional>
<empty/>
</element>
</zeroOrMore>
<zeroOrMore>
<ref name="route"/>
</zeroOrMore>
<optional>
<element name="script">
<attribute name="path">
@@ -2558,11 +2426,6 @@
<ref name="positiveInteger"/>
</attribute>
</optional>
<optional>
<attribute name='rx_queue_size'>
<ref name='positiveInteger'/>
</attribute>
</optional>
<optional>
<attribute name="txmode">
<choice>
@@ -2686,38 +2549,6 @@
</optional>
</interleave>
</define>
<!--
All ip-related info for either the host or guest side of an interface
-->
<define name="interface-ip-info">
<zeroOrMore>
<element name="ip">
<attribute name="address">
<ref name="ipAddr"/>
</attribute>
<optional>
<attribute name="family">
<ref name="addr-family"/>
</attribute>
</optional>
<optional>
<attribute name="prefix">
<ref name="ipPrefix"/>
</attribute>
</optional>
<optional>
<attribute name="peer">
<ref name="ipAddr"/>
</attribute>
</optional>
<empty/>
</element>
</zeroOrMore>
<zeroOrMore>
<ref name="route"/>
</zeroOrMore>
</define>
<!--
An emulator description is just a path to the binary used for the task
-->
@@ -2727,7 +2558,10 @@
</element>
</define>
<!--
A graphic description (SPICE, VNC, SDL, ...)
A graphic description, currently in Xen only 2 types are supported:
- sdl with optional display, xauth and fullscreen
- vnc with a required port and optional listen IP address, password
and keymap
-->
<define name="graphic">
<element name="graphics">
@@ -2989,14 +2823,6 @@
<empty/>
</element>
</optional>
<optional>
<element name="gl">
<attribute name="enable">
<ref name="virYesNo"/>
</attribute>
<empty/>
</element>
</optional>
</interleave>
</group>
<group>
@@ -3057,11 +2883,9 @@
<attribute name="type">
<value>address</value>
</attribute>
<optional>
<attribute name="address">
<ref name="addrIPorName"/>
</attribute>
</optional>
<attribute name="address">
<ref name="addrIPorName"/>
</attribute>
</group>
<group>
<attribute name="type">
@@ -3076,21 +2900,6 @@
</attribute>
</optional>
</group>
<group>
<attribute name="type">
<value>socket</value>
</attribute>
<optional>
<attribute name="socket">
<ref name="absFilePath"/>
</attribute>
</optional>
</group>
<group>
<attribute name="type">
<value>none</value>
</attribute>
</group>
</choice>
</element>
</zeroOrMore>
@@ -3129,11 +2938,6 @@
<ref name="unsignedInt"/>
</attribute>
</optional>
<optional>
<attribute name="vram64">
<ref name="unsignedInt"/>
</attribute>
</optional>
</group>
</choice>
<optional>
@@ -3472,18 +3276,6 @@
</optional>
</element>
</optional>
<optional>
<element name="log">
<attribute name="file">
<ref name="absFilePath"/>
</attribute>
<optional>
<attribute name="append">
<ref name="virOnOff"/>
</attribute>
</optional>
</element>
</optional>
</define>
<!--
The description for a console
@@ -3612,9 +3404,6 @@
</optional>
</element>
</optional>
<optional>
<ref name="alias"/>
</optional>
<optional>
<ref name="address"/>
</optional>
@@ -3690,16 +3479,6 @@
</optional>
</element>
</define>
<define name="xenTarget">
<element name="target">
<attribute name="type">
<value>xen</value>
</attribute>
<optional>
<attribute name="name"/>
</optional>
</element>
</define>
<define name="channel">
<element name="channel">
<ref name="qemucdevSrcType"/>
@@ -3708,7 +3487,6 @@
<choice>
<ref name="guestfwdTarget"/>
<ref name="virtioTarget"/>
<ref name="xenTarget"/>
</choice>
<optional>
<ref name="alias"/>
@@ -3809,14 +3587,6 @@
</optional>
</define>
<define name="iommu">
<element name="iommu">
<attribute name="model">
<value>intel</value>
</attribute>
</element>
</define>
<define name="input">
<element name="input">
<choice>
@@ -4118,7 +3888,27 @@
<ref name="deviceName"/>
</element>
</element>
<ref name="interface-ip-info"/>
<zeroOrMore>
<element name="ip">
<attribute name="address">
<ref name="ipAddr"/>
</attribute>
<optional>
<attribute name="family">
<ref name="addr-family"/>
</attribute>
</optional>
<optional>
<attribute name="prefix">
<ref name="ipPrefix"/>
</attribute>
</optional>
<empty/>
</element>
</zeroOrMore>
<zeroOrMore>
<ref name="route"/>
</zeroOrMore>
</interleave>
</define>
@@ -4159,11 +3949,9 @@
<attribute name="bus">
<ref name="usbAddr"/>
</attribute>
<optional>
<attribute name="port">
<ref name="usbPort"/>
</attribute>
</optional>
<attribute name="port">
<ref name="usbPort"/>
</attribute>
</define>
<define name="spaprvioaddress">
<optional>
@@ -4288,9 +4076,6 @@
<zeroOrMore>
<ref name="panic"/>
</zeroOrMore>
<optional>
<ref name="iommu"/>
</optional>
</interleave>
</element>
</define>
@@ -4323,11 +4108,7 @@
</optional>
<optional>
<element name="hap">
<optional>
<attribute name="state">
<ref name="virOnOff"/>
</attribute>
</optional>
<empty/>
</element>
</optional>
<optional>
@@ -4382,15 +4163,6 @@
</optional>
</element>
</optional>
<optional>
<element name="smm">
<optional>
<attribute name="state">
<ref name="virOnOff"/>
</attribute>
</optional>
</element>
</optional>
</interleave>
</element>
</optional>
@@ -4426,6 +4198,125 @@
</element>
</define>
<define name="cpuMode">
<attribute name="mode">
<choice>
<value>custom</value>
<value>host-model</value>
<value>host-passthrough</value>
</choice>
</attribute>
</define>
<define name="cpuMatch">
<attribute name="match">
<choice>
<value>minimum</value>
<value>exact</value>
<value>strict</value>
</choice>
</attribute>
</define>
<define name="cpuModel">
<element name="model">
<optional>
<attribute name="fallback">
<choice>
<value>allow</value>
<value>forbid</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="vendor_id">
<data type="string">
<param name='pattern'>[^,]{12}</param>
</data>
</attribute>
</optional>
<choice>
<text/>
<empty/>
</choice>
</element>
</define>
<define name="cpuVendor">
<element name="vendor">
<text/>
</element>
</define>
<define name="cpuFeature">
<element name="feature">
<attribute name="policy">
<choice>
<value>force</value>
<value>require</value>
<value>optional</value>
<value>disable</value>
<value>forbid</value>
</choice>
</attribute>
<attribute name="name">
<ref name="featureName"/>
</attribute>
<empty/>
</element>
</define>
<define name="cpuTopology">
<element name="topology">
<attribute name="sockets">
<ref name="positiveInteger"/>
</attribute>
<attribute name="cores">
<ref name="positiveInteger"/>
</attribute>
<attribute name="threads">
<ref name="positiveInteger"/>
</attribute>
</element>
</define>
<define name="cpuNuma">
<element name="numa">
<oneOrMore>
<ref name="numaCell"/>
</oneOrMore>
</element>
</define>
<define name="numaCell">
<element name="cell">
<optional>
<attribute name="id">
<ref name="unsignedInt"/>
</attribute>
</optional>
<attribute name="cpus">
<ref name="cpuset"/>
</attribute>
<attribute name="memory">
<ref name="memoryKB"/>
</attribute>
<optional>
<attribute name="unit">
<ref name="unit"/>
</attribute>
</optional>
<optional>
<attribute name="memAccess">
<choice>
<value>shared</value>
<value>private</value>
</choice>
</attribute>
</optional>
</element>
</define>
<!--
System information specification:
Placeholder for system specific informations likes the ones
@@ -4522,21 +4413,6 @@
</data>
</define>
<define name="acpiTable">
<element name="acpi">
<zeroOrMore>
<element name="table">
<attribute name="type">
<choice>
<value>slic</value>
</choice>
</attribute>
<ref name="absFilePath"/>
</element>
</zeroOrMore>
</element>
</define>
<define name="smbios">
<element name="smbios">
<attribute name="mode">
@@ -4662,9 +4538,6 @@
<optional>
<ref name="address"/>
</optional>
<optional>
<ref name="alias"/>
</optional>
</interleave>
</element>
</define>
@@ -4731,7 +4604,8 @@
<value>random</value>
</attribute>
<choice>
<ref name='absFilePath'/>
<value>/dev/random</value>
<value>/dev/hwrng</value>
<empty/>
</choice>
</group>
@@ -4988,43 +4862,6 @@
</optional>
</element>
</optional>
<optional>
<element name="vpindex">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="runtime">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="synic">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="stimer">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="reset">
<ref name="featurestate"/>
</element>
</optional>
<optional>
<element name="vendor_id">
<ref name="featurestate"/>
<optional>
<attribute name="value">
<data type="string">
<param name='pattern'>[^,]{0,12}</param>
</data>
</attribute>
</optional>
</element>
</optional>
</interleave>
</element>
</define>
@@ -5324,6 +5161,29 @@
</element>
</define>
<define name="metadata">
<element name="metadata">
<zeroOrMore>
<ref name="customElement"/>
</zeroOrMore>
</element>
</define>
<define name="customElement">
<element>
<anyName/>
<zeroOrMore>
<choice>
<attribute>
<anyName/>
</attribute>
<text/>
<ref name="customElement"/>
</choice>
</zeroOrMore>
</element>
</define>
<!--
Type library
-->
@@ -5370,6 +5230,10 @@
<param name="maxInclusive">1000</param>
</data>
</define>
<!-- Memory as an attribute is in KiB, no way to express a unit -->
<define name="memoryKB">
<data type="unsignedLong"/>
</define>
<define name="domainName">
<data type="string">
<!-- Use literal newline instead of \n for bug in libxml2 2.7.6 -->
@@ -5453,6 +5317,11 @@
<param name="pattern">[0-9]{1,20}</param>
</data>
</define>
<define name="featureName">
<data type="string">
<param name='pattern'>[a-zA-Z0-9\-_\.]+</param>
</data>
</define>
<define name="timeDelta">
<data type="string">
<param name="pattern">(-|\+)?[0-9]+</param>
@@ -5529,7 +5398,6 @@
<value>isa</value>
<value>pseries</value>
<value>hyperv</value>
<value>s390</value>
</choice>
</attribute>
</optional>

View File

@@ -37,11 +37,6 @@
<text/>
</element>
<!-- <metadata> element -->
<optional>
<ref name="metadata"/>
</optional>
<!-- <uuid> element -->
<optional>
<element name="uuid"><ref name="UUID"/></element>
@@ -72,7 +67,10 @@
<optional>
<attribute name="macTableManager">
<ref name="macTableManager"/>
<choice>
<value>kernel</value>
<value>libvirt</value>
</choice>
</attribute>
</optional>
@@ -103,7 +101,6 @@
<choice>
<value>nat</value>
<value>route</value>
<value>open</value>
<value>bridge</value>
<value>passthrough</value>
<value>private</value>
@@ -247,11 +244,6 @@
and other features in the <dns> element -->
<optional>
<element name="dns">
<optional>
<attribute name="enable">
<ref name="virYesNo"/>
</attribute>
</optional>
<optional>
<attribute name="forwardPlainNames">
<ref name="virYesNo"/>
@@ -260,13 +252,7 @@
<interleave>
<zeroOrMore>
<element name="forwarder">
<optional>
<attribute name="addr"><ref name="ipAddr"/></attribute>
</optional>
<optional>
<attribute name="domain"><ref name="dnsName"/></attribute>
</optional>
<empty/>
<attribute name="addr"><ref name="ipAddr"/></attribute>
</element>
</zeroOrMore>
<zeroOrMore>

View File

@@ -19,17 +19,17 @@
<element name="parameters">
<optional>
<attribute name="managerid">
<ref name="uint8"/>
<ref name="uint8range"/>
</attribute>
</optional>
<optional>
<attribute name="typeid">
<ref name="uint24"/>
<ref name="uint24range"/>
</attribute>
</optional>
<optional>
<attribute name="typeidversion">
<ref name="uint8"/>
<ref name="uint8range"/>
</attribute>
</optional>
<optional>
@@ -97,17 +97,17 @@
<element name="parameters">
<optional>
<attribute name="managerid">
<ref name="uint8"/>
<ref name="uint8range"/>
</attribute>
</optional>
<optional>
<attribute name="typeid">
<ref name="uint24"/>
<ref name="uint24range"/>
</attribute>
</optional>
<optional>
<attribute name="typeidversion">
<ref name="uint8"/>
<ref name="uint8range"/>
</attribute>
</optional>
<optional>
@@ -260,10 +260,4 @@
</optional>
</element>
</define>
<define name="macTableManager">
<choice>
<value>kernel</value>
<value>libvirt</value>
</choice>
</define>
</grammar>

View File

@@ -40,7 +40,6 @@
<ref name="capusbinterface"/>
<ref name="capnet"/>
<ref name="capscsihost"/>
<ref name="capscsitarget"/>
<ref name="capscsi"/>
<ref name="capstorage"/>
</choice>
@@ -143,24 +142,8 @@
<value>virt_functions</value>
</attribute>
<optional>
<attribute name='maxCount'>
<ref name='unsignedInt'/>
</attribute>
</optional>
<zeroOrMore>
<ref name='address'/>
</zeroOrMore>
</element>
</optional>
<optional>
<element name='capability'>
<attribute name='type'>
<choice>
<value>pci-bridge</value>
<value>cardbus-bridge</value>
</choice>
</attribute>
</optional>
</element>
</optional>
@@ -388,16 +371,6 @@
</optional>
</define>
<define name='capscsitarget'>
<attribute name='type'>
<value>scsi_target</value>
</attribute>
<element name='target'>
<text/>
</element>
</define>
<define name='capscsi'>
<attribute name='type'>
<value>scsi</value>

View File

@@ -578,12 +578,12 @@
<interleave>
<optional>
<attribute name="type">
<ref name="uint8"/>
<ref name="uint8range"/>
</attribute>
</optional>
<optional>
<attribute name="code">
<ref name="uint8"/>
<ref name="uint8range"/>
</attribute>
</optional>
</interleave>
@@ -593,22 +593,22 @@
<interleave>
<optional>
<attribute name="type">
<ref name="uint8"/>
<ref name="uint8range"/>
</attribute>
</optional>
<optional>
<attribute name="typeend">
<ref name="uint8"/>
<ref name="uint8range"/>
</attribute>
</optional>
<optional>
<attribute name="code">
<ref name="uint8"/>
<ref name="uint8range"/>
</attribute>
</optional>
<optional>
<attribute name="codeend">
<ref name="uint8"/>
<ref name="uint8range"/>
</attribute>
</optional>
</interleave>
@@ -642,12 +642,12 @@
<define name="stp-attributes">
<optional>
<attribute name="type">
<ref name="uint8"/>
<ref name="uint8range"/>
</attribute>
</optional>
<optional>
<attribute name="flags">
<ref name="uint8"/>
<ref name="uint8range"/>
</attribute>
</optional>
<optional>

View File

@@ -36,7 +36,6 @@
<ref name='usagevolume'/>
<ref name='usageceph'/>
<ref name='usageiscsi'/>
<ref name='usagetls'/>
<!-- More choices later -->
</choice>
</element>
@@ -72,13 +71,4 @@
</element>
</define>
<define name='usagetls'>
<attribute name='type'>
<value>tls</value>
</attribute>
<element name='name'>
<ref name='genericName'/>
</element>
</define>
</grammar>

View File

@@ -12,22 +12,11 @@
<choice>
<value>default</value>
<value>qcow</value>
<value>luks</value>
</choice>
</attribute>
<interleave>
<zeroOrMore>
<ref name='secret'/>
</zeroOrMore>
<optional>
<element name='cipher'>
<ref name='keycipher'/>
</element>
<element name='ivgen'>
<ref name='keyivgen'/>
</element>
</optional>
</interleave>
<zeroOrMore>
<ref name='secret'/>
</zeroOrMore>
</element>
</define>
@@ -38,14 +27,9 @@
<value>passphrase</value>
</choice>
</attribute>
<choice>
<attribute name='uuid'>
<ref name="UUID"/>
</attribute>
<attribute name='usage'>
<text/>
</attribute>
</choice>
<attribute name='uuid'>
<ref name="UUID"/>
</attribute>
</element>
</define>
@@ -92,7 +76,6 @@
<value>fat</value>
<value>vhd</value>
<value>ploop</value>
<value>luks</value>
<ref name='storageFormatBacking'/>
</choice>
</define>
@@ -146,32 +129,4 @@
</optional>
</define>
<define name='keycipher'>
<attribute name='name'>
<text/>
</attribute>
<attribute name='size'>
<ref name="unsignedInt"/>
</attribute>
<optional>
<attribute name='mode'>
<text/>
</attribute>
<attribute name='hash'>
<text/>
</attribute>
</optional>
</define>
<define name='keyivgen'>
<attribute name='name'>
<text/>
</attribute>
<optional>
<attribute name='hash'>
<text/>
</attribute>
</optional>
</define>
</grammar>

View File

@@ -120,10 +120,6 @@
<a href="hooks.html">Hooks</a>
<span>Hooks for system specific management</span>
</li>
<li>
<a href="nss.html">NSS module</a>
<span>Enable domain host name translation to IP addresses</span>
</li>
</ul>
</li>
<li>
@@ -304,10 +300,6 @@
</ul>
-->
<ul>
<li>
<a href="html/libvirt-libvirt-common.html">Common</a>
<span>common APIs for the libvirt library</span>
</li>
<li>
<a href="html/libvirt-libvirt-domain.html">Domain</a>
<span>domain APIs for the libvirt library</span>
@@ -396,10 +388,6 @@
<a href="api_extension.html">API extensions</a>
<span>Adding new public libvirt APIs</span>
</li>
<li>
<a href="internals/eventloop.html">Event loop and worker pool</a>
<span>Libvirt's event loop and worker pool mode</span>
</li>
<li>
<a href="internals/command.html">Spawning commands</a>
<span>Spawning commands from libvirt driver code</span>

View File

@@ -37,36 +37,21 @@ EXTRA_DIST = \
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir) \
-I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib
LDADD = $(STATIC_BINARIES) $(WARN_CFLAGS) $(COVERAGE_LDFLAGS) \
$(top_builddir)/src/libvirt.la $(top_builddir)/gnulib/lib/libgnu.la \
$(top_builddir)/src/libvirt-admin.la
$(top_builddir)/src/libvirt.la $(top_builddir)/gnulib/lib/libgnu.la
noinst_PROGRAMS=dominfo/info1 dommigrate/dommigrate domsuspend/suspend \
domtop/domtop hellolibvirt/hellolibvirt object-events/event-test \
openauth/openauth rename/rename admin/list_servers admin/list_clients \
admin/threadpool_params admin/client_limits admin/client_info \
admin/client_close
openauth/openauth rename/rename
dominfo_info1_SOURCES = dominfo/info1.c
dommigrate_dommigrate_SOURCES = dommigrate/dommigrate.c
domsuspend_suspend_SOURCES = domsuspend/suspend.c
domtop_domtop_SOURCES = domtop/domtop.c
hellolibvirt_hellolibvirt_SOURCES = hellolibvirt/hellolibvirt.c
object_events_event_test_CFLAGS = \
$(WARN_CFLAGS) \
$(NULL)
object_events_event_test_SOURCES = object-events/event-test.c
openauth_openauth_SOURCES = openauth/openauth.c
rename_rename_SOURCES = rename/rename.c
admin_list_servers_SOURCES = admin/list_servers.c
admin_list_clients_SOURCES = admin/list_clients.c
admin_threadpool_params_SOURCES = admin/threadpool_params.c
admin_client_limits_SOURCES = admin/client_limits.c
admin_client_info_SOURCES = admin/client_info.c
admin_client_close_SOURCES = admin/client_close.c
if WITH_APPARMOR_PROFILES
apparmordir = $(sysconfdir)/apparmor.d/
apparmor_DATA = \
@@ -100,5 +85,5 @@ uninstall-local::
for f in $(FILTERS); do \
rm -f "$(NWFILTER_DIR)/`basename $$f`"; \
done
-test -z "$(shell ls $(NWFILTER_DIR))" || rmdir $(NWFILTER_DIR)
-test -z $(shell ls $(NWFILTER_DIR)) || rmdir $(NWFILTER_DIR)
endif WITH_NWFILTER

View File

@@ -1,57 +0,0 @@
#include<stdio.h>
#include<stdlib.h>
#include<libvirt/libvirt.h>
#include<libvirt/libvirt-admin.h>
int main(void)
{
int ret = -1;
virAdmConnectPtr conn1 = NULL; /* admin connection */
virConnectPtr conn2 = NULL; /* libvirt standard connection */
virAdmServerPtr srv = NULL; /* which server is the client connected to */
virAdmClientPtr clnt = NULL; /* which client to disconnect */
/* first, open a standard libvirt connection to the daemon */
if (!(conn2 = virConnectOpen(NULL)))
return -1;
/* next, open an admin connection that will be used to disconnect the
* standard libvirt client
*/
if (!(conn1 = virAdmConnectOpen(NULL, 0)))
goto cleanup;
/* a virAdmServerPtr handle is needed, so a server lookup is performed */
if (!(srv = virAdmConnectLookupServer(conn1, "libvirtd", 0)))
goto cleanup;
/* a virAdmClientPtr handle is also necessary, so lookup for client is
* performed as well
*/
if (!(clnt = virAdmServerLookupClient(srv, 1, 0)))
goto cleanup;
/* finally, use the client handle to disconnect the standard libvirt client
* from libvirtd daemon
*/
if (virAdmClientClose(clnt, 0) < 0)
goto cleanup;
ret = 0;
cleanup:
/* Once finished, both server and client handles need to be freed and
* both connections @conn1 and @conn2 should be closed to free the
* memory.
* NOTE: Although @conn2 has been disconnected, unlike disconnecting by
* calling virConnectClose which closes the connection voluntarily and
* frees the object automatically, virAdmClientClose is a forceful
* disconnect of another client (client can use it on itself as well).
* Therefore no automatic deallocation of the object takes place and is
* the callers responsibility to do so.
*/
virAdmClientFree(clnt);
virAdmServerFree(srv);
virAdmConnectClose(conn1);
virConnectClose(conn2);
return ret;
}

View File

@@ -1,170 +0,0 @@
#define _GNU_SOURCE
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
#include<libvirt/libvirt-admin.h>
static const char *
exampleTransportToString(int transport)
{
const char *str = NULL;
switch ((virClientTransport) transport) {
case VIR_CLIENT_TRANS_UNIX:
str = "unix";
break;
case VIR_CLIENT_TRANS_TCP:
str = "tcp";
break;
case VIR_CLIENT_TRANS_TLS:
str = "tls";
break;
}
return str ? str : "unknown";
}
static char *
exampleGetTimeStr(time_t then)
{
char *ret = NULL;
struct tm timeinfo;
if (!localtime_r(&then, &timeinfo))
return NULL;
if (!(ret = calloc(64, sizeof(char))))
return NULL;
if (strftime(ret, 64, "%Y-%m-%d %H:%M:%S%z",
&timeinfo) == 0) {
free(ret);
return NULL;
}
return ret;
}
static char *
exampleGetTypedParamValue(virTypedParameterPtr item)
{
int ret = 0;
char *str = NULL;
switch (item->type) {
case VIR_TYPED_PARAM_INT:
ret = asprintf(&str, "%d", item->value.i);
break;
case VIR_TYPED_PARAM_UINT:
ret = asprintf(&str, "%u", item->value.ui);
break;
case VIR_TYPED_PARAM_LLONG:
ret = asprintf(&str, "%lld", item->value.l);
break;
case VIR_TYPED_PARAM_ULLONG:
ret = asprintf(&str, "%llu", item->value.ul);
break;
case VIR_TYPED_PARAM_DOUBLE:
ret = asprintf(&str, "%f", item->value.d);
break;
case VIR_TYPED_PARAM_BOOLEAN:
str = strdup(item->value.b ? "yes" : "no");
break;
case VIR_TYPED_PARAM_STRING:
str = strdup(item->value.s);
break;
default:
fprintf(stderr, "unimplemented parameter type %d\n", item->type);
return NULL;
}
if (ret < 0) {
fprintf(stderr, "error formatting typed param value\n");
return NULL;
}
return str;
}
int main(int argc, char **argv)
{
int ret = -1;
virAdmConnectPtr conn = NULL;
virAdmServerPtr srv = NULL; /* which server is the client connected to */
virAdmClientPtr clnt = NULL; /* which client get identity for */
virTypedParameterPtr params = NULL; /* where to store identity info */
int nparams = 0;
size_t i = 0;
char *timestr = NULL;
if (argc != 3) {
fprintf(stderr, "Two arguments, first specifying the server client is "
"connected to and second, specifying the client's ID for which "
"identity information should be retrieved, are expected\n");
return -1;
}
/* first, open a connection to the daemon */
if (!(conn = virAdmConnectOpen(NULL, 0)))
return -1;
/* first a virAdmServerPtr handle is necessary to obtain, that is done by
* doing a lookup for specific server, argv[1] holds the server name
*/
if (!(srv = virAdmConnectLookupServer(conn, argv[1], 0)))
goto cleanup;
/* next, virAdmClientPtr handle is necessary to obtain, that is done by
* doing a lookup on a specific server, argv[2] holds the client's ID
*/
if (!(clnt = virAdmServerLookupClient(srv, strtoll(argv[2], NULL, 10), 0)))
goto cleanup;
/* finally, retrieve @clnt's identity information */
if (virAdmClientGetInfo(clnt, &params, &nparams, 0) < 0)
goto cleanup;
/* this information is provided by the client object itself, not by typed
* params container; it is unnecessary to call virAdmClientGetInfo if only
* ID, transport method, and timestamp are the required data
*/
if (!(timestr = exampleGetTimeStr(virAdmClientGetTimestamp(clnt))))
goto cleanup;
printf("%-15s: %llu\n", "id", virAdmClientGetID(clnt));
printf("%-15s: %s\n", "connection_time", timestr);
printf("%-15s: %s\n", "transport",
exampleTransportToString(virAdmClientGetTransport(clnt)));
/* this is the actual identity information retrieved in typed params
* container
*/
for (i = 0; i < nparams; i++) {
char *str = NULL;
if (!(str = exampleGetTypedParamValue(&params[i])))
goto cleanup;
printf("%-15s: %s\n", params[i].field, str);
free(str);
}
ret = 0;
cleanup:
/* Once finished, free the typed params container, server and client
* handles and close the connection properly, @conn will be deallocated
* automatically
*/
virTypedParamsFree(params, nparams);
virAdmClientFree(clnt);
virAdmServerFree(srv);
virAdmConnectClose(conn);
free(timestr);
return ret;
}

View File

@@ -1,63 +0,0 @@
#include<stdio.h>
#include<stdlib.h>
#include<libvirt/libvirt-admin.h>
int main(int argc, char **argv)
{
int ret = -1;
virAdmConnectPtr conn = NULL;
virAdmServerPtr srv = NULL; /* which server to work with */
virTypedParameterPtr params = NULL;
int nparams = 0;
size_t i;
if (argc != 2) {
fprintf(stderr, "One argument specifying the server which to work "
"with is expected\n");
return -1;
}
/* first, open a connection to the daemon */
if (!(conn = virAdmConnectOpen(NULL, 0)))
goto cleanup;
/* a server handle is necessary before any API regarding threadpool
* parameters can be issued
*/
if (!(srv = virAdmConnectLookupServer(conn, argv[1], 0)))
goto cleanup;
/* get the current client limits */
if (virAdmServerGetClientLimits(srv, &params, &nparams, 0) < 0)
goto cleanup;
for (i = 0; i < nparams; i++)
printf("%-15s: %d\n", params[i].field, params[i].value.ui);
virTypedParamsFree(params, nparams);
params = NULL;
nparams = 0;
/* set nclients_max to 100 and nclients_unauth_max to 20 */
int maxparams = 0;
if (virTypedParamsAddUInt(&params, &nparams, &maxparams,
VIR_SERVER_CLIENTS_MAX, 100) < 0 ||
virTypedParamsAddUInt(&params, &nparams, &maxparams,
VIR_SERVER_CLIENTS_UNAUTH_MAX, 20) < 0)
goto cleanup;
/* now, change the client limits on the server */
if (virAdmServerSetClientLimits(srv, params, nparams, 0) < 0)
goto cleanup;
ret = 0;
cleanup:
virTypedParamsFree(params, nparams);
/* Once finished deallocate the server handle and close the connection
* properly, @conn will be deallocated automatically
*/
virAdmServerFree(srv);
virAdmConnectClose(conn);
return ret;
}

View File

@@ -1,111 +0,0 @@
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<libvirt/libvirt-admin.h>
static const char *
exampleTransportToString(int transport)
{
const char *str = NULL;
switch ((virClientTransport) transport) {
case VIR_CLIENT_TRANS_UNIX:
str = "unix";
break;
case VIR_CLIENT_TRANS_TCP:
str = "tcp";
break;
case VIR_CLIENT_TRANS_TLS:
str = "tls";
break;
}
return str ? str : "unknown";
}
static char *
exampleGetTimeStr(time_t then)
{
char *ret = NULL;
struct tm timeinfo;
if (!localtime_r(&then, &timeinfo))
return NULL;
if (!(ret = calloc(64, sizeof(char))))
return NULL;
if (strftime(ret, 64, "%Y-%m-%d %H:%M:%S%z",
&timeinfo) == 0) {
free(ret);
return NULL;
}
return ret;
}
int main(int argc, char **argv)
{
int ret = -1;
virAdmConnectPtr conn = NULL;
virAdmServerPtr srv = NULL; /* which server list the clients from */
virAdmClientPtr *clients = NULL; /* where to store the servers */
size_t i = 0;
int count = 0;
if (argc != 2) {
fprintf(stderr, "One argument specifying the server to list connected "
"clients for is expected\n");
return -1;
}
/* first, open a connection to the daemon */
if (!(conn = virAdmConnectOpen(NULL, 0)))
return -1;
/* first a virAdmServerPtr handle is necessary to obtain, that is done by
* doing a lookup for specific server, let's get a handle on "libvirtd"
* server
*/
if (!(srv = virAdmConnectLookupServer(conn, argv[1], 0)))
goto cleanup;
/* now get the currently connected clients to server @srv */
if ((count = virAdmServerListClients(srv, &clients, 0)) < 0)
goto cleanup;
/* let's print the currently connected clients and some basic info about
* them, we have 2 options how to interate over the returned list,
* use @count as the boundary or use the fact that @clients are guaranteed
* to contain 1 extra element NULL;
* this example uses the first option
*/
printf(" %-5s %-15s %-15s\n%s\n", "Id", "Transport", "Connected since",
"--------------------------------------------------");
for (i = 0; i < count; i++) {
virAdmClientPtr client = clients[i];
unsigned long long id = virAdmClientGetID(client);
int transport = virAdmClientGetTransport(client);
char * timestr = NULL;
if (!(timestr =
exampleGetTimeStr(virAdmClientGetTimestamp(client))))
goto cleanup;
printf(" %-5llu %-15s %-15s\n", id,
exampleTransportToString(transport), timestr);
free(timestr);
}
ret = 0;
cleanup:
/* Once finished, free the list of clients, free the server handle and
* close the connection properly, @conn will be deallocated automatically
*/
for (i = 0; i < count; i++)
virAdmClientFree(clients[i]);
free(clients);
virAdmServerFree(srv);
virAdmConnectClose(conn);
return ret;
}

View File

@@ -1,42 +0,0 @@
#include<stdio.h>
#include<stdlib.h>
#include<libvirt/libvirt-admin.h>
int main(void)
{
int ret = -1;
virAdmConnectPtr conn = NULL;
virAdmServerPtr *servers = NULL; /* where to store the servers */
virAdmServerPtr *tmp = NULL;
size_t i = 0;
int count = 0;
/* first, open a connection to the daemon */
if (!(conn = virAdmConnectOpen(NULL, 0)))
goto cleanup;
/* get the available servers on the default daemon - libvirtd */
if ((count = virAdmConnectListServers(conn, &servers, 0)) < 0)
goto cleanup;
/* let's print the available servers, we have 2 options how to interate
* over the returned list, use @count as the boundary or use the fact
* that @servers are guaranteed to contain 1 extra element NULL;
* this example uses the second option
*/
printf(" %-15s\n", "Server name");
printf("---------------\n");
for (tmp = servers; *tmp; tmp++)
printf(" %-15s\n", virAdmServerGetName(*tmp));
ret = 0;
cleanup:
/* Once finished, free the list of servers and close the connection
* properly, @conn will be deallocated automatically
*/
for (i = 0; i < count; i++)
virAdmServerFree(servers[i]);
free(servers);
virAdmConnectClose(conn);
return ret;
}

View File

@@ -1,65 +0,0 @@
#include<stdio.h>
#include<stdlib.h>
#include<libvirt/libvirt-admin.h>
int main(int argc, char **argv)
{
int ret = -1;
virAdmConnectPtr conn = NULL;
virAdmServerPtr srv = NULL; /* which server to work with */
virTypedParameterPtr params = NULL;
int nparams = 0;
size_t i;
if (argc != 2) {
fprintf(stderr, "One argument specifying the server which to work "
"with is expected\n");
return -1;
}
/* first, open a connection to the daemon */
if (!(conn = virAdmConnectOpen(NULL, 0)))
goto cleanup;
/* a server handle is necessary before any API regarding threadpool
* parameters can be issued
*/
if (!(srv = virAdmConnectLookupServer(conn, argv[1], 0)))
goto cleanup;
/* get the current threadpool parameters */
if (virAdmServerGetThreadPoolParameters(srv, &params, &nparams, 0) < 0)
goto cleanup;
for (i = 0; i < nparams; i++)
printf("%-15s: %d\n", params[i].field, params[i].value.ui);
virTypedParamsFree(params, nparams);
params = NULL;
nparams = 0;
/* let's set minWorkers to 10, maxWorkers to 15 and prioWorkers to 10 */
int maxparams = 0;
if (virTypedParamsAddUInt(&params, &nparams, &maxparams,
VIR_THREADPOOL_WORKERS_MIN, 10) < 0 ||
virTypedParamsAddUInt(&params, &nparams, &maxparams,
VIR_THREADPOOL_WORKERS_MAX, 15) < 0 ||
virTypedParamsAddUInt(&params, &nparams, &maxparams,
VIR_THREADPOOL_WORKERS_PRIORITY, 10) < 0)
goto cleanup;
/* now, change the threadpool settings to some different values */
if (virAdmServerSetThreadPoolParameters(srv, params, nparams, 0) < 0)
goto cleanup;
ret = 0;
cleanup:
virTypedParamsFree(params, nparams);
/* Once finished deallocate the server handle and close the connection
* properly, @conn will be deallocated automatically
*/
virAdmServerFree(srv);
virAdmConnectClose(conn);
return ret;
}

View File

@@ -148,3 +148,22 @@
/etc/udev/udev.conf r,
/sys/bus/ r,
/sys/class/ r,
/usr/{lib,libexec}/qemu-bridge-helper Cx -> qemu_bridge_helper,
# child profile for bridge helper process
profile qemu_bridge_helper {
#include <abstractions/base>
capability setuid,
capability setgid,
capability setpcap,
capability net_admin,
network inet stream,
/dev/net/tun rw,
/etc/qemu/** r,
owner @{PROC}/*/status r,
/usr/{lib,libexec}/qemu-bridge-helper rmix,
}

View File

@@ -45,7 +45,6 @@
/bin/* PUx,
/sbin/* PUx,
/usr/bin/* PUx,
/usr/sbin/virtlogd pix,
/usr/sbin/* PUx,
/lib/udev/scsi_id PUx,
/usr/{lib,lib64}/xen-common/bin/xen-toolstack PUx,
@@ -67,22 +66,4 @@
# allow changing to our UUID-based named profiles
change_profile -> @{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*,
/usr/{lib,libexec}/qemu-bridge-helper Cx -> qemu_bridge_helper,
# child profile for bridge helper process
profile qemu_bridge_helper {
#include <abstractions/base>
capability setuid,
capability setgid,
capability setpcap,
capability net_admin,
network inet stream,
/dev/net/tun rw,
/etc/qemu/** r,
owner @{PROC}/*/status r,
/usr/{lib,libexec}/qemu-bridge-helper rmix,
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
diff --git i/m4/ssize_t.m4 w/m4/ssize_t.m4
index 209d64c..5ea72a1 100644
--- i/m4/ssize_t.m4
+++ w/m4/ssize_t.m4
@@ -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-2016 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],
return !x;]])],
[gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])])
if test $gt_cv_ssize_t = no; then
- AC_DEFINE([ssize_t], [int],
- [Define as a signed type of the same size as size_t.])
+ AC_CACHE_CHECK([for rank of size_t], [gt_cv_size_t_rank],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/types.h>
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ int foo(unsigned long bar);
+ int foo(size_t bar);
+ #ifdef __cplusplus
+ }
+ #endif
+ ]])],
+ [gt_cv_size_t_rank=long], [gt_cv_size_t_rank=int])])
+ AC_DEFINE_UNQUOTED([ssize_t], [$gt_cv_size_t_rank],
+ [Define as a signed type of the same size and rank as size_t.])
fi
])

View File

@@ -18,11 +18,15 @@
virincdir = $(includedir)/libvirt
allheaders = $(wildcard $(srcdir)/*.h)
virinc_HEADERS = $(filter-out $(srcdir)/libvirt-common.h, $(allheaders))
virinc_HEADERS += libvirt-common.h
allheaders = $(wildcard $(srcdir)/libvirt/*.h)
virinc_HEADERS = $(filter-out $(srcdir)/libvirt/libvirt-admin.h \
$(srcdir)/libvirt/libvirt-common.h, $(allheaders))
virinc_HEADERS += libvirt/libvirt-common.h
EXTRA_DIST = libvirt-common.h.in
EXTRA_DIST = libvirt/libvirt-common.h.in
# Temporarily disabled, but we need it for building
EXTRA_DIST += libvirt/libvirt-admin.h
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(virincdir)

View File

@@ -50,14 +50,6 @@ typedef struct _virAdmConnect virAdmConnect;
*/
typedef struct _virAdmServer virAdmServer;
/**
* virAdmClient:
*
* a virAdmClient is a private structure and client-side representation of
* a remote server's client object (as server sees clients connected to it)
*/
typedef struct _virAdmClient virAdmClient;
/**
* virAdmConnectPtr:
*
@@ -76,23 +68,13 @@ typedef virAdmConnect *virAdmConnectPtr;
*/
typedef virAdmServer *virAdmServerPtr;
/**
* virAdmClientPtr:
*
* a virAdmClientPtr is a pointer to a virAdmClient structure,
* this is the type used to reference client-side representation of a
* client object throughout all the APIs.
*/
typedef virAdmClient *virAdmClientPtr;
int virAdmInitialize(void);
virAdmConnectPtr virAdmConnectOpen(const char *name, unsigned int flags);
int virAdmConnectClose(virAdmConnectPtr conn);
int virAdmConnectRef(virAdmConnectPtr conn);
int virAdmConnectIsAlive(virAdmConnectPtr conn);
int virAdmServerFree(virAdmServerPtr srv);
int virAdmConnectListServers(virAdmConnectPtr conn,
int virAdmConnectListServers(virAdmConnectPtr dmn,
virAdmServerPtr **servers,
unsigned int flags);
@@ -124,286 +106,6 @@ int virAdmConnectUnregisterCloseCallback(virAdmConnectPtr conn,
const char *virAdmServerGetName(virAdmServerPtr srv);
virAdmServerPtr virAdmConnectLookupServer(virAdmConnectPtr conn,
const char *name,
unsigned int flags);
/* Manage threadpool attributes */
/**
* VIR_THREADPOOL_WORKERS_MIN:
* Macro for the threadpool minWorkers limit: represents the bottom limit to
* number of active workers in threadpool, as VIR_TYPED_PARAM_UINT.
*/
# define VIR_THREADPOOL_WORKERS_MIN "minWorkers"
/**
* VIR_THREADPOOL_WORKERS_MAX:
* Macro for the threadpool maxWorkers limit: represents the upper limit to
* number of active workers in threadpool, as VIR_TYPED_PARAM_UINT.
* The value of this limit has to be greater than VIR_THREADPOOL_WORKERS_MIN
* at all times.
*/
# define VIR_THREADPOOL_WORKERS_MAX "maxWorkers"
/**
* VIR_THREADPOOL_WORKERS_PRIORITY:
* Macro for the threadpool nPrioWorkers attribute: represents the current number
* of active priority workers in threadpool, as VIR_TYPED_PARAM_UINT.
*/
# define VIR_THREADPOOL_WORKERS_PRIORITY "prioWorkers"
/**
* VIR_THREADPOOL_WORKERS_FREE:
* Macro for the threadpool freeWorkers attribute: represents the current number
* of free workers available to accomplish a job, as VIR_TYPED_PARAM_UINT.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_THREADPOOL_WORKERS_FREE "freeWorkers"
/**
* VIR_THREADPOOL_WORKERS_CURRENT:
* Macro for the threadpool nWorkers attribute: represents the current number
* of active ordinary workers in threadpool, as VIR_TYPED_PARAM_UINT.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_THREADPOOL_WORKERS_CURRENT "nWorkers"
/**
* VIR_THREADPOOL_JOB_QUEUE_DEPTH:
* Macro for the threadpool jobQueueDepth attribute: represents the current
* number of jobs waiting in a queue to be processed, as VIR_TYPED_PARAM_UINT.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_THREADPOOL_JOB_QUEUE_DEPTH "jobQueueDepth"
/* Tunables for a server workerpool */
int virAdmServerGetThreadPoolParameters(virAdmServerPtr srv,
virTypedParameterPtr *params,
int *nparams,
unsigned int flags);
int virAdmServerSetThreadPoolParameters(virAdmServerPtr srv,
virTypedParameterPtr params,
int nparams,
unsigned int flags);
/* virAdmClient object accessors */
unsigned long long virAdmClientGetID(virAdmClientPtr client);
long long virAdmClientGetTimestamp(virAdmClientPtr client);
int virAdmClientGetTransport(virAdmClientPtr client);
int virAdmClientFree(virAdmClientPtr client);
typedef enum {
VIR_CLIENT_TRANS_UNIX = 0, /* connection via UNIX socket */
VIR_CLIENT_TRANS_TCP, /* connection via unencrypted TCP socket */
VIR_CLIENT_TRANS_TLS, /* connection via encrypted TCP socket */
# ifdef VIR_ENUM_SENTINELS
VIR_CLIENT_TRANS_LAST
# endif
} virClientTransport;
int virAdmServerListClients(virAdmServerPtr srv,
virAdmClientPtr **clients,
unsigned int flags);
virAdmClientPtr
virAdmServerLookupClient(virAdmServerPtr srv,
unsigned long long id,
unsigned int flags);
/* Client identity info */
/**
* VIR_CLIENT_INFO_READONLY:
* Macro represents client's connection permission, whether the client is
* connected in read-only mode or just the opposite - read-write,
* as VIR_TYPED_PARAM_BOOLEAN.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_CLIENT_INFO_READONLY "readonly"
/**
* VIR_CLIENT_INFO_SOCKET_ADDR:
* Macro represents clients network socket address in a standard URI format:
* (IPv4|[IPv6]):port, as VIR_TYPED_PARAM_STRING.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_CLIENT_INFO_SOCKET_ADDR "sock_addr"
/**
* VIR_CLIENT_INFO_SASL_USER_NAME:
* Macro represents client's SASL user name, if SASL authentication is enabled
* on the remote host, as VIR_TYPED_PARAM_STRING.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_CLIENT_INFO_SASL_USER_NAME "sasl_user_name"
/**
* VIR_CLIENT_INFO_X509_DISTINGUISHED_NAME:
* Macro represents the 'distinguished name' field in X509 certificate the
* client used to establish a TLS session with remote host, as
* VIR_TYPED_PARAM_STRING.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_CLIENT_INFO_X509_DISTINGUISHED_NAME "tls_x509_dname"
/**
* VIR_CLIENT_INFO_UNIX_USER_ID:
* Macro represents UNIX UID the client process is running with. Only relevant
* for clients connected locally, i.e. via a UNIX socket,
* as VIR_TYPED_PARAM_INT.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_CLIENT_INFO_UNIX_USER_ID "unix_user_id"
/**
* VIR_CLIENT_INFO_UNIX_USER_NAME:
* Macro represents the user name that is bound to the client process's UID it
* is running with. Only relevant for clients connected locally, i.e. via a
* UNIX socket, as VIR_TYPED_PARAM_STRING.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_CLIENT_INFO_UNIX_USER_NAME "unix_user_name"
/**
* VIR_CLIENT_INFO_UNIX_GROUP_ID:
* Macro represents UNIX GID the client process is running with. Only relevant
* for clients connected locally, i.e. via a UNIX socket,
* as VIR_TYPED_PARAM_INT.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_CLIENT_INFO_UNIX_GROUP_ID "unix_group_id"
/**
* VIR_CLIENT_INFO_UNIX_GROUP_NAME:
* Macro represents the group name that is bound to the client process's GID it
* is running with. Only relevant for clients connected locally, i.e. via a
* UNIX socket, as VIR_TYPED_PARAM_STRING.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_CLIENT_INFO_UNIX_GROUP_NAME "unix_group_name"
/**
* VIR_CLIENT_INFO_UNIX_PROCESS_ID:
* Macro represents the client process's pid it is running with. Only relevant
* for clients connected locally, i.e. via a UNIX socket,
* as VIR_TYPED_PARAM_INT.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_CLIENT_INFO_UNIX_PROCESS_ID "unix_process_id"
/**
* VIR_CLIENT_INFO_SELINUX_CONTEXT:
* Macro represents the client's (peer's) SELinux context and this can either
* be at socket layer or at transport layer, depending on the connection type,
* as VIR_TYPED_PARAM_STRING.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_CLIENT_INFO_SELINUX_CONTEXT "selinux_context"
int virAdmClientGetInfo(virAdmClientPtr client,
virTypedParameterPtr *params,
int *nparams,
unsigned int flags);
int virAdmClientClose(virAdmClientPtr client, unsigned int flags);
/* Manage per-server client limits */
/**
* VIR_SERVER_CLIENTS_MAX:
* Macro for per-server nclients_max limit: represents the upper limit to
* number of clients connected to the server, as uint.
*/
# define VIR_SERVER_CLIENTS_MAX "nclients_max"
/**
* VIR_SERVER_CLIENTS_CURRENT:
* Macro for per-server nclients attribute: represents the current number of
* clients connected to the server, as VIR_TYPED_PARAM_UINT.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_SERVER_CLIENTS_CURRENT "nclients"
/**
* VIR_SERVER_CLIENTS_UNAUTH_MAX:
* Macro for per-server nclients_unauth_max limit: represents the upper limit
* to number of clients connected to the server, but not authenticated yet,
* as VIR_TYPED_PARAM_UINT.
*/
# define VIR_SERVER_CLIENTS_UNAUTH_MAX "nclients_unauth_max"
/**
* VIR_SERVER_CLIENTS_UNAUTH_CURRENT:
* Macro for per-server nclients_unauth attribute: represents the current
* number of clients connected to the server, but not authenticated yet,
* as VIR_TYPED_PARAM_UINT.
*
* NOTE: This attribute is read-only and any attempt to set it will be denied
* by daemon
*/
# define VIR_SERVER_CLIENTS_UNAUTH_CURRENT "nclients_unauth"
int virAdmServerGetClientLimits(virAdmServerPtr srv,
virTypedParameterPtr *params,
int *nparams,
unsigned int flags);
int virAdmServerSetClientLimits(virAdmServerPtr srv,
virTypedParameterPtr params,
int nparams,
unsigned int flags);
# ifdef __cplusplus
}
# endif

View File

@@ -1,9 +1,8 @@
/*
/* -*- c -*-
* libvirt-common.h
* Summary: common macros and enums for the libvirt and libvirt-admin library
* Description: Provides common macros and enums needed by both libvirt and
* libvirt-admin libraries
* Author: Erik Skultety <eskultet@redhat.com>
*
* Copyright (C) 2015 Red Hat, Inc.
*
@@ -20,6 +19,8 @@
* 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: Erik Skultety <eskultet@redhat.com>
*/
#if !defined __VIR_LIBVIRT_H_INCLUDES__ && !defined __VIR_ADMIN_H_INCLUDES__
@@ -49,7 +50,7 @@ extern "C" {
# define VIR_EXPORT_VAR extern
# else
# ifdef IN_LIBVIRT
# define VIR_EXPORT_VAR __declspec(dllexport) extern
# define VIR_EXPORT_VAR __declspec(dllexport)
# else
# define VIR_EXPORT_VAR __declspec(dllimport) extern
# endif
@@ -119,173 +120,6 @@ typedef enum {
# endif
} virConnectCloseReason;
/**
* virTypedParameterType:
*
* Express the type of a virTypedParameter
*/
typedef enum {
VIR_TYPED_PARAM_INT = 1, /* integer case */
VIR_TYPED_PARAM_UINT = 2, /* unsigned integer case */
VIR_TYPED_PARAM_LLONG = 3, /* long long case */
VIR_TYPED_PARAM_ULLONG = 4, /* unsigned long long case */
VIR_TYPED_PARAM_DOUBLE = 5, /* double case */
VIR_TYPED_PARAM_BOOLEAN = 6, /* boolean(character) case */
VIR_TYPED_PARAM_STRING = 7, /* string case */
# ifdef VIR_ENUM_SENTINELS
VIR_TYPED_PARAM_LAST
# endif
} virTypedParameterType;
/**
* virTypedParameterFlags:
*
* Flags related to libvirt APIs that use virTypedParameter.
*
* These enums should not conflict with those of virDomainModificationImpact.
*/
typedef enum {
/* 1 << 0 is reserved for virDomainModificationImpact */
/* 1 << 1 is reserved for virDomainModificationImpact */
/* Older servers lacked the ability to handle string typed
* parameters. Attempts to set a string parameter with an older
* server will fail at the client, but attempts to retrieve
* parameters must not return strings from a new server to an
* older client, so this flag exists to identify newer clients to
* newer servers. This flag is automatically set when needed, so
* the user does not have to worry about it; however, manually
* setting the flag can be used to reject servers that cannot
* return typed strings, even if no strings would be returned.
*/
VIR_TYPED_PARAM_STRING_OKAY = 1 << 2,
} virTypedParameterFlags;
/**
* VIR_TYPED_PARAM_FIELD_LENGTH:
*
* Macro providing the field length of virTypedParameter name
*/
# define VIR_TYPED_PARAM_FIELD_LENGTH 80
/**
* virTypedParameter:
*
* A named parameter, including a type and value.
*
* The types virSchedParameter, virBlkioParameter, and
* virMemoryParameter are aliases of this type, for use when
* targeting libvirt earlier than 0.9.2.
*/
typedef struct _virTypedParameter virTypedParameter;
struct _virTypedParameter {
char field[VIR_TYPED_PARAM_FIELD_LENGTH]; /* parameter name */
int type; /* parameter type, virTypedParameterType */
union {
int i; /* type is INT */
unsigned int ui; /* type is UINT */
long long int l; /* type is LLONG */
unsigned long long int ul; /* type is ULLONG */
double d; /* type is DOUBLE */
char b; /* type is BOOLEAN */
char *s; /* type is STRING, may not be NULL */
} value; /* parameter value */
};
/**
* virTypedParameterPtr:
*
* a pointer to a virTypedParameter structure.
*/
typedef virTypedParameter *virTypedParameterPtr;
virTypedParameterPtr virTypedParamsGet(virTypedParameterPtr params,
int nparams,
const char *name);
int virTypedParamsGetInt(virTypedParameterPtr params,
int nparams,
const char *name,
int *value);
int virTypedParamsGetUInt(virTypedParameterPtr params,
int nparams,
const char *name,
unsigned int *value);
int virTypedParamsGetLLong(virTypedParameterPtr params,
int nparams,
const char *name,
long long *value);
int virTypedParamsGetULLong(virTypedParameterPtr params,
int nparams,
const char *name,
unsigned long long *value);
int virTypedParamsGetDouble(virTypedParameterPtr params,
int nparams,
const char *name,
double *value);
int virTypedParamsGetBoolean(virTypedParameterPtr params,
int nparams,
const char *name,
int *value);
int virTypedParamsGetString(virTypedParameterPtr params,
int nparams,
const char *name,
const char **value);
int virTypedParamsAddInt(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
int value);
int virTypedParamsAddUInt(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
unsigned int value);
int virTypedParamsAddLLong(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
long long value);
int virTypedParamsAddULLong(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
unsigned long long value);
int virTypedParamsAddDouble(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
double value);
int virTypedParamsAddBoolean(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
int value);
int virTypedParamsAddString(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
const char *value);
int virTypedParamsAddStringList(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
const char **values);
int virTypedParamsAddFromString(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
int type,
const char *value);
void virTypedParamsClear(virTypedParameterPtr params,
int nparams);
void virTypedParamsFree(virTypedParameterPtr params,
int nparams);
# ifdef __cplusplus
}
# endif

View File

@@ -90,7 +90,6 @@ typedef enum {
VIR_DOMAIN_RUNNING_WAKEUP = 8, /* returned from pmsuspended due to
wakeup event */
VIR_DOMAIN_RUNNING_CRASHED = 9, /* resumed from crashed */
VIR_DOMAIN_RUNNING_POSTCOPY = 10, /* running in post-copy migration mode */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_RUNNING_LAST
@@ -118,8 +117,6 @@ typedef enum {
VIR_DOMAIN_PAUSED_SNAPSHOT = 9, /* paused while creating a snapshot */
VIR_DOMAIN_PAUSED_CRASHED = 10, /* paused due to a guest crash */
VIR_DOMAIN_PAUSED_STARTING_UP = 11, /* the domain is being started */
VIR_DOMAIN_PAUSED_POSTCOPY = 12, /* paused for post-copy migration */
VIR_DOMAIN_PAUSED_POSTCOPY_FAILED = 13, /* paused after failed post-copy */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_PAUSED_LAST
@@ -314,22 +311,6 @@ typedef enum {
*/
# define VIR_DOMAIN_SCHEDULER_CPU_SHARES "cpu_shares"
/**
* VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD:
*
* Macro represents the enforcement period for a quota, in microseconds,
* for whole domain, when using the posix scheduler, as a ullong.
*/
# define VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD "global_period"
/**
* VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA:
*
* Macro represents the maximum bandwidth to be used within a period for
* whole domain, when using the posix scheduler, as an llong.
*/
# define VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA "global_quota"
/**
* VIR_DOMAIN_SCHEDULER_VCPU_PERIOD:
*
@@ -364,22 +345,6 @@ typedef enum {
*/
# define VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA "emulator_quota"
/**
* VIR_DOMAIN_SCHEDULER_IOTHREAD_PERIOD:
*
* Macro represents the enforcement period for a quota, in microseconds,
* for IOThreads only, when using the posix scheduler, as a ullong.
*/
# define VIR_DOMAIN_SCHEDULER_IOTHREAD_PERIOD "iothread_period"
/**
* VIR_DOMAIN_SCHEDULER_IOTHREAD_QUOTA:
*
* Macro represents the maximum bandwidth to be used within a period for
* IOThreads only, when using the posix scheduler, as an llong.
*/
# define VIR_DOMAIN_SCHEDULER_IOTHREAD_QUOTA "iothread_quota"
/**
* VIR_DOMAIN_SCHEDULER_WEIGHT:
*
@@ -619,20 +584,11 @@ typedef enum {
* is in kB */
VIR_DOMAIN_MEMORY_STAT_RSS = 7,
/*
* How much the balloon can be inflated without pushing the guest system
* to swap, corresponds to 'Available' in /proc/meminfo
*/
VIR_DOMAIN_MEMORY_STAT_USABLE = 8,
/* Timestamp of the last update of statistics, in seconds. */
VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE = 9,
/*
* The number of statistics supported by this version of the interface.
* To add new statistics, add them to the enum and increase this value.
*/
VIR_DOMAIN_MEMORY_STAT_NR = 10,
VIR_DOMAIN_MEMORY_STAT_NR = 8,
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_MEMORY_STAT_LAST = VIR_DOMAIN_MEMORY_STAT_NR
@@ -703,7 +659,6 @@ typedef enum {
VIR_MIGRATE_ABORT_ON_ERROR = (1 << 12), /* abort migration on I/O errors happened during migration */
VIR_MIGRATE_AUTO_CONVERGE = (1 << 13), /* force convergence */
VIR_MIGRATE_RDMA_PIN_ALL = (1 << 14), /* RDMA memory pinning */
VIR_MIGRATE_POSTCOPY = (1 << 15), /* enable (but do not start) post-copy migration */
} virDomainMigrateFlags;
@@ -751,21 +706,6 @@ typedef enum {
*/
# define VIR_MIGRATE_PARAM_DEST_XML "destination_xml"
/**
* VIR_MIGRATE_PARAM_PERSIST_XML:
*
* virDomainMigrate* params field: the new persistent configuration to be used
* for the domain on the destination host as VIR_TYPED_PARAM_STRING.
* This field cannot be used to rename the domain during migration (use
* VIR_MIGRATE_PARAM_DEST_NAME field for that purpose). Domain name in the
* destination XML must match the original domain name.
*
* Omitting this parameter keeps the original domain persistent configuration.
* Using this field with hypervisors that do not support changing domain
* configuration during migration will result in a failure.
*/
# define VIR_MIGRATE_PARAM_PERSIST_XML "persistent_xml"
/**
* VIR_MIGRATE_PARAM_BANDWIDTH:
*
@@ -817,78 +757,6 @@ typedef enum {
*/
# define VIR_MIGRATE_PARAM_MIGRATE_DISKS "migrate_disks"
/**
* VIR_MIGRATE_PARAM_DISKS_PORT:
*
* virDomainMigrate* params field: port that destination server should use
* for incoming disks migration. Type is VIR_TYPED_PARAM_INT. If set to 0 or
* omitted, libvirt will choose a suitable default. At the moment this is only
* supported by the QEMU driver.
*/
# define VIR_MIGRATE_PARAM_DISKS_PORT "disks_port"
/**
* VIR_MIGRATE_PARAM_COMPRESSION:
*
* virDomainMigrate* params multiple field: name of the method used to
* compress migration traffic. Supported compression methods: xbzrle, mt.
* The parameter may be specified multiple times if more than one method
* should be used.
*/
# define VIR_MIGRATE_PARAM_COMPRESSION "compression"
/**
* VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL:
*
* virDomainMigrate* params field: the level of compression for multithread
* compression as VIR_TYPED_PARAM_INT. Accepted values are in range 0-9.
* 0 is no compression, 1 is maximum speed and 9 is maximum compression.
*/
# define VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL "compression.mt.level"
/**
* VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS:
*
* virDomainMigrate* params field: the number of compression threads for
* multithread compression as VIR_TYPED_PARAM_INT.
*/
# define VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS "compression.mt.threads"
/**
* VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS:
*
* virDomainMigrate* params field: the number of decompression threads for
* multithread compression as VIR_TYPED_PARAM_INT.
*/
# define VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS "compression.mt.dthreads"
/**
* VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE:
*
* virDomainMigrate* params field: the size of page cache for xbzrle
* compression as VIR_TYPED_PARAM_ULLONG.
*/
# define VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE "compression.xbzrle.cache"
/**
* VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL:
*
* virDomainMigrate* params field: the initial percentage guest CPUs are
* throttled to when auto-convergence decides migration is not converging.
* As VIR_TYPED_PARAM_INT.
*/
# define VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL "auto_converge.initial"
/**
* VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT:
*
* virDomainMigrate* params field: the increment added to
* VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL whenever the hypervisor decides
* the current rate is not enough to ensure convergence of the migration.
* As VIR_TYPED_PARAM_INT.
*/
# define VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT "auto_converge.increment"
/* Domain migration. */
virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn,
unsigned long flags, const char *dname,
@@ -939,9 +807,6 @@ int virDomainMigrateGetMaxSpeed(virDomainPtr domain,
unsigned long *bandwidth,
unsigned int flags);
int virDomainMigrateStartPostCopy(virDomainPtr domain,
unsigned int flags);
char * virConnectGetDomainCapabilities(virConnectPtr conn,
const char *emulatorbin,
const char *arch,
@@ -1616,7 +1481,6 @@ typedef enum {
snapshot metadata */
VIR_DOMAIN_UNDEFINE_NVRAM = (1 << 2), /* Also remove any
nvram file */
VIR_DOMAIN_UNDEFINE_KEEP_NVRAM = (1 << 3), /* Keep nvram file */
/* Future undefine control flags should come here. */
} virDomainUndefineFlagsValues;
@@ -1907,7 +1771,6 @@ typedef enum {
VIR_DOMAIN_STATS_VCPU = (1 << 3), /* return domain virtual CPU info */
VIR_DOMAIN_STATS_INTERFACE = (1 << 4), /* return domain interfaces info */
VIR_DOMAIN_STATS_BLOCK = (1 << 5), /* return domain block info */
VIR_DOMAIN_STATS_PERF = (1 << 6), /* return domain perf event info */
} virDomainStatsTypes;
typedef enum {
@@ -1923,7 +1786,7 @@ typedef enum {
VIR_CONNECT_GET_ALL_DOMAINS_STATS_OTHER = VIR_CONNECT_LIST_DOMAINS_OTHER,
VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING = 1 << 30, /* include backing chain for block stats */
VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS = 1U << 31, /* enforce requested stats */
VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS = 1 << 31, /* enforce requested stats */
} virConnectGetAllDomainStatsFlags;
int virConnectGetAllDomainStats(virConnectPtr conn,
@@ -1938,89 +1801,6 @@ int virDomainListGetStats(virDomainPtr *doms,
void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats);
/*
* Perf Event API
*/
/**
* VIR_PERF_PARAM_CMT:
*
* Macro for typed parameter name that represents CMT perf event
* which can be used to measure the usage of cache (bytes) by
* applications running on the platform. It corresponds to the
* "perf.cmt" field in the *Stats APIs.
*/
# define VIR_PERF_PARAM_CMT "cmt"
/**
* VIR_PERF_PARAM_MBMT:
*
* Macro for typed parameter name that represents MBMT perf event
* which can be used to monitor total system bandwidth (bytes/s)
* from one level of cache to another. It corresponds to the
* "perf.mbmt" field in the *Stats APIs.
*/
# define VIR_PERF_PARAM_MBMT "mbmt"
/**
* VIR_PERF_PARAM_MBML:
*
* Macro for typed parameter name that represents MBML perf event
* which can be used to monitor the amount of data (bytes/s) sent
* through the memory controller on the socket. It corresponds to
* the "perf.mbml" field in the *Stats APIs.
*/
# define VIR_PERF_PARAM_MBML "mbml"
/**
* VIR_PERF_PARAM_CACHE_MISSES:
*
* Macro for typed parameter name that represents cache_misses perf
* event which can be used to measure the count of cache misses by
* applications running on the platform. It corresponds to the
* "perf.cache_misses" field in the *Stats APIs.
*/
# define VIR_PERF_PARAM_CACHE_MISSES "cache_misses"
/**
* VIR_PERF_PARAM_CACHE_REFERENCES:
*
* Macro for typed parameter name that represents cache_references
* perf event which can be used to measure the count of cache hits
* by applications running on the platform. It corresponds to the
* "perf.cache_references" field in the *Stats APIs.
*/
# define VIR_PERF_PARAM_CACHE_REFERENCES "cache_references"
/**
* VIR_PERF_PARAM_INSTRUCTIONS:
*
* Macro for typed parameter name that represents instructions perf
* event which can be used to measure the count of instructions
* by applications running on the platform. It corresponds to the
* "perf.instructions" field in the *Stats APIs.
*/
# define VIR_PERF_PARAM_INSTRUCTIONS "instructions"
/**
* VIR_PERF_PARAM_CPU_CYCLES:
*
* Macro for typed parameter name that represents cpu_cycles perf event
* which can be used to measure how many cpu cycles one instruction needs.
* It corresponds to the "perf.cpu_cycles" field in the *Stats APIs.
*/
# define VIR_PERF_PARAM_CPU_CYCLES "cpu_cycles"
int virDomainGetPerfEvents(virDomainPtr dom,
virTypedParameterPtr *params,
int *nparams,
unsigned int flags);
int virDomainSetPerfEvents(virDomainPtr dom,
virTypedParameterPtr params,
int nparams,
unsigned int flags);
/*
* BlockJob API
*/
@@ -2550,7 +2330,6 @@ typedef enum {
VIR_DOMAIN_EVENT_DEFINED_ADDED = 0, /* Newly created config file */
VIR_DOMAIN_EVENT_DEFINED_UPDATED = 1, /* Changed config file */
VIR_DOMAIN_EVENT_DEFINED_RENAMED = 2, /* Domain was renamed */
VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT = 3, /* Config was restored from a snapshot */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_EVENT_DEFINED_LAST
@@ -2601,8 +2380,6 @@ typedef enum {
VIR_DOMAIN_EVENT_SUSPENDED_RESTORED = 4, /* Restored from paused state file */
VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT = 5, /* Restored from paused snapshot */
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR = 6, /* suspended after failure during libvirt API call */
VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY = 7, /* suspended for post-copy migration */
VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED = 8, /* suspended after failed post-copy */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_EVENT_SUSPENDED_LAST
@@ -2618,8 +2395,6 @@ typedef enum {
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED = 0, /* Normal resume due to admin unpause */
VIR_DOMAIN_EVENT_RESUMED_MIGRATED = 1, /* Resumed for completion of migration */
VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT = 2, /* Resumed from snapshot */
VIR_DOMAIN_EVENT_RESUMED_POSTCOPY = 3, /* Resumed, but migration is still
running in post-copy mode */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_EVENT_RESUMED_LAST
@@ -3050,14 +2825,6 @@ int virDomainAbortJob(virDomainPtr dom);
*/
# define VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW "compression_overflow"
/**
* VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE:
*
* virDomainGetJobStats field: current percentage guest CPUs are throttled
* to when auto-convergence decided migration was not converging, as
* VIR_TYPED_PARAM_INT.
*/
# define VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE "auto_converge_throttle"
/**
@@ -3344,12 +3111,8 @@ typedef void (*virConnectDomainEventBlockJobCallback)(virConnectPtr conn,
* The reason describing why this callback is called
*/
typedef enum {
VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START = 0,
/* removable media changed to empty according to startup policy as source
* was missing. oldSrcPath is set, newSrcPath is NULL */
VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START = 0, /* oldSrcPath is set */
VIR_DOMAIN_EVENT_DISK_DROP_MISSING_ON_START = 1,
/* disk was dropped from domain as source file was missing.
* oldSrcPath is set, newSrcPath is NULL */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_EVENT_DISK_CHANGE_LAST
@@ -3520,26 +3283,6 @@ typedef void (*virConnectDomainEventDeviceAddedCallback)(virConnectPtr conn,
const char *devAlias,
void *opaque);
/**
* virConnectDomainEventDeviceRemovalFailedCallback:
* @conn: connection object
* @dom: domain on which the event occurred
* @devAlias: device alias
* @opaque: application specified data
*
* This callback occurs when it's certain that removal of a device failed.
*
* The callback signature to use when registering for an event of type
* VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED with
* virConnectDomainEventRegisterAny().
*/
typedef void (*virConnectDomainEventDeviceRemovalFailedCallback)(virConnectPtr conn,
virDomainPtr dom,
const char *devAlias,
void *opaque);
/**
* virConnectDomainEventMigrationIterationCallback:
* @conn: connection object
@@ -3561,29 +3304,6 @@ typedef void (*virConnectDomainEventMigrationIterationCallback)(virConnectPtr co
int iteration,
void *opaque);
/**
* virConnectDomainEventJobCompletedCallback:
* @conn: connection object
* @dom: domain on which the event occurred
* @params: job statistics stored as an array of virTypedParameter
* @nparams: size of the params array
* @opaque: application specific data
*
* This callback occurs when a job (such as migration) running on the domain
* is completed. The params array will contain statistics of the just completed
* job as virDomainGetJobStats would return. The callback must not free @params
* (the array will be freed once the callback finishes).
*
* The callback signature to use when registering for an event of type
* VIR_DOMAIN_EVENT_ID_JOB_COMPLETED with
* virConnectDomainEventRegisterAny().
*/
typedef void (*virConnectDomainEventJobCompletedCallback)(virConnectPtr conn,
virDomainPtr dom,
virTypedParameterPtr params,
int nparams,
void *opaque);
/**
* VIR_DOMAIN_TUNABLE_CPU_VCPUPIN:
*
@@ -3618,22 +3338,6 @@ typedef void (*virConnectDomainEventJobCompletedCallback)(virConnectPtr conn,
*/
# define VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES "cputune.cpu_shares"
/**
* VIR_DOMAIN_TUNABLE_CPU_GLOBAL_PERIOD:
*
* Macro represents the enforcement period for a quota, in microseconds,
* for whole domain, when using the posix scheduler, as VIR_TYPED_PARAM_ULLONG.
*/
# define VIR_DOMAIN_TUNABLE_CPU_GLOBAL_PERIOD "cputune.global_period"
/**
* VIR_DOMAIN_TUNABLE_CPU_GLOBAL_QUOTA:
*
* Macro represents the maximum bandwidth to be used within a period for
* whole domain, when using the posix scheduler, as VIR_TYPED_PARAM_LLONG.
*/
# define VIR_DOMAIN_TUNABLE_CPU_GLOBAL_QUOTA "cputune.global_quota"
/**
* VIR_DOMAIN_TUNABLE_CPU_VCPU_PERIOD:
*
@@ -3668,22 +3372,6 @@ typedef void (*virConnectDomainEventJobCompletedCallback)(virConnectPtr conn,
*/
# define VIR_DOMAIN_TUNABLE_CPU_EMULATOR_QUOTA "cputune.emulator_quota"
/**
* VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_PERIOD:
*
* Macro represents the enforcement period for a quota, in microseconds, for
* iothreads only, when using the posix scheduler, as VIR_TYPED_PARAM_ULLONG.
*/
# define VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_PERIOD "cputune.iothread_period"
/**
* VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_QUOTA:
*
* Macro represents the maximum bandwidth to be used within a period for
* iothreads only, when using the posix scheduler, as VIR_TYPED_PARAM_LLONG.
*/
# define VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_QUOTA "cputune.iothread_quota"
/**
* VIR_DOMAIN_TUNABLE_BLKDEV_DISK:
*
@@ -3900,8 +3588,6 @@ typedef enum {
VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE = 18,/* virConnectDomainEventAgentLifecycleCallback */
VIR_DOMAIN_EVENT_ID_DEVICE_ADDED = 19, /* virConnectDomainEventDeviceAddedCallback */
VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION = 20, /* virConnectDomainEventMigrationIterationCallback */
VIR_DOMAIN_EVENT_ID_JOB_COMPLETED = 21, /* virConnectDomainEventJobCompletedCallback */
VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED = 22, /* virConnectDomainEventDeviceRemovalFailedCallback */
# ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_EVENT_ID_LAST
@@ -4205,14 +3891,4 @@ int virDomainRename(virDomainPtr dom,
const char *new_name,
unsigned int flags);
int virDomainGetGuestVcpus(virDomainPtr domain,
virTypedParameterPtr *params,
unsigned int *nparams,
unsigned int flags);
int virDomainSetGuestVcpus(virDomainPtr domain,
const char *cpumap,
int state,
unsigned int flags);
#endif /* __VIR_LIBVIRT_DOMAIN_H__ */

View File

@@ -140,6 +140,192 @@ struct _virSecurityModel {
*/
typedef virSecurityModel *virSecurityModelPtr;
/* Common data types shared among interfaces with name/type/value lists. */
/**
* virTypedParameterType:
*
* Express the type of a virTypedParameter
*/
typedef enum {
VIR_TYPED_PARAM_INT = 1, /* integer case */
VIR_TYPED_PARAM_UINT = 2, /* unsigned integer case */
VIR_TYPED_PARAM_LLONG = 3, /* long long case */
VIR_TYPED_PARAM_ULLONG = 4, /* unsigned long long case */
VIR_TYPED_PARAM_DOUBLE = 5, /* double case */
VIR_TYPED_PARAM_BOOLEAN = 6, /* boolean(character) case */
VIR_TYPED_PARAM_STRING = 7, /* string case */
# ifdef VIR_ENUM_SENTINELS
VIR_TYPED_PARAM_LAST
# endif
} virTypedParameterType;
/**
* virTypedParameterFlags:
*
* Flags related to libvirt APIs that use virTypedParameter.
*
* These enums should not conflict with those of virDomainModificationImpact.
*/
typedef enum {
/* 1 << 0 is reserved for virDomainModificationImpact */
/* 1 << 1 is reserved for virDomainModificationImpact */
/* Older servers lacked the ability to handle string typed
* parameters. Attempts to set a string parameter with an older
* server will fail at the client, but attempts to retrieve
* parameters must not return strings from a new server to an
* older client, so this flag exists to identify newer clients to
* newer servers. This flag is automatically set when needed, so
* the user does not have to worry about it; however, manually
* setting the flag can be used to reject servers that cannot
* return typed strings, even if no strings would be returned.
*/
VIR_TYPED_PARAM_STRING_OKAY = 1 << 2,
} virTypedParameterFlags;
/**
* VIR_TYPED_PARAM_FIELD_LENGTH:
*
* Macro providing the field length of virTypedParameter name
*/
# define VIR_TYPED_PARAM_FIELD_LENGTH 80
/**
* virTypedParameter:
*
* A named parameter, including a type and value.
*
* The types virSchedParameter, virBlkioParameter, and
* virMemoryParameter are aliases of this type, for use when
* targeting libvirt earlier than 0.9.2.
*/
typedef struct _virTypedParameter virTypedParameter;
struct _virTypedParameter {
char field[VIR_TYPED_PARAM_FIELD_LENGTH]; /* parameter name */
int type; /* parameter type, virTypedParameterType */
union {
int i; /* type is INT */
unsigned int ui; /* type is UINT */
long long int l; /* type is LLONG */
unsigned long long int ul; /* type is ULLONG */
double d; /* type is DOUBLE */
char b; /* type is BOOLEAN */
char *s; /* type is STRING, may not be NULL */
} value; /* parameter value */
};
/**
* virTypedParameterPtr:
*
* a pointer to a virTypedParameter structure.
*/
typedef virTypedParameter *virTypedParameterPtr;
virTypedParameterPtr
virTypedParamsGet (virTypedParameterPtr params,
int nparams,
const char *name);
int
virTypedParamsGetInt (virTypedParameterPtr params,
int nparams,
const char *name,
int *value);
int
virTypedParamsGetUInt (virTypedParameterPtr params,
int nparams,
const char *name,
unsigned int *value);
int
virTypedParamsGetLLong (virTypedParameterPtr params,
int nparams,
const char *name,
long long *value);
int
virTypedParamsGetULLong (virTypedParameterPtr params,
int nparams,
const char *name,
unsigned long long *value);
int
virTypedParamsGetDouble (virTypedParameterPtr params,
int nparams,
const char *name,
double *value);
int
virTypedParamsGetBoolean(virTypedParameterPtr params,
int nparams,
const char *name,
int *value);
int
virTypedParamsGetString (virTypedParameterPtr params,
int nparams,
const char *name,
const char **value);
int
virTypedParamsAddInt (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
int value);
int
virTypedParamsAddUInt (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
unsigned int value);
int
virTypedParamsAddLLong (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
long long value);
int
virTypedParamsAddULLong (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
unsigned long long value);
int
virTypedParamsAddDouble (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
double value);
int
virTypedParamsAddBoolean(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
int value);
int
virTypedParamsAddString (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
const char *value);
int
virTypedParamsAddStringList(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
const char **values);
int
virTypedParamsAddFromString(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
int type,
const char *value);
void
virTypedParamsClear (virTypedParameterPtr params,
int nparams);
void
virTypedParamsFree (virTypedParameterPtr params,
int nparams);
/* data types related to virNodePtr */

View File

@@ -46,8 +46,6 @@ int virDomainLxcEnterSecurityLabel(virSecurityModelPtr model,
virSecurityLabelPtr label,
virSecurityLabelPtr oldlabel,
unsigned int flags);
int virDomainLxcEnterCGroup(virDomainPtr domain,
unsigned int flags);
# ifdef __cplusplus
}

View File

@@ -121,96 +121,5 @@ virNodeDevicePtr virNodeDeviceCreateXML (virConnectPtr conn,
int virNodeDeviceDestroy (virNodeDevicePtr dev);
/**
* VIR_NODE_DEVICE_EVENT_CALLBACK:
*
* Used to cast the event specific callback into the generic one
* for use for virConnectNodeDeviceEventRegisterAny()
*/
# define VIR_NODE_DEVICE_EVENT_CALLBACK(cb)((virConnectNodeDeviceEventGenericCallback)(cb))
/**
* virNodeDeviceEventID:
*
* An enumeration of supported eventId parameters for
* virConnectNodeDeviceEventRegisterAny(). Each event id determines which
* signature of callback function will be used.
*/
typedef enum {
VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE = 0, /* virConnectNodeDeviceEventLifecycleCallback */
VIR_NODE_DEVICE_EVENT_ID_UPDATE = 1, /* virConnectNodeDeviceEventUpdateCallback */
# ifdef VIR_ENUM_SENTINELS
VIR_NODE_DEVICE_EVENT_ID_LAST
/*
* NB: this enum value will increase over time as new events are
* added to the libvirt API. It reflects the last event ID supported
* by this version of the libvirt API.
*/
# endif
} virNodeDeviceEventID;
/**
* virConnectNodeDeviceEventGenericCallback:
* @conn: the connection pointer
* @dev: the node device pointer
* @opaque: application specified data
*
* A generic node device event callback handler, for use with
* virConnectNodeDeviceEventRegisterAny(). Specific events usually
* have a customization with extra parameters, often with @opaque being
* passed in a different parameter position; use
* VIR_NODE_DEVICE_EVENT_CALLBACK() when registering an appropriate handler.
*/
typedef void (*virConnectNodeDeviceEventGenericCallback)(virConnectPtr conn,
virNodeDevicePtr dev,
void *opaque);
/* Use VIR_NODE_DEVICE_EVENT_CALLBACK() to cast the 'cb' parameter */
int virConnectNodeDeviceEventRegisterAny(virConnectPtr conn,
virNodeDevicePtr dev, /* optional, to filter */
int eventID,
virConnectNodeDeviceEventGenericCallback cb,
void *opaque,
virFreeCallback freecb);
int virConnectNodeDeviceEventDeregisterAny(virConnectPtr conn,
int callbackID);
/**
* virNodeDeviceEventLifecycleType:
*
* a virNodeDeviceEventLifecycleType is emitted during node device
* lifecycle events
*/
typedef enum {
VIR_NODE_DEVICE_EVENT_CREATED = 0,
VIR_NODE_DEVICE_EVENT_DELETED = 1,
# ifdef VIR_ENUM_SENTINELS
VIR_NODE_DEVICE_EVENT_LAST
# endif
} virNodeDeviceEventLifecycleType;
/**
* virConnectNodeDeviceEventLifecycleCallback:
* @conn: connection object
* @dev: node device on which the event occurred
* @event: The specific virNodeDeviceEventLifeCycleType which occurred
* @detail: contains some details on the reason of the event.
* @opaque: application specified data
*
* This callback is called when a node device lifecycle action is performed,
* like added or removed.
*
* The callback signature to use when registering for an event of type
* VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE with
* virConnectNodeDeviceEventRegisterAny()
*/
typedef void (*virConnectNodeDeviceEventLifecycleCallback)(virConnectPtr conn,
virNodeDevicePtr dev,
int event,
int detail,
void *opaque);
#endif /* __VIR_LIBVIRT_NODEDEV_H__ */

View File

@@ -4,7 +4,7 @@
* Description: Provides APIs for the management of secrets
* Author: Daniel Veillard <veillard@redhat.com>
*
* Copyright (C) 2006-2014, 2016 Red Hat, Inc.
* 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
@@ -43,7 +43,6 @@ typedef enum {
VIR_SECRET_USAGE_TYPE_VOLUME = 1,
VIR_SECRET_USAGE_TYPE_CEPH = 2,
VIR_SECRET_USAGE_TYPE_ISCSI = 3,
VIR_SECRET_USAGE_TYPE_TLS = 4,
# ifdef VIR_ENUM_SENTINELS
VIR_SECRET_USAGE_TYPE_LAST

View File

@@ -122,7 +122,6 @@ typedef enum {
VIR_STORAGE_VOL_NETWORK = 3, /* Network volumes like RBD (RADOS Block Device) */
VIR_STORAGE_VOL_NETDIR = 4, /* Network accessible directory that can
* contain other network volumes */
VIR_STORAGE_VOL_PLOOP = 5, /* Ploop based volumes */
# ifdef VIR_ENUM_SENTINELS
VIR_STORAGE_VOL_LAST
@@ -377,98 +376,5 @@ int virStorageVolResize (virStorageVolPtr vol,
int virStoragePoolIsActive(virStoragePoolPtr pool);
int virStoragePoolIsPersistent(virStoragePoolPtr pool);
/**
* VIR_STORAGE_POOL_EVENT_CALLBACK:
*
* Used to cast the event specific callback into the generic one
* for use for virConnectStoragePoolEventRegisterAny()
*/
# define VIR_STORAGE_POOL_EVENT_CALLBACK(cb)((virConnectStoragePoolEventGenericCallback)(cb))
/**
* virStoragePoolEventID:
*
* An enumeration of supported eventId parameters for
* virConnectStoragePoolEventRegisterAny(). Each event id determines which
* signature of callback function will be used.
*/
typedef enum {
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE = 0, /* virConnectStoragePoolEventLifecycleCallback */
VIR_STORAGE_POOL_EVENT_ID_REFRESH = 1, /* virConnectStoragePoolEventGenericCallback */
# ifdef VIR_ENUM_SENTINELS
VIR_STORAGE_POOL_EVENT_ID_LAST
/*
* NB: this enum value will increase over time as new events are
* added to the libvirt API. It reflects the last event ID supported
* by this version of the libvirt API.
*/
# endif
} virStoragePoolEventID;
/**
* virConnectStoragePoolEventGenericCallback:
* @conn: the connection pointer
* @pool: the pool pointer
* @opaque: application specified data
*
* A generic storage pool event callback handler, for use with
* virConnectStoragePoolEventRegisterAny(). Specific events usually
* have a customization with extra parameters, often with @opaque being
* passed in a different parameter position; use
* VIR_STORAGE_POOL_EVENT_CALLBACK() when registering an appropriate handler.
*/
typedef void (*virConnectStoragePoolEventGenericCallback)(virConnectPtr conn,
virStoragePoolPtr pool,
void *opaque);
/* Use VIR_STORAGE_POOL_EVENT_CALLBACK() to cast the 'cb' parameter */
int virConnectStoragePoolEventRegisterAny(virConnectPtr conn,
virStoragePoolPtr pool, /* optional, to filter */
int eventID,
virConnectStoragePoolEventGenericCallback cb,
void *opaque,
virFreeCallback freecb);
int virConnectStoragePoolEventDeregisterAny(virConnectPtr conn,
int callbackID);
/**
* virStoragePoolEventLifecycleType:
*
* a virStoragePoolEventLifecycleType is emitted during storage pool
* lifecycle events
*/
typedef enum {
VIR_STORAGE_POOL_EVENT_DEFINED = 0,
VIR_STORAGE_POOL_EVENT_UNDEFINED = 1,
VIR_STORAGE_POOL_EVENT_STARTED = 2,
VIR_STORAGE_POOL_EVENT_STOPPED = 3,
# ifdef VIR_ENUM_SENTINELS
VIR_STORAGE_POOL_EVENT_LAST
# endif
} virStoragePoolEventLifecycleType;
/**
* virConnectStoragePoolEventLifecycleCallback:
* @conn: connection object
* @pool: pool on which the event occurred
* @event: The specific virStoragePoolEventLifeCycleType which occurred
* @detail: contains some details on the reason of the event.
* @opaque: application specified data
*
* This callback is called when a pool lifecycle action is performed, like start
* or stop.
*
* The callback signature to use when registering for an event of type
* VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE with
* virConnectStoragePoolEventRegisterAny()
*/
typedef void (*virConnectStoragePoolEventLifecycleCallback)(virConnectPtr conn,
virStoragePoolPtr pool,
int event,
int detail,
void *opaque);
#endif /* __VIR_LIBVIRT_STORAGE_H__ */

View File

@@ -4,7 +4,7 @@
* Description: Provides the interfaces of the libvirt library to handle
* errors raised while using the library.
*
* Copyright (C) 2006-2016 Red Hat, Inc.
* Copyright (C) 2006-2015 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
@@ -130,8 +130,6 @@ typedef enum {
VIR_FROM_LOGGING = 63, /* Error from log manager */
VIR_FROM_XENXL = 64, /* Error from Xen xl config code */
VIR_FROM_PERF = 65, /* Error from perf */
# ifdef VIR_ENUM_SENTINELS
VIR_ERR_DOMAIN_LAST
# endif
@@ -312,11 +310,6 @@ typedef enum {
CPU*/
VIR_ERR_XML_INVALID_SCHEMA = 92, /* XML document doesn't validate against schema */
VIR_ERR_MIGRATE_FINISH_OK = 93, /* Finish API succeeded but it is expected to return NULL */
VIR_ERR_AUTH_UNAVAILABLE = 94, /* authentication unavailable */
VIR_ERR_NO_SERVER = 95, /* Server was not found */
VIR_ERR_NO_CLIENT = 96, /* Client was not found */
VIR_ERR_AGENT_UNSYNCED = 97, /* guest agent replies with wrong id
to guest-sync command */
} virErrorNumber;
/**

File diff suppressed because it is too large Load Diff

View File

@@ -250,7 +250,7 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
if test "$gl_cv_warn_c__Wlogical_op" = yes &&
test "$lv_cv_gcc_wlogical_op_broken" = yes; then
AC_DEFINE_UNQUOTED([BROKEN_GCC_WLOGICALOP_STRCHR], 1,
AC_DEFINE_UNQUOTED([BROKEN_GCC_WLOGICALOP], 1,
[Define to 1 if gcc -Wlogical-op reports false positives on strchr])
fi

Some files were not shown because too many files have changed in this diff Show More