mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-09-21 09:44:54 +03:00
Compare commits
13 Commits
v6.0.0-rc2
...
v4.5-maint
Author | SHA1 | Date | |
---|---|---|---|
|
415cc5c064 | ||
|
fd16bd525a | ||
|
d025c10d54 | ||
|
6a028b6e82 | ||
|
ec58805400 | ||
|
618358632b | ||
|
d1017aeee9 | ||
|
35176b5c78 | ||
|
6aedf9bfad | ||
|
78920738ca | ||
|
88924317f3 | ||
|
941ca31e90 | ||
|
3818514602 |
1
.ctags
1
.ctags
@@ -3,4 +3,3 @@
|
||||
--exclude=*.html
|
||||
--exclude=*.html.in
|
||||
--langmap=c:+.h.in
|
||||
--c-kinds=+p
|
||||
|
@@ -1 +0,0 @@
|
||||
../.ctags
|
@@ -1,21 +0,0 @@
|
||||
# EditorConfig is a file format and collection of text editor plugins
|
||||
# for maintaining consistent coding styles between different editors
|
||||
# and IDEs. Most popular editors support this either natively or via
|
||||
# plugin.
|
||||
#
|
||||
# Check https://editorconfig.org for details.
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
|
||||
[*.c]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.{rng,xml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
231
.gitignore
vendored
231
.gitignore
vendored
@@ -1,44 +1,215 @@
|
||||
# vim related ignores
|
||||
*.swp
|
||||
.lvimrc
|
||||
|
||||
# emacs related ignores
|
||||
*#*#
|
||||
*.#*#
|
||||
.#*
|
||||
|
||||
# autotools related ignores
|
||||
!/m4/virt-*.m4
|
||||
*.[187]
|
||||
*.[187].in
|
||||
*.a
|
||||
*.cov
|
||||
*.exe
|
||||
*.exe.manifest
|
||||
*.gcda
|
||||
*.gcno
|
||||
*.gcov
|
||||
*.html
|
||||
*.i
|
||||
*.init
|
||||
*.la
|
||||
*.lo
|
||||
*.loT
|
||||
*.o
|
||||
*.orig
|
||||
*.pem
|
||||
*.pyc
|
||||
*.rej
|
||||
*.s
|
||||
*.service
|
||||
*.socket
|
||||
*.swp
|
||||
*~
|
||||
.#*
|
||||
.color_coded
|
||||
.deps
|
||||
.dirstamp
|
||||
.gdb_history
|
||||
.git
|
||||
.git-module-status
|
||||
.libs
|
||||
.lvimrc
|
||||
.memdump
|
||||
.sc-start-sc_*
|
||||
.ycm_extra_conf.py
|
||||
/AUTHORS
|
||||
/ChangeLog
|
||||
/GNUmakefile
|
||||
/INSTALL
|
||||
/NEWS
|
||||
/aclocal.m4
|
||||
/autom4te.cache
|
||||
/build-aux/.gitignore
|
||||
/build-aux/compile
|
||||
/build-aux/depcomp
|
||||
/build-aux/missing
|
||||
/build-aux/test-driver
|
||||
/build-aux/*
|
||||
/build/
|
||||
/confdefs.h
|
||||
/config.cache
|
||||
/config.guess
|
||||
/config.h
|
||||
/config.h.in
|
||||
/config.log
|
||||
/config.rpath
|
||||
/config.status
|
||||
/config.sub
|
||||
/configure
|
||||
/m4/*
|
||||
Makefile.in
|
||||
|
||||
# gnulib related ignores
|
||||
!/gnulib/lib/Makefile.am
|
||||
!/gnulib/tests/Makefile.am
|
||||
*.rej
|
||||
*~
|
||||
/configure.lineno
|
||||
/conftest.*
|
||||
/docs/aclperms.htmlinc
|
||||
/docs/apibuild.py.stamp
|
||||
/docs/devhelp/libvirt.devhelp
|
||||
/docs/hvsupport.html.in
|
||||
/docs/libvirt-admin-*.xml
|
||||
/docs/libvirt-api.xml
|
||||
/docs/libvirt-lxc-*.xml
|
||||
/docs/libvirt-qemu-*.xml
|
||||
/docs/libvirt-refs.xml
|
||||
/docs/news.html.in
|
||||
/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/logging
|
||||
/examples/admin/threadpool_params
|
||||
/examples/object-events/event-test
|
||||
/examples/dominfo/info1
|
||||
/examples/domsuspend/suspend
|
||||
/examples/dommigrate/dommigrate
|
||||
/examples/domtop/domtop
|
||||
/examples/hellolibvirt/hellolibvirt
|
||||
/examples/openauth/openauth
|
||||
/examples/rename/rename
|
||||
/gnulib/lib/*
|
||||
/gnulib/m4/*
|
||||
/gnulib/tests/*
|
||||
|
||||
# git related ignores
|
||||
*.orig
|
||||
.git-module-status
|
||||
|
||||
# libvirt related ignores
|
||||
/build/
|
||||
/ci/scratch/
|
||||
/include/libvirt/libvirt-common.h
|
||||
/libtool
|
||||
/libvirt-*.tar.xz
|
||||
/libvirt-[0-9]*
|
||||
/libvirt*.pc
|
||||
/libvirt.spec
|
||||
/ltconfig
|
||||
/ltmain.sh
|
||||
/m4/*
|
||||
/maint.mk
|
||||
/mingw-libvirt.spec
|
||||
/mkinstalldirs
|
||||
/po/*gmo
|
||||
/po/*po
|
||||
!/po/*.mini.po
|
||||
/po/*pot
|
||||
/proxy/
|
||||
/python/
|
||||
/run
|
||||
/sc_*
|
||||
/src/.*.stamp
|
||||
/src/*.pc
|
||||
/src/access/org.libvirt.api.policy
|
||||
/src/access/viraccessapicheck.c
|
||||
/src/access/viraccessapicheck.h
|
||||
/src/access/viraccessapichecklxc.c
|
||||
/src/access/viraccessapichecklxc.h
|
||||
/src/access/viraccessapicheckqemu.c
|
||||
/src/access/viraccessapicheckqemu.h
|
||||
/src/admin/admin_client.h
|
||||
/src/admin/admin_protocol.[ch]
|
||||
/src/admin/admin_server_dispatch_stubs.h
|
||||
/src/esx/*.generated.*
|
||||
/src/hyperv/*.generated.*
|
||||
/src/libvirt*.def
|
||||
/src/libvirt.syms
|
||||
/src/libvirt_access.syms
|
||||
/src/libvirt_access.xml
|
||||
/src/libvirt_access_lxc.syms
|
||||
/src/libvirt_access_lxc.xml
|
||||
/src/libvirt_access_qemu.syms
|
||||
/src/libvirt_access_qemu.xml
|
||||
/src/libvirt_admin.syms
|
||||
/src/libvirt_*.stp
|
||||
/src/libvirt_*helper
|
||||
/src/libvirt_*probes.h
|
||||
/src/libvirt_lxc
|
||||
/src/libvirtd
|
||||
/src/libvirtd*.logrotate
|
||||
/src/locking/libxl-lockd.conf
|
||||
/src/locking/libxl-sanlock.conf
|
||||
/src/locking/lock_daemon_dispatch_stubs.h
|
||||
/src/locking/lock_protocol.[ch]
|
||||
/src/locking/qemu-lockd.conf
|
||||
/src/locking/qemu-sanlock.conf
|
||||
/src/locking/test_libvirt_sanlock.aug
|
||||
/src/logging/log_daemon_dispatch_stubs.h
|
||||
/src/logging/log_protocol.[ch]
|
||||
/src/lxc/lxc_controller_dispatch.h
|
||||
/src/lxc/lxc_monitor_dispatch.h
|
||||
/src/lxc/lxc_monitor_protocol.c
|
||||
/src/lxc/lxc_monitor_protocol.h
|
||||
/src/lxc/lxc_protocol.[ch]
|
||||
/src/lxc/test_libvirtd_lxc.aug
|
||||
/src/qemu/test_libvirtd_qemu.aug
|
||||
/src/remote/*_client_bodies.h
|
||||
/src/remote/*_protocol.[ch]
|
||||
/src/remote/*_stubs.h
|
||||
/src/rpc/virkeepaliveprotocol.[ch]
|
||||
/src/rpc/virnetprotocol.[ch]
|
||||
/src/test_libvirt*.aug
|
||||
/src/test_virtlockd.aug
|
||||
/src/test_virtlogd.aug
|
||||
/src/util/virkeycodetable*.h
|
||||
/src/util/virkeynametable*.h
|
||||
/src/virt-aa-helper
|
||||
/src/virtlockd
|
||||
/src/virtlogd
|
||||
/src/virt-guest-shutdown.target
|
||||
/tests/*.log
|
||||
/tests/*.pid
|
||||
/tests/*.trs
|
||||
/tests/*test
|
||||
/tests/commandhelper
|
||||
/tests/qemucapsprobe
|
||||
!/tests/virsh-self-test
|
||||
!/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/libvirt-guests.sh
|
||||
/tools/virt-login-shell
|
||||
/tools/virsh
|
||||
/tools/virsh-*-edit.c
|
||||
/tools/virt-admin
|
||||
/tools/virt-*-validate
|
||||
/tools/virt-sanlock-cleanup
|
||||
/tools/wireshark/src/plugin.c
|
||||
/tools/wireshark/src/libvirt
|
||||
/update.log
|
||||
GPATH
|
||||
GRTAGS
|
||||
GTAGS
|
||||
Makefile
|
||||
Makefile.in
|
||||
TAGS
|
||||
coverage
|
||||
cscope.files
|
||||
cscope.in.out
|
||||
cscope.out
|
||||
cscope.po.out
|
||||
results.log
|
||||
stamp-h
|
||||
stamp-h.in
|
||||
stamp-h1
|
||||
tags
|
||||
!/build-aux/*.pl
|
||||
!/gnulib/lib/Makefile.am
|
||||
!/gnulib/tests/Makefile.am
|
||||
!/m4/virt-*.m4
|
||||
|
@@ -1,46 +0,0 @@
|
||||
.job_template: &job_definition
|
||||
script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- ../autogen.sh $CONFIGURE_OPTS || (cat config.log && exit 1)
|
||||
- make -j $(getconf _NPROCESSORS_ONLN)
|
||||
|
||||
# We could run every arch on every versions, but it is a little
|
||||
# overkill. Instead we split jobs evenly across 9, 10 and sid
|
||||
# to achieve reasonable cross-coverage.
|
||||
|
||||
debian-9-cross-armv6l:
|
||||
<<: *job_definition
|
||||
image: quay.io/libvirt/buildenv-libvirt-debian-9-cross-armv6l:latest
|
||||
|
||||
debian-9-cross-mips64el:
|
||||
<<: *job_definition
|
||||
image: quay.io/libvirt/buildenv-libvirt-debian-9-cross-mips64el:latest
|
||||
|
||||
debian-9-cross-mips:
|
||||
<<: *job_definition
|
||||
image: quay.io/libvirt/buildenv-libvirt-debian-9-cross-mips:latest
|
||||
|
||||
debian-10-cross-aarch64:
|
||||
<<: *job_definition
|
||||
image: quay.io/libvirt/buildenv-libvirt-debian-10-cross-aarch64:latest
|
||||
|
||||
debian-10-cross-ppc64le:
|
||||
<<: *job_definition
|
||||
image: quay.io/libvirt/buildenv-libvirt-debian-10-cross-ppc64le:latest
|
||||
|
||||
debian-10-cross-s390x:
|
||||
<<: *job_definition
|
||||
image: quay.io/libvirt/buildenv-libvirt-debian-10-cross-s390x:latest
|
||||
|
||||
debian-sid-cross-armv7l:
|
||||
<<: *job_definition
|
||||
image: quay.io/libvirt/buildenv-libvirt-debian-sid-cross-armv7l:latest
|
||||
|
||||
debian-sid-cross-i686:
|
||||
<<: *job_definition
|
||||
image: quay.io/libvirt/buildenv-libvirt-debian-sid-cross-i686:latest
|
||||
|
||||
debian-sid-cross-mipsel:
|
||||
<<: *job_definition
|
||||
image: quay.io/libvirt/buildenv-libvirt-debian-sid-cross-mipsel:latest
|
2
.gnulib
2
.gnulib
Submodule .gnulib updated: 7d06937892...d6397dde2e
21
.mailmap
21
.mailmap
@@ -20,6 +20,7 @@
|
||||
<jfehlig@suse.com> <jfehlig@novell.com>
|
||||
<jfehlig@suse.com> <jfehlig@linux-ypgk.site>
|
||||
<jclift@redhat.com> <justin@salasaga.org>
|
||||
<berrange@redhat.com> <dan@berrange.com>
|
||||
<soren@linux2go.dk> <soren@canonical.com>
|
||||
<cfergeau@redhat.com> <teuf@gnome.org>
|
||||
<wency@cn.fujitsu.com> <wency cn fujitsu com>
|
||||
@@ -38,15 +39,6 @@
|
||||
<zhlcindy@linux.vnet.ibm.com> <zhlcindy@gmail.com>
|
||||
<serge.hallyn@canonical.com> <serue@us.ibm.com>
|
||||
<pritesh.kothari@sun.com> <Pritesh.Kothari@Sun.COM>
|
||||
<cbosdonnat@suse.com> <cedric.bosdonnat@free.fr>
|
||||
<mnestratov@virtuozzo.com> <mnestratov@parallels.com>
|
||||
<nshirokovskiy@virtuozzo.com> <nshirokovskiy@parallels.com>
|
||||
<jyang@redhat.com> <osier@yunify.com>
|
||||
<kkoukiou@redhat.com> <k.koukiou@googlemail.com>
|
||||
<intrigeri@boum.org> <intrigeri+libvirt@boum.org>
|
||||
<fidencio@redhat.com> <fabiano@fidencio.org>
|
||||
<shi_lei@massclouds.com> <shilei.massclouds@gmx.com>
|
||||
<adrian.brzezinski@eo.pl> <redhat@adrb.pl>
|
||||
|
||||
# Name consolidation:
|
||||
# Preferred author spelling <preferred email>
|
||||
@@ -64,16 +56,9 @@ Aurelien Rougemont <beorn@binaries.fr>
|
||||
Serge E. Hallyn <serge.hallyn@canonical.com>
|
||||
Henrik Persson E <henrik.e.persson@ericsson.com>
|
||||
Philipp Hahn <hahn@univention.de>
|
||||
Marco Bozzolan <bozzolan@gmail.com>
|
||||
Marco Bozzolan <redshift@gmx.com>
|
||||
Pritesh Kothari <pritesh.kothari@sun.com>
|
||||
Wang Yufei (James) <james.wangyufei@huawei.com>
|
||||
Deepak C Shetty <dpkshetty@gmail.com>
|
||||
Dave Allan <dallan@redhat.com>
|
||||
Richard W.M. Jones <rjones@redhat.com>
|
||||
|
||||
# Non-trivial consolidation:
|
||||
# see git documentation for information about the format
|
||||
Daniel P. Berrangé <berrange@redhat.com>
|
||||
Daniel P. Berrangé <berrange@redhat.com> <dan@berrange.com>
|
||||
Michal Prívozník <mprivozn@redhat.com>
|
||||
Michal Prívozník <mprivozn@redhat.com> <miso.privoznik@gmail.com>
|
||||
Marco Bozzolan <bozzolan@gmail.com> <redshift@gmx.com>
|
||||
|
129
.travis.yml
129
.travis.yml
@@ -5,102 +5,95 @@ branches:
|
||||
except:
|
||||
- /^.*-maint$/
|
||||
|
||||
addons:
|
||||
homebrew:
|
||||
update: true
|
||||
packages:
|
||||
- ccache
|
||||
- rpcgen
|
||||
- xz
|
||||
- yajl
|
||||
- glib
|
||||
- docutils
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- services:
|
||||
- docker
|
||||
env:
|
||||
- IMAGE="ubuntu-1804"
|
||||
- MAKE_ARGS="syntax-check distcheck"
|
||||
script:
|
||||
- make -C ci/ ci-build@$IMAGE CI_MAKE_ARGS="$MAKE_ARGS"
|
||||
- IMAGE="ubuntu-18"
|
||||
- DISTCHECK_CONFIGURE_FLAGS="--with-init-script=systemd"
|
||||
- DOCKER_CMD="$LINUX_CMD"
|
||||
- services:
|
||||
- docker
|
||||
env:
|
||||
- IMAGE="centos-7"
|
||||
- MAKE_ARGS="syntax-check distcheck"
|
||||
script:
|
||||
- make -C ci/ ci-build@$IMAGE CI_MAKE_ARGS="$MAKE_ARGS"
|
||||
- services:
|
||||
- docker
|
||||
env:
|
||||
- IMAGE="debian-9"
|
||||
- MAKE_ARGS="syntax-check distcheck"
|
||||
script:
|
||||
- make -C ci/ ci-build@$IMAGE CI_MAKE_ARGS="$MAKE_ARGS"
|
||||
- services:
|
||||
- docker
|
||||
env:
|
||||
- IMAGE="fedora-31"
|
||||
- MAKE_ARGS="syntax-check distcheck"
|
||||
script:
|
||||
- make -C ci/ ci-build@$IMAGE CI_MAKE_ARGS="$MAKE_ARGS"
|
||||
- DISTCHECK_CONFIGURE_FLAGS="--with-init-script=upstart"
|
||||
- DOCKER_CMD="$LINUX_CMD"
|
||||
- services:
|
||||
- docker
|
||||
env:
|
||||
- IMAGE="fedora-rawhide"
|
||||
- MAKE_ARGS="syntax-check distcheck"
|
||||
script:
|
||||
- make -C ci/ ci-build@$IMAGE CI_MAKE_ARGS="$MAKE_ARGS"
|
||||
- services:
|
||||
- docker
|
||||
env:
|
||||
- IMAGE="fedora-30"
|
||||
- MINGW="mingw32"
|
||||
script:
|
||||
- make -C ci/ ci-build@$IMAGE CI_CONFIGURE="$MINGW-configure"
|
||||
- DOCKER_CMD="$MINGW_CMD"
|
||||
- services:
|
||||
- docker
|
||||
env:
|
||||
- IMAGE="fedora-30"
|
||||
- IMAGE="fedora-rawhide"
|
||||
- MINGW="mingw64"
|
||||
script:
|
||||
- make -C ci/ ci-build@$IMAGE CI_CONFIGURE="$MINGW-configure"
|
||||
- DOCKER_CMD="$MINGW_CMD"
|
||||
- compiler: clang
|
||||
language: c
|
||||
os: osx
|
||||
osx_image: xcode10.3
|
||||
env:
|
||||
- PATH="/usr/local/opt/gettext/bin:/usr/local/opt/ccache/libexec:/usr/local/opt/rpcgen/bin:$PATH"
|
||||
- PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"
|
||||
before_script:
|
||||
# Hack to blow away py2
|
||||
- brew link --overwrite python
|
||||
script:
|
||||
# We can't run 'distcheck' or 'syntax-check' because they fail on
|
||||
# macOS, but doing 'install' and 'dist' gives us some useful coverage
|
||||
- mkdir build && cd build
|
||||
- ../autogen.sh --prefix=$(pwd)/install-root && make -j3 && make -j3 install && make -j3 dist
|
||||
- compiler: clang
|
||||
language: c
|
||||
os: osx
|
||||
osx_image: xcode11.3
|
||||
env:
|
||||
- PATH="/usr/local/opt/gettext/bin:/usr/local/opt/ccache/libexec:/usr/local/opt/rpcgen/bin:$PATH"
|
||||
- PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"
|
||||
before_script:
|
||||
# Hack to blow away py2
|
||||
- brew link --overwrite python
|
||||
script:
|
||||
# We can't run 'distcheck' or 'syntax-check' because they fail on
|
||||
# macOS, but doing 'install' and 'dist' gives us some useful coverage
|
||||
- mkdir build && cd build
|
||||
- ../autogen.sh --prefix=$(pwd)/install-root && make -j3 && make -j3 install && make -j3 dist
|
||||
/bin/sh -xc "$MACOS_CMD"
|
||||
|
||||
script:
|
||||
- docker run
|
||||
-v $(pwd):/build
|
||||
-w /build
|
||||
-e VIR_TEST_DEBUG="$VIR_TEST_DEBUG"
|
||||
-e MINGW="$MINGW"
|
||||
-e DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS"
|
||||
"libvirt/buildenv-$IMAGE"
|
||||
/bin/sh -xc "$DOCKER_CMD"
|
||||
|
||||
git:
|
||||
submodules: true
|
||||
|
||||
env:
|
||||
global:
|
||||
- VIR_TEST_DEBUG=1
|
||||
- LINUX_CMD="
|
||||
./autogen.sh &&
|
||||
make -j3 syntax-check &&
|
||||
make -j3 distcheck DISTCHECK_CONFIGURE_FLAGS=\"\$DISTCHECK_CONFIGURE_FLAGS\" ||
|
||||
(
|
||||
echo '=== LOG FILE(S) START ===';
|
||||
find -name test-suite.log | xargs cat;
|
||||
echo '=== LOG FILE(S) END ===';
|
||||
exit 1
|
||||
)
|
||||
"
|
||||
- MINGW_CMD="
|
||||
NOCONFIGURE=1 ./autogen.sh &&
|
||||
\$MINGW-configure &&
|
||||
make -j3 ||
|
||||
(
|
||||
echo '=== LOG FILE(S) START ===';
|
||||
find -name test-suite.log | xargs cat;
|
||||
echo '=== LOG FILE(S) END ===';
|
||||
exit 1
|
||||
)
|
||||
"
|
||||
# We can't run 'distcheck' or 'syntax-check' because they fail on
|
||||
# macOS, but doing 'install' and 'dist' gives us some useful coverage
|
||||
- MACOS_CMD="
|
||||
brew update &&
|
||||
brew install ccache rpcgen xz yajl &&
|
||||
./autogen.sh --prefix=\$(pwd)/install-root &&
|
||||
make -j3 &&
|
||||
make -j3 install &&
|
||||
make -j3 dist ||
|
||||
(
|
||||
echo '=== LOG FILE(S) START ===';
|
||||
find -name test-suite.log | xargs cat;
|
||||
echo '=== LOG FILE(S) END ===';
|
||||
exit 1
|
||||
)
|
||||
"
|
||||
|
||||
notifications:
|
||||
irc:
|
||||
# The channel name "irc.oftc.net#virt" is encrypted against libvirt/libvirt
|
||||
|
@@ -14,19 +14,17 @@ Christian Ehrhardt <christian.ehrhardt@canonical.com>
|
||||
Christophe Fergeau <cfergeau@redhat.com>
|
||||
Claudio Bley <claudio.bley@gmail.com>
|
||||
Cole Robinson <crobinso@redhat.com>
|
||||
Daniel P. Berrangé <berrange@redhat.com>
|
||||
Daniel Berrange <berrange@redhat.com>
|
||||
Daniel Veillard <veillard@redhat.com>
|
||||
Doug Goldstein <cardoe@gentoo.org>
|
||||
Eric Blake <eblake@redhat.com>
|
||||
Erik Skultety <eskultet@redhat.com>
|
||||
Fabiano Fidêncio <fidencio@redhat.com>
|
||||
Gao Feng <gaofeng@cn.fujitsu.com>
|
||||
Guido Günther <agx@sigxcpu.org>
|
||||
Ján Tomko <jtomko@redhat.com>
|
||||
Jim Fehlig <jfehlig@suse.com>
|
||||
Jiří Denemark <jdenemar@redhat.com>
|
||||
John Ferlan <jferlan@redhat.com>
|
||||
Katerina Koukiou <kkoukiou@redhat.com>
|
||||
Laine Stump <laine@redhat.com>
|
||||
Mark McLoughlin <markmc@redhat.com>
|
||||
Martin Kletzander <mkletzan@redhat.com>
|
||||
@@ -92,7 +90,9 @@ Stefan de Konink <dekonink@kinkrsoftware.nl>
|
||||
Takahashi Tomohiro <takatom@jp.fujitsu.com>
|
||||
Tatsuro Enokura <fj7716hz@aa.jp.fujitsu.com>
|
||||
|
||||
#contributorslist#
|
||||
#authorslist#
|
||||
|
||||
[....send patches to get your name here....]
|
||||
|
||||
The libvirt logo was designed by Diana Fong
|
||||
|
||||
|
15
ChangeLog
15
ChangeLog
@@ -1,15 +0,0 @@
|
||||
libvirt ChangeLog
|
||||
=================
|
||||
|
||||
The libvirt project doesn't include a detailed ChangeLog in its release
|
||||
archives.
|
||||
|
||||
If you're interested in the full list of changes made to libvirt since
|
||||
the project was started, you can clone the git repository from
|
||||
|
||||
https://libvirt.org/git/libvirt.git
|
||||
|
||||
and browse them locally using your favorite git history viewer or,
|
||||
alternatively, browse them online at
|
||||
|
||||
https://libvirt.org/git/?p=libvirt.git;a=log
|
16699
ChangeLog-old
Normal file
16699
ChangeLog-old
Normal file
File diff suppressed because it is too large
Load Diff
74
GNUmakefile
74
GNUmakefile
@@ -1,74 +0,0 @@
|
||||
# Having a separate GNUmakefile lets me 'include' the dynamically
|
||||
# generated rules created via cfg.mk (package-local configuration)
|
||||
# as well as maint.mk (generic maintainer rules).
|
||||
# This makefile is used only if you run GNU Make.
|
||||
# It is necessary if you want to build targets usually of interest
|
||||
# only to the maintainer.
|
||||
|
||||
# Copyright (C) 2001, 2003, 2006-2019 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
_build-aux ?= build-aux
|
||||
_autoreconf ?= autoreconf -v
|
||||
|
||||
# If the user runs GNU make but has not yet run ./configure,
|
||||
# give them a diagnostic.
|
||||
_gl-Makefile := $(wildcard [M]akefile)
|
||||
ifneq ($(_gl-Makefile),)
|
||||
|
||||
# Make tar archive easier to reproduce.
|
||||
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
|
||||
|
||||
# Allow the user to add to this in the Makefile.
|
||||
ALL_RECURSIVE_TARGETS =
|
||||
|
||||
include Makefile
|
||||
include $(srcdir)/$(_build-aux)/syntax-check.mk
|
||||
|
||||
else
|
||||
|
||||
.DEFAULT_GOAL := abort-due-to-no-makefile
|
||||
srcdir = .
|
||||
|
||||
# The package can override .DEFAULT_GOAL to run actions like autoreconf.
|
||||
include $(srcdir)/$(_build-aux)/syntax-check.mk
|
||||
|
||||
ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
|
||||
$(MAKECMDGOALS): abort-due-to-no-makefile
|
||||
endif
|
||||
|
||||
abort-due-to-no-makefile:
|
||||
@echo There seems to be no Makefile in this directory. 1>&2
|
||||
@echo "You must run ./configure before running 'make'." 1>&2
|
||||
@exit 1
|
||||
|
||||
endif
|
||||
|
||||
# Tell version 3.79 and up of GNU make to not build goals in this
|
||||
# directory in parallel, in case someone tries to build multiple
|
||||
# targets, and one of them can cause a recursive target to be invoked.
|
||||
|
||||
# Only set this if Automake doesn't provide it.
|
||||
AM_RECURSIVE_TARGETS ?= $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) \
|
||||
dist distcheck tags ctags
|
||||
|
||||
ALL_RECURSIVE_TARGETS += $(AM_RECURSIVE_TARGETS)
|
||||
|
||||
ifneq ($(word 2, $(MAKECMDGOALS)), )
|
||||
ifneq ($(filter $(ALL_RECURSIVE_TARGETS), $(MAKECMDGOALS)), )
|
||||
.NOTPARALLEL:
|
||||
endif
|
||||
endif
|
89
Makefile.am
89
Makefile.am
@@ -19,10 +19,6 @@
|
||||
LCOV = lcov
|
||||
GENHTML = genhtml
|
||||
|
||||
# when building from tarball -Werror isn't auto enabled
|
||||
# so force it explicitly
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-werror
|
||||
|
||||
SUBDIRS = . gnulib/lib include/libvirt src tools docs gnulib/tests \
|
||||
tests po examples
|
||||
|
||||
@@ -33,6 +29,7 @@ ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
EXTRA_DIST = \
|
||||
config-post.h \
|
||||
ChangeLog-old \
|
||||
libvirt.spec libvirt.spec.in \
|
||||
mingw-libvirt.spec.in \
|
||||
libvirt.pc.in \
|
||||
@@ -41,43 +38,10 @@ EXTRA_DIST = \
|
||||
libvirt-admin.pc.in \
|
||||
Makefile.nonreentrant \
|
||||
autogen.sh \
|
||||
GNUmakefile \
|
||||
cfg.mk \
|
||||
run.in \
|
||||
README.md \
|
||||
AUTHORS.in \
|
||||
scripts/apibuild.py \
|
||||
scripts/augeas-gentest.py \
|
||||
build-aux/check-spacing.pl \
|
||||
scripts/check-aclperms.py \
|
||||
scripts/check-aclrules.py \
|
||||
scripts/check-drivername.py \
|
||||
scripts/check-driverimpls.py \
|
||||
scripts/check-file-access.py \
|
||||
scripts/check-remote-protocol.py \
|
||||
scripts/check-symfile.py \
|
||||
scripts/check-symsorting.py \
|
||||
scripts/dtrace2systemtap.py \
|
||||
scripts/esx_vi_generator.py \
|
||||
scripts/genaclperms.py \
|
||||
scripts/genpolkit.py \
|
||||
scripts/gensystemtap.py \
|
||||
scripts/group-qemu-caps.py \
|
||||
scripts/header-ifdef.py \
|
||||
scripts/hvsupport.py \
|
||||
scripts/hyperv_wmi_generator.py \
|
||||
scripts/minimize-po.py \
|
||||
scripts/mock-noinline.py \
|
||||
scripts/prohibit-duplicate-header.py \
|
||||
scripts/reformat-news.py \
|
||||
scripts/test-wrap-argv.py \
|
||||
build-aux/syntax-check.mk \
|
||||
build-aux/useless-if-before-free \
|
||||
build-aux/vc-list-files \
|
||||
ci/Makefile \
|
||||
ci/build.sh \
|
||||
ci/list-images.sh \
|
||||
ci/prepare.sh \
|
||||
$(NULL)
|
||||
AUTHORS.in
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc libvirt-admin.pc
|
||||
@@ -85,7 +49,7 @@ pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc libvirt-admin.pc
|
||||
NEWS: \
|
||||
$(srcdir)/docs/news.xml \
|
||||
$(srcdir)/docs/news-ascii.xsl \
|
||||
$(top_srcdir)/scripts/reformat-news.py
|
||||
$(srcdir)/docs/reformat-news.py
|
||||
$(AM_V_GEN) \
|
||||
if [ -x $(XSLTPROC) ]; then \
|
||||
$(XSLTPROC) --nonet \
|
||||
@@ -93,14 +57,14 @@ NEWS: \
|
||||
$(srcdir)/docs/news.xml \
|
||||
>$@-tmp \
|
||||
|| { rm -f $@-tmp; exit 1; }; \
|
||||
$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/reformat-news.py $@-tmp >$@ \
|
||||
$(PYTHON) $(srcdir)/docs/reformat-news.py $@-tmp >$@ \
|
||||
|| { rm -f $@-tmp; exit 1; }; \
|
||||
rm -f $@-tmp; \
|
||||
fi
|
||||
EXTRA_DIST += \
|
||||
$(srcdir)/docs/news.xml \
|
||||
$(srcdir)/docs/news-ascii.xsl \
|
||||
$(NULL)
|
||||
$(srcdir)/docs/reformat-news.py
|
||||
|
||||
rpm: clean
|
||||
@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.xz)
|
||||
@@ -110,13 +74,13 @@ srpm: clean
|
||||
|
||||
check-local: all tests
|
||||
|
||||
check-access: all
|
||||
check-access:
|
||||
@($(MAKE) $(AM_MAKEFLAGS) -C tests check-access)
|
||||
|
||||
cov: clean-cov
|
||||
$(MKDIR_P) $(top_builddir)/coverage
|
||||
$(LCOV) -c -o $(top_builddir)/coverage/libvirt.info.tmp \
|
||||
-d $(top_builddir)/src \
|
||||
-d $(top_builddir)/src -d $(top_builddir)/daemon \
|
||||
-d $(top_builddir)/tests
|
||||
$(LCOV) -r $(top_builddir)/coverage/libvirt.info.tmp \
|
||||
-o $(top_builddir)/coverage/libvirt.info
|
||||
@@ -129,28 +93,25 @@ clean-cov:
|
||||
|
||||
MAINTAINERCLEANFILES = .git-module-status
|
||||
|
||||
distclean-local: clean-GNUmakefile
|
||||
clean-GNUmakefile:
|
||||
test '$(srcdir)' = . || rm -f $(top_builddir)/GNUmakefile
|
||||
dist-hook: gen-ChangeLog gen-AUTHORS
|
||||
|
||||
dist-hook: gen-AUTHORS
|
||||
# Generate the ChangeLog file (with all entries since the switch to git)
|
||||
# and insert it into the directory we're about to use to create a tarball.
|
||||
gen_start_date = 2009-07-04
|
||||
.PHONY: gen-ChangeLog
|
||||
gen-ChangeLog:
|
||||
$(AM_V_GEN)if test -d .git; then \
|
||||
$(top_srcdir)/build-aux/gitlog-to-changelog \
|
||||
--since=$(gen_start_date) > $(distdir)/cl-t; \
|
||||
rm -f $(distdir)/ChangeLog; \
|
||||
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
|
||||
fi
|
||||
|
||||
.PHONY: gen-AUTHORS
|
||||
gen-AUTHORS:
|
||||
$(AM_V_GEN)\
|
||||
if test -d $(srcdir)/.git; then \
|
||||
( \
|
||||
cd $(srcdir) && \
|
||||
git log --pretty=format:'%aN <%aE>' | sort -u \
|
||||
) > all.list && \
|
||||
sort -u $(srcdir)/AUTHORS.in > maint.list && \
|
||||
comm -23 all.list maint.list > contrib.list && \
|
||||
contrib="`cat contrib.list`" && \
|
||||
perl -p -e "s/#contributorslist#// and print '$$contrib'" \
|
||||
< $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp && \
|
||||
mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS && \
|
||||
rm -f all.list maint.list contrib.list; \
|
||||
$(AM_V_GEN)if test -d $(srcdir)/.git; then \
|
||||
out="`cd $(srcdir) && git log --pretty=format:'%aN <%aE>' | sort -u`" && \
|
||||
perl -p -e "s/#authorslist#// and print '$$out'" \
|
||||
< $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp && \
|
||||
mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS ; \
|
||||
fi
|
||||
|
||||
ci-%:
|
||||
$(MAKE) -C $(srcdir)/ci/ $@
|
||||
|
@@ -11,7 +11,7 @@ We've opted to keep only the highest-level sources in the GIT repository.
|
||||
This eases our maintenance burden, (fewer merges etc.), but imposes more
|
||||
requirements on anyone wishing to build from the just-checked-out sources.
|
||||
Note the requirements to build the released archive are much less and
|
||||
are just the requirements of the standard configure && make procedure.
|
||||
are just the requirements of the standard ./configure && make procedure.
|
||||
Specific development tools and versions will be checked for and listed by
|
||||
the bootstrap script.
|
||||
|
||||
@@ -34,14 +34,10 @@ reduce download time and disk space requirements:
|
||||
|
||||
$ export GNULIB_SRCDIR=/path/to/gnulib
|
||||
|
||||
We require to have the build directory different than the source directory:
|
||||
|
||||
$ mkdir build && cd build
|
||||
|
||||
The next step is to get all required pieces from gnulib,
|
||||
to run autoreconf, and to invoke ../autogen.sh:
|
||||
to run autoreconf, and to invoke ./configure:
|
||||
|
||||
$ ../autogen.sh
|
||||
$ ./autogen.sh
|
||||
|
||||
And there you are! Just
|
||||
|
||||
@@ -51,7 +47,6 @@ And there you are! Just
|
||||
At this point, there should be no difference between your local copy,
|
||||
and the GIT master copy:
|
||||
|
||||
$ cd ..
|
||||
$ git diff
|
||||
|
||||
should output no difference.
|
||||
|
13
README.md
13
README.md
@@ -30,7 +30,7 @@ License
|
||||
The libvirt C API is distributed under the terms of GNU Lesser General
|
||||
Public License, version 2.1 (or later). Some parts of the code that are
|
||||
not part of the C library may have the more restrictive GNU General
|
||||
Public License, version 2.0 (or later). See the files `COPYING.LESSER`
|
||||
Public License, version 2.1 (or later). See the files `COPYING.LESSER`
|
||||
and `COPYING` for full license terms & conditions.
|
||||
|
||||
|
||||
@@ -38,13 +38,11 @@ Installation
|
||||
------------
|
||||
|
||||
Libvirt uses the GNU Autotools build system, so in general can be built
|
||||
and installed with the usual commands, however, we mandate to have the
|
||||
build directory different than the source directory. For example, to build
|
||||
in a manner that is suitable for installing as root, use:
|
||||
and installed with the usual commands. For example, to build in a manner
|
||||
that is suitable for installing as root, use:
|
||||
|
||||
```
|
||||
$ mkdir build && cd build
|
||||
$ ../configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
|
||||
$ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
|
||||
$ make
|
||||
$ sudo make install
|
||||
```
|
||||
@@ -52,8 +50,7 @@ $ sudo make install
|
||||
While to build & install as an unprivileged user
|
||||
|
||||
```
|
||||
$ mkdir build && cd build
|
||||
$ ../configure --prefix=$HOME/usr
|
||||
$ ./configure --prefix=$HOME/usr
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
295
bootstrap
295
bootstrap
@@ -1,10 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2019-01-04.17; # UTC
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
# Copyright (C) 2003-2020 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -47,8 +47,6 @@ PERL="${PERL-perl}"
|
||||
|
||||
me=$0
|
||||
|
||||
default_gnulib_url=git://git.sv.gnu.org/gnulib
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: $me [OPTION]...
|
||||
@@ -78,37 +76,6 @@ contents are read as shell variables to configure the bootstrap.
|
||||
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
|
||||
are honored.
|
||||
|
||||
Gnulib sources can be fetched in various ways:
|
||||
|
||||
* If this package is in a git repository with a 'gnulib' submodule
|
||||
configured, then that submodule is initialized and updated and sources
|
||||
are fetched from there. If \$GNULIB_SRCDIR is set (directly or via
|
||||
--gnulib-srcdir) and is a git repository, then it is used as a reference.
|
||||
|
||||
* Otherwise, if \$GNULIB_SRCDIR is set (directly or via --gnulib-srcdir),
|
||||
then sources are fetched from that local directory. If it is a git
|
||||
repository and \$GNULIB_REVISION is set, then that revision is checked
|
||||
out.
|
||||
|
||||
* Otherwise, if this package is in a git repository with a 'gnulib'
|
||||
submodule configured, then that submodule is initialized and updated and
|
||||
sources are fetched from there.
|
||||
|
||||
* Otherwise, if the 'gnulib' directory does not exist, Gnulib sources are
|
||||
cloned into that directory using git from \$GNULIB_URL, defaulting to
|
||||
$default_gnulib_url.
|
||||
If \$GNULIB_REVISION is set, then that revision is checked out.
|
||||
|
||||
* Otherwise, the existing Gnulib sources in the 'gnulib' directory are
|
||||
used. If it is a git repository and \$GNULIB_REVISION is set, then that
|
||||
revision is checked out.
|
||||
|
||||
If you maintain a package and want to pin a particular revision of the
|
||||
Gnulib sources that has been tested with your package, then there are two
|
||||
possible approaches: either configure a 'gnulib' submodule with the
|
||||
appropriate revision, or set \$GNULIB_REVISION (and if necessary
|
||||
\$GNULIB_URL) in $me.conf.
|
||||
|
||||
Running without arguments will suffice in most cases.
|
||||
EOF
|
||||
}
|
||||
@@ -162,11 +129,18 @@ bootstrap_post_import_hook() { :; }
|
||||
# Override it via your own definition in bootstrap.conf.
|
||||
bootstrap_epilogue() { :; }
|
||||
|
||||
# The command to download all .po files for a specified domain into a
|
||||
# specified directory. Fill in the first %s with the destination
|
||||
# directory and the second with the domain name.
|
||||
# The command to download all .po files for a specified domain into
|
||||
# a specified directory. Fill in the first %s is the domain name, and
|
||||
# the second with the destination directory. Use rsync's -L and -r
|
||||
# options because the latest/%s directory and the .po files within are
|
||||
# all symlinks.
|
||||
po_download_command_format=\
|
||||
"wget --mirror --level=1 -nd -nv -A.po -P '%s' \
|
||||
"rsync --delete --exclude '*.s1' -Lrtvz \
|
||||
'translationproject.org::tp/latest/%s/' '%s'"
|
||||
|
||||
# Fallback for downloading .po files (if rsync fails).
|
||||
po_download_command_format2=\
|
||||
"wget --mirror -nd -q -np -A.po -P '%s' \
|
||||
https://translationproject.org/latest/%s/"
|
||||
|
||||
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
|
||||
@@ -196,15 +170,7 @@ source_base=lib
|
||||
m4_base=m4
|
||||
doc_base=doc
|
||||
tests_base=tests
|
||||
gnulib_extra_files="
|
||||
build-aux/install-sh
|
||||
build-aux/mdate-sh
|
||||
build-aux/texinfo.tex
|
||||
build-aux/depcomp
|
||||
build-aux/config.guess
|
||||
build-aux/config.sub
|
||||
doc/INSTALL
|
||||
"
|
||||
gnulib_extra_files=''
|
||||
|
||||
# Additional gnulib-tool options to use. Use "\newline" to break lines.
|
||||
gnulib_tool_option_extras=
|
||||
@@ -298,18 +264,24 @@ case "$0" in
|
||||
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
||||
esac
|
||||
|
||||
# Extra files from gnulib, which override files from other sources.
|
||||
test -z "${gnulib_extra_files}" && \
|
||||
gnulib_extra_files="
|
||||
build-aux/install-sh
|
||||
build-aux/mdate-sh
|
||||
build-aux/texinfo.tex
|
||||
build-aux/depcomp
|
||||
build-aux/config.guess
|
||||
build-aux/config.sub
|
||||
doc/INSTALL
|
||||
"
|
||||
|
||||
if test "$vc_ignore" = auto; then
|
||||
vc_ignore=
|
||||
test -d .git && vc_ignore=.gitignore
|
||||
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
|
||||
fi
|
||||
|
||||
if test x"$gnulib_modules$gnulib_files$gnulib_extra_files" = x; then
|
||||
use_gnulib=false
|
||||
else
|
||||
use_gnulib=true
|
||||
fi
|
||||
|
||||
# Translate configuration into internal form.
|
||||
|
||||
# Parse options.
|
||||
@@ -640,101 +612,95 @@ git_modules_config () {
|
||||
test -f .gitmodules && git config --file .gitmodules "$@"
|
||||
}
|
||||
|
||||
if $use_gnulib; then
|
||||
if $use_git; then
|
||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||
if $use_git; then
|
||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||
fi
|
||||
|
||||
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
|
||||
# submodule, for use in the rest of the script.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
-)
|
||||
# Note that $use_git is necessarily true in this case.
|
||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule init -- "$gnulib_path" || exit $?
|
||||
git submodule update -- "$gnulib_path" || exit $?
|
||||
|
||||
elif [ ! -d "$gnulib_path" ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
|
||||
trap cleanup_gnulib 1 2 13 15
|
||||
|
||||
shallow=
|
||||
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
||||
git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
|
||||
cleanup_gnulib
|
||||
|
||||
trap - 1 2 13 15
|
||||
fi
|
||||
|
||||
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
|
||||
# submodule, for use in the rest of the script.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
-)
|
||||
# Note that $use_git is necessarily true in this case.
|
||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
git submodule init -- "$gnulib_path" || exit $?
|
||||
git submodule update -- "$gnulib_path" || exit $?
|
||||
|
||||
elif [ ! -d "$gnulib_path" ]; then
|
||||
echo "$0: getting gnulib files..."
|
||||
|
||||
trap cleanup_gnulib 1 2 13 15
|
||||
|
||||
shallow=
|
||||
if test -z "$GNULIB_REVISION"; then
|
||||
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
;;
|
||||
*)
|
||||
# Use GNULIB_SRCDIR directly or as a reference.
|
||||
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
|
||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
if git submodule -h|grep -- --reference > /dev/null; then
|
||||
# Prefer the one-liner available in git 1.6.4 or newer.
|
||||
git submodule update --init --reference "$GNULIB_SRCDIR" \
|
||||
"$gnulib_path" || exit $?
|
||||
else
|
||||
# This fallback allows at least git 1.5.5.
|
||||
if test -f "$gnulib_path"/gnulib-tool; then
|
||||
# Since file already exists, assume submodule init already complete.
|
||||
git submodule update -- "$gnulib_path" || exit $?
|
||||
else
|
||||
# Older git can't clone into an empty directory.
|
||||
rmdir "$gnulib_path" 2>/dev/null
|
||||
git clone --reference "$GNULIB_SRCDIR" \
|
||||
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
||||
&& git submodule init -- "$gnulib_path" \
|
||||
&& git submodule update -- "$gnulib_path" \
|
||||
|| exit $?
|
||||
fi
|
||||
git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
|
||||
|| cleanup_gnulib
|
||||
|
||||
trap - 1 2 13 15
|
||||
fi
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
;;
|
||||
*)
|
||||
# Use GNULIB_SRCDIR directly or as a reference.
|
||||
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
|
||||
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
echo "$0: getting gnulib files..."
|
||||
if git submodule -h|grep -- --reference > /dev/null; then
|
||||
# Prefer the one-liner available in git 1.6.4 or newer.
|
||||
git submodule update --init --reference "$GNULIB_SRCDIR" \
|
||||
"$gnulib_path" || exit $?
|
||||
else
|
||||
# This fallback allows at least git 1.5.5.
|
||||
if test -f "$gnulib_path"/gnulib-tool; then
|
||||
# Since file already exists, assume submodule init already complete.
|
||||
git submodule update -- "$gnulib_path" || exit $?
|
||||
else
|
||||
# Older git can't clone into an empty directory.
|
||||
rmdir "$gnulib_path" 2>/dev/null
|
||||
git clone --reference "$GNULIB_SRCDIR" \
|
||||
"$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \
|
||||
&& git submodule init -- "$gnulib_path" \
|
||||
&& git submodule update -- "$gnulib_path" \
|
||||
|| exit $?
|
||||
fi
|
||||
fi
|
||||
GNULIB_SRCDIR=$gnulib_path
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \
|
||||
&& ! git_modules_config submodule.gnulib.url >/dev/null; then
|
||||
(cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
||||
# we no longer need to use git or $gnulib_path below here.
|
||||
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
||||
# we no longer need to use git or $gnulib_path below here.
|
||||
|
||||
if $bootstrap_sync; then
|
||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||
echo "$0: updating bootstrap and restarting..."
|
||||
case $(sh -c 'echo "$1"' -- a) in
|
||||
a) ignored=--;;
|
||||
*) ignored=ignored;;
|
||||
esac
|
||||
exec sh -c \
|
||||
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
||||
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||
"$0" "$@" --no-bootstrap-sync
|
||||
}
|
||||
fi
|
||||
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
<$gnulib_tool || exit $?
|
||||
if $bootstrap_sync; then
|
||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||
echo "$0: updating bootstrap and restarting..."
|
||||
case $(sh -c 'echo "$1"' -- a) in
|
||||
a) ignored=--;;
|
||||
*) ignored=ignored;;
|
||||
esac
|
||||
exec sh -c \
|
||||
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
||||
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||
"$0" "$@" --no-bootstrap-sync
|
||||
}
|
||||
fi
|
||||
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
<$gnulib_tool || exit $?
|
||||
|
||||
# Get translations.
|
||||
|
||||
download_po_files() {
|
||||
subdir=$1
|
||||
domain=$2
|
||||
echo "$me: getting translations into $subdir for $domain..."
|
||||
cmd=$(printf "$po_download_command_format" "$subdir" "$domain")
|
||||
cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
|
||||
eval "$cmd" && return
|
||||
# Fallback to HTTPS.
|
||||
cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
|
||||
eval "$cmd"
|
||||
}
|
||||
|
||||
@@ -932,47 +898,36 @@ fi
|
||||
|
||||
# Import from gnulib.
|
||||
|
||||
if $use_gnulib; then
|
||||
gnulib_tool_options="\
|
||||
--no-changelog\
|
||||
--aux-dir=$build_aux\
|
||||
--doc-base=$doc_base\
|
||||
--lib=$gnulib_name\
|
||||
--m4-base=$m4_base/\
|
||||
--source-base=$source_base/\
|
||||
--tests-base=$tests_base\
|
||||
--local-dir=$local_gl_dir\
|
||||
$gnulib_tool_option_extras\
|
||||
"
|
||||
if test $use_libtool = 1; then
|
||||
case "$gnulib_tool_options " in
|
||||
*' --libtool '*) ;;
|
||||
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
||||
esac
|
||||
fi
|
||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|
||||
|| die "gnulib-tool failed"
|
||||
|
||||
for file in $gnulib_files; do
|
||||
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
||||
|| die "failed to symlink $file"
|
||||
done
|
||||
gnulib_tool_options="\
|
||||
--import\
|
||||
--no-changelog\
|
||||
--aux-dir $build_aux\
|
||||
--doc-base $doc_base\
|
||||
--lib $gnulib_name\
|
||||
--m4-base $m4_base/\
|
||||
--source-base $source_base/\
|
||||
--tests-base $tests_base\
|
||||
--local-dir $local_gl_dir\
|
||||
$gnulib_tool_option_extras\
|
||||
"
|
||||
if test $use_libtool = 1; then
|
||||
case "$gnulib_tool_options " in
|
||||
*' --libtool '*) ;;
|
||||
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
||||
esac
|
||||
fi
|
||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|
||||
|| die "gnulib-tool failed"
|
||||
|
||||
for file in $gnulib_files; do
|
||||
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
||||
|| die "failed to symlink $file"
|
||||
done
|
||||
|
||||
bootstrap_post_import_hook \
|
||||
|| die "bootstrap_post_import_hook failed"
|
||||
|
||||
# Don't proceed if there are uninitialized submodules. In particular,
|
||||
# the next step will remove dangling links, which might be links into
|
||||
# uninitialized submodules.
|
||||
#
|
||||
# Uninitialized submodules are listed with an initial dash.
|
||||
if $use_git && git submodule | grep '^-' >/dev/null; then
|
||||
die "some git submodules are not initialized. " \
|
||||
"Run 'git submodule init' and bootstrap again."
|
||||
fi
|
||||
|
||||
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
|
||||
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
|
||||
# The following requires GNU find 4.2.3 or newer. Considering the usual
|
||||
|
229
bootstrap.conf
229
bootstrap.conf
@@ -10,120 +10,123 @@
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
# gnulib modules used by this package.
|
||||
|
||||
# NB the GSocket conversion is non-trivial due to the
|
||||
# different FD vs HANDLE usage in gnulib vs glib. Need
|
||||
# to find a way to duplicate a socket HANDLE before
|
||||
# turning it into a FD, since closing an FD also closes
|
||||
# the original HANDLE.
|
||||
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules accept"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules bind"
|
||||
# -> conditional build to avoid Win32
|
||||
gnulib_modules="$gnulib_modules chown"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules close"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules connect"
|
||||
# -> Meson
|
||||
gnulib_modules="$gnulib_modules configmake"
|
||||
# -> eliminate usage in some manner
|
||||
gnulib_modules="$gnulib_modules environ"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules fcntl"
|
||||
# -> conditional build avoid win32
|
||||
gnulib_modules="$gnulib_modules fcntl-h"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules getaddrinfo"
|
||||
# -> copy gnuliub win32 impl
|
||||
gnulib_modules="$gnulib_modules getpass"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules getpeername"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules getsockname"
|
||||
# -> copy gnulib STRBUFLEN macro
|
||||
gnulib_modules="$gnulib_modules intprops"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules ioctl"
|
||||
# -> Meson
|
||||
gnulib_modules="$gnulib_modules largefile"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules listen"
|
||||
# -> custom configure check
|
||||
gnulib_modules="$gnulib_modules localeconv"
|
||||
# -> Meson
|
||||
gnulib_modules="$gnulib_modules manywarnings"
|
||||
# -> painful copy gnulib
|
||||
gnulib_modules="$gnulib_modules mgetgroups"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules net_if"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules netdb"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules nonblocking"
|
||||
# -> Just add -lutil to cli
|
||||
gnulib_modules="$gnulib_modules openpty"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules passfd"
|
||||
# -> open code / copy gnulib code
|
||||
gnulib_modules="$gnulib_modules physmem"
|
||||
# -> open code / conditional comp
|
||||
gnulib_modules="$gnulib_modules pipe-posix"
|
||||
# -> open code / conditional comp
|
||||
gnulib_modules="$gnulib_modules pipe2"
|
||||
# -> GMainLoop
|
||||
gnulib_modules="$gnulib_modules poll"
|
||||
# -> Meson
|
||||
gnulib_modules="$gnulib_modules posix-shell"
|
||||
# -> open code conditional logic
|
||||
gnulib_modules="$gnulib_modules pthread_sigmask"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules recv"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules send"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules setsockopt"
|
||||
# -> open code conditional logic
|
||||
gnulib_modules="$gnulib_modules sigaction"
|
||||
# -> open code conditional logic
|
||||
gnulib_modules="$gnulib_modules sigpipe"
|
||||
# -> GSocket
|
||||
gnulib_modules="$gnulib_modules socket"
|
||||
# -> open code conditional or use GIO GFileInfo
|
||||
gnulib_modules="$gnulib_modules stat-time"
|
||||
# -> remove use or open-code it. possibly add to glib
|
||||
gnulib_modules="$gnulib_modules strchrnul"
|
||||
# -> g_strsplit
|
||||
gnulib_modules="$gnulib_modules strtok_r"
|
||||
# -> remove sys/stat.h include from any win32 code paths
|
||||
gnulib_modules="$gnulib_modules sys_stat"
|
||||
# -> remove sys/wait.h include from any win32 code paths
|
||||
gnulib_modules="$gnulib_modules sys_wait"
|
||||
# -> remove from any win32 code paths
|
||||
gnulib_modules="$gnulib_modules termios"
|
||||
# -> GDateTime ?
|
||||
gnulib_modules="$gnulib_modules time_r"
|
||||
# -> obsolete - exists on Linux, MacOS >= ?? & FreeBSD >= 6
|
||||
gnulib_modules="$gnulib_modules ttyname_r"
|
||||
# -> g_get_os_info in GLib 2.64 but can't use that yet
|
||||
gnulib_modules="$gnulib_modules uname"
|
||||
# -> G_STATIC_ASSERT
|
||||
gnulib_modules="$gnulib_modules verify"
|
||||
# -> remove from Win32 code paths
|
||||
gnulib_modules="$gnulib_modules waitpid"
|
||||
# -> Meson
|
||||
gnulib_modules="$gnulib_modules warnings"
|
||||
# -> open code impl
|
||||
gnulib_modules="$gnulib_modules wcwidth"
|
||||
gnulib_modules='
|
||||
accept
|
||||
areadlink
|
||||
autobuild
|
||||
base64
|
||||
bind
|
||||
bitrotate
|
||||
byteswap
|
||||
c-ctype
|
||||
c-strcase
|
||||
c-strcasestr
|
||||
calloc-posix
|
||||
canonicalize-lgpl
|
||||
chown
|
||||
clock-time
|
||||
close
|
||||
connect
|
||||
configmake
|
||||
count-leading-zeros
|
||||
count-one-bits
|
||||
dirname-lgpl
|
||||
environ
|
||||
execinfo
|
||||
fclose
|
||||
fcntl
|
||||
fcntl-h
|
||||
fdatasync
|
||||
ffs
|
||||
ffsl
|
||||
fnmatch
|
||||
fsync
|
||||
func
|
||||
getaddrinfo
|
||||
getcwd-lgpl
|
||||
gethostname
|
||||
getopt-posix
|
||||
getpass
|
||||
getpeername
|
||||
getsockname
|
||||
gettimeofday
|
||||
gitlog-to-changelog
|
||||
gnumakefile
|
||||
ignore-value
|
||||
inet_pton
|
||||
intprops
|
||||
ioctl
|
||||
isatty
|
||||
largefile
|
||||
ldexp
|
||||
listen
|
||||
localeconv
|
||||
maintainer-makefile
|
||||
manywarnings
|
||||
mgetgroups
|
||||
mkdtemp
|
||||
mkostemp
|
||||
mkostemps
|
||||
mktempd
|
||||
net_if
|
||||
netdb
|
||||
nonblocking
|
||||
openpty
|
||||
passfd
|
||||
perror
|
||||
physmem
|
||||
pipe-posix
|
||||
pipe2
|
||||
poll
|
||||
posix-shell
|
||||
pthread
|
||||
pthread_sigmask
|
||||
recv
|
||||
regex
|
||||
sched
|
||||
secure_getenv
|
||||
send
|
||||
setenv
|
||||
setsockopt
|
||||
sigaction
|
||||
sigpipe
|
||||
snprintf
|
||||
socket
|
||||
stat-time
|
||||
stdarg
|
||||
stpcpy
|
||||
strchrnul
|
||||
strdup-posix
|
||||
strndup
|
||||
strerror
|
||||
strerror_r-posix
|
||||
strptime
|
||||
strsep
|
||||
strtok_r
|
||||
sys_stat
|
||||
sys_wait
|
||||
termios
|
||||
time_r
|
||||
timegm
|
||||
ttyname_r
|
||||
uname
|
||||
unsetenv
|
||||
useless-if-before-free
|
||||
usleep
|
||||
vasprintf
|
||||
verify
|
||||
vc-list-files
|
||||
vsnprintf
|
||||
waitpid
|
||||
warnings
|
||||
'
|
||||
|
||||
SKIP_PO=true
|
||||
|
||||
@@ -172,8 +175,8 @@ xmllint -
|
||||
xsltproc -
|
||||
"
|
||||
|
||||
# Automake requires that AUTHORS exist.
|
||||
touch AUTHORS || exit 1
|
||||
# Automake requires that ChangeLog and AUTHORS exist.
|
||||
touch AUTHORS ChangeLog || exit 1
|
||||
|
||||
# Override bootstrap's list - we don't use mdate-sh or texinfo.tex.
|
||||
gnulib_extra_files="
|
||||
@@ -193,9 +196,3 @@ bootstrap_post_import_hook()
|
||||
sed 's,\.\./\.\./\.\.,../..,g; s/^TESTS /GNULIB_TESTS /' $m > $m-t
|
||||
mv -f $m-t $m
|
||||
}
|
||||
|
||||
bootstrap_epilogue()
|
||||
{
|
||||
echo "$0: done. Now you can run 'mkdir build && cd build && ../configure'."
|
||||
exit 0
|
||||
}
|
||||
|
71
build-aux/augeas-gentest.pl
Executable file
71
build-aux/augeas-gentest.pl
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
# augeas-gentest.pl: Generate an augeas test file, from an
|
||||
# example config file + test file template
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Authors:
|
||||
# Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
die "syntax: $0 CONFIG TEMPLATE AUGTEST\n" unless @ARGV == 3;
|
||||
|
||||
my $config = shift @ARGV;
|
||||
my $template = shift @ARGV;
|
||||
my $augtest = shift @ARGV;
|
||||
|
||||
open AUGTEST, ">", $augtest or die "cannot create $augtest: $!";
|
||||
|
||||
$SIG{__DIE__} = sub {
|
||||
unlink $augtest;
|
||||
};
|
||||
|
||||
open CONFIG, "<", $config or die "cannot read $config: $!";
|
||||
open TEMPLATE, "<", $template or die "cannot read $template: $!";
|
||||
|
||||
my $group = 0;
|
||||
while (<TEMPLATE>) {
|
||||
if (/::CONFIG::/) {
|
||||
my $group = 0;
|
||||
print AUGTEST " let conf = \"";
|
||||
while (<CONFIG>) {
|
||||
if (/^#\w/) {
|
||||
s/^#//;
|
||||
s/\"/\\\"/g;
|
||||
print AUGTEST $_;
|
||||
$group = /\[\s$/;
|
||||
} elsif ($group) {
|
||||
s/\"/\\\"/g;
|
||||
if (/#\s*\]/) {
|
||||
$group = 0;
|
||||
}
|
||||
if (/^#/) {
|
||||
s/^#//;
|
||||
print AUGTEST $_;
|
||||
}
|
||||
}
|
||||
}
|
||||
print AUGTEST "\"\n";
|
||||
} else {
|
||||
print AUGTEST $_;
|
||||
}
|
||||
}
|
||||
|
||||
close TEMPLATE;
|
||||
close CONFIG;
|
||||
close AUGTEST or die "cannot save $augtest: $!";
|
@@ -16,6 +16,9 @@
|
||||
# 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/>.
|
||||
#
|
||||
# Authors:
|
||||
# Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
@@ -42,6 +45,9 @@ foreach my $file (@ARGV) {
|
||||
# Kill any quoted strings
|
||||
$data =~ s,"(?:[^\\\"]|\\.)*","XXX",g;
|
||||
|
||||
# Kill any C++ style comments
|
||||
$data =~ s,//.*$,//,;
|
||||
|
||||
next if $data =~ /^#/;
|
||||
|
||||
# Kill contents of multi-line comments
|
||||
|
37
build-aux/minimize-po.pl
Executable file
37
build-aux/minimize-po.pl
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
my @block;
|
||||
my $msgstr = 0;
|
||||
my $empty = 0;
|
||||
my $unused = 0;
|
||||
my $fuzzy = 0;
|
||||
while (<>) {
|
||||
if (/^$/) {
|
||||
if (!$empty && !$unused && !$fuzzy) {
|
||||
print @block;
|
||||
}
|
||||
@block = ();
|
||||
$msgstr = 0;
|
||||
$fuzzy = 0;
|
||||
push @block, $_;
|
||||
} else {
|
||||
if (/^msgstr/) {
|
||||
$msgstr = 1;
|
||||
$empty = 1;
|
||||
}
|
||||
if (/^#.*fuzzy/) {
|
||||
$fuzzy = 1;
|
||||
}
|
||||
if (/^#~ msgstr/) {
|
||||
$unused = 1;
|
||||
}
|
||||
if ($msgstr && /".+"/) {
|
||||
$empty = 0;
|
||||
}
|
||||
push @block, $_;
|
||||
}
|
||||
}
|
||||
|
||||
if (@block && !$empty && !$unused) {
|
||||
print @block;
|
||||
}
|
72
build-aux/mock-noinline.pl
Normal file
72
build-aux/mock-noinline.pl
Normal file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
my %noninlined;
|
||||
my %mocked;
|
||||
|
||||
# Functions in public header don't get the noinline annotation
|
||||
# so whitelist them here
|
||||
$noninlined{"virEventAddTimeout"} = 1;
|
||||
|
||||
foreach my $arg (@ARGV) {
|
||||
if ($arg =~ /\.h$/) {
|
||||
#print "Scan header $arg\n";
|
||||
&scan_annotations($arg);
|
||||
} elsif ($arg =~ /mock\.c$/) {
|
||||
#print "Scan mock $arg\n";
|
||||
&scan_overrides($arg);
|
||||
}
|
||||
}
|
||||
|
||||
my $warned = 0;
|
||||
foreach my $func (keys %mocked) {
|
||||
next if exists $noninlined{$func};
|
||||
|
||||
$warned++;
|
||||
print STDERR "$func is mocked at $mocked{$func} but missing noinline annotation\n";
|
||||
}
|
||||
|
||||
exit $warned ? 1 : 0;
|
||||
|
||||
|
||||
sub scan_annotations {
|
||||
my $file = shift;
|
||||
|
||||
open FH, $file or die "cannot read $file: $!";
|
||||
|
||||
my $func;
|
||||
while (<FH>) {
|
||||
if (/^\s*(\w+)\(/ || /^(?:\w+\*?\s+)+(?:\*\s*)?(\w+)\(/) {
|
||||
my $name = $1;
|
||||
if ($name !~ /ATTRIBUTE/) {
|
||||
$func = $name;
|
||||
}
|
||||
} elsif (/^\s*$/) {
|
||||
$func = undef;
|
||||
}
|
||||
if (/ATTRIBUTE_NOINLINE/) {
|
||||
if (defined $func) {
|
||||
$noninlined{$func} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close FH
|
||||
}
|
||||
|
||||
sub scan_overrides {
|
||||
my $file = shift;
|
||||
|
||||
open FH, $file or die "cannot read $file: $!";
|
||||
|
||||
my $func;
|
||||
while (<FH>) {
|
||||
if (/^(\w+)\(/ || /^\w+\s*(?:\*\s*)?(\w+)\(/) {
|
||||
my $name = $1;
|
||||
if ($name =~ /^vir/) {
|
||||
$mocked{$name} = "$file:$.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close FH
|
||||
}
|
26
build-aux/prohibit-duplicate-header.pl
Normal file
26
build-aux/prohibit-duplicate-header.pl
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env 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;
|
File diff suppressed because it is too large
Load Diff
@@ -1,226 +0,0 @@
|
||||
#!/bin/sh
|
||||
#! -*-perl-*-
|
||||
|
||||
# Detect instances of "if (p) free (p);".
|
||||
# Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
|
||||
|
||||
# Copyright (C) 2008-2019 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Written by Jim Meyering
|
||||
|
||||
# This is a prologue that allows to run a perl script as an executable
|
||||
# on systems that are compliant to a POSIX version before POSIX:2017.
|
||||
# On such systems, the usual invocation of an executable through execlp()
|
||||
# or execvp() fails with ENOEXEC if it is a script that does not start
|
||||
# with a #! line. The script interpreter mentioned in the #! line has
|
||||
# to be /bin/sh, because on GuixSD systems that is the only program that
|
||||
# has a fixed file name. The second line is essential for perl and is
|
||||
# also useful for editing this file in Emacs. The next two lines below
|
||||
# are valid code in both sh and perl. When executed by sh, they re-execute
|
||||
# the script through the perl program found in $PATH. The '-x' option
|
||||
# is essential as well; without it, perl would re-execute the script
|
||||
# through /bin/sh. When executed by perl, the next two lines are a no-op.
|
||||
eval 'exec perl -wSx "$0" "$@"'
|
||||
if 0;
|
||||
|
||||
my $VERSION = '2018-03-07 03:47'; # UTC
|
||||
# The definition above must lie within the first 8 lines in order
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long;
|
||||
|
||||
(my $ME = $0) =~ s|.*/||;
|
||||
|
||||
# use File::Coda; # https://meyering.net/code/Coda/
|
||||
END {
|
||||
defined fileno STDOUT or return;
|
||||
close STDOUT and return;
|
||||
warn "$ME: failed to close standard output: $!\n";
|
||||
$? ||= 1;
|
||||
}
|
||||
|
||||
sub usage ($)
|
||||
{
|
||||
my ($exit_code) = @_;
|
||||
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
||||
if ($exit_code != 0)
|
||||
{
|
||||
print $STREAM "Try '$ME --help' for more information.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $STREAM <<EOF;
|
||||
Usage: $ME [OPTIONS] FILE...
|
||||
|
||||
Detect any instance in FILE of a useless "if" test before a free call, e.g.,
|
||||
"if (p) free (p);". Any such test may be safely removed without affecting
|
||||
the semantics of the C code in FILE. Use --name=FOO --name=BAR to also
|
||||
detect free-like functions named FOO and BAR.
|
||||
|
||||
OPTIONS:
|
||||
|
||||
--list print only the name of each matching FILE (\\0-terminated)
|
||||
--name=N add name N to the list of \'free\'-like functions to detect;
|
||||
may be repeated
|
||||
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
Exit status:
|
||||
|
||||
0 one or more matches
|
||||
1 no match
|
||||
2 an error
|
||||
|
||||
EXAMPLE:
|
||||
|
||||
For example, this command prints all removable "if" tests before "free"
|
||||
and "kfree" calls in the linux kernel sources:
|
||||
|
||||
git ls-files -z |xargs -0 $ME --name=kfree
|
||||
|
||||
EOF
|
||||
}
|
||||
exit $exit_code;
|
||||
}
|
||||
|
||||
sub is_NULL ($)
|
||||
{
|
||||
my ($expr) = @_;
|
||||
return ($expr eq 'NULL' || $expr eq '0');
|
||||
}
|
||||
|
||||
{
|
||||
sub EXIT_MATCH {0}
|
||||
sub EXIT_NO_MATCH {1}
|
||||
sub EXIT_ERROR {2}
|
||||
my $err = EXIT_NO_MATCH;
|
||||
|
||||
my $list;
|
||||
my @name = qw(free);
|
||||
GetOptions
|
||||
(
|
||||
help => sub { usage 0 },
|
||||
version => sub { print "$ME version $VERSION\n"; exit },
|
||||
list => \$list,
|
||||
'name=s@' => \@name,
|
||||
) or usage 1;
|
||||
|
||||
# Make sure we have the right number of non-option arguments.
|
||||
# Always tell the user why we fail.
|
||||
@ARGV < 1
|
||||
and (warn "$ME: missing FILE argument\n"), usage EXIT_ERROR;
|
||||
|
||||
my $or = join '|', @name;
|
||||
my $regexp = qr/(?:$or)/;
|
||||
|
||||
# Set the input record separator.
|
||||
# Note: this makes it impractical to print line numbers.
|
||||
$/ = '"';
|
||||
|
||||
my $found_match = 0;
|
||||
FILE:
|
||||
foreach my $file (@ARGV)
|
||||
{
|
||||
open FH, '<', $file
|
||||
or (warn "$ME: can't open '$file' for reading: $!\n"),
|
||||
$err = EXIT_ERROR, next;
|
||||
while (defined (my $line = <FH>))
|
||||
{
|
||||
# Skip non-matching lines early to save time
|
||||
$line =~ /\bif\b/
|
||||
or next;
|
||||
while ($line =~
|
||||
/\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\)
|
||||
# 1 2 3
|
||||
(?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;|
|
||||
\s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg)
|
||||
{
|
||||
my $all = $1;
|
||||
my ($lhs, $rhs) = ($2, $3);
|
||||
my ($free_opnd, $braced_free_opnd) = ($4, $5);
|
||||
my $non_NULL;
|
||||
if (!defined $rhs) { $non_NULL = $lhs }
|
||||
elsif (is_NULL $rhs) { $non_NULL = $lhs }
|
||||
elsif (is_NULL $lhs) { $non_NULL = $rhs }
|
||||
else { next }
|
||||
|
||||
# Compare the non-NULL part of the "if" expression and the
|
||||
# free'd expression, without regard to white space.
|
||||
$non_NULL =~ tr/ \t//d;
|
||||
my $e2 = defined $free_opnd ? $free_opnd : $braced_free_opnd;
|
||||
$e2 =~ tr/ \t//d;
|
||||
if ($non_NULL eq $e2)
|
||||
{
|
||||
$found_match = 1;
|
||||
$list
|
||||
and (print "$file\0"), next FILE;
|
||||
print "$file: $all\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
continue
|
||||
{
|
||||
close FH;
|
||||
}
|
||||
|
||||
$found_match && $err == EXIT_NO_MATCH
|
||||
and $err = EXIT_MATCH;
|
||||
|
||||
exit $err;
|
||||
}
|
||||
|
||||
my $foo = <<'EOF';
|
||||
# The above is to *find* them.
|
||||
# This adjusts them, removing the unnecessary "if (p)" part.
|
||||
|
||||
# FIXME: do something like this as an option (doesn't do braces):
|
||||
free=xfree
|
||||
git grep -l -z "$free *(" \
|
||||
| xargs -0 useless-if-before-free -l --name="$free" \
|
||||
| xargs -0 perl -0x3b -pi -e \
|
||||
's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\)\s*;)/$2/s'
|
||||
|
||||
# Use the following to remove redundant uses of kfree inside braces.
|
||||
# Note that -0777 puts perl in slurp-whole-file mode;
|
||||
# but we have plenty of memory, these days...
|
||||
free=kfree
|
||||
git grep -l -z "$free *(" \
|
||||
| xargs -0 useless-if-before-free -l --name="$free" \
|
||||
| xargs -0 perl -0777 -pi -e \
|
||||
's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s*\{\s*('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\);)\s*\}[^\n]*$/$2/gms'
|
||||
|
||||
Be careful that the result of the above transformation is valid.
|
||||
If the matched string is followed by "else", then obviously, it won't be.
|
||||
|
||||
When modifying files, refuse to process anything other than a regular file.
|
||||
EOF
|
||||
|
||||
## Local Variables:
|
||||
## mode: perl
|
||||
## indent-tabs-mode: nil
|
||||
## eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
## time-stamp-line-limit: 50
|
||||
## time-stamp-start: "my $VERSION = '"
|
||||
## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
||||
## time-stamp-time-zone: "UTC0"
|
||||
## time-stamp-end: "'; # UTC"
|
||||
## End:
|
@@ -1,113 +0,0 @@
|
||||
#!/bin/sh
|
||||
# List version-controlled file names.
|
||||
|
||||
# Print a version string.
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 2006-2019 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# List the specified version-controlled files.
|
||||
# With no argument, list them all. With a single DIRECTORY argument,
|
||||
# list the version-controlled files in that directory.
|
||||
|
||||
# If there's an argument, it must be a single, "."-relative directory name.
|
||||
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
|
||||
|
||||
postprocess=
|
||||
case $1 in
|
||||
--help) cat <<EOF
|
||||
Usage: $0 [-C SRCDIR] [DIR...]
|
||||
|
||||
Output a list of version-controlled files in DIR (default .), relative to
|
||||
SRCDIR (default .). SRCDIR must be the top directory of a checkout.
|
||||
|
||||
Options:
|
||||
--help print this help, then exit
|
||||
--version print version number, then exit
|
||||
-C SRCDIR change directory to SRCDIR before generating list
|
||||
|
||||
Report bugs and patches to <bug-gnulib@gnu.org>.
|
||||
EOF
|
||||
exit ;;
|
||||
|
||||
--version)
|
||||
year=`echo "$scriptversion" | sed 's/[^0-9].*//'`
|
||||
cat <<EOF
|
||||
vc-list-files $scriptversion
|
||||
Copyright (C) $year Free Software Foundation, Inc,
|
||||
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law.
|
||||
EOF
|
||||
exit ;;
|
||||
|
||||
-C)
|
||||
test "$2" = . || postprocess="| sed 's|^|$2/|'"
|
||||
cd "$2" || exit 1
|
||||
shift; shift ;;
|
||||
esac
|
||||
|
||||
test $# = 0 && set .
|
||||
|
||||
for dir
|
||||
do
|
||||
if test -d .git || test -f .git; then
|
||||
test "x$dir" = x. \
|
||||
&& dir= sed_esc= \
|
||||
|| { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; }
|
||||
# Ignore git symlinks - either they point into the tree, in which case
|
||||
# we don't need to visit the target twice, or they point somewhere
|
||||
# else (often into a submodule), in which case the content does not
|
||||
# belong to this package.
|
||||
eval exec git ls-tree -r 'HEAD:"$dir"' \
|
||||
\| sed -n '"s/^100[^ ]*./$sed_esc/p"' $postprocess
|
||||
elif test -d .hg; then
|
||||
eval exec hg locate '"$dir/*"' $postprocess
|
||||
elif test -d .bzr; then
|
||||
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
||||
eval exec bzr ls -R --versioned '"$dir"' $postprocess
|
||||
elif test -d CVS; then
|
||||
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
||||
if test -x build-aux/cvsu; then
|
||||
eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
|
||||
elif (cvsu --help) >/dev/null 2>&1; then
|
||||
eval cvsu --find --types=AFGM '"$dir"' $postprocess
|
||||
else
|
||||
eval awk -F/ \''{ \
|
||||
if (!$1 && $3 !~ /^-/) { \
|
||||
f=FILENAME; \
|
||||
if (f ~ /CVS\/Entries$/) \
|
||||
f = substr(f, 1, length(f)-11); \
|
||||
print f $2; \
|
||||
}}'\'' \
|
||||
`find "$dir" -name Entries -print` /dev/null' $postprocess
|
||||
fi
|
||||
elif test -d .svn; then
|
||||
eval exec svn list -R '"$dir"' $postprocess
|
||||
else
|
||||
echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
268
ci/Makefile
268
ci/Makefile
@@ -1,268 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
# vim: filetype=make
|
||||
|
||||
# The root directory of the libvirt.git checkout
|
||||
CI_GIT_ROOT = $(shell git rev-parse --show-toplevel)
|
||||
|
||||
# The root directory for all CI-related contents
|
||||
CI_ROOTDIR = $(CI_GIT_ROOT)/ci
|
||||
|
||||
# The directory holding content on the host that we will
|
||||
# expose to the container.
|
||||
CI_SCRATCHDIR = $(CI_ROOTDIR)/scratch
|
||||
|
||||
# The directory holding the clone of the git repo that
|
||||
# we will expose to the container
|
||||
CI_HOST_SRCDIR = $(CI_SCRATCHDIR)/src
|
||||
|
||||
# The directory holding the source inside the
|
||||
# container, i.e. where we want to expose
|
||||
# the $(CI_HOST_SRCDIR) directory from the host
|
||||
CI_CONT_SRCDIR = $(CI_USER_HOME)/libvirt
|
||||
|
||||
# Relative directory to perform the build in. This
|
||||
# defaults to using a separate build dir, but can be
|
||||
# set to empty string for an in-source tree build.
|
||||
CI_VPATH = build
|
||||
|
||||
# The directory holding the build output inside the
|
||||
# container.
|
||||
CI_CONT_BUILDDIR = $(CI_CONT_SRCDIR)/$(CI_VPATH)
|
||||
|
||||
# Can be overridden with mingw{32,64}-configure if desired
|
||||
CI_CONFIGURE = $(CI_CONT_SRCDIR)/configure
|
||||
|
||||
# Default to using all possible CPUs
|
||||
CI_SMP = $(shell getconf _NPROCESSORS_ONLN)
|
||||
|
||||
# Any extra arguments to pass to make
|
||||
CI_MAKE_ARGS =
|
||||
|
||||
# Any extra arguments to pass to configure
|
||||
CI_CONFIGURE_ARGS =
|
||||
|
||||
# Script containing environment preparation steps
|
||||
CI_PREPARE_SCRIPT = $(CI_ROOTDIR)/prepare.sh
|
||||
|
||||
# Script containing build instructions
|
||||
CI_BUILD_SCRIPT = $(CI_ROOTDIR)/build.sh
|
||||
|
||||
# Location of the container images we're going to pull
|
||||
# Can be useful to overridde to use a locally built
|
||||
# image instead
|
||||
CI_IMAGE_PREFIX = quay.io/libvirt/buildenv-libvirt-
|
||||
|
||||
# The default tag is ':latest' but if the container
|
||||
# repo above uses different conventions this can override it
|
||||
CI_IMAGE_TAG = :latest
|
||||
|
||||
# We delete the virtual root after completion, set
|
||||
# to 0 if you need to keep it around for debugging
|
||||
CI_CLEAN = 1
|
||||
|
||||
# We'll always freshly clone the virtual root each
|
||||
# time in case it was not cleaned up before. Set
|
||||
# to 1 if you want to try restarting a previously
|
||||
# preserved env
|
||||
CI_REUSE = 0
|
||||
|
||||
# We need the container process to run with current host IDs
|
||||
# so that it can access the passed in build directory
|
||||
CI_UID = $(shell id -u)
|
||||
CI_GID = $(shell id -g)
|
||||
|
||||
# We also need the user's login and home directory to prepare the
|
||||
# environment the way some programs expect it
|
||||
CI_USER_LOGIN = $(shell echo "$$USER")
|
||||
CI_USER_HOME = $(shell echo "$$HOME")
|
||||
|
||||
CI_ENGINE = auto
|
||||
# Container engine we are going to use, can be overridden per make
|
||||
# invocation, if it is not we try podman and then default to docker.
|
||||
ifeq ($(CI_ENGINE),auto)
|
||||
override CI_ENGINE = $(shell podman version >/dev/null 2>&1 && echo podman || echo docker)
|
||||
endif
|
||||
|
||||
# IDs you run as do not need to exist in
|
||||
# the container's /etc/passwd & /etc/group files, but
|
||||
# if they do not, then libvirt's 'make check' will fail
|
||||
# many tests.
|
||||
|
||||
# We do not directly mount /etc/{passwd,group} as Docker
|
||||
# is liable to mess with SELinux labelling which will
|
||||
# then prevent the host accessing them. And podman cannot
|
||||
# relabel the files due to it running rootless. So
|
||||
# copying them first is safer and less error-prone.
|
||||
CI_PWDB_MOUNTS = \
|
||||
--volume $(CI_SCRATCHDIR)/group:/etc/group:ro,z \
|
||||
--volume $(CI_SCRATCHDIR)/passwd:/etc/passwd:ro,z \
|
||||
$(NULL)
|
||||
|
||||
CI_HOME_MOUNTS = \
|
||||
--volume $(CI_SCRATCHDIR)/home:$(CI_USER_HOME):z \
|
||||
$(NULL)
|
||||
|
||||
CI_SCRIPT_MOUNTS = \
|
||||
--volume $(CI_SCRATCHDIR)/prepare:$(CI_USER_HOME)/prepare:z \
|
||||
--volume $(CI_SCRATCHDIR)/build:$(CI_USER_HOME)/build:z \
|
||||
$(NULL)
|
||||
|
||||
# Docker containers can have very large ulimits
|
||||
# for nofiles - as much as 1048576. This makes
|
||||
# libvirt very slow at exec'ing programs.
|
||||
CI_ULIMIT_FILES = 1024
|
||||
|
||||
ifeq ($(CI_ENGINE),podman)
|
||||
# Podman cannot reuse host namespace when running non-root
|
||||
# containers. Until support for --keep-uid is added we can
|
||||
# just create another mapping that will do that for us.
|
||||
# Beware, that in {uid,git}map=container_id:host_id:range, the
|
||||
# host_id does actually refer to the uid in the first mapping
|
||||
# where 0 (root) is mapped to the current user and rest is
|
||||
# offset.
|
||||
#
|
||||
# In order to set up this mapping, we need to keep all the
|
||||
# user IDs to prevent possible errors as some images might
|
||||
# expect UIDs up to 90000 (looking at you fedora), so we don't
|
||||
# want the overflowuid to be used for them. For mapping all
|
||||
# the other users properly, some math needs to be done.
|
||||
# Don't worry, it's just addition and subtraction.
|
||||
#
|
||||
# 65536 ought to be enough (tm), but for really rare cases the
|
||||
# maximums might need to be higher, but that only happens when
|
||||
# your /etc/sub{u,g}id allow users to have more IDs. Unless
|
||||
# --keep-uid is supported, let's do this in a way that should
|
||||
# work for everyone.
|
||||
CI_MAX_UID = $(shell sed -n "s/^$(CI_USER_LOGIN):[^:]\+://p" /etc/subuid)
|
||||
CI_MAX_GID = $(shell sed -n "s/^$(CI_USER_LOGIN):[^:]\+://p" /etc/subgid)
|
||||
ifeq ($(CI_MAX_UID),)
|
||||
CI_MAX_UID = 65536
|
||||
endif
|
||||
ifeq ($(CI_MAX_GID),)
|
||||
CI_MAX_GID = 65536
|
||||
endif
|
||||
CI_UID_OTHER = $(shell echo $$(($(CI_UID)+1)))
|
||||
CI_GID_OTHER = $(shell echo $$(($(CI_GID)+1)))
|
||||
CI_UID_OTHER_RANGE = $(shell echo $$(($(CI_MAX_UID)-$(CI_UID))))
|
||||
CI_GID_OTHER_RANGE = $(shell echo $$(($(CI_MAX_GID)-$(CI_GID))))
|
||||
|
||||
CI_PODMAN_ARGS = \
|
||||
--uidmap 0:1:$(CI_UID) \
|
||||
--uidmap $(CI_UID):0:1 \
|
||||
--uidmap $(CI_UID_OTHER):$(CI_UID_OTHER):$(CI_UID_OTHER_RANGE) \
|
||||
--gidmap 0:1:$(CI_GID) \
|
||||
--gidmap $(CI_GID):0:1 \
|
||||
--gidmap $(CI_GID_OTHER):$(CI_GID_OTHER):$(CI_GID_OTHER_RANGE) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
# Args to use when cloning a git repo.
|
||||
# -c stop it complaining about checking out a random hash
|
||||
# -q stop it displaying progress info for local clone
|
||||
# --local ensure we don't actually copy files
|
||||
CI_GIT_ARGS = \
|
||||
-c advice.detachedHead=false \
|
||||
-q \
|
||||
--local \
|
||||
$(NULL)
|
||||
|
||||
# Args to use when running the container
|
||||
# --rm stop inactive containers getting left behind
|
||||
# --user we execute as the same user & group account
|
||||
# as dev so that file ownership matches host
|
||||
# instead of root:root
|
||||
# --volume to pass in the cloned git repo & config
|
||||
# --ulimit lower files limit for performance reasons
|
||||
# --interactive
|
||||
# --tty Ensure we have ability to Ctrl-C the build
|
||||
CI_ENGINE_ARGS = \
|
||||
--rm \
|
||||
--interactive \
|
||||
--tty \
|
||||
$(CI_PODMAN_ARGS) \
|
||||
$(CI_PWDB_MOUNTS) \
|
||||
$(CI_HOME_MOUNTS) \
|
||||
$(CI_SCRIPT_MOUNTS) \
|
||||
--volume $(CI_HOST_SRCDIR):$(CI_CONT_SRCDIR):z \
|
||||
--ulimit nofile=$(CI_ULIMIT_FILES):$(CI_ULIMIT_FILES) \
|
||||
--cap-add=SYS_PTRACE \
|
||||
$(NULL)
|
||||
|
||||
ci-check-engine:
|
||||
@echo -n "Checking if $(CI_ENGINE) is available..." && \
|
||||
$(CI_ENGINE) version 1>/dev/null && echo "yes"
|
||||
|
||||
ci-prepare-tree: ci-check-engine
|
||||
@test "$(CI_REUSE)" != "1" && rm -rf $(CI_SCRATCHDIR) || :
|
||||
@if ! test -d $(CI_SCRATCHDIR) ; then \
|
||||
mkdir -p $(CI_SCRATCHDIR); \
|
||||
cp /etc/passwd $(CI_SCRATCHDIR); \
|
||||
cp /etc/group $(CI_SCRATCHDIR); \
|
||||
mkdir -p $(CI_SCRATCHDIR)/home; \
|
||||
cp "$(CI_PREPARE_SCRIPT)" $(CI_SCRATCHDIR)/prepare; \
|
||||
cp "$(CI_BUILD_SCRIPT)" $(CI_SCRATCHDIR)/build; \
|
||||
chmod +x "$(CI_SCRATCHDIR)/prepare" "$(CI_SCRATCHDIR)/build"; \
|
||||
echo "Cloning $(CI_GIT_ROOT) to $(CI_HOST_SRCDIR)"; \
|
||||
git clone $(CI_GIT_ARGS) $(CI_GIT_ROOT) $(CI_HOST_SRCDIR) || exit 1; \
|
||||
for mod in $$(git submodule | awk '{ print $$2 }' | sed -E 's,^../,,g') ; \
|
||||
do \
|
||||
test -f $(CI_GIT_ROOT)/$$mod/.git || continue ; \
|
||||
echo "Cloning $(CI_GIT_ROOT)/$$mod to $(CI_HOST_SRCDIR)/$$mod"; \
|
||||
git clone $(CI_GIT_ARGS) $(CI_GIT_ROOT)/$$mod $(CI_HOST_SRCDIR)/$$mod || exit 1; \
|
||||
done ; \
|
||||
fi
|
||||
|
||||
ci-run-command@%: ci-prepare-tree
|
||||
$(CI_ENGINE) run $(CI_ENGINE_ARGS) $(CI_IMAGE_PREFIX)$*$(CI_IMAGE_TAG) \
|
||||
/bin/bash -c ' \
|
||||
$(CI_USER_HOME)/prepare || exit 1; \
|
||||
sudo \
|
||||
--login \
|
||||
--user="#$(CI_UID)" \
|
||||
--group="#$(CI_GID)" \
|
||||
CI_CONT_SRCDIR="$(CI_CONT_SRCDIR)" \
|
||||
CI_CONT_BUILDDIR="$(CI_CONT_BUILDDIR)" \
|
||||
CI_SMP="$(CI_SMP)" \
|
||||
CI_CONFIGURE="$(CI_CONFIGURE)" \
|
||||
CI_CONFIGURE_ARGS="$(CI_CONFIGURE_ARGS)" \
|
||||
CI_MAKE_ARGS="$(CI_MAKE_ARGS)" \
|
||||
$(CI_COMMAND) || exit 1'
|
||||
@test "$(CI_CLEAN)" = "1" && rm -rf $(CI_SCRATCHDIR) || :
|
||||
|
||||
ci-shell@%:
|
||||
$(MAKE) -C $(CI_ROOTDIR) ci-run-command@$* CI_COMMAND="/bin/bash"
|
||||
|
||||
ci-build@%:
|
||||
$(MAKE) -C $(CI_ROOTDIR) ci-run-command@$* CI_COMMAND="$(CI_USER_HOME)/build"
|
||||
|
||||
ci-check@%:
|
||||
$(MAKE) -C $(CI_ROOTDIR) ci-build@$* CI_MAKE_ARGS="check"
|
||||
|
||||
ci-list-images:
|
||||
@echo
|
||||
@echo "Available x86 container images:"
|
||||
@echo
|
||||
@sh list-images.sh "$(CI_ENGINE)" "$(CI_IMAGE_PREFIX)" | grep -v cross
|
||||
@echo
|
||||
@echo "Available cross-compiler container images:"
|
||||
@echo
|
||||
@sh list-images.sh "$(CI_ENGINE)" "$(CI_IMAGE_PREFIX)" | grep cross
|
||||
@echo
|
||||
|
||||
ci-help:
|
||||
@echo "Build libvirt inside containers used for CI"
|
||||
@echo
|
||||
@echo "Available targets:"
|
||||
@echo
|
||||
@echo " ci-build@\$$IMAGE - run a default 'make'"
|
||||
@echo " ci-check@\$$IMAGE - run a 'make check'"
|
||||
@echo " ci-shell@\$$IMAGE - run an interactive shell"
|
||||
@echo " ci-list-images - list available images"
|
||||
@echo " ci-help - show this help message"
|
||||
@echo
|
||||
@echo "Available make variables:"
|
||||
@echo
|
||||
@echo " CI_CLEAN=0 - do not delete '$(CI_SCRATCHDIR)' after completion"
|
||||
@echo " CI_REUSE=1 - re-use existing '$(CI_SCRATCHDIR)' content"
|
||||
@echo " CI_ENGINE=auto - container engine to use (podman, docker)"
|
||||
@echo
|
40
ci/build.sh
40
ci/build.sh
@@ -1,40 +0,0 @@
|
||||
# This script is used to build libvirt inside the container.
|
||||
#
|
||||
# You can customize it to your liking, or alternatively use a
|
||||
# completely different script by passing
|
||||
#
|
||||
# CI_BUILD_SCRIPT=/path/to/your/build/script
|
||||
#
|
||||
# to make.
|
||||
|
||||
mkdir -p "$CI_CONT_BUILDDIR" || exit 1
|
||||
cd "$CI_CONT_BUILDDIR"
|
||||
|
||||
export VIR_TEST_DEBUG=1
|
||||
NOCONFIGURE=1 "$CI_CONT_SRCDIR/autogen.sh" || exit 1
|
||||
|
||||
# $CONFIGURE_OPTS is a env that can optionally be set in the container,
|
||||
# populated at build time from the Dockerfile. A typical use case would
|
||||
# be to pass --host/--target args to trigger cross-compilation
|
||||
#
|
||||
# This can be augmented by make local args in $CI_CONFIGURE_ARGS
|
||||
"$CI_CONFIGURE" $CONFIGURE_OPTS $CI_CONFIGURE_ARGS
|
||||
if test $? != 0; then
|
||||
test -f config.log && cat config.log
|
||||
exit 1
|
||||
fi
|
||||
find -name test-suite.log -delete
|
||||
|
||||
# gl_public_submodule_commit= to disable gnulib's submodule check
|
||||
# which breaks due to way we clone the submodules
|
||||
make -j"$CI_SMP" gl_public_submodule_commit= $CI_MAKE_ARGS
|
||||
|
||||
if test $? != 0; then \
|
||||
LOGS=$(find -name test-suite.log)
|
||||
if test "$LOGS"; then
|
||||
echo "=== LOG FILE(S) START ==="
|
||||
cat $LOGS
|
||||
echo "=== LOG FILE(S) END ==="
|
||||
fi
|
||||
exit 1
|
||||
fi
|
@@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
engine="$1"
|
||||
prefix="$2"
|
||||
|
||||
do_podman() {
|
||||
# Podman freaks out if the search term ends with a dash, which ours
|
||||
# by default does, so let's strip it. The repository name is the
|
||||
# second field in the output, and it already starts with the registry
|
||||
podman search --limit 100 "${prefix%-}" | while read _ repo _; do
|
||||
echo "$repo"
|
||||
done
|
||||
}
|
||||
|
||||
do_docker() {
|
||||
# Docker doesn't include the registry name in the output, so we have
|
||||
# to add it. The repository name is the first field in the output
|
||||
registry="${prefix%%/*}"
|
||||
docker search --limit 100 "$prefix" | while read repo _; do
|
||||
echo "$registry/$repo"
|
||||
done
|
||||
}
|
||||
|
||||
"do_$engine" | grep "^$prefix" | sed "s,^$prefix,,g" | while read repo; do
|
||||
echo " $repo"
|
||||
done | sort -u
|
@@ -1,13 +0,0 @@
|
||||
# This script is used to prepare the environment that will be used
|
||||
# to build libvirt inside the container.
|
||||
#
|
||||
# You can customize it to your liking, or alternatively use a
|
||||
# completely different script by passing
|
||||
#
|
||||
# CI_PREPARE_SCRIPT=/path/to/your/prepare/script
|
||||
#
|
||||
# to make.
|
||||
#
|
||||
# Note that this script will have root privileges inside the
|
||||
# container, so it can be used for things like installing additional
|
||||
# packages.
|
@@ -16,8 +16,64 @@
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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
|
||||
* functions with the code in question disabled, and for that we
|
||||
* must override the main config.h rules. Hence this file :-(
|
||||
*/
|
||||
|
||||
#ifdef LIBVIRT_SETUID_RPC_CLIENT
|
||||
# undef HAVE_LIBNL
|
||||
# undef HAVE_LIBNL3
|
||||
# undef HAVE_LIBSASL2
|
||||
# undef HAVE_SYS_ACL_H
|
||||
# undef WITH_CAPNG
|
||||
# undef WITH_CURL
|
||||
# undef WITH_DBUS
|
||||
# undef WITH_DEVMAPPER
|
||||
# undef WITH_DTRACE_PROBES
|
||||
# undef WITH_GNUTLS
|
||||
# undef WITH_LIBSSH
|
||||
# undef WITH_MACVTAP
|
||||
# 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_LIBNL
|
||||
# undef HAVE_LIBNL3
|
||||
# undef HAVE_LIBSASL2
|
||||
# undef HAVE_SYS_ACL_H
|
||||
# undef WITH_CAPNG
|
||||
# undef WITH_CURL
|
||||
# undef WITH_DEVMAPPER
|
||||
# undef WITH_DTRACE_PROBES
|
||||
# undef WITH_GNUTLS
|
||||
# undef WITH_LIBSSH
|
||||
# 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 */
|
||||
|
||||
#ifndef __GNUC__
|
||||
# error "Libvirt requires GCC >= 4.8, or CLang"
|
||||
# error "Libvirt requires GCC >= 4.4, or CLang"
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -32,30 +88,6 @@
|
||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
#endif
|
||||
|
||||
#if defined(__clang_major__) && defined(__clang_minor__)
|
||||
# ifdef __apple_build_version__
|
||||
# if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1)
|
||||
# error You need at least XCode Clang v5.1 to compile QEMU
|
||||
# endif
|
||||
# else
|
||||
# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4)
|
||||
# error You need at least Clang v3.4 to compile QEMU
|
||||
# endif
|
||||
# endif
|
||||
#elif defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
|
||||
# error You need at least GCC v4.8 to compile QEMU
|
||||
# endif
|
||||
#else
|
||||
# error You either need at least GCC 4.8 or Clang 3.4 or XCode Clang 5.1 to compile libvirt
|
||||
#if !(__GNUC_PREREQ(4, 4) || defined(__clang__))
|
||||
# error "Libvirt requires GCC >= 4.4, or CLang"
|
||||
#endif
|
||||
|
||||
/* Ask for warnings for anything that was marked deprecated in
|
||||
* the defined version, or before. It is a candidate for rewrite.
|
||||
*/
|
||||
#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_48
|
||||
|
||||
/* Ask for warnings if code tries to use function that did not
|
||||
* exist in the defined version. These risk breaking builds
|
||||
*/
|
||||
#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_48
|
||||
|
227
configure.ac
227
configure.ac
@@ -16,27 +16,15 @@ 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], [6.0.0], [libvir-list@redhat.com], [], [https://libvirt.org])
|
||||
|
||||
if test $srcdir = "."
|
||||
then
|
||||
AC_MSG_ERROR([Build directory must be different from source directory])
|
||||
fi
|
||||
|
||||
AC_INIT([libvirt], [4.5.0], [libvir-list@redhat.com], [], [https://libvirt.org])
|
||||
AC_CONFIG_SRCDIR([src/libvirt.c])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AH_BOTTOM([#include <config-post.h>])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
dnl Make automake keep quiet about wildcards & other GNUmake-isms
|
||||
AM_INIT_AUTOMAKE([
|
||||
foreign
|
||||
-Wno-portability
|
||||
tar-pax
|
||||
no-dist-gzip
|
||||
dist-xz
|
||||
subdir-objects
|
||||
])
|
||||
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])
|
||||
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
|
||||
@@ -129,29 +117,12 @@ AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_CPP
|
||||
|
||||
dnl autoconf 2.70 adds a --runstatedir option so that downstreams
|
||||
dnl can point to /run instead of the historic /var/run, but
|
||||
dnl autoconf hasn't had a release since 2012.
|
||||
dnl
|
||||
dnl gnulib sets configmake.h to include runstatedir, but sets
|
||||
dnl it to $localstatedir/run if $runstatedir env var is not set
|
||||
dnl which is useless for apps that need to use /run without
|
||||
dnl waiting for autoconf 2.70
|
||||
dnl
|
||||
dnl we introduce --with-runstatedir and then overwrite the
|
||||
dnl value of $runstatedir so gnulib's configmake.h becomes useful
|
||||
AC_ARG_WITH(
|
||||
[runstatedir],
|
||||
[AS_HELP_STRING(
|
||||
[--with-runstatedir],
|
||||
[State directory for temporary sockets, pid files, etc])])
|
||||
|
||||
if test -n "$with_runstatedir"
|
||||
then
|
||||
runstatedir=$with_runstatedir
|
||||
dnl Setting AB_VERSION makes the 'autobuild' lines of configure output
|
||||
dnl slightly more useful
|
||||
if test -d $srcdir/.git && git --version >/dev/null 2>&1 ; then
|
||||
AB_VERSION=`cd $srcdir && git describe --match 'v[[0-9]]*' 2>/dev/null`
|
||||
fi
|
||||
|
||||
|
||||
gl_EARLY
|
||||
gl_INIT
|
||||
|
||||
@@ -203,13 +174,13 @@ want_ifconfig=no
|
||||
dnl Make some notes about which OS we're compiling for, as the lxc and qemu
|
||||
dnl drivers require linux headers, and storage_mpath, dtrace, and nwfilter
|
||||
dnl are also linux specific. The "network" and storage_fs drivers are known
|
||||
dnl to not work on macOS presently, so we also make a note if compiling
|
||||
dnl to not work on MacOS X presently, so we also make a note if compiling
|
||||
dnl for that
|
||||
|
||||
with_linux=no with_macos=no with_freebsd=no with_win=no with_cygwin=no
|
||||
with_linux=no with_osx=no with_freebsd=no with_win=no with_cygwin=no
|
||||
case $host in
|
||||
*-*-linux*) with_linux=yes ;;
|
||||
*-*-darwin*) with_macos=yes ;;
|
||||
*-*-darwin*) with_osx=yes ;;
|
||||
*-*-freebsd*) with_freebsd=yes ;;
|
||||
*-*-mingw* | *-*-msvc* ) with_win=yes ;;
|
||||
*-*-cygwin*) with_cygwin=yes ;;
|
||||
@@ -235,7 +206,6 @@ fi
|
||||
|
||||
AM_CONDITIONAL([WITH_LINUX], [test "$with_linux" = "yes"])
|
||||
AM_CONDITIONAL([WITH_FREEBSD], [test "$with_freebsd" = "yes"])
|
||||
AM_CONDITIONAL([WITH_MACOS], [test "$with_macos" = "yes"])
|
||||
|
||||
# We don't support the daemon yet
|
||||
if test "$with_win" = "yes" ; then
|
||||
@@ -255,6 +225,7 @@ if test "$with_libvirtd" = "no" ; then
|
||||
with_qemu=no
|
||||
with_lxc=no
|
||||
with_libxl=no
|
||||
with_uml=no
|
||||
with_vbox=no
|
||||
fi
|
||||
|
||||
@@ -269,17 +240,16 @@ LIBVIRT_LINKER_NO_UNDEFINED
|
||||
LIBVIRT_ARG_APPARMOR
|
||||
LIBVIRT_ARG_ATTR
|
||||
LIBVIRT_ARG_AUDIT
|
||||
LIBVIRT_ARG_AVAHI
|
||||
LIBVIRT_ARG_BASH_COMPLETION
|
||||
LIBVIRT_ARG_BLKID
|
||||
LIBVIRT_ARG_CAPNG
|
||||
LIBVIRT_ARG_CURL
|
||||
LIBVIRT_ARG_DBUS
|
||||
LIBVIRT_ARG_FIREWALLD
|
||||
LIBVIRT_ARG_FIREWALLD_ZONE
|
||||
LIBVIRT_ARG_FUSE
|
||||
LIBVIRT_ARG_GLUSTER
|
||||
LIBVIRT_ARG_HAL
|
||||
LIBVIRT_ARG_LIBISCSI
|
||||
LIBVIRT_ARG_LIBPCAP
|
||||
LIBVIRT_ARG_LIBSSH
|
||||
LIBVIRT_ARG_LIBXML
|
||||
@@ -307,6 +277,7 @@ LIBVIRT_CHECK_APPARMOR
|
||||
LIBVIRT_CHECK_ATOMIC
|
||||
LIBVIRT_CHECK_ATTR
|
||||
LIBVIRT_CHECK_AUDIT
|
||||
LIBVIRT_CHECK_AVAHI
|
||||
LIBVIRT_CHECK_BASH_COMPLETION
|
||||
LIBVIRT_CHECK_BLKID
|
||||
LIBVIRT_CHECK_CAPNG
|
||||
@@ -315,13 +286,10 @@ LIBVIRT_CHECK_DBUS
|
||||
LIBVIRT_CHECK_DEVMAPPER
|
||||
LIBVIRT_CHECK_DLOPEN
|
||||
LIBVIRT_CHECK_FIREWALLD
|
||||
LIBVIRT_CHECK_FIREWALLD_ZONE
|
||||
LIBVIRT_CHECK_FUSE
|
||||
LIBVIRT_CHECK_GLIB
|
||||
LIBVIRT_CHECK_GLUSTER
|
||||
LIBVIRT_CHECK_GNUTLS
|
||||
LIBVIRT_CHECK_HAL
|
||||
LIBVIRT_CHECK_LIBISCSI
|
||||
LIBVIRT_CHECK_LIBNL
|
||||
LIBVIRT_CHECK_LIBPARTED
|
||||
LIBVIRT_CHECK_LIBPCAP
|
||||
@@ -352,50 +320,17 @@ AC_CHECK_SIZEOF([long])
|
||||
|
||||
dnl Availability of various common functions (non-fatal if missing),
|
||||
dnl and various less common threadsafe functions
|
||||
AC_CHECK_FUNCS_ONCE([\
|
||||
cfmakeraw \
|
||||
fallocate \
|
||||
geteuid \
|
||||
getgid \
|
||||
getifaddrs \
|
||||
getmntent_r \
|
||||
getpwuid_r \
|
||||
getrlimit \
|
||||
getuid \
|
||||
getutxid \
|
||||
if_indextoname \
|
||||
mmap \
|
||||
newlocale \
|
||||
posix_fallocate \
|
||||
posix_memalign \
|
||||
prlimit \
|
||||
sched_getaffinity \
|
||||
sched_setscheduler \
|
||||
setgroups \
|
||||
setns \
|
||||
setrlimit \
|
||||
symlink \
|
||||
sysctlbyname \
|
||||
unshare \
|
||||
])
|
||||
AC_CHECK_FUNCS_ONCE([cfmakeraw fallocate geteuid getgid getgrnam_r \
|
||||
getmntent_r getpwuid_r getrlimit getuid if_indextoname kill mmap \
|
||||
newlocale posix_fallocate posix_memalign prlimit regexec \
|
||||
sched_getaffinity setgroups setns setrlimit symlink sysctlbyname \
|
||||
getifaddrs sched_setscheduler unshare])
|
||||
|
||||
dnl Availability of various common headers (non-fatal if missing).
|
||||
AC_CHECK_HEADERS([\
|
||||
ifaddrs.h \
|
||||
libtasn1.h \
|
||||
linux/magic.h \
|
||||
mntent.h \
|
||||
net/ethernet.h \
|
||||
netinet/tcp.h \
|
||||
pwd.h \
|
||||
stdarg.h \
|
||||
syslog.h \
|
||||
sys/mount.h \
|
||||
sys/syscall.h \
|
||||
sys/sysctl.h \
|
||||
sys/ucred.h \
|
||||
sys/un.h \
|
||||
])
|
||||
AC_CHECK_HEADERS([pwd.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 stdarg.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])
|
||||
@@ -438,6 +373,19 @@ dnl
|
||||
|
||||
LIBVIRT_CHECK_EXTERNAL_PROGRAMS
|
||||
|
||||
|
||||
dnl Specific dir for HTML output ?
|
||||
LIBVIRT_ARG_WITH([HTML_DIR], [path to base html directory],
|
||||
['$(datadir)/doc'])
|
||||
LIBVIRT_ARG_WITH([HTML_SUBDIR], [directory used under html-dir],
|
||||
['$(PACKAGE)-$(VERSION)/html'])
|
||||
if test "x$with_html_subdir" != "x" ; then
|
||||
HTML_DIR="$with_html_dir/$with_html_subdir"
|
||||
else
|
||||
HTML_DIR="$with_html_dir"
|
||||
fi
|
||||
AC_SUBST([HTML_DIR])
|
||||
|
||||
dnl if --prefix is /usr, don't use /usr/var for localstatedir
|
||||
dnl or /usr/etc for sysconfdir
|
||||
dnl as this makes a lot of things break in testing situations
|
||||
@@ -456,11 +404,14 @@ dnl
|
||||
LIBVIRT_DRIVER_ARG_QEMU
|
||||
LIBVIRT_DRIVER_ARG_OPENVZ
|
||||
LIBVIRT_DRIVER_ARG_VMWARE
|
||||
LIBVIRT_DRIVER_ARG_PHYP
|
||||
LIBVIRT_DRIVER_ARG_XENAPI
|
||||
LIBVIRT_DRIVER_ARG_LIBXL
|
||||
LIBVIRT_DRIVER_ARG_VBOX
|
||||
LIBVIRT_DRIVER_ARG_LXC
|
||||
LIBVIRT_DRIVER_ARG_VZ
|
||||
LIBVIRT_DRIVER_ARG_BHYVE
|
||||
LIBVIRT_DRIVER_ARG_UML
|
||||
LIBVIRT_DRIVER_ARG_ESX
|
||||
LIBVIRT_DRIVER_ARG_HYPERV
|
||||
LIBVIRT_DRIVER_ARG_TEST
|
||||
@@ -472,11 +423,14 @@ LIBVIRT_DRIVER_ARG_INTERFACE
|
||||
LIBVIRT_DRIVER_CHECK_QEMU
|
||||
LIBVIRT_DRIVER_CHECK_OPENVZ
|
||||
LIBVIRT_DRIVER_CHECK_VMWARE
|
||||
LIBVIRT_DRIVER_CHECK_PHYP
|
||||
LIBVIRT_DRIVER_CHECK_XENAPI
|
||||
LIBVIRT_DRIVER_CHECK_LIBXL
|
||||
LIBVIRT_DRIVER_CHECK_VBOX
|
||||
LIBVIRT_DRIVER_CHECK_LXC
|
||||
LIBVIRT_DRIVER_CHECK_VZ
|
||||
LIBVIRT_DRIVER_CHECK_BHYVE
|
||||
LIBVIRT_DRIVER_CHECK_UML
|
||||
LIBVIRT_DRIVER_CHECK_ESX
|
||||
LIBVIRT_DRIVER_CHECK_HYPERV
|
||||
LIBVIRT_DRIVER_CHECK_TEST
|
||||
@@ -485,6 +439,8 @@ LIBVIRT_DRIVER_CHECK_LIBVIRTD
|
||||
LIBVIRT_DRIVER_CHECK_NETWORK
|
||||
LIBVIRT_DRIVER_CHECK_INTERFACE
|
||||
|
||||
AM_CONDITIONAL([WITH_XENCONFIG], [test "$with_libxl" = "yes"])
|
||||
|
||||
|
||||
dnl
|
||||
dnl in case someone want to build static binaries
|
||||
@@ -532,6 +488,9 @@ dnl
|
||||
AC_CHECK_HEADERS([linux/kvm.h])
|
||||
|
||||
|
||||
AM_CONDITIONAL([WITH_SETUID_RPC_CLIENT], [test "$with_lxc$with_login_shell" != "nono"])
|
||||
|
||||
|
||||
dnl
|
||||
dnl check for kernel headers required by src/bridge.c
|
||||
dnl
|
||||
@@ -603,7 +562,6 @@ LIBVIRT_STORAGE_ARG_DIR
|
||||
LIBVIRT_STORAGE_ARG_FS
|
||||
LIBVIRT_STORAGE_ARG_LVM
|
||||
LIBVIRT_STORAGE_ARG_ISCSI
|
||||
LIBVIRT_STORAGE_ARG_ISCSI_DIRECT
|
||||
LIBVIRT_STORAGE_ARG_SCSI
|
||||
LIBVIRT_STORAGE_ARG_MPATH
|
||||
LIBVIRT_STORAGE_ARG_DISK
|
||||
@@ -618,7 +576,6 @@ if test "$with_libvirtd" = "no"; then
|
||||
with_storage_fs=no
|
||||
with_storage_lvm=no
|
||||
with_storage_iscsi=no
|
||||
with_storage_iscsi_direct=no
|
||||
with_storage_scsi=no
|
||||
with_storage_mpath=no
|
||||
with_storage_disk=no
|
||||
@@ -629,9 +586,9 @@ if test "$with_libvirtd" = "no"; then
|
||||
with_storage_vstorage=no
|
||||
fi
|
||||
|
||||
dnl storage-fs does not work on macOS
|
||||
dnl storage-fs does not work on MacOS X
|
||||
|
||||
if test "$with_macos" = "yes"; then
|
||||
if test "$with_osx" = "yes"; then
|
||||
with_storage_fs=no
|
||||
fi
|
||||
|
||||
@@ -639,7 +596,6 @@ LIBVIRT_STORAGE_CHECK_DIR
|
||||
LIBVIRT_STORAGE_CHECK_FS
|
||||
LIBVIRT_STORAGE_CHECK_LVM
|
||||
LIBVIRT_STORAGE_CHECK_ISCSI
|
||||
LIBVIRT_STORAGE_CHECK_ISCSI_DIRECT
|
||||
LIBVIRT_STORAGE_CHECK_SCSI
|
||||
LIBVIRT_STORAGE_CHECK_MPATH
|
||||
LIBVIRT_STORAGE_CHECK_DISK
|
||||
@@ -650,7 +606,7 @@ LIBVIRT_STORAGE_CHECK_ZFS
|
||||
LIBVIRT_STORAGE_CHECK_VSTORAGE
|
||||
|
||||
with_storage=no
|
||||
for backend in dir fs lvm iscsi iscsi_direct scsi mpath rbd disk; do
|
||||
for backend in dir fs lvm iscsi scsi mpath rbd disk; do
|
||||
if eval test \$with_storage_$backend = yes; then
|
||||
with_storage=yes
|
||||
break
|
||||
@@ -669,13 +625,6 @@ if test "$with_linux" = "yes"; then
|
||||
AC_CHECK_HEADERS([linux/btrfs.h])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl check for xfs dev headers required by xfs ioctl
|
||||
dnl
|
||||
if test "$with_linux" = "yes"; then
|
||||
AC_CHECK_HEADERS([xfs/xfs.h])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl check for DEVLINK_CMD_ESWITCH_GET
|
||||
dnl
|
||||
@@ -699,23 +648,10 @@ if test "$with_linux" = "yes"; then
|
||||
fi
|
||||
|
||||
dnl Allow perl/python overrides
|
||||
AC_PATH_PROGS([PYTHON], [python3])
|
||||
AC_PATH_PROGS([PYTHON], [python3 python2 python])
|
||||
if test -z "$PYTHON"; then
|
||||
AC_MSG_ERROR(['python3' binary is required to build libvirt])
|
||||
AC_MSG_ERROR(['python3', 'python2' or 'python' binary is required to build libvirt])
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([PYTHON], "$PYTHON", [path to python binary])
|
||||
AC_PATH_PROG([FLAKE8], [flake8])
|
||||
if test -z "$FLAKE8"; then
|
||||
AC_MSG_WARN(['flake8' binary is required to check python code style])
|
||||
fi
|
||||
|
||||
dnl Python3 < 3.7 treats the C locale as 7-bit only.
|
||||
dnl We must force env vars so it treats it as UTF-8
|
||||
dnl regardless of the user's locale.
|
||||
RUNUTF8="LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8"
|
||||
AC_SUBST(RUNUTF8)
|
||||
|
||||
|
||||
AC_PATH_PROG([PERL], [perl])
|
||||
if test -z "$PERL"; then
|
||||
AC_MSG_ERROR(['perl' binary is required to build libvirt])
|
||||
@@ -776,6 +712,34 @@ if test "$enable_test_coverage" = yes; then
|
||||
WARN_CFLAGS=$save_WARN_CFLAGS
|
||||
fi
|
||||
|
||||
LIBVIRT_ARG_ENABLE([TEST_OOM], [memory allocation failure checking], [no])
|
||||
case "$enable_test_oom" in
|
||||
yes|no) ;;
|
||||
*) AC_MSG_ERROR([bad value ${enable_test_oom} for test-oom option]) ;;
|
||||
esac
|
||||
|
||||
if test "$enable_test_oom" = yes; then
|
||||
have_trace=yes
|
||||
AC_CHECK_HEADER([execinfo.h],[],[have_trace=no])
|
||||
AC_CHECK_FUNC([backtrace],[],[have_trace=no])
|
||||
if test "$have_trace" = "yes"; then
|
||||
AC_DEFINE([TEST_OOM_TRACE], 1, [Whether backtrace() is available])
|
||||
fi
|
||||
AC_DEFINE([TEST_OOM], 1, [Whether malloc OOM checking is enabled])
|
||||
fi
|
||||
|
||||
LIBVIRT_ARG_ENABLE([TEST_LOCKING], [thread locking tests using CIL], [no])
|
||||
case "$enable_test_locking" in
|
||||
yes|no) ;;
|
||||
*) AC_MSG_ERROR([bad value ${enable_test_locking} for test-locking option]) ;;
|
||||
esac
|
||||
|
||||
if test "$enable_test_locking" = "yes"; then
|
||||
LOCK_CHECKING_CFLAGS="-save-temps"
|
||||
AC_SUBST([LOCK_CHECKING_CFLAGS])
|
||||
fi
|
||||
AM_CONDITIONAL([WITH_CIL],[test "$enable_test_locking" = "yes"])
|
||||
|
||||
dnl Cygwin, MinGW and MSVC checks
|
||||
LIBVIRT_WIN_CHECK_COMMON
|
||||
LIBVIRT_WIN_CHECK_CYGWIN
|
||||
@@ -880,12 +844,6 @@ AC_CHECK_DECLS([clock_serv_t, host_get_clock_service, clock_get_time],
|
||||
#include <mach/mach.h>
|
||||
])
|
||||
|
||||
# Check if we have new enough kernel to support BPF devices for cgroups v2
|
||||
if test "$with_linux" = "yes"; then
|
||||
AC_CHECK_DECLS([BPF_PROG_QUERY, BPF_CGROUP_DEVICE],
|
||||
[], [], [#include <linux/bpf.h>])
|
||||
fi
|
||||
|
||||
# Check if we need to look for ifconfig
|
||||
if test "$want_ifconfig" = "yes"; then
|
||||
AC_PATH_PROG([IFCONFIG_PATH], [ifconfig])
|
||||
@@ -910,11 +868,10 @@ test "x$lv_cv_static_analysis" = xyes && t=1
|
||||
AC_DEFINE_UNQUOTED([STATIC_ANALYSIS], [$t],
|
||||
[Define to 1 when performing static analysis.])
|
||||
|
||||
GNUmakefile=GNUmakefile
|
||||
m4_if(m4_version_compare([2.61a.100],
|
||||
m4_defn([m4_PACKAGE_VERSION])), [1], [],
|
||||
[AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
|
||||
[GNUmakefile=$GNUmakefile])])
|
||||
# Some GNULIB base64 symbols clash with a kerberos library
|
||||
AC_DEFINE_UNQUOTED([isbase64],[libvirt_gl_isbase64],[Hack to avoid symbol clash])
|
||||
AC_DEFINE_UNQUOTED([base64_encode],[libvirt_gl_base64_encode],[Hack to avoid symbol clash])
|
||||
AC_DEFINE_UNQUOTED([base64_encode_alloc],[libvirt_gl_base64_encode_alloc],[Hack to avoid symbol clash])
|
||||
|
||||
AC_CONFIG_FILES([run],
|
||||
[chmod +x,-w run])
|
||||
@@ -946,11 +903,14 @@ AC_MSG_NOTICE([])
|
||||
AC_MSG_NOTICE([Drivers])
|
||||
AC_MSG_NOTICE([])
|
||||
LIBVIRT_DRIVER_RESULT_QEMU
|
||||
LIBVIRT_DRIVER_RESULT_UML
|
||||
LIBVIRT_DRIVER_RESULT_OPENVZ
|
||||
LIBVIRT_DRIVER_RESULT_VMWARE
|
||||
LIBVIRT_DRIVER_RESULT_VBOX
|
||||
LIBVIRT_DRIVER_RESULT_XENAPI
|
||||
LIBVIRT_DRIVER_RESULT_LIBXL
|
||||
LIBVIRT_DRIVER_RESULT_LXC
|
||||
LIBVIRT_DRIVER_RESULT_PHYP
|
||||
LIBVIRT_DRIVER_RESULT_ESX
|
||||
LIBVIRT_DRIVER_RESULT_HYPERV
|
||||
LIBVIRT_DRIVER_RESULT_VZ
|
||||
@@ -967,7 +927,6 @@ LIBVIRT_STORAGE_RESULT_DIR
|
||||
LIBVIRT_STORAGE_RESULT_FS
|
||||
LIBVIRT_STORAGE_RESULT_LVM
|
||||
LIBVIRT_STORAGE_RESULT_ISCSI
|
||||
LIBVIRT_STORAGE_RESULT_ISCSI_DIRECT
|
||||
LIBVIRT_STORAGE_RESULT_SCSI
|
||||
LIBVIRT_STORAGE_RESULT_MPATH
|
||||
LIBVIRT_STORAGE_RESULT_DISK
|
||||
@@ -992,6 +951,7 @@ LIBVIRT_RESULT_ACL
|
||||
LIBVIRT_RESULT_APPARMOR
|
||||
LIBVIRT_RESULT_ATTR
|
||||
LIBVIRT_RESULT_AUDIT
|
||||
LIBVIRT_RESULT_AVAHI
|
||||
LIBVIRT_RESULT_BASH_COMPLETION
|
||||
LIBVIRT_RESULT_BLKID
|
||||
LIBVIRT_RESULT_CAPNG
|
||||
@@ -999,13 +959,10 @@ LIBVIRT_RESULT_CURL
|
||||
LIBVIRT_RESULT_DBUS
|
||||
LIBVIRT_RESULT_DLOPEN
|
||||
LIBVIRT_RESULT_FIREWALLD
|
||||
LIBVIRT_RESULT_FIREWALLD_ZONE
|
||||
LIBVIRT_RESULT_FUSE
|
||||
LIBVIRT_RESULT_GLIB
|
||||
LIBVIRT_RESULT_GLUSTER
|
||||
LIBVIRT_RESULT_GNUTLS
|
||||
LIBVIRT_RESULT_HAL
|
||||
LIBVIRT_RESULT_LIBISCSI
|
||||
LIBVIRT_RESULT_LIBNL
|
||||
LIBVIRT_RESULT_LIBPCAP
|
||||
LIBVIRT_RESULT_LIBSSH
|
||||
@@ -1029,6 +986,7 @@ LIBVIRT_RESULT_SSH2
|
||||
LIBVIRT_RESULT_UDEV
|
||||
LIBVIRT_RESULT_VIRTUALPORT
|
||||
LIBVIRT_RESULT_XDR
|
||||
LIBVIRT_RESULT_XENAPI
|
||||
LIBVIRT_RESULT_YAJL
|
||||
AC_MSG_NOTICE([])
|
||||
AC_MSG_NOTICE([Windows])
|
||||
@@ -1038,13 +996,14 @@ LIBVIRT_WIN_RESULT_WINDRES
|
||||
AC_MSG_NOTICE([])
|
||||
AC_MSG_NOTICE([Test suite])
|
||||
AC_MSG_NOTICE([])
|
||||
LIBVIRT_RESULT([Coverage], [$enable_test_coverage])
|
||||
AC_MSG_NOTICE([ Coverage: $enable_test_coverage])
|
||||
AC_MSG_NOTICE([ Alloc OOM: $enable_test_oom])
|
||||
AC_MSG_NOTICE([])
|
||||
AC_MSG_NOTICE([Miscellaneous])
|
||||
AC_MSG_NOTICE([])
|
||||
LIBVIRT_RESULT_DEBUG
|
||||
LIBVIRT_RESULT([Use -Werror], [$enable_werror])
|
||||
LIBVIRT_RESULT([Warning Flags], [$WARN_CFLAGS])
|
||||
AC_MSG_NOTICE([ Use -Werror: $enable_werror])
|
||||
AC_MSG_NOTICE([ Warning Flags: $WARN_CFLAGS])
|
||||
LIBVIRT_RESULT_DTRACE
|
||||
LIBVIRT_RESULT_NUMAD
|
||||
LIBVIRT_RESULT_INIT_SCRIPT
|
||||
|
499
docs/Makefile.am
499
docs/Makefile.am
@@ -16,84 +16,26 @@
|
||||
## License along with this library. If not, see
|
||||
## <http://www.gnu.org/licenses/>.
|
||||
|
||||
HTML_DIR = $(docdir)/html
|
||||
|
||||
modules = \
|
||||
libvirt-common \
|
||||
libvirt-domain \
|
||||
libvirt-domain-checkpoint \
|
||||
libvirt-domain-snapshot \
|
||||
libvirt-event \
|
||||
libvirt-host \
|
||||
libvirt-interface \
|
||||
libvirt-network \
|
||||
libvirt-nodedev \
|
||||
libvirt-nwfilter \
|
||||
libvirt-secret \
|
||||
libvirt-storage \
|
||||
libvirt-stream \
|
||||
virterror \
|
||||
$(NULL)
|
||||
|
||||
modules_admin = libvirt-admin
|
||||
modules_qemu = libvirt-qemu
|
||||
modules_lxc = libvirt-lxc
|
||||
|
||||
all: vpathhack
|
||||
|
||||
# This hack enables us to view the web pages
|
||||
# from within the uninstalled build tree
|
||||
vpathhack:
|
||||
@for dir in fonts js logos; \
|
||||
do \
|
||||
test -e $$dir || ln -s $(srcdir)/$$dir $$dir ; \
|
||||
done
|
||||
@for file in $(css); \
|
||||
do \
|
||||
test -e $$file || ln -s $(srcdir)/$$file $$file ; \
|
||||
done
|
||||
|
||||
clean-local:
|
||||
for dir in fonts js logos; \
|
||||
do \
|
||||
rm -f $$dir ; \
|
||||
done
|
||||
for file in $(css); \
|
||||
do \
|
||||
rm -f $$file ; \
|
||||
done
|
||||
DEVHELP_DIR=$(datadir)/gtk-doc/html/libvirt
|
||||
|
||||
apihtml = \
|
||||
html/index.html \
|
||||
$(apihtml_generated)
|
||||
|
||||
apihtml_generated = \
|
||||
$(addprefix html/libvirt-,$(addsuffix .html,$(modules))) \
|
||||
$(NULL)
|
||||
|
||||
apiadminhtml = \
|
||||
html/index-admin.html \
|
||||
$(apiadminhtml_generated)
|
||||
|
||||
apiadminhtml_generated = \
|
||||
$(addprefix html/libvirt-,$(addsuffix .html,$(modules_admin))) \
|
||||
$(NULL)
|
||||
|
||||
apiqemuhtml = \
|
||||
html/index-qemu.html \
|
||||
$(apiqemuhtml_generated)
|
||||
|
||||
apiqemuhtml_generated = \
|
||||
$(addprefix html/libvirt-,$(addsuffix .html,$(modules_qemu))) \
|
||||
$(NULL)
|
||||
|
||||
apilxchtml = \
|
||||
html/index-lxc.html \
|
||||
$(apilxchtml_generated)
|
||||
|
||||
apilxchtml_generated = \
|
||||
$(addprefix html/libvirt-,$(addsuffix .html,$(modules_lxc))) \
|
||||
$(NULL)
|
||||
html/libvirt-libvirt-common.html \
|
||||
html/libvirt-libvirt-domain.html \
|
||||
html/libvirt-libvirt-domain-snapshot.html \
|
||||
html/libvirt-libvirt-event.html \
|
||||
html/libvirt-libvirt-host.html \
|
||||
html/libvirt-libvirt-interface.html \
|
||||
html/libvirt-libvirt-network.html \
|
||||
html/libvirt-libvirt-nodedev.html \
|
||||
html/libvirt-libvirt-nwfilter.html \
|
||||
html/libvirt-libvirt-secret.html \
|
||||
html/libvirt-libvirt-storage.html \
|
||||
html/libvirt-libvirt-stream.html \
|
||||
html/libvirt-virterror.html
|
||||
|
||||
apipng = \
|
||||
html/left.png \
|
||||
@@ -101,8 +43,11 @@ apipng = \
|
||||
html/home.png \
|
||||
html/right.png
|
||||
|
||||
apirefdir = $(HTML_DIR)/html
|
||||
apiref_DATA = $(apihtml) $(apiadminhtml) $(apiqemuhtml) $(apilxchtml) $(apipng)
|
||||
devhelphtml = \
|
||||
devhelp/libvirt.devhelp \
|
||||
devhelp/index.html \
|
||||
devhelp/general.html \
|
||||
devhelp/libvirt-virterror.html
|
||||
|
||||
css = \
|
||||
generic.css \
|
||||
@@ -110,13 +55,6 @@ css = \
|
||||
mobile.css \
|
||||
main.css
|
||||
|
||||
javascript = \
|
||||
js/main.js \
|
||||
$(NULL)
|
||||
|
||||
javascriptdir = $(HTML_DIR)/js
|
||||
javascript_DATA = $(javascript)
|
||||
|
||||
fonts = \
|
||||
fonts/LICENSE.md \
|
||||
fonts/stylesheet.css \
|
||||
@@ -131,8 +69,15 @@ fonts = \
|
||||
fonts/overpass-mono-semibold.woff \
|
||||
fonts/overpass-regular.woff
|
||||
|
||||
fontsdir = $(HTML_DIR)/fonts
|
||||
fonts_DATA = $(fonts)
|
||||
devhelppng = \
|
||||
devhelp/home.png \
|
||||
devhelp/left.png \
|
||||
devhelp/right.png \
|
||||
devhelp/up.png
|
||||
|
||||
devhelpcss = devhelp/style.css
|
||||
|
||||
devhelpxsl = devhelp/devhelp.xsl devhelp/html.xsl
|
||||
|
||||
logofiles = \
|
||||
logos/logo-base.svg \
|
||||
@@ -153,9 +98,6 @@ logofiles = \
|
||||
logos/logo-banner-light-256.png \
|
||||
logos/logo-banner-light-800.png
|
||||
|
||||
logofilesdir = $(HTML_DIR)/logos
|
||||
logofiles_DATA = $(logofiles)
|
||||
|
||||
png = \
|
||||
32favicon.png \
|
||||
libvirt-daemon-arch.png \
|
||||
@@ -171,157 +113,42 @@ gif = \
|
||||
architecture.gif \
|
||||
node.gif
|
||||
|
||||
|
||||
internals_html_in = \
|
||||
$(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/internals/*.html.in))
|
||||
internals_rst = \
|
||||
$(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/internals/*.rst))
|
||||
internals_rst_html_in = \
|
||||
$(internals_rst:%.rst=%.html.in)
|
||||
internals_html = \
|
||||
$(internals_html_in:%.html.in=%.html) \
|
||||
$(internals_rst_html_in:%.html.in=%.html)
|
||||
|
||||
internalsdir = $(HTML_DIR)/internals
|
||||
internals_DATA = $(internals_html)
|
||||
|
||||
kbase_html_in = \
|
||||
$(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/kbase/*.html.in))
|
||||
kbase_rst = \
|
||||
$(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/kbase/*.rst))
|
||||
kbase_rst_html_in = \
|
||||
$(kbase_rst:%.rst=%.html.in)
|
||||
kbase_html = \
|
||||
$(kbase_html_in:%.html.in=%.html) \
|
||||
$(kbase_rst_html_in:%.html.in=%.html)
|
||||
|
||||
kbasedir = $(HTML_DIR)/kbase
|
||||
kbase_DATA = $(kbase_html)
|
||||
|
||||
# Sync with src/util/
|
||||
KEYCODES = linux osx atset1 atset2 atset3 xtkbd usb win32 qnum
|
||||
KEYNAMES = linux osx win32
|
||||
|
||||
manpages_rst = \
|
||||
manpages/index.rst \
|
||||
$(NULL)
|
||||
manpages1_rst = \
|
||||
manpages/virt-pki-validate.rst \
|
||||
manpages/virt-xml-validate.rst \
|
||||
manpages/virt-admin.rst \
|
||||
manpages/virsh.rst \
|
||||
$(NULL)
|
||||
manpages7_rst = \
|
||||
$(KEYCODES:%=manpages/virkeycode-%.rst) \
|
||||
$(KEYNAMES:%=manpages/virkeyname-%.rst) \
|
||||
$(NULL)
|
||||
manpages8_rst = $(NULL)
|
||||
manpages_rst += \
|
||||
$(manpages1_rst) \
|
||||
$(manpages7_rst) \
|
||||
$(manpages8_rst) \
|
||||
$(NULL)
|
||||
if WITH_LIBVIRTD
|
||||
manpages8_rst += \
|
||||
manpages/libvirtd.rst \
|
||||
manpages/virtlockd.rst \
|
||||
manpages/virtlogd.rst \
|
||||
$(NULL)
|
||||
else ! WITH_LIBVIRTD
|
||||
manpages_rst += \
|
||||
manpages/libvirtd.rst \
|
||||
manpages/virtlockd.rst \
|
||||
manpages/virtlogd.rst \
|
||||
$(NULL)
|
||||
endif ! WITH_LIBVIRTD
|
||||
if WITH_HOST_VALIDATE
|
||||
manpages1_rst += manpages/virt-host-validate.rst
|
||||
else ! WITH_HOST_VALIDATE
|
||||
manpages_rst += manpages/virt-host-validate.rst
|
||||
endif ! WITH_HOST_VALIDATE
|
||||
if WITH_LOGIN_SHELL
|
||||
manpages1_rst += manpages/virt-login-shell.rst
|
||||
else ! WITH_LOGIN_SHELL
|
||||
manpages_rst += manpages/virt-login-shell.rst
|
||||
endif ! WITH_LOGIN_SHELL
|
||||
if WITH_SANLOCK
|
||||
manpages8_rst += manpages/virt-sanlock-cleanup.rst
|
||||
else ! WITH_SANLOCK
|
||||
manpages_rst += manpages/virt-sanlock-cleanup.rst
|
||||
endif ! WITH_SANLOCK
|
||||
manpages_rst_html_in = \
|
||||
$(manpages_rst:%.rst=%.html.in)
|
||||
manpages_html = \
|
||||
$(manpages_rst_html_in:%.html.in=%.html)
|
||||
|
||||
man1_MANS = $(manpages1_rst:%.rst=%.1)
|
||||
man7_MANS = $(manpages7_rst:%.rst=%.7)
|
||||
man8_MANS = $(manpages8_rst:%.rst=%.8)
|
||||
|
||||
%.1: %.rst
|
||||
$(AM_V_GEN)$(MKDIR_P) `dirname $@` && \
|
||||
grep -v '^\.\. contents::' < $< | \
|
||||
sed -e 's|SYSCONFDIR|$(sysconfdir)|g' \
|
||||
-e 's|RUNSTATEDIR|$(runstatedir)|g' | \
|
||||
$(RST2MAN) > $@ || { rm $@ && exit 1; }
|
||||
|
||||
%.7: %.rst
|
||||
$(AM_V_GEN)$(MKDIR_P) `dirname $@` && \
|
||||
grep -v '^\.\. contents::' < $< | \
|
||||
sed -e 's|SYSCONFDIR|$(sysconfdir)|g' \
|
||||
-e 's|RUNSTATEDIR|$(runstatedir)|g' | \
|
||||
$(RST2MAN) > $@ || { rm $@ && exit 1; }
|
||||
|
||||
%.8: %.rst
|
||||
$(AM_V_GEN)$(MKDIR_P) `dirname $@` && \
|
||||
grep -v '^\.\. contents::' < $< | \
|
||||
sed -e 's|SYSCONFDIR|$(sysconfdir)|g' \
|
||||
-e 's|RUNSTATEDIR|$(runstatedir)|g' | \
|
||||
$(RST2MAN) > $@ || { rm $@ && exit 1; }
|
||||
|
||||
manpages/virkeycode-%.rst: $(top_srcdir)/src/keycodemapdb/data/keymaps.csv \
|
||||
$(top_srcdir)/src/keycodemapdb/tools/keymap-gen Makefile.am
|
||||
$(AM_V_GEN)export NAME=`echo $@ | \
|
||||
sed -e 's,manpages/virkeycode-,,' -e 's,\.rst,,'` && \
|
||||
$(MKDIR_P) manpages/ && \
|
||||
$(RUNUTF8) $(PYTHON) $(top_srcdir)/src/keycodemapdb/tools/keymap-gen \
|
||||
code-docs \
|
||||
--lang rst \
|
||||
--title "virkeycode-$$NAME" \
|
||||
--subtitle "Key code values for $$NAME" \
|
||||
$(top_srcdir)/src/keycodemapdb/data/keymaps.csv $$NAME > $@
|
||||
|
||||
manpages/virkeyname-%.rst: $(top_srcdir)/src/keycodemapdb/data/keymaps.csv \
|
||||
$(top_srcdir)/src/keycodemapdb/tools/keymap-gen Makefile.am
|
||||
$(AM_V_GEN)export NAME=`echo $@ | \
|
||||
sed -e 's,manpages/virkeyname-,,' -e 's,\.rst,,'` && \
|
||||
$(MKDIR_P) manpages/ && \
|
||||
$(RUNUTF8) $(PYTHON) $(top_srcdir)/src/keycodemapdb/tools/keymap-gen \
|
||||
name-docs \
|
||||
--lang rst \
|
||||
--title "virkeyname-$$NAME" \
|
||||
--subtitle "Key name values for $$NAME" \
|
||||
$(top_srcdir)/src/keycodemapdb/data/keymaps.csv $$NAME > $@
|
||||
|
||||
manpagesdir = $(HTML_DIR)/manpages
|
||||
manpages_DATA = $(manpages_html)
|
||||
internals_html = $(internals_html_in:%.html.in=%.html)
|
||||
|
||||
# Since we ship pre-built html in the tarball, we must also
|
||||
# ship the sources, even when those sources are themselves
|
||||
# generated.
|
||||
# Generate hvsupport.html and news.html first, since they take one extra step.
|
||||
dot_html_generated_in = \
|
||||
hvsupport.html.in \
|
||||
news.html.in
|
||||
dot_html_in = \
|
||||
hvsupport.html.in \
|
||||
news.html.in \
|
||||
$(notdir $(wildcard $(srcdir)/*.html.in))
|
||||
dot_rst = \
|
||||
$(notdir $(wildcard $(srcdir)/*.rst))
|
||||
dot_rst_html_in = \
|
||||
$(dot_rst:%.rst=%.html)
|
||||
dot_html = \
|
||||
$(dot_html_generated_in:%.html.in=%.html) \
|
||||
$(dot_html_in:%.html.in=%.html) \
|
||||
$(dot_rst_html_in:%.html.in=%.html)
|
||||
dot_html = $(dot_html_in:%.html.in=%.html)
|
||||
|
||||
htmldir = $(HTML_DIR)
|
||||
html_DATA = $(css) $(png) $(gif) $(dot_html)
|
||||
dot_php_in = $(notdir $(wildcard $(srcdir)/*.php.in))
|
||||
dot_php_code_in = $(dot_php_in:%.php.in=%.php.code.in)
|
||||
dot_php = $(dot_php_in:%.php.in=%.php)
|
||||
|
||||
patches = $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/api_extension/*.patch))
|
||||
|
||||
xml = \
|
||||
libvirt-api.xml \
|
||||
libvirt-refs.xml
|
||||
|
||||
qemu_xml = \
|
||||
libvirt-qemu-api.xml \
|
||||
libvirt-qemu-refs.xml
|
||||
|
||||
lxc_xml = \
|
||||
libvirt-lxc-api.xml \
|
||||
libvirt-lxc-refs.xml
|
||||
|
||||
admin_xml = \
|
||||
libvirt-admin-api.xml \
|
||||
libvirt-admin-refs.xml
|
||||
|
||||
apidir = $(pkgdatadir)/api
|
||||
api_DATA = \
|
||||
@@ -344,39 +171,31 @@ schemadir = $(pkgdatadir)/schemas
|
||||
schema_DATA = $(wildcard $(srcdir)/schemas/*.rng)
|
||||
|
||||
EXTRA_DIST= \
|
||||
apibuild.py genaclperms.pl \
|
||||
site.xsl subsite.xsl newapi.xsl page.xsl \
|
||||
wrapstring.xsl \
|
||||
$(dot_html_in) $(dot_rst) $(gif) $(apipng) \
|
||||
$(fig) $(png) $(css) \
|
||||
$(javascript) $(logofiles) \
|
||||
$(internals_html_in) $(internals_rst) $(fonts) \
|
||||
$(kbase_html_in) $(kbase_rst) \
|
||||
$(manpages_rst) \
|
||||
$(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \
|
||||
$(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \
|
||||
$(xml) $(qemu_xml) $(lxc_xml) $(admin_xml) $(fig) $(png) $(css) \
|
||||
$(logofiles) $(patches) $(dot_php_in) $(dot_php_code_in) $(dot_php)\
|
||||
$(internals_html_in) $(internals_html) $(fonts) \
|
||||
aclperms.htmlinc \
|
||||
hvsupport.pl \
|
||||
$(schema_DATA)
|
||||
|
||||
acl_generated = aclperms.htmlinc
|
||||
|
||||
aclperms.htmlinc: $(top_srcdir)/src/access/viraccessperm.h \
|
||||
$(top_srcdir)/scripts/genaclperms.py Makefile.am
|
||||
$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/genaclperms.py $< > $@
|
||||
$(srcdir)/aclperms.htmlinc: $(top_srcdir)/src/access/viraccessperm.h \
|
||||
$(srcdir)/genaclperms.pl Makefile.am
|
||||
$(AM_V_GEN)$(PERL) $(srcdir)/genaclperms.pl $< > $@
|
||||
|
||||
CLEANFILES = \
|
||||
$(dot_html) \
|
||||
$(apihtml) \
|
||||
$(apiadminhtml) \
|
||||
$(apiqemuhtml) \
|
||||
$(apilxchtml) \
|
||||
$(internals_html) \
|
||||
$(kbase_html) \
|
||||
$(manpages_html) \
|
||||
$(man1_MANS) \
|
||||
$(man7_MANS) \
|
||||
$(manpages7_rst) \
|
||||
$(man8_MANS) \
|
||||
$(api_DATA) \
|
||||
$(dot_html_generated_in) \
|
||||
aclperms.htmlinc
|
||||
MAINTAINERCLEANFILES = \
|
||||
$(addprefix $(srcdir)/,$(dot_html)) \
|
||||
$(addprefix $(srcdir)/,$(apihtml)) \
|
||||
$(addprefix $(srcdir)/,$(devhelphtml)) \
|
||||
$(addprefix $(srcdir)/,$(internals_html)) \
|
||||
$(addprefix $(srcdir)/,$(dot_php)) \
|
||||
$(srcdir)/hvsupport.html.in $(srcdir)/aclperms.htmlinc
|
||||
|
||||
timestamp="$(shell if test -n "$$SOURCE_DATE_EPOCH"; \
|
||||
then \
|
||||
@@ -385,42 +204,49 @@ timestamp="$(shell if test -n "$$SOURCE_DATE_EPOCH"; \
|
||||
date -u; \
|
||||
fi)"
|
||||
|
||||
hvsupport.html: hvsupport.html.in
|
||||
all-am: web
|
||||
|
||||
hvsupport.html.in: $(top_srcdir)/scripts/hvsupport.py $(api_DATA) \
|
||||
api: $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml
|
||||
qemu_api: $(srcdir)/libvirt-qemu-api.xml $(srcdir)/libvirt-qemu-refs.xml
|
||||
lxc_api: $(srcdir)/libvirt-lxc-api.xml $(srcdir)/libvirt-lxc-refs.xml
|
||||
admin_api: $(srcdir)/libvirt-admin-api.xml $(srcdir)/libvirt-admin-refs.xml
|
||||
|
||||
web: $(dot_html) $(internals_html) html/index.html devhelp/index.html \
|
||||
$(dot_php)
|
||||
|
||||
hvsupport.html: $(srcdir)/hvsupport.html.in
|
||||
|
||||
$(srcdir)/hvsupport.html.in: $(srcdir)/hvsupport.pl $(api_DATA) \
|
||||
$(top_srcdir)/src/libvirt_public.syms \
|
||||
$(top_srcdir)/src/libvirt_qemu.syms $(top_srcdir)/src/libvirt_lxc.syms \
|
||||
$(top_srcdir)/src/driver.h
|
||||
$(AM_V_GEN)$(RUNUTF8) $(PYTHON) $(top_srcdir)/scripts/hvsupport.py \
|
||||
$(top_srcdir) $(top_builddir) > $@ || { rm $@ && exit 1; }
|
||||
$(AM_V_GEN)$(PERL) $(srcdir)/hvsupport.pl $(top_srcdir)/src > $@ \
|
||||
|| { rm $@ && exit 1; }
|
||||
|
||||
# xsltproc seems to add the xmlns="" attribute to random output elements:
|
||||
# use sed to strip it out, as leaving it there triggers XML errors during
|
||||
# further transformation steps
|
||||
news.html.in: \
|
||||
$(srcdir)/news.xml \
|
||||
$(srcdir)/news-html.xsl
|
||||
$(AM_V_GEN)$(XSLTPROC) --nonet \
|
||||
$(srcdir)/news-html.xsl \
|
||||
$(srcdir)/news.xml \
|
||||
>$@ \
|
||||
|| { rm -f $@; exit 1; };
|
||||
>$@-tmp \
|
||||
|| { rm -f $@-tmp; exit 1; }; \
|
||||
sed 's/ xmlns=""//g' $@-tmp >$@ \
|
||||
|| { rm -f $@-tmp; exit 1; }; \
|
||||
rm -f $@-tmp
|
||||
EXTRA_DIST += \
|
||||
$(srcdir)/news.xml \
|
||||
$(srcdir)/news.rng \
|
||||
$(srcdir)/news-html.xsl
|
||||
MAINTAINERCLEANFILES += \
|
||||
$(srcdir)/news.html.in
|
||||
|
||||
%.png: %.fig
|
||||
convert -rotate 90 $< $@
|
||||
|
||||
manpages/%.html.in: manpages/%.rst
|
||||
$(AM_V_GEN)$(MKDIR_P) `dirname $@` && \
|
||||
grep -v '^:Manual ' < $< | \
|
||||
sed -e 's|SYSCONFDIR|$(sysconfdir)|g' \
|
||||
-e 's|RUNSTATEDIR|$(runstatedir)|g' | \
|
||||
$(RST2HTML) > $@ || { rm $@ && exit 1; }
|
||||
|
||||
%.html.in: %.rst
|
||||
$(AM_V_GEN)$(MKDIR_P) `dirname $@` && \
|
||||
$(RST2HTML) $< > $@ || { rm $@ && exit 1; }
|
||||
|
||||
%.html.tmp: %.html.in site.xsl subsite.xsl page.xsl \
|
||||
$(acl_generated)
|
||||
$(AM_V_GEN)name=`echo $@ | sed -e 's/.tmp//'`; \
|
||||
@@ -433,56 +259,65 @@ manpages/%.html.in: manpages/%.rst
|
||||
style=subsite.xsl; \
|
||||
fi; \
|
||||
$(XSLTPROC) --stringparam pagename $$name \
|
||||
--stringparam builddir '$(abs_top_builddir)' \
|
||||
--stringparam timestamp $(timestamp) --nonet \
|
||||
$(top_srcdir)/docs/$$style $< > $@ \
|
||||
|| { rm $@ && exit 1; }
|
||||
|
||||
%.html: %.html.tmp
|
||||
$(AM_V_GEN)$(XMLLINT) --nonet --format $< > $@ \
|
||||
|| { rm $@ && exit 1; }
|
||||
$(AM_V_GEN)$(XMLLINT) --nonet --format $< > $(srcdir)/$@ \
|
||||
|| { rm $(srcdir)/$@ && exit 1; }
|
||||
|
||||
%.php.tmp: %.php.in site.xsl page.xsl
|
||||
$(AM_V_GEN)$(XSLTPROC) --stringparam pagename $(@:.tmp=) \
|
||||
--stringparam timestamp $(timestamp) --nonet \
|
||||
$(top_srcdir)/docs/site.xsl $< > $@ \
|
||||
|| { rm $@ && exit 1; }
|
||||
|
||||
%.php: %.php.tmp %.php.code.in
|
||||
$(AM_V_GEN)sed \
|
||||
-e '/<span id="php_placeholder"><\/span>/r '"$(srcdir)/$@.code.in" \
|
||||
-e /php_placeholder/d < $@.tmp > $(srcdir)/$@ \
|
||||
|| { rm $(srcdir)/$@ && exit 1; }
|
||||
|
||||
$(apihtml_generated): html/index.html
|
||||
$(apiadminhtml_generated): html/index-admin.html
|
||||
$(apiqemuhtml_generated): html/index-qemu.html
|
||||
$(apilxchtml_generated): html/index-lxc.html
|
||||
|
||||
html/index.html: libvirt-api.xml newapi.xsl page.xsl $(APIBUILD_STAMP)
|
||||
$(AM_V_GEN)$(XSLTPROC) --nonet -o ./ \
|
||||
$(AM_V_GEN)$(XSLTPROC) --nonet -o $(srcdir)/ \
|
||||
--stringparam builddir '$(abs_top_builddir)' \
|
||||
--stringparam timestamp $(timestamp) \
|
||||
$(srcdir)/newapi.xsl libvirt-api.xml
|
||||
$(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml && \
|
||||
$(XMLLINT) --nonet --noout $(srcdir)/html/*.html
|
||||
|
||||
html/index-%.html: libvirt-%-api.xml newapi.xsl page.xsl $(APIBUILD_STAMP)
|
||||
$(AM_V_GEN)$(XSLTPROC) --nonet -o ./ \
|
||||
--stringparam builddir '$(abs_top_builddir)' \
|
||||
--stringparam timestamp $(timestamp) \
|
||||
--stringparam indexfile $(@:html/%=%) \
|
||||
$(srcdir)/newapi.xsl $<
|
||||
$(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl)
|
||||
$(AM_V_GEN)$(XSLTPROC) --stringparam timestamp $(timestamp) \
|
||||
--nonet -o $(srcdir)/devhelp/ \
|
||||
$(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml
|
||||
|
||||
check-html:
|
||||
$(XMLLINT) --nonet --noout html/*.html
|
||||
|
||||
check-local: check-html
|
||||
|
||||
python_generated_files = \
|
||||
html/libvirt-libvirt-lxc.html \
|
||||
html/libvirt-libvirt-qemu.html \
|
||||
html/libvirt-libvirt-admin.html \
|
||||
html/libvirt-virterror.html \
|
||||
$(api_DATA) \
|
||||
$(srcdir)/html/libvirt-libvirt-lxc.html \
|
||||
$(srcdir)/html/libvirt-libvirt-qemu.html \
|
||||
$(srcdir)/html/libvirt-libvirt-admin.html \
|
||||
$(srcdir)/html/libvirt-virterror.html \
|
||||
$(srcdir)/libvirt-api.xml \
|
||||
$(srcdir)/libvirt-refs.xml \
|
||||
$(srcdir)/libvirt-lxc-api.xml \
|
||||
$(srcdir)/libvirt-lxc-refs.xml \
|
||||
$(srcdir)/libvirt-qemu-api.xml \
|
||||
$(srcdir)/libvirt-qemu-refs.xml \
|
||||
$(srcdir)/libvirt-admin-api.xml \
|
||||
$(srcdir)/libvirt-admin-refs.xml \
|
||||
$(NULL)
|
||||
|
||||
APIBUILD=$(top_srcdir)/scripts/apibuild.py
|
||||
APIBUILD_STAMP=apibuild.py.stamp
|
||||
CLEANFILES += $(APIBUILD_STAMP)
|
||||
APIBUILD=$(srcdir)/apibuild.py
|
||||
APIBUILD_STAMP=$(APIBUILD).stamp
|
||||
EXTRA_DIST += $(APIBUILD_STAMP)
|
||||
|
||||
$(python_generated_files): $(APIBUILD_STAMP)
|
||||
|
||||
$(APIBUILD_STAMP): $(top_srcdir)/scripts/apibuild.py \
|
||||
$(APIBUILD_STAMP): $(srcdir)/apibuild.py \
|
||||
$(top_srcdir)/include/libvirt/libvirt.h \
|
||||
$(top_srcdir)/include/libvirt/libvirt-common.h.in \
|
||||
$(top_srcdir)/include/libvirt/libvirt-domain-checkpoint.h \
|
||||
$(top_srcdir)/include/libvirt/libvirt-domain-snapshot.h \
|
||||
$(top_srcdir)/include/libvirt/libvirt-domain.h \
|
||||
$(top_srcdir)/include/libvirt/libvirt-event.h \
|
||||
@@ -499,7 +334,6 @@ $(APIBUILD_STAMP): $(top_srcdir)/scripts/apibuild.py \
|
||||
$(top_srcdir)/include/libvirt/libvirt-admin.h \
|
||||
$(top_srcdir)/include/libvirt/virterror.h \
|
||||
$(top_srcdir)/src/libvirt.c \
|
||||
$(top_srcdir)/src/libvirt-domain-checkpoint.c \
|
||||
$(top_srcdir)/src/libvirt-domain-snapshot.c \
|
||||
$(top_srcdir)/src/libvirt-domain.c \
|
||||
$(top_srcdir)/src/libvirt-host.c \
|
||||
@@ -512,10 +346,65 @@ $(APIBUILD_STAMP): $(top_srcdir)/scripts/apibuild.py \
|
||||
$(top_srcdir)/src/libvirt-stream.c \
|
||||
$(top_srcdir)/src/libvirt-lxc.c \
|
||||
$(top_srcdir)/src/libvirt-qemu.c \
|
||||
$(top_srcdir)/src/admin/libvirt-admin.c \
|
||||
$(top_srcdir)/src/libvirt-admin.c \
|
||||
$(top_srcdir)/src/util/virerror.c \
|
||||
$(top_srcdir)/src/util/virevent.c \
|
||||
$(top_srcdir)/src/util/virtypedparam-public.c
|
||||
$(AM_V_GEN)srcdir=$(srcdir) builddir=$(builddir) \
|
||||
$(RUNUTF8) $(PYTHON) $(APIBUILD)
|
||||
$(top_srcdir)/src/util/virtypedparam.c
|
||||
$(AM_V_GEN)srcdir=$(srcdir) builddir=$(builddir) $(PYTHON) $(APIBUILD)
|
||||
touch $@
|
||||
|
||||
|
||||
check-local: all
|
||||
dist-local: all
|
||||
|
||||
clean-local:
|
||||
rm -f *~ *.bak *.hierarchy *.signals *-unused.txt *.html html/*.html
|
||||
|
||||
maintainer-clean-local: clean-local
|
||||
rm -rf $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml
|
||||
rm -rf $(srcdir)/libvirt-qemu-api.xml $(srcdir)/libvirt-qemu-refs.xml
|
||||
rm -rf $(srcdir)/libvirt-lxc-api.xml $(srcdir)/libvirt-lxc-refs.xml
|
||||
rm -rf $(srcdir)/libvirt-admin-api.xml $(srcdir)/libvirt-admin-refs.xml
|
||||
rm -rf $(APIBUILD_STAMP)
|
||||
|
||||
rebuild: api qemu_api lxc_api admin_api all
|
||||
|
||||
install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
|
||||
for f in $(css) $(dot_html) $(gif) $(png); do \
|
||||
$(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR); done
|
||||
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/logos
|
||||
for f in $(logofiles); do \
|
||||
$(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR)/logos; done
|
||||
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/html
|
||||
for h in $(apihtml); do \
|
||||
$(INSTALL) -m 0644 $(srcdir)/$$h $(DESTDIR)$(HTML_DIR)/html; done
|
||||
for p in $(apipng); do \
|
||||
$(INSTALL) -m 0644 $(srcdir)/$$p $(DESTDIR)$(HTML_DIR)/html; done
|
||||
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/internals
|
||||
for f in $(internals_html); do \
|
||||
$(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR)/internals; done
|
||||
$(mkinstalldirs) $(DESTDIR)$(DEVHELP_DIR)
|
||||
for file in $(devhelphtml) $(devhelppng) $(devhelpcss); do \
|
||||
$(INSTALL) -m 0644 $(srcdir)/$${file} $(DESTDIR)$(DEVHELP_DIR) ; \
|
||||
done
|
||||
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/fonts
|
||||
for f in $(fonts); do \
|
||||
$(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR)/fonts; \
|
||||
done
|
||||
|
||||
uninstall-local:
|
||||
for f in $(css) $(dot_html) $(gif) $(png) $(fonts); do \
|
||||
rm -f $(DESTDIR)$(HTML_DIR)/$$f; \
|
||||
done
|
||||
for f in $(logofiles); 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
|
||||
|
@@ -64,7 +64,7 @@
|
||||
</p>
|
||||
|
||||
<h3><a id="object_connect">virConnectPtr</a></h3>
|
||||
<table>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
@@ -80,7 +80,7 @@
|
||||
</table>
|
||||
|
||||
<h3><a id="object_domain">virDomainPtr</a></h3>
|
||||
<table>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
@@ -104,7 +104,7 @@
|
||||
</table>
|
||||
|
||||
<h3><a id="object_interface">virInterfacePtr</a></h3>
|
||||
<table>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
@@ -128,7 +128,7 @@
|
||||
</table>
|
||||
|
||||
<h3><a id="object_network">virNetworkPtr</a></h3>
|
||||
<table>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
@@ -152,7 +152,7 @@
|
||||
</table>
|
||||
|
||||
<h3><a id="object_node_device">virNodeDevicePtr</a></h3>
|
||||
<table>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
@@ -172,7 +172,7 @@
|
||||
</table>
|
||||
|
||||
<h3><a id="object_nwfilter">virNWFilterPtr</a></h3>
|
||||
<table>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
@@ -196,7 +196,7 @@
|
||||
</table>
|
||||
|
||||
<h3><a id="object_secret">virSecretPtr</a></h3>
|
||||
<table>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
@@ -232,7 +232,7 @@
|
||||
</table>
|
||||
|
||||
<h3><a id="object_storage_pool">virStoragePoolPtr</a></h3>
|
||||
<table>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
@@ -256,7 +256,7 @@
|
||||
</table>
|
||||
|
||||
<h3><a id="object_storage_vol">virStorageVolPtr</a></h3>
|
||||
<table>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
@@ -287,111 +287,6 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2><a id="connect_driver">Hypervisor Driver connect_driver</a></h2>
|
||||
<p>
|
||||
The <code>connect_driver</code> parameter describes the
|
||||
client's <a href="remote.html">remote Connection Driver</a>
|
||||
name based on the <a href="uri.html">URI</a> used for the
|
||||
connection.
|
||||
</p>
|
||||
<p>
|
||||
<span class="since">Since 4.1.0</span>, when calling an API
|
||||
outside the scope of the primary connection driver, the
|
||||
primary driver will attempt to open a secondary connection
|
||||
to the specific API driver in order to process the API. For
|
||||
example, when hypervisor domain processing needs to make an
|
||||
API call within the storage driver or the network filter driver
|
||||
an attempt to open a connection to the "storage" or "nwfilter"
|
||||
driver will be made. Similarly, a "storage" primary connection
|
||||
may need to create a connection to the "secret" driver in order
|
||||
to process secrets for the API. If successful, then calls to
|
||||
those API's will occur in the <code>connect_driver</code> context
|
||||
of the secondary connection driver rather than in the context of
|
||||
the primary driver. This affects the <code>connect_driver</code>
|
||||
returned from rule generation from the <code>action.loookup</code>
|
||||
function. The following table provides a list of the various
|
||||
connection drivers and the <code>connect_driver</code> name
|
||||
used by each regardless of primary or secondary connection.
|
||||
The access denied error message from libvirt will list the
|
||||
connection driver by name that denied the access.
|
||||
</p>
|
||||
|
||||
<h3><a id="object_connect_driver">Connection Driver Name</a></h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Connection Driver</th>
|
||||
<th><code>connect_driver</code> name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>bhyve</td>
|
||||
<td>bhyve</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>esx</td>
|
||||
<td>ESX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>hyperv</td>
|
||||
<td>Hyper-V</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>interface</td>
|
||||
<td>interface</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>libxl</td>
|
||||
<td>xenlight</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>lxc</td>
|
||||
<td>LXC</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>network</td>
|
||||
<td>network</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>nodedev</td>
|
||||
<td>nodedev</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>nwfilter</td>
|
||||
<td>NWFilter</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>openvz</td>
|
||||
<td>OPENVZ</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>qemu</td>
|
||||
<td>QEMU</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>secret</td>
|
||||
<td>secret</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>storage</td>
|
||||
<td>storage</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>vbox</td>
|
||||
<td>VBOX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>vmware</td>
|
||||
<td>VMWARE</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>vz</td>
|
||||
<td>vz</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<h2><a id="user">User identity attributes</a></h2>
|
||||
|
||||
|
@@ -330,7 +330,7 @@
|
||||
daemon through the <a href="remote.html">remote</a> driver via an
|
||||
<a href="internals/rpc.html">RPC</a>. Some hypervisors do support
|
||||
client-side connections and responses, such as Test, OpenVZ, VMware,
|
||||
VirtualBox (vbox), ESX, Hyper-V, Xen, and Virtuozzo.
|
||||
Power VM (phyp), VirtualBox (vbox), ESX, Hyper-V, Xen, and Virtuozzo.
|
||||
The libvirtd daemon service is started on the host at system boot
|
||||
time and can also be restarted at any time by a properly privileged
|
||||
user, such as root. The libvirtd daemon uses the same libvirt API
|
||||
|
@@ -8,9 +8,14 @@
|
||||
|
||||
<p>
|
||||
This document walks you through the process of implementing a new
|
||||
API in libvirt. Remember that new API consists of any new public
|
||||
functions, as well as the addition of flags or extensions of XML used by
|
||||
existing functions.
|
||||
API in libvirt. It uses as an example the addition of an API for
|
||||
separating maximum from current vcpu usage of a domain, over
|
||||
the course of a fifteen-patch series.
|
||||
Remember that new API consists of any new public functions, as
|
||||
well as the addition of flags or extensions of XML used by
|
||||
existing functions. The example in this document adds both new
|
||||
functions and an XML extension. Not all libvirt API additions
|
||||
require quite as many patches.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -22,7 +27,12 @@
|
||||
added to libvirt. Someone may already be working on the feature you
|
||||
want. Also, recognize that everything you write is likely to undergo
|
||||
significant rework as you discuss it with the other developers, so
|
||||
don't wait too long before getting feedback.
|
||||
don't wait too long before getting feedback. In the vcpu example
|
||||
below, list feedback was first requested
|
||||
<a href="https://www.redhat.com/archives/libvir-list/2010-September/msg00423.html">here</a>
|
||||
and resulted in several rounds of improvements before coding
|
||||
began. In turn, this example is slightly rearranged from the actual
|
||||
order of the commits.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -71,12 +81,14 @@
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Submit new code in the form of one patch per step. That's not to say
|
||||
submit patches before you have working functionality--get the whole thing
|
||||
working and make sure you're happy with it. Then use git to break the
|
||||
changes into pieces so you don't drop a big blob of code on the
|
||||
mailing list in one go. Also, you should follow the upstream tree, and
|
||||
rebase your series to adapt your patches to work with any other changes
|
||||
Submit new code in the form shown in the example code: one patch
|
||||
per step. That's not to say submit patches before you have working
|
||||
functionality--get the whole thing working and make sure you're happy
|
||||
with it. Then use git or some other version control system that lets
|
||||
you rewrite your commit history and break patches into pieces so you
|
||||
don't drop a big blob of code on the mailing list in one go.
|
||||
Also, you should follow the upstream tree, and rebase your
|
||||
series to adapt your patches to work with any other changes
|
||||
that were accepted upstream during your development.
|
||||
</p>
|
||||
|
||||
@@ -89,14 +101,16 @@
|
||||
separately.
|
||||
</p>
|
||||
|
||||
<h2><a id='publicapi'>Defining the public API</a></h2>
|
||||
<p>With that said, let's begin.</p>
|
||||
|
||||
<h2><a name='publicapi'>Defining the public API</a></h2>
|
||||
|
||||
<p>The first task is to define the public API. If the new API
|
||||
involves an XML extension, you have to enhance the RelaxNG
|
||||
schema and document the new elements or attributes:</p>
|
||||
|
||||
<p><code>
|
||||
docs/schemas/domaincommon.rng<br/>
|
||||
docs/schemas/domain.rng<br/>
|
||||
docs/formatdomain.html.in
|
||||
</code></p>
|
||||
|
||||
@@ -106,7 +120,7 @@
|
||||
libvirt library and call the new function:</p>
|
||||
|
||||
<p><code>
|
||||
include/libvirt/libvirt-$MODULE.h.in
|
||||
include/libvirt/libvirt.h.in
|
||||
src/libvirt_public.syms
|
||||
</code></p>
|
||||
|
||||
@@ -119,7 +133,11 @@
|
||||
rework it as you go through the process of implementing it.
|
||||
</p>
|
||||
|
||||
<h2><a id='internalapi'>Defining the internal API</a></h2>
|
||||
<p class="example">See <a href="api_extension/0001-add-to-xml.patch">0001-add-to-xml.patch</a>
|
||||
and <a href="api_extension/0002-add-new-public-API.patch">0002-add-new-public-API.patch</a>
|
||||
for example code.</p>
|
||||
|
||||
<h2><a name='internalapi'>Defining the internal API</a></h2>
|
||||
|
||||
<p>
|
||||
Each public API call is associated with a driver, such as a host
|
||||
@@ -137,7 +155,7 @@
|
||||
|
||||
<p>The driver structs are defined in:</p>
|
||||
|
||||
<p><code>src/driver-$MODULE.h</code></p>
|
||||
<p><code>src/driver.h</code></p>
|
||||
|
||||
<p>
|
||||
To define the internal API, first typedef the driver function
|
||||
@@ -146,7 +164,9 @@
|
||||
provide a <code>NULL</code> stub for the new function.
|
||||
</p>
|
||||
|
||||
<h2><a id='implpublic'>Implementing the public API</a></h2>
|
||||
<p class="example">See <a href="api_extension/0003-define-internal-driver-API.patch">0003-define-internal-driver-API.patch</a></p>
|
||||
|
||||
<h2><a name='implpublic'>Implementing the public API</a></h2>
|
||||
|
||||
<p>
|
||||
Implementing the public API is largely a formality in which we wire up
|
||||
@@ -177,17 +197,23 @@
|
||||
|
||||
<p>The public API calls are implemented in:</p>
|
||||
|
||||
<p><code>src/libvirt-$MODULE.c</code></p>
|
||||
<p><code>src/libvirt.c</code></p>
|
||||
|
||||
<h2><a id='remoteproto'>Implementing the remote protocol</a></h2>
|
||||
<p class="example">See <a href="api_extension/0004-implement-the-public-APIs.patch">0004-implement-the-public-APIs.patch</a></p>
|
||||
|
||||
<h2><a name='remoteproto'>Implementing the remote protocol</a></h2>
|
||||
|
||||
<p>
|
||||
Implementing the remote protocol is essentially a
|
||||
straightforward exercise which is probably most easily
|
||||
understood by referring to the existing code.
|
||||
understood by referring to the existing code and the example
|
||||
patch. It involves several related changes, including the
|
||||
regeneration of derived files, with further details below.
|
||||
</p>
|
||||
|
||||
<h3><a id='wireproto'>Defining the wire protocol format</a></h3>
|
||||
<p class="example">See <a href="api_extension/0005-implement-the-remote-protocol.patch">0005-implement-the-remote-protocol.patch</a></p>
|
||||
|
||||
<h3><a name='wireproto'>Defining the wire protocol format</a></h3>
|
||||
|
||||
<p>
|
||||
Defining the wire protocol involves making additions to:
|
||||
@@ -219,21 +245,21 @@
|
||||
</p>
|
||||
|
||||
<p><code>
|
||||
src/remote/remote_daemon_dispatch_stubs.h
|
||||
src/remote/remote_daemon_dispatch.h
|
||||
src/remote/remote_daemon_dispatch.c
|
||||
daemon/remote_dispatch_args.h
|
||||
daemon/remote_dispatch_prototypes.h
|
||||
daemon/remote_dispatch_table.h
|
||||
src/remote/remote_protocol.c
|
||||
src/remote/remote_protocol.h
|
||||
</code></p>
|
||||
|
||||
<h3><a id='rpcclient'>Implement the RPC client</a></h3>
|
||||
<h3><a name='rpcclient'>Implement the RPC client</a></h3>
|
||||
|
||||
<p>
|
||||
Implementing the RPC client uses the rpcgen generated .h files.
|
||||
The remote method calls go in:
|
||||
Implementing the uses the rpcgen generated .h files. The remote
|
||||
method calls go in:
|
||||
</p>
|
||||
|
||||
<p><code>src/remote/remote_driver.c</code></p>
|
||||
<p><code>src/remote/remote_internal.c</code></p>
|
||||
|
||||
<p>Each remote method invocation does the following:</p>
|
||||
|
||||
@@ -256,7 +282,7 @@
|
||||
The server side dispatchers are implemented in:
|
||||
</p>
|
||||
|
||||
<p><code>src/remote/remote_daemon_dispatch.c</code></p>
|
||||
<p><code>daemon/remote.c</code></p>
|
||||
|
||||
<p>Again, this step uses the .h files generated by make rpcgen.</p>
|
||||
|
||||
@@ -272,6 +298,8 @@
|
||||
existing lines probably imply a backwards-incompatible API change.
|
||||
</p>
|
||||
|
||||
<p class="example">See <a href="api_extension/0005-implement-the-remote-protocol.patch">0005-implement-the-remote-protocol.patch</a></p>
|
||||
|
||||
<h2><a id="internaluseapi">Use the new API internally</a></h2>
|
||||
|
||||
<p>
|
||||
@@ -284,6 +312,8 @@
|
||||
not necessary if the new API has no relation to existing API.
|
||||
</p>
|
||||
|
||||
<p class="example">See <a href="api_extension/0006-make-old-API-trivially-wrap-to-new-API.patch">0006-make-old-API-trivially-wrap-to-new-API.patch</a></p>
|
||||
|
||||
<h2><a id="virshuseapi">Expose the new API in virsh</a></h2>
|
||||
|
||||
<p>
|
||||
@@ -309,10 +339,12 @@
|
||||
</p>
|
||||
|
||||
<p><code>
|
||||
tools/virsh-$MODULE.c<br/>
|
||||
tools/virsh.c<br/>
|
||||
tools/virsh.pod
|
||||
</code></p>
|
||||
|
||||
<p class="example">See <a href="api_extension/0007-add-virsh-support.patch">0007-add-virsh-support.patch</a></p>
|
||||
|
||||
<h2><a id="driverimpl">Implement the driver methods</a></h2>
|
||||
|
||||
<p>
|
||||
@@ -339,6 +371,8 @@
|
||||
the same way as the older API wrappers.
|
||||
</p>
|
||||
|
||||
<p class="example">See <a href="api_extension/0008-support-new-xml.patch">0008-support-new-xml.patch</a></p>
|
||||
|
||||
<h3><a id="drivercode">Implement driver handling</a></h3>
|
||||
|
||||
<p>
|
||||
@@ -350,14 +384,41 @@
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It is always a good idea to patch the test driver in addition to the
|
||||
target driver, to prove that the API can be used for more than one
|
||||
driver.
|
||||
In the example patches, three separate drivers are supported:
|
||||
test, qemu, and xen. It is always a good idea to patch the test
|
||||
driver in addition to the target driver, to prove that the API
|
||||
can be used for more than one driver. The example updates the
|
||||
test driver in one patch:
|
||||
</p>
|
||||
|
||||
<p class="example">See <a href="api_extension/0009-support-all-flags-in-test-driver.patch">0009-support-all-flags-in-test-driver.patch</a></p>
|
||||
|
||||
<p>
|
||||
Any cleanups resulting from the changes should be added as separate
|
||||
patches at the end of the series.
|
||||
The qemu changes were easier to split into two phases, one for
|
||||
updating the mapping between the new XML and the hypervisor
|
||||
command line arguments, and one for supporting all possible
|
||||
flags of the new API:
|
||||
</p>
|
||||
|
||||
<p class="example">See <a href="api_extension/0010-improve-vcpu-support-in-qemu-command-line.patch">0010-improve-vcpu-support-in-qemu-command-line.patch</a>
|
||||
and <a href="api_extension/0011-complete-vcpu-support-in-qemu-driver.patch">0011-complete-vcpu-support-in-qemu-driver.patch</a></p>
|
||||
|
||||
<p>
|
||||
Finally, the example breaks the xen driver changes across four
|
||||
patches. One maps the XML changes to the hypervisor command,
|
||||
the next two are independently implementing the getter and
|
||||
setter APIs, and the last one provides cleanup of code that was
|
||||
rendered dead by the new API.
|
||||
</p>
|
||||
|
||||
<p class="example">See <a href="api_extension/0012-improve-vcpu-support-in-xen-command-line.patch">0012-improve-vcpu-support-in-xen-command-line.patch</a>,
|
||||
<a href="api_extension/0013-improve-getting-xen-vcpu-counts.patch">0013-improve-getting-xen-vcpu-counts.patch</a>,
|
||||
<a href="api_extension/0014-improve-setting-xen-vcpu-counts.patch">0014-improve-setting-xen-vcpu-counts.patch</a>,
|
||||
and <a href="api_extension/0015-remove-dead-xen-code.patch">0015-remove-dead-xen-code.patch</a></p>
|
||||
|
||||
<p>
|
||||
The exact details of the example code are probably uninteresting
|
||||
unless you're concerned with virtual cpu management.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
145
docs/api_extension/0001-add-to-xml.patch
Normal file
145
docs/api_extension/0001-add-to-xml.patch
Normal file
@@ -0,0 +1,145 @@
|
||||
From a74f4e44649906dcd82151f7ef837f66d7fa2ab1 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Mon, 27 Sep 2010 17:36:06 -0600
|
||||
Subject: [PATCH 01/15] vcpu: add current attribute to <vcpu> element
|
||||
|
||||
Syntax agreed on in
|
||||
https://www.redhat.com/archives/libvir-list/2010-September/msg00476.html
|
||||
|
||||
<domain ...>
|
||||
<vcpu current='x'>y</vcpu>
|
||||
...
|
||||
|
||||
can now be used to specify 1 <= x <= y current vcpus, in relation
|
||||
to the boot-time max of y vcpus. If current is omitted, then
|
||||
current and max are assumed to be the same value.
|
||||
|
||||
* docs/schemas/domain.rng: Add new attribute.
|
||||
* docs/formatdomain.html.in: Document it.
|
||||
* tests/qemuxml2argvdata/qemuxml2argv-smp.xml: Add to
|
||||
domainschematest.
|
||||
* tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml: Likewise.
|
||||
---
|
||||
docs/formatdomain.html.in | 9 +++++--
|
||||
docs/schemas/domain.rng | 5 ++++
|
||||
tests/qemuxml2argvdata/qemuxml2argv-smp.xml | 28 +++++++++++++++++++++++++++
|
||||
tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml | 22 +++++++++++++++++++++
|
||||
4 files changed, 61 insertions(+), 3 deletions(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smp.xml
|
||||
create mode 100644 tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index a8a1fac..96de121 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -200,7 +200,7 @@
|
||||
<swap_hard_limit>2097152</swap_hard_limit>
|
||||
<min_guarantee>65536</min_guarantee>
|
||||
</memtune>
|
||||
- <vcpu cpuset="1-4,^3,6">2</vcpu>
|
||||
+ <vcpu cpuset="1-4,^3,6" current="1">2</vcpu>
|
||||
...</pre>
|
||||
|
||||
<dl>
|
||||
@@ -238,7 +238,7 @@
|
||||
minimum memory allocation for the guest. The units for this value are
|
||||
kilobytes (i.e. blocks of 1024 bytes)</dd>
|
||||
<dt><code>vcpu</code></dt>
|
||||
- <dd>The content of this element defines the number of virtual
|
||||
+ <dd>The content of this element defines the maximum number of virtual
|
||||
CPUs allocated for the guest OS, which must be between 1 and
|
||||
the maximum supported by the hypervisor. <span class="since">Since
|
||||
0.4.4</span>, this element can contain an optional
|
||||
@@ -246,7 +246,10 @@
|
||||
list of physical CPU numbers that virtual CPUs can be pinned
|
||||
to. Each element in that list is either a single CPU number,
|
||||
a range of CPU numbers, or a caret followed by a CPU number to
|
||||
- be excluded from a previous range.
|
||||
+ be excluded from a previous range. <span class="since">Since
|
||||
+ 0.8.5</span>, the optional attribute <code>current</code> can
|
||||
+ be used to specify whether fewer than the maximum number of
|
||||
+ virtual CPUs should be enabled.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
|
||||
index f230263..a934a77 100644
|
||||
--- a/docs/schemas/domain.rng
|
||||
+++ b/docs/schemas/domain.rng
|
||||
@@ -337,6 +337,11 @@
|
||||
<ref name="cpuset"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
+ <optional>
|
||||
+ <attribute name="current">
|
||||
+ <ref name="countCPU"/>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
<ref name="countCPU"/>
|
||||
</element>
|
||||
</optional>
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smp.xml b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
|
||||
new file mode 100644
|
||||
index 0000000..975f873
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smp.xml
|
||||
@@ -0,0 +1,28 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory>219200</memory>
|
||||
+ <currentMemory>219200</currentMemory>
|
||||
+ <vcpu current='1'>2</vcpu>
|
||||
+ <os>
|
||||
+ <type arch='i686' machine='pc'>hvm</type>
|
||||
+ <boot dev='hd'/>
|
||||
+ </os>
|
||||
+ <cpu>
|
||||
+ <topology sockets='2' cores='1' threads='1'/>
|
||||
+ </cpu>
|
||||
+ <clock offset='utc'/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>destroy</on_crash>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu</emulator>
|
||||
+ <disk type='block' device='disk'>
|
||||
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
+ <target dev='hda' bus='ide'/>
|
||||
+ <address type='drive' controller='0' bus='0' unit='0'/>
|
||||
+ </disk>
|
||||
+ <controller type='ide' index='0'/>
|
||||
+ <memballoon model='virtio'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
|
||||
new file mode 100644
|
||||
index 0000000..d061e11
|
||||
--- /dev/null
|
||||
+++ b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.xml
|
||||
@@ -0,0 +1,22 @@
|
||||
+<domain type='xen' id='15'>
|
||||
+ <name>pvtest</name>
|
||||
+ <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
|
||||
+ <os>
|
||||
+ <type>linux</type>
|
||||
+ <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
+ <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
+ <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
+ </os>
|
||||
+ <memory>430080</memory>
|
||||
+ <vcpu current='2'>4</vcpu>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>destroy</on_reboot>
|
||||
+ <on_crash>destroy</on_crash>
|
||||
+ <devices>
|
||||
+ <disk type='file' device='disk'>
|
||||
+ <source file='/root/some.img'/>
|
||||
+ <target dev='xvda'/>
|
||||
+ </disk>
|
||||
+ <console tty='/dev/pts/4'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
--
|
||||
1.7.2.3
|
||||
|
62
docs/api_extension/0002-add-new-public-API.patch
Normal file
62
docs/api_extension/0002-add-new-public-API.patch
Normal file
@@ -0,0 +1,62 @@
|
||||
From ea3f5c68093429c6ad507b45689cdf209c2c257b Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Fri, 24 Sep 2010 16:48:45 -0600
|
||||
Subject: [PATCH 02/15] vcpu: add new public API
|
||||
|
||||
API agreed on in
|
||||
https://www.redhat.com/archives/libvir-list/2010-September/msg00456.html,
|
||||
but modified for enum names to be consistent with virDomainDeviceModifyFlags.
|
||||
|
||||
* include/libvirt/libvirt.h.in (virDomainVcpuFlags)
|
||||
(virDomainSetVcpusFlags, virDomainGetVcpusFlags): New
|
||||
declarations.
|
||||
* src/libvirt_public.syms: Export new symbols.
|
||||
---
|
||||
include/libvirt/libvirt.h.in | 15 +++++++++++++++
|
||||
src/libvirt_public.syms | 2 ++
|
||||
2 files changed, 17 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
|
||||
index 2eba61e..d0cc4c0 100644
|
||||
--- a/include/libvirt/libvirt.h.in
|
||||
+++ b/include/libvirt/libvirt.h.in
|
||||
@@ -915,8 +915,23 @@ struct _virVcpuInfo {
|
||||
};
|
||||
typedef virVcpuInfo *virVcpuInfoPtr;
|
||||
|
||||
+/* Flags for controlling virtual CPU hot-plugging. */
|
||||
+typedef enum {
|
||||
+ /* Must choose at least one of these two bits; SetVcpus can choose both */
|
||||
+ VIR_DOMAIN_VCPU_LIVE = (1 << 0), /* Affect active domain */
|
||||
+ VIR_DOMAIN_VCPU_CONFIG = (1 << 1), /* Affect next boot */
|
||||
+
|
||||
+ /* Additional flags to be bit-wise OR'd in */
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */
|
||||
+} virDomainVcpuFlags;
|
||||
+
|
||||
int virDomainSetVcpus (virDomainPtr domain,
|
||||
unsigned int nvcpus);
|
||||
+int virDomainSetVcpusFlags (virDomainPtr domain,
|
||||
+ unsigned int nvcpus,
|
||||
+ unsigned int flags);
|
||||
+int virDomainGetVcpusFlags (virDomainPtr domain,
|
||||
+ unsigned int flags);
|
||||
|
||||
int virDomainPinVcpu (virDomainPtr domain,
|
||||
unsigned int vcpu,
|
||||
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
|
||||
index fceb516..a8091b1 100644
|
||||
--- a/src/libvirt_public.syms
|
||||
+++ b/src/libvirt_public.syms
|
||||
@@ -409,6 +409,8 @@ LIBVIRT_0.8.5 {
|
||||
global:
|
||||
virDomainSetMemoryParameters;
|
||||
virDomainGetMemoryParameters;
|
||||
+ virDomainGetVcpusFlags;
|
||||
+ virDomainSetVcpusFlags;
|
||||
} LIBVIRT_0.8.2;
|
||||
|
||||
# .... define new API here using predicted next version number ....
|
||||
--
|
||||
1.7.2.3
|
||||
|
222
docs/api_extension/0003-define-internal-driver-API.patch
Normal file
222
docs/api_extension/0003-define-internal-driver-API.patch
Normal file
@@ -0,0 +1,222 @@
|
||||
From dd255d64053e9960cd375994ce8f056522e12acc Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Mon, 27 Sep 2010 09:18:22 -0600
|
||||
Subject: [PATCH 03/15] vcpu: define internal driver API
|
||||
|
||||
* src/driver.h (virDrvDomainSetVcpusFlags)
|
||||
(virDrvDomainGetVcpusFlags): New typedefs.
|
||||
(_virDriver): New callback members.
|
||||
* src/esx/esx_driver.c (esxDriver): Add stub for driver.
|
||||
* src/lxc/lxc_driver.c (lxcDriver): Likewise.
|
||||
* src/opennebula/one_driver.c (oneDriver): Likewise.
|
||||
* src/openvz/openvz_driver.c (openvzDriver): Likewise.
|
||||
* src/phyp/phyp_driver.c (phypDriver): Likewise.
|
||||
* src/qemu/qemu_driver.c (qemuDriver): Likewise.
|
||||
* src/remote/remote_driver.c (remote_driver): Likewise.
|
||||
* src/test/test_driver.c (testDriver): Likewise.
|
||||
* src/uml/uml_driver.c (umlDriver): Likewise.
|
||||
* src/vbox/vbox_tmpl.c (Driver): Likewise.
|
||||
* src/xen/xen_driver.c (xenUnifiedDriver): Likewise.
|
||||
* src/xenapi/xenapi_driver.c (xenapiDriver): Likewise.
|
||||
---
|
||||
src/driver.h | 9 +++++++++
|
||||
src/esx/esx_driver.c | 2 ++
|
||||
src/lxc/lxc_driver.c | 2 ++
|
||||
src/opennebula/one_driver.c | 2 ++
|
||||
src/openvz/openvz_driver.c | 2 ++
|
||||
src/phyp/phyp_driver.c | 2 ++
|
||||
src/qemu/qemu_driver.c | 2 ++
|
||||
src/remote/remote_driver.c | 2 ++
|
||||
src/test/test_driver.c | 2 ++
|
||||
src/uml/uml_driver.c | 2 ++
|
||||
src/vbox/vbox_tmpl.c | 2 ++
|
||||
src/xen/xen_driver.c | 2 ++
|
||||
src/xenapi/xenapi_driver.c | 2 ++
|
||||
13 files changed, 33 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/src/driver.h b/src/driver.h
|
||||
index 32aeb04..79a96c1 100644
|
||||
--- a/src/driver.h
|
||||
+++ b/src/driver.h
|
||||
@@ -185,6 +185,13 @@ typedef int
|
||||
(*virDrvDomainSetVcpus) (virDomainPtr domain,
|
||||
unsigned int nvcpus);
|
||||
typedef int
|
||||
+ (*virDrvDomainSetVcpusFlags) (virDomainPtr domain,
|
||||
+ unsigned int nvcpus,
|
||||
+ unsigned int flags);
|
||||
+typedef int
|
||||
+ (*virDrvDomainGetVcpusFlags) (virDomainPtr domain,
|
||||
+ unsigned int flags);
|
||||
+typedef int
|
||||
(*virDrvDomainPinVcpu) (virDomainPtr domain,
|
||||
unsigned int vcpu,
|
||||
unsigned char *cpumap,
|
||||
@@ -520,6 +527,8 @@ struct _virDriver {
|
||||
virDrvDomainRestore domainRestore;
|
||||
virDrvDomainCoreDump domainCoreDump;
|
||||
virDrvDomainSetVcpus domainSetVcpus;
|
||||
+ virDrvDomainSetVcpusFlags domainSetVcpusFlags;
|
||||
+ virDrvDomainGetVcpusFlags domainGetVcpusFlags;
|
||||
virDrvDomainPinVcpu domainPinVcpu;
|
||||
virDrvDomainGetVcpus domainGetVcpus;
|
||||
virDrvDomainGetMaxVcpus domainGetMaxVcpus;
|
||||
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
|
||||
index 1b4ee29..2a32374 100644
|
||||
--- a/src/esx/esx_driver.c
|
||||
+++ b/src/esx/esx_driver.c
|
||||
@@ -4160,6 +4160,8 @@ static virDriver esxDriver = {
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
esxDomainSetVcpus, /* domainSetVcpus */
|
||||
+ NULL, /* domainSetVcpusFlags */
|
||||
+ NULL, /* domainGetVcpusFlags */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
esxDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
|
||||
index df814da..7563a8c 100644
|
||||
--- a/src/lxc/lxc_driver.c
|
||||
+++ b/src/lxc/lxc_driver.c
|
||||
@@ -2768,6 +2768,8 @@ static virDriver lxcDriver = {
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
NULL, /* domainSetVcpus */
|
||||
+ NULL, /* domainSetVcpusFlags */
|
||||
+ NULL, /* domainGetVcpusFlags */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
NULL, /* domainGetMaxVcpus */
|
||||
diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c
|
||||
index ced9a38..199fca3 100644
|
||||
--- a/src/opennebula/one_driver.c
|
||||
+++ b/src/opennebula/one_driver.c
|
||||
@@ -751,6 +751,8 @@ static virDriver oneDriver = {
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
NULL, /* domainSetVcpus */
|
||||
+ NULL, /* domainSetVcpusFlags */
|
||||
+ NULL, /* domainGetVcpusFlags */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
NULL, /* domainGetMaxVcpus */
|
||||
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
|
||||
index 92cf4a1..9d19aeb 100644
|
||||
--- a/src/openvz/openvz_driver.c
|
||||
+++ b/src/openvz/openvz_driver.c
|
||||
@@ -1590,6 +1590,8 @@ static virDriver openvzDriver = {
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
openvzDomainSetVcpus, /* domainSetVcpus */
|
||||
+ NULL, /* domainSetVcpusFlags */
|
||||
+ NULL, /* domainGetVcpusFlags */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
openvzDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
|
||||
index e63d8d9..6e0a5e9 100644
|
||||
--- a/src/phyp/phyp_driver.c
|
||||
+++ b/src/phyp/phyp_driver.c
|
||||
@@ -3941,6 +3941,8 @@ static virDriver phypDriver = {
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
phypDomainSetCPU, /* domainSetVcpus */
|
||||
+ NULL, /* domainSetVcpusFlags */
|
||||
+ NULL, /* domainGetVcpusFlags */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
phypGetLparCPUMAX, /* domainGetMaxVcpus */
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index abd8e9d..3d17e04 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -12938,6 +12938,8 @@ static virDriver qemuDriver = {
|
||||
qemudDomainRestore, /* domainRestore */
|
||||
qemudDomainCoreDump, /* domainCoreDump */
|
||||
qemudDomainSetVcpus, /* domainSetVcpus */
|
||||
+ NULL, /* domainSetVcpusFlags */
|
||||
+ NULL, /* domainGetVcpusFlags */
|
||||
qemudDomainPinVcpu, /* domainPinVcpu */
|
||||
qemudDomainGetVcpus, /* domainGetVcpus */
|
||||
qemudDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
|
||||
index 0b10406..1a687ad 100644
|
||||
--- a/src/remote/remote_driver.c
|
||||
+++ b/src/remote/remote_driver.c
|
||||
@@ -10468,6 +10468,8 @@ static virDriver remote_driver = {
|
||||
remoteDomainRestore, /* domainRestore */
|
||||
remoteDomainCoreDump, /* domainCoreDump */
|
||||
remoteDomainSetVcpus, /* domainSetVcpus */
|
||||
+ NULL, /* domainSetVcpusFlags */
|
||||
+ NULL, /* domainGetVcpusFlags */
|
||||
remoteDomainPinVcpu, /* domainPinVcpu */
|
||||
remoteDomainGetVcpus, /* domainGetVcpus */
|
||||
remoteDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
|
||||
index 7d4d119..6a00558 100644
|
||||
--- a/src/test/test_driver.c
|
||||
+++ b/src/test/test_driver.c
|
||||
@@ -5260,6 +5260,8 @@ static virDriver testDriver = {
|
||||
testDomainRestore, /* domainRestore */
|
||||
testDomainCoreDump, /* domainCoreDump */
|
||||
testSetVcpus, /* domainSetVcpus */
|
||||
+ NULL, /* domainSetVcpusFlags */
|
||||
+ NULL, /* domainGetVcpusFlags */
|
||||
testDomainPinVcpu, /* domainPinVcpu */
|
||||
testDomainGetVcpus, /* domainGetVcpus */
|
||||
testDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
|
||||
index 3dcd321..5161012 100644
|
||||
--- a/src/uml/uml_driver.c
|
||||
+++ b/src/uml/uml_driver.c
|
||||
@@ -2129,6 +2129,8 @@ static virDriver umlDriver = {
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
NULL, /* domainSetVcpus */
|
||||
+ NULL, /* domainSetVcpusFlags */
|
||||
+ NULL, /* domainGetVcpusFlags */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
NULL, /* domainGetMaxVcpus */
|
||||
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
|
||||
index 7e7d8e4..cb9193a 100644
|
||||
--- a/src/vbox/vbox_tmpl.c
|
||||
+++ b/src/vbox/vbox_tmpl.c
|
||||
@@ -8267,6 +8267,8 @@ virDriver NAME(Driver) = {
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
vboxDomainSetVcpus, /* domainSetVcpus */
|
||||
+ NULL, /* domainSetVcpusFlags */
|
||||
+ NULL, /* domainGetVcpusFlags */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
vboxDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
|
||||
index c2a4de3..7d67ced 100644
|
||||
--- a/src/xen/xen_driver.c
|
||||
+++ b/src/xen/xen_driver.c
|
||||
@@ -1951,6 +1951,8 @@ static virDriver xenUnifiedDriver = {
|
||||
xenUnifiedDomainRestore, /* domainRestore */
|
||||
xenUnifiedDomainCoreDump, /* domainCoreDump */
|
||||
xenUnifiedDomainSetVcpus, /* domainSetVcpus */
|
||||
+ NULL, /* domainSetVcpusFlags */
|
||||
+ NULL, /* domainGetVcpusFlags */
|
||||
xenUnifiedDomainPinVcpu, /* domainPinVcpu */
|
||||
xenUnifiedDomainGetVcpus, /* domainGetVcpus */
|
||||
xenUnifiedDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
|
||||
index e62a139..753169c 100644
|
||||
--- a/src/xenapi/xenapi_driver.c
|
||||
+++ b/src/xenapi/xenapi_driver.c
|
||||
@@ -1754,6 +1754,8 @@ static virDriver xenapiDriver = {
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
xenapiDomainSetVcpus, /* domainSetVcpus */
|
||||
+ NULL, /* domainSetVcpusFlags */
|
||||
+ NULL, /* domainGetVcpusFlags */
|
||||
xenapiDomainPinVcpu, /* domainPinVcpu */
|
||||
xenapiDomainGetVcpus, /* domainGetVcpus */
|
||||
xenapiDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
--
|
||||
1.7.2.3
|
||||
|
188
docs/api_extension/0004-implement-the-public-APIs.patch
Normal file
188
docs/api_extension/0004-implement-the-public-APIs.patch
Normal file
@@ -0,0 +1,188 @@
|
||||
From 9d2c60799271d605f82dfd4bfa6ed7d14ad87e26 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Mon, 27 Sep 2010 09:37:22 -0600
|
||||
Subject: [PATCH 04/15] vcpu: implement the public APIs
|
||||
|
||||
Factors common checks (such as nonzero vcpu count) up front, but
|
||||
drivers will still need to do additional flag checks.
|
||||
|
||||
* src/libvirt.c (virDomainSetVcpusFlags, virDomainGetVcpusFlags):
|
||||
New functions.
|
||||
(virDomainSetVcpus, virDomainGetMaxVcpus): Refer to new API.
|
||||
---
|
||||
src/libvirt.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
1 files changed, 134 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/libvirt.c b/src/libvirt.c
|
||||
index 629d97b..1b39210 100644
|
||||
--- a/src/libvirt.c
|
||||
+++ b/src/libvirt.c
|
||||
@@ -5192,7 +5192,9 @@ error:
|
||||
* This function requires privileged access to the hypervisor.
|
||||
*
|
||||
* This command only changes the runtime configuration of the domain,
|
||||
- * so can only be called on an active domain.
|
||||
+ * so can only be called on an active domain. It is hypervisor-dependent
|
||||
+ * whether it also affects persistent configuration; for more control,
|
||||
+ * use virDomainSetVcpusFlags().
|
||||
*
|
||||
* Returns 0 in case of success, -1 in case of failure.
|
||||
*/
|
||||
@@ -5237,13 +5239,139 @@ error:
|
||||
}
|
||||
|
||||
/**
|
||||
+ * virDomainSetVcpusFlags:
|
||||
+ * @domain: pointer to domain object, or NULL for Domain0
|
||||
+ * @nvcpus: the new number of virtual CPUs for this domain, must be at least 1
|
||||
+ * @flags: an OR'ed set of virDomainVcpuFlags
|
||||
+ *
|
||||
+ * Dynamically change the number of virtual CPUs used by the domain.
|
||||
+ * Note that this call may fail if the underlying virtualization hypervisor
|
||||
+ * does not support it or if growing the number is arbitrary limited.
|
||||
+ * This function requires privileged access to the hypervisor.
|
||||
+ *
|
||||
+ * @flags must include VIR_DOMAIN_VCPU_LIVE to affect a running
|
||||
+ * domain (which may fail if domain is not active), or
|
||||
+ * VIR_DOMAIN_VCPU_CONFIG to affect the next boot via the XML
|
||||
+ * description of the domain. Both flags may be set.
|
||||
+ *
|
||||
+ * If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then
|
||||
+ * VIR_DOMAIN_VCPU_LIVE must be clear, and only the maximum virtual
|
||||
+ * CPU limit is altered; generally, this value must be less than or
|
||||
+ * equal to virConnectGetMaxVcpus(). Otherwise, this call affects the
|
||||
+ * current virtual CPU limit, which must be less than or equal to the
|
||||
+ * maximum limit.
|
||||
+ *
|
||||
+ * Returns 0 in case of success, -1 in case of failure.
|
||||
+ */
|
||||
+
|
||||
+int
|
||||
+virDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
|
||||
+ unsigned int flags)
|
||||
+{
|
||||
+ virConnectPtr conn;
|
||||
+ VIR_DEBUG("domain=%p, nvcpus=%u, flags=%u", domain, nvcpus, flags);
|
||||
+
|
||||
+ virResetLastError();
|
||||
+
|
||||
+ if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||
+ virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
+ virDispatchError(NULL);
|
||||
+ return (-1);
|
||||
+ }
|
||||
+ if (domain->conn->flags & VIR_CONNECT_RO) {
|
||||
+ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ /* Perform some argument validation common to all implementations. */
|
||||
+ if (nvcpus < 1 || (unsigned short) nvcpus != nvcpus ||
|
||||
+ (flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0) {
|
||||
+ virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
+ conn = domain->conn;
|
||||
+
|
||||
+ if (conn->driver->domainSetVcpusFlags) {
|
||||
+ int ret;
|
||||
+ ret = conn->driver->domainSetVcpusFlags (domain, nvcpus, flags);
|
||||
+ if (ret < 0)
|
||||
+ goto error;
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
+
|
||||
+error:
|
||||
+ virDispatchError(domain->conn);
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * virDomainGetVcpusFlags:
|
||||
+ * @domain: pointer to domain object, or NULL for Domain0
|
||||
+ * @flags: an OR'ed set of virDomainVcpuFlags
|
||||
+ *
|
||||
+ * Query the number of virtual CPUs used by the domain. Note that
|
||||
+ * this call may fail if the underlying virtualization hypervisor does
|
||||
+ * not support it. This function requires privileged access to the
|
||||
+ * hypervisor.
|
||||
+ *
|
||||
+ * @flags must include either VIR_DOMAIN_VCPU_ACTIVE to query a
|
||||
+ * running domain (which will fail if domain is not active), or
|
||||
+ * VIR_DOMAIN_VCPU_PERSISTENT to query the XML description of the
|
||||
+ * domain. It is an error to set both flags.
|
||||
+ *
|
||||
+ * If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then the maximum
|
||||
+ * virtual CPU limit is queried. Otherwise, this call queries the
|
||||
+ * current virtual CPU limit.
|
||||
+ *
|
||||
+ * Returns 0 in case of success, -1 in case of failure.
|
||||
+ */
|
||||
+
|
||||
+int
|
||||
+virDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||
+{
|
||||
+ virConnectPtr conn;
|
||||
+ VIR_DEBUG("domain=%p, flags=%u", domain, flags);
|
||||
+
|
||||
+ virResetLastError();
|
||||
+
|
||||
+ if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||
+ virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
+ virDispatchError(NULL);
|
||||
+ return (-1);
|
||||
+ }
|
||||
+
|
||||
+ /* Exactly one of these two flags should be set. */
|
||||
+ if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
|
||||
+ virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
+ goto error;
|
||||
+ }
|
||||
+ conn = domain->conn;
|
||||
+
|
||||
+ if (conn->driver->domainGetVcpusFlags) {
|
||||
+ int ret;
|
||||
+ ret = conn->driver->domainGetVcpusFlags (domain, flags);
|
||||
+ if (ret < 0)
|
||||
+ goto error;
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
+
|
||||
+error:
|
||||
+ virDispatchError(domain->conn);
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* virDomainPinVcpu:
|
||||
* @domain: pointer to domain object, or NULL for Domain0
|
||||
* @vcpu: virtual CPU number
|
||||
* @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes) (IN)
|
||||
- * Each bit set to 1 means that corresponding CPU is usable.
|
||||
- * Bytes are stored in little-endian order: CPU0-7, 8-15...
|
||||
- * In each byte, lowest CPU number is least significant bit.
|
||||
+ * Each bit set to 1 means that corresponding CPU is usable.
|
||||
+ * Bytes are stored in little-endian order: CPU0-7, 8-15...
|
||||
+ * In each byte, lowest CPU number is least significant bit.
|
||||
* @maplen: number of bytes in cpumap, from 1 up to size of CPU map in
|
||||
* underlying virtualization system (Xen...).
|
||||
* If maplen < size, missing bytes are set to zero.
|
||||
@@ -5371,9 +5499,9 @@ error:
|
||||
*
|
||||
* Provides the maximum number of virtual CPUs supported for
|
||||
* the guest VM. If the guest is inactive, this is basically
|
||||
- * the same as virConnectGetMaxVcpus. If the guest is running
|
||||
+ * the same as virConnectGetMaxVcpus(). If the guest is running
|
||||
* this will reflect the maximum number of virtual CPUs the
|
||||
- * guest was booted with.
|
||||
+ * guest was booted with. For more details, see virDomainGetVcpusFlags().
|
||||
*
|
||||
* Returns the maximum of virtual CPU or -1 in case of error.
|
||||
*/
|
||||
--
|
||||
1.7.2.3
|
||||
|
421
docs/api_extension/0005-implement-the-remote-protocol.patch
Normal file
421
docs/api_extension/0005-implement-the-remote-protocol.patch
Normal file
@@ -0,0 +1,421 @@
|
||||
From eb826444f90c2563dadf148630b0cd6a9b41ba1e Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Mon, 27 Sep 2010 10:10:06 -0600
|
||||
Subject: [PATCH 05/15] vcpu: implement the remote protocol
|
||||
|
||||
Done by editing the first three files, then running
|
||||
'make -C src rpcgen', then editing src/remote_protocol-structs
|
||||
to match.
|
||||
|
||||
* daemon/remote.c (remoteDispatchDomainSetVcpusFlags)
|
||||
(remoteDispatchDomainGetVcpusFlags): New functions.
|
||||
* src/remote/remote_driver.c (remoteDomainSetVcpusFlags)
|
||||
(remoteDomainGetVcpusFlags, remote_driver): Client side
|
||||
serialization.
|
||||
* src/remote/remote_protocol.x
|
||||
(remote_domain_set_vcpus_flags_args)
|
||||
(remote_domain_get_vcpus_flags_args)
|
||||
(remote_domain_get_vcpus_flags_ret)
|
||||
(REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS)
|
||||
(REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS): Define wire format.
|
||||
* daemon/remote_dispatch_args.h: Regenerate.
|
||||
* daemon/remote_dispatch_prototypes.h: Likewise.
|
||||
* daemon/remote_dispatch_table.h: Likewise.
|
||||
* src/remote/remote_protocol.c: Likewise.
|
||||
* src/remote/remote_protocol.h: Likewise.
|
||||
* src/remote_protocol-structs: Likewise.
|
||||
---
|
||||
daemon/remote.c | 53 ++++++++++++++++++++++++++++++++
|
||||
daemon/remote_dispatch_args.h | 2 +
|
||||
daemon/remote_dispatch_prototypes.h | 16 ++++++++++
|
||||
daemon/remote_dispatch_ret.h | 1 +
|
||||
daemon/remote_dispatch_table.h | 10 ++++++
|
||||
src/remote/remote_driver.c | 57 +++++++++++++++++++++++++++++++++-
|
||||
src/remote/remote_protocol.c | 33 ++++++++++++++++++++
|
||||
src/remote/remote_protocol.h | 26 ++++++++++++++++
|
||||
src/remote/remote_protocol.x | 19 +++++++++++-
|
||||
src/remote_protocol-structs | 12 +++++++
|
||||
10 files changed, 226 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/daemon/remote.c b/daemon/remote.c
|
||||
index 7a96e29..323f00c 100644
|
||||
--- a/daemon/remote.c
|
||||
+++ b/daemon/remote.c
|
||||
@@ -1751,6 +1751,33 @@ oom:
|
||||
}
|
||||
|
||||
static int
|
||||
+remoteDispatchDomainGetVcpusFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
+ struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
+ virConnectPtr conn,
|
||||
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||
+ remote_error *rerr,
|
||||
+ remote_domain_get_vcpus_flags_args *args,
|
||||
+ remote_domain_get_vcpus_flags_ret *ret)
|
||||
+{
|
||||
+ virDomainPtr dom;
|
||||
+
|
||||
+ dom = get_nonnull_domain (conn, args->dom);
|
||||
+ if (dom == NULL) {
|
||||
+ remoteDispatchConnError(rerr, conn);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ ret->num = virDomainGetVcpusFlags (dom, args->flags);
|
||||
+ if (ret->num == -1) {
|
||||
+ virDomainFree(dom);
|
||||
+ remoteDispatchConnError(rerr, conn);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ virDomainFree(dom);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
remoteDispatchDomainMigratePrepare (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
virConnectPtr conn,
|
||||
@@ -2568,6 +2595,32 @@ remoteDispatchDomainSetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
static int
|
||||
+remoteDispatchDomainSetVcpusFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
+ struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
+ virConnectPtr conn,
|
||||
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||
+ remote_error *rerr,
|
||||
+ remote_domain_set_vcpus_flags_args *args,
|
||||
+ void *ret ATTRIBUTE_UNUSED)
|
||||
+{
|
||||
+ virDomainPtr dom;
|
||||
+
|
||||
+ dom = get_nonnull_domain (conn, args->dom);
|
||||
+ if (dom == NULL) {
|
||||
+ remoteDispatchConnError(rerr, conn);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (virDomainSetVcpusFlags (dom, args->nvcpus, args->flags) == -1) {
|
||||
+ virDomainFree(dom);
|
||||
+ remoteDispatchConnError(rerr, conn);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ virDomainFree(dom);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
remoteDispatchDomainShutdown (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
virConnectPtr conn,
|
||||
diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h
|
||||
index d8528b6..9583e9c 100644
|
||||
--- a/daemon/remote_dispatch_args.h
|
||||
+++ b/daemon/remote_dispatch_args.h
|
||||
@@ -167,3 +167,5 @@
|
||||
remote_domain_create_with_flags_args val_remote_domain_create_with_flags_args;
|
||||
remote_domain_set_memory_parameters_args val_remote_domain_set_memory_parameters_args;
|
||||
remote_domain_get_memory_parameters_args val_remote_domain_get_memory_parameters_args;
|
||||
+ remote_domain_set_vcpus_flags_args val_remote_domain_set_vcpus_flags_args;
|
||||
+ remote_domain_get_vcpus_flags_args val_remote_domain_get_vcpus_flags_args;
|
||||
diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h
|
||||
index b674bb4..6b35851 100644
|
||||
--- a/daemon/remote_dispatch_prototypes.h
|
||||
+++ b/daemon/remote_dispatch_prototypes.h
|
||||
@@ -306,6 +306,14 @@ static int remoteDispatchDomainGetVcpus(
|
||||
remote_error *err,
|
||||
remote_domain_get_vcpus_args *args,
|
||||
remote_domain_get_vcpus_ret *ret);
|
||||
+static int remoteDispatchDomainGetVcpusFlags(
|
||||
+ struct qemud_server *server,
|
||||
+ struct qemud_client *client,
|
||||
+ virConnectPtr conn,
|
||||
+ remote_message_header *hdr,
|
||||
+ remote_error *err,
|
||||
+ remote_domain_get_vcpus_flags_args *args,
|
||||
+ remote_domain_get_vcpus_flags_ret *ret);
|
||||
static int remoteDispatchDomainHasCurrentSnapshot(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
@@ -554,6 +562,14 @@ static int remoteDispatchDomainSetVcpus(
|
||||
remote_error *err,
|
||||
remote_domain_set_vcpus_args *args,
|
||||
void *ret);
|
||||
+static int remoteDispatchDomainSetVcpusFlags(
|
||||
+ struct qemud_server *server,
|
||||
+ struct qemud_client *client,
|
||||
+ virConnectPtr conn,
|
||||
+ remote_message_header *hdr,
|
||||
+ remote_error *err,
|
||||
+ remote_domain_set_vcpus_flags_args *args,
|
||||
+ void *ret);
|
||||
static int remoteDispatchDomainShutdown(
|
||||
struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
diff --git a/daemon/remote_dispatch_ret.h b/daemon/remote_dispatch_ret.h
|
||||
index 17c9bca..3723b00 100644
|
||||
--- a/daemon/remote_dispatch_ret.h
|
||||
+++ b/daemon/remote_dispatch_ret.h
|
||||
@@ -136,3 +136,4 @@
|
||||
remote_domain_get_block_info_ret val_remote_domain_get_block_info_ret;
|
||||
remote_domain_create_with_flags_ret val_remote_domain_create_with_flags_ret;
|
||||
remote_domain_get_memory_parameters_ret val_remote_domain_get_memory_parameters_ret;
|
||||
+ remote_domain_get_vcpus_flags_ret val_remote_domain_get_vcpus_flags_ret;
|
||||
diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
|
||||
index 47d95eb..dd2adc7 100644
|
||||
--- a/daemon/remote_dispatch_table.h
|
||||
+++ b/daemon/remote_dispatch_table.h
|
||||
@@ -997,3 +997,13 @@
|
||||
.args_filter = (xdrproc_t) xdr_remote_domain_get_memory_parameters_args,
|
||||
.ret_filter = (xdrproc_t) xdr_remote_domain_get_memory_parameters_ret,
|
||||
},
|
||||
+{ /* DomainSetVcpusFlags => 199 */
|
||||
+ .fn = (dispatch_fn) remoteDispatchDomainSetVcpusFlags,
|
||||
+ .args_filter = (xdrproc_t) xdr_remote_domain_set_vcpus_flags_args,
|
||||
+ .ret_filter = (xdrproc_t) xdr_void,
|
||||
+},
|
||||
+{ /* DomainGetVcpusFlags => 200 */
|
||||
+ .fn = (dispatch_fn) remoteDispatchDomainGetVcpusFlags,
|
||||
+ .args_filter = (xdrproc_t) xdr_remote_domain_get_vcpus_flags_args,
|
||||
+ .ret_filter = (xdrproc_t) xdr_remote_domain_get_vcpus_flags_ret,
|
||||
+},
|
||||
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
|
||||
index 1a687ad..37c37ef 100644
|
||||
--- a/src/remote/remote_driver.c
|
||||
+++ b/src/remote/remote_driver.c
|
||||
@@ -2580,6 +2580,59 @@ done:
|
||||
}
|
||||
|
||||
static int
|
||||
+remoteDomainSetVcpusFlags (virDomainPtr domain, unsigned int nvcpus,
|
||||
+ unsigned int flags)
|
||||
+{
|
||||
+ int rv = -1;
|
||||
+ remote_domain_set_vcpus_flags_args args;
|
||||
+ struct private_data *priv = domain->conn->privateData;
|
||||
+
|
||||
+ remoteDriverLock(priv);
|
||||
+
|
||||
+ make_nonnull_domain (&args.dom, domain);
|
||||
+ args.nvcpus = nvcpus;
|
||||
+ args.flags = flags;
|
||||
+
|
||||
+ if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS,
|
||||
+ (xdrproc_t) xdr_remote_domain_set_vcpus_flags_args,
|
||||
+ (char *) &args,
|
||||
+ (xdrproc_t) xdr_void, (char *) NULL) == -1)
|
||||
+ goto done;
|
||||
+
|
||||
+ rv = 0;
|
||||
+
|
||||
+done:
|
||||
+ remoteDriverUnlock(priv);
|
||||
+ return rv;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+remoteDomainGetVcpusFlags (virDomainPtr domain, unsigned int flags)
|
||||
+{
|
||||
+ int rv = -1;
|
||||
+ remote_domain_get_vcpus_flags_args args;
|
||||
+ remote_domain_get_vcpus_flags_ret ret;
|
||||
+ struct private_data *priv = domain->conn->privateData;
|
||||
+
|
||||
+ remoteDriverLock(priv);
|
||||
+
|
||||
+ make_nonnull_domain (&args.dom, domain);
|
||||
+ args.flags = flags;
|
||||
+
|
||||
+ memset (&ret, 0, sizeof ret);
|
||||
+ if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS,
|
||||
+ (xdrproc_t) xdr_remote_domain_get_vcpus_flags_args, (char *) &args,
|
||||
+ (xdrproc_t) xdr_remote_domain_get_vcpus_flags_ret, (char *) &ret) == -1)
|
||||
+ goto done;
|
||||
+
|
||||
+ rv = ret.num;
|
||||
+
|
||||
+done:
|
||||
+ remoteDriverUnlock(priv);
|
||||
+ return rv;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
remoteDomainPinVcpu (virDomainPtr domain,
|
||||
unsigned int vcpu,
|
||||
unsigned char *cpumap,
|
||||
@@ -10468,8 +10521,8 @@ static virDriver remote_driver = {
|
||||
remoteDomainRestore, /* domainRestore */
|
||||
remoteDomainCoreDump, /* domainCoreDump */
|
||||
remoteDomainSetVcpus, /* domainSetVcpus */
|
||||
- NULL, /* domainSetVcpusFlags */
|
||||
- NULL, /* domainGetVcpusFlags */
|
||||
+ remoteDomainSetVcpusFlags, /* domainSetVcpusFlags */
|
||||
+ remoteDomainGetVcpusFlags, /* domainGetVcpusFlags */
|
||||
remoteDomainPinVcpu, /* domainPinVcpu */
|
||||
remoteDomainGetVcpus, /* domainGetVcpus */
|
||||
remoteDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
|
||||
index 5c55713..38ea050 100644
|
||||
--- a/src/remote/remote_protocol.c
|
||||
+++ b/src/remote/remote_protocol.c
|
||||
@@ -1355,6 +1355,39 @@ xdr_remote_domain_set_vcpus_args (XDR *xdrs, remote_domain_set_vcpus_args *objp)
|
||||
}
|
||||
|
||||
bool_t
|
||||
+xdr_remote_domain_set_vcpus_flags_args (XDR *xdrs, remote_domain_set_vcpus_flags_args *objp)
|
||||
+{
|
||||
+
|
||||
+ if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
|
||||
+ return FALSE;
|
||||
+ if (!xdr_u_int (xdrs, &objp->nvcpus))
|
||||
+ return FALSE;
|
||||
+ if (!xdr_u_int (xdrs, &objp->flags))
|
||||
+ return FALSE;
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+bool_t
|
||||
+xdr_remote_domain_get_vcpus_flags_args (XDR *xdrs, remote_domain_get_vcpus_flags_args *objp)
|
||||
+{
|
||||
+
|
||||
+ if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
|
||||
+ return FALSE;
|
||||
+ if (!xdr_u_int (xdrs, &objp->flags))
|
||||
+ return FALSE;
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+bool_t
|
||||
+xdr_remote_domain_get_vcpus_flags_ret (XDR *xdrs, remote_domain_get_vcpus_flags_ret *objp)
|
||||
+{
|
||||
+
|
||||
+ if (!xdr_int (xdrs, &objp->num))
|
||||
+ return FALSE;
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+bool_t
|
||||
xdr_remote_domain_pin_vcpu_args (XDR *xdrs, remote_domain_pin_vcpu_args *objp)
|
||||
{
|
||||
char **objp_cpp0 = (char **) (void *) &objp->cpumap.cpumap_val;
|
||||
diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h
|
||||
index 756da11..d75e76c 100644
|
||||
--- a/src/remote/remote_protocol.h
|
||||
+++ b/src/remote/remote_protocol.h
|
||||
@@ -750,6 +750,24 @@ struct remote_domain_set_vcpus_args {
|
||||
};
|
||||
typedef struct remote_domain_set_vcpus_args remote_domain_set_vcpus_args;
|
||||
|
||||
+struct remote_domain_set_vcpus_flags_args {
|
||||
+ remote_nonnull_domain dom;
|
||||
+ u_int nvcpus;
|
||||
+ u_int flags;
|
||||
+};
|
||||
+typedef struct remote_domain_set_vcpus_flags_args remote_domain_set_vcpus_flags_args;
|
||||
+
|
||||
+struct remote_domain_get_vcpus_flags_args {
|
||||
+ remote_nonnull_domain dom;
|
||||
+ u_int flags;
|
||||
+};
|
||||
+typedef struct remote_domain_get_vcpus_flags_args remote_domain_get_vcpus_flags_args;
|
||||
+
|
||||
+struct remote_domain_get_vcpus_flags_ret {
|
||||
+ int num;
|
||||
+};
|
||||
+typedef struct remote_domain_get_vcpus_flags_ret remote_domain_get_vcpus_flags_ret;
|
||||
+
|
||||
struct remote_domain_pin_vcpu_args {
|
||||
remote_nonnull_domain dom;
|
||||
int vcpu;
|
||||
@@ -2281,6 +2299,8 @@ enum remote_procedure {
|
||||
REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196,
|
||||
REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197,
|
||||
REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198,
|
||||
+ REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199,
|
||||
+ REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200,
|
||||
};
|
||||
typedef enum remote_procedure remote_procedure;
|
||||
|
||||
@@ -2422,6 +2442,9 @@ extern bool_t xdr_remote_domain_define_xml_args (XDR *, remote_domain_define_xm
|
||||
extern bool_t xdr_remote_domain_define_xml_ret (XDR *, remote_domain_define_xml_ret*);
|
||||
extern bool_t xdr_remote_domain_undefine_args (XDR *, remote_domain_undefine_args*);
|
||||
extern bool_t xdr_remote_domain_set_vcpus_args (XDR *, remote_domain_set_vcpus_args*);
|
||||
+extern bool_t xdr_remote_domain_set_vcpus_flags_args (XDR *, remote_domain_set_vcpus_flags_args*);
|
||||
+extern bool_t xdr_remote_domain_get_vcpus_flags_args (XDR *, remote_domain_get_vcpus_flags_args*);
|
||||
+extern bool_t xdr_remote_domain_get_vcpus_flags_ret (XDR *, remote_domain_get_vcpus_flags_ret*);
|
||||
extern bool_t xdr_remote_domain_pin_vcpu_args (XDR *, remote_domain_pin_vcpu_args*);
|
||||
extern bool_t xdr_remote_domain_get_vcpus_args (XDR *, remote_domain_get_vcpus_args*);
|
||||
extern bool_t xdr_remote_domain_get_vcpus_ret (XDR *, remote_domain_get_vcpus_ret*);
|
||||
@@ -2762,6 +2785,9 @@ extern bool_t xdr_remote_domain_define_xml_args ();
|
||||
extern bool_t xdr_remote_domain_define_xml_ret ();
|
||||
extern bool_t xdr_remote_domain_undefine_args ();
|
||||
extern bool_t xdr_remote_domain_set_vcpus_args ();
|
||||
+extern bool_t xdr_remote_domain_set_vcpus_flags_args ();
|
||||
+extern bool_t xdr_remote_domain_get_vcpus_flags_args ();
|
||||
+extern bool_t xdr_remote_domain_get_vcpus_flags_ret ();
|
||||
extern bool_t xdr_remote_domain_pin_vcpu_args ();
|
||||
extern bool_t xdr_remote_domain_get_vcpus_args ();
|
||||
extern bool_t xdr_remote_domain_get_vcpus_ret ();
|
||||
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
|
||||
index e80fb5f..d57e6d0 100644
|
||||
--- a/src/remote/remote_protocol.x
|
||||
+++ b/src/remote/remote_protocol.x
|
||||
@@ -768,6 +768,21 @@ struct remote_domain_set_vcpus_args {
|
||||
int nvcpus;
|
||||
};
|
||||
|
||||
+struct remote_domain_set_vcpus_flags_args {
|
||||
+ remote_nonnull_domain dom;
|
||||
+ unsigned int nvcpus;
|
||||
+ unsigned int flags;
|
||||
+};
|
||||
+
|
||||
+struct remote_domain_get_vcpus_flags_args {
|
||||
+ remote_nonnull_domain dom;
|
||||
+ unsigned int flags;
|
||||
+};
|
||||
+
|
||||
+struct remote_domain_get_vcpus_flags_ret {
|
||||
+ int num;
|
||||
+};
|
||||
+
|
||||
struct remote_domain_pin_vcpu_args {
|
||||
remote_nonnull_domain dom;
|
||||
int vcpu;
|
||||
@@ -2062,7 +2077,9 @@ enum remote_procedure {
|
||||
REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195,
|
||||
REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196,
|
||||
REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197,
|
||||
- REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198
|
||||
+ REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198,
|
||||
+ REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199,
|
||||
+ REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200
|
||||
|
||||
/*
|
||||
* Notice how the entries are grouped in sets of 10 ?
|
||||
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
|
||||
index 838423e..d505886 100644
|
||||
--- a/src/remote_protocol-structs
|
||||
+++ b/src/remote_protocol-structs
|
||||
@@ -461,6 +461,18 @@ struct remote_domain_set_vcpus_args {
|
||||
remote_nonnull_domain dom;
|
||||
int nvcpus;
|
||||
};
|
||||
+struct remote_domain_set_vcpus_flags_args {
|
||||
+ remote_nonnull_domain dom;
|
||||
+ u_int nvcpus;
|
||||
+ u_int flags;
|
||||
+};
|
||||
+struct remote_domain_get_vcpus_flags_args {
|
||||
+ remote_nonnull_domain dom;
|
||||
+ u_int flags;
|
||||
+};
|
||||
+struct remote_domain_get_vcpus_flags_ret {
|
||||
+ int num;
|
||||
+};
|
||||
struct remote_domain_pin_vcpu_args {
|
||||
remote_nonnull_domain dom;
|
||||
int vcpu;
|
||||
--
|
||||
1.7.2.3
|
||||
|
@@ -0,0 +1,735 @@
|
||||
From 50c51f13e2af04afac46e181c4ed62581545a488 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Mon, 27 Sep 2010 16:37:53 -0600
|
||||
Subject: [PATCH 06/15] vcpu: make old API trivially wrap to new API
|
||||
|
||||
Note - this wrapping is completely mechanical; the old API will
|
||||
function identically, since the new API validates that the exact
|
||||
same flags are provided by the old API. On a per-driver basis,
|
||||
it may make sense to have the old API pass a different set of flags,
|
||||
but that should be done in the per-driver patch that implements
|
||||
the full range of flag support in the new API.
|
||||
|
||||
* src/esx/esx_driver.c (esxDomainSetVcpus, escDomainGetMaxVpcus):
|
||||
Move guts...
|
||||
(esxDomainSetVcpusFlags, esxDomainGetVcpusFlags): ...to new
|
||||
functions.
|
||||
(esxDriver): Trivially support the new API.
|
||||
* src/openvz/openvz_driver.c (openvzDomainSetVcpus)
|
||||
(openvzDomainSetVcpusFlags, openvzDomainGetMaxVcpus)
|
||||
(openvzDomainGetVcpusFlags, openvzDriver): Likewise.
|
||||
* src/phyp/phyp_driver.c (phypDomainSetCPU)
|
||||
(phypDomainSetVcpusFlags, phypGetLparCPUMAX)
|
||||
(phypDomainGetVcpusFlags, phypDriver): Likewise.
|
||||
* src/qemu/qemu_driver.c (qemudDomainSetVcpus)
|
||||
(qemudDomainSetVcpusFlags, qemudDomainGetMaxVcpus)
|
||||
(qemudDomainGetVcpusFlags, qemuDriver): Likewise.
|
||||
* src/test/test_driver.c (testSetVcpus, testDomainSetVcpusFlags)
|
||||
(testDomainGetMaxVcpus, testDomainGetVcpusFlags, testDriver):
|
||||
Likewise.
|
||||
* src/vbox/vbox_tmpl.c (vboxDomainSetVcpus)
|
||||
(vboxDomainSetVcpusFlags, virDomainGetMaxVcpus)
|
||||
(virDomainGetVcpusFlags, virDriver): Likewise.
|
||||
* src/xen/xen_driver.c (xenUnifiedDomainSetVcpus)
|
||||
(xenUnifiedDomainSetVcpusFlags, xenUnifiedDomainGetMaxVcpus)
|
||||
(xenUnifiedDomainGetVcpusFlags, xenUnifiedDriver): Likewise.
|
||||
* src/xenapi/xenapi_driver.c (xenapiDomainSetVcpus)
|
||||
(xenapiDomainSetVcpusFlags, xenapiDomainGetMaxVcpus)
|
||||
(xenapiDomainGetVcpusFlags, xenapiDriver): Likewise.
|
||||
(xenapiError): New helper macro.
|
||||
---
|
||||
src/esx/esx_driver.c | 32 +++++++++++++++++++---
|
||||
src/openvz/openvz_driver.c | 34 +++++++++++++++++++++---
|
||||
src/phyp/phyp_driver.c | 32 ++++++++++++++++++++---
|
||||
src/qemu/qemu_driver.c | 38 +++++++++++++++++++++++++---
|
||||
src/test/test_driver.c | 36 ++++++++++++++++++++++---
|
||||
src/vbox/vbox_tmpl.c | 36 +++++++++++++++++++++++---
|
||||
src/xen/xen_driver.c | 34 ++++++++++++++++++++++---
|
||||
src/xenapi/xenapi_driver.c | 60 ++++++++++++++++++++++++++++++++++++++------
|
||||
8 files changed, 263 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
|
||||
index 2a32374..b3e1284 100644
|
||||
--- a/src/esx/esx_driver.c
|
||||
+++ b/src/esx/esx_driver.c
|
||||
@@ -2384,7 +2384,8 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
|
||||
|
||||
|
||||
static int
|
||||
-esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
|
||||
+esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
|
||||
+ unsigned int flags)
|
||||
{
|
||||
int result = -1;
|
||||
esxPrivate *priv = domain->conn->privateData;
|
||||
@@ -2394,6 +2395,11 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
|
||||
esxVI_ManagedObjectReference *task = NULL;
|
||||
esxVI_TaskInfoState taskInfoState;
|
||||
|
||||
+ if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
+ ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
if (nvcpus < 1) {
|
||||
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("Requested number of virtual CPUs must at least be 1"));
|
||||
@@ -2453,15 +2459,26 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
|
||||
+{
|
||||
+ return esxDomainSetVcpusFlags(domain, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
+}
|
||||
+
|
||||
|
||||
static int
|
||||
-esxDomainGetMaxVcpus(virDomainPtr domain)
|
||||
+esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||
{
|
||||
esxPrivate *priv = domain->conn->privateData;
|
||||
esxVI_String *propertyNameList = NULL;
|
||||
esxVI_ObjectContent *hostSystem = NULL;
|
||||
esxVI_DynamicProperty *dynamicProperty = NULL;
|
||||
|
||||
+ if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
+ ESX_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
if (priv->maxVcpus > 0) {
|
||||
return priv->maxVcpus;
|
||||
}
|
||||
@@ -2507,7 +2524,12 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
|
||||
return priv->maxVcpus;
|
||||
}
|
||||
|
||||
-
|
||||
+static int
|
||||
+esxDomainGetMaxVcpus(virDomainPtr domain)
|
||||
+{
|
||||
+ return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
+}
|
||||
|
||||
static char *
|
||||
esxDomainDumpXML(virDomainPtr domain, int flags)
|
||||
@@ -4160,8 +4182,8 @@ static virDriver esxDriver = {
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
esxDomainSetVcpus, /* domainSetVcpus */
|
||||
- NULL, /* domainSetVcpusFlags */
|
||||
- NULL, /* domainGetVcpusFlags */
|
||||
+ esxDomainSetVcpusFlags, /* domainSetVcpusFlags */
|
||||
+ esxDomainGetVcpusFlags, /* domainGetVcpusFlags */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
esxDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
|
||||
index 9d19aeb..0f3cfdf 100644
|
||||
--- a/src/openvz/openvz_driver.c
|
||||
+++ b/src/openvz/openvz_driver.c
|
||||
@@ -67,7 +67,6 @@
|
||||
static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid);
|
||||
static int openvzGetMaxVCPUs(virConnectPtr conn, const char *type);
|
||||
static int openvzDomainGetMaxVcpus(virDomainPtr dom);
|
||||
-static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus);
|
||||
static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
|
||||
unsigned int nvcpus);
|
||||
static int openvzDomainSetMemoryInternal(virDomainObjPtr vm,
|
||||
@@ -1211,11 +1210,24 @@ static int openvzGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+static int
|
||||
+openvzDomainGetVcpusFlags(virDomainPtr dom ATTRIBUTE_UNUSED,
|
||||
+ unsigned int flags)
|
||||
+{
|
||||
+ if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
+ openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
-static int openvzDomainGetMaxVcpus(virDomainPtr dom ATTRIBUTE_UNUSED) {
|
||||
return openvzGetMaxVCPUs(NULL, "openvz");
|
||||
}
|
||||
|
||||
+static int openvzDomainGetMaxVcpus(virDomainPtr dom)
|
||||
+{
|
||||
+ return openvzDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
+}
|
||||
+
|
||||
static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
|
||||
unsigned int nvcpus)
|
||||
{
|
||||
@@ -1241,12 +1253,18 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
|
||||
+static int openvzDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
+ unsigned int flags)
|
||||
{
|
||||
virDomainObjPtr vm;
|
||||
struct openvz_driver *driver = dom->conn->privateData;
|
||||
int ret = -1;
|
||||
|
||||
+ if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
+ openvzError(VIR_ERR_INVALID_ARG, _("unsupported flags (0x%x)"), flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
openvzDriverLock(driver);
|
||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||
openvzDriverUnlock(driver);
|
||||
@@ -1272,6 +1290,12 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int
|
||||
+openvzDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
|
||||
+{
|
||||
+ return openvzDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
+}
|
||||
+
|
||||
static virDrvOpenStatus openvzOpen(virConnectPtr conn,
|
||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||
int flags ATTRIBUTE_UNUSED)
|
||||
@@ -1590,8 +1614,8 @@ static virDriver openvzDriver = {
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
openvzDomainSetVcpus, /* domainSetVcpus */
|
||||
- NULL, /* domainSetVcpusFlags */
|
||||
- NULL, /* domainGetVcpusFlags */
|
||||
+ openvzDomainSetVcpusFlags, /* domainSetVcpusFlags */
|
||||
+ openvzDomainGetVcpusFlags, /* domainGetVcpusFlags */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
openvzDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
|
||||
index 6e0a5e9..e284ae0 100644
|
||||
--- a/src/phyp/phyp_driver.c
|
||||
+++ b/src/phyp/phyp_driver.c
|
||||
@@ -1497,15 +1497,27 @@ phypGetLparCPU(virConnectPtr conn, const char *managed_system, int lpar_id)
|
||||
}
|
||||
|
||||
static int
|
||||
-phypGetLparCPUMAX(virDomainPtr dom)
|
||||
+phypDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||
{
|
||||
phyp_driverPtr phyp_driver = dom->conn->privateData;
|
||||
char *managed_system = phyp_driver->managed_system;
|
||||
|
||||
+ if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
+ PHYP_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
return phypGetLparCPUGeneric(dom->conn, managed_system, dom->id, 1);
|
||||
}
|
||||
|
||||
static int
|
||||
+phypGetLparCPUMAX(virDomainPtr dom)
|
||||
+{
|
||||
+ return phypDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
phypGetRemoteSlot(virConnectPtr conn, const char *managed_system,
|
||||
const char *lpar_name)
|
||||
{
|
||||
@@ -3831,7 +3843,8 @@ phypConnectGetCapabilities(virConnectPtr conn)
|
||||
}
|
||||
|
||||
static int
|
||||
-phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
|
||||
+phypDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
+ unsigned int flags)
|
||||
{
|
||||
ConnectionData *connection_data = dom->conn->networkPrivateData;
|
||||
phyp_driverPtr phyp_driver = dom->conn->privateData;
|
||||
@@ -3846,6 +3859,11 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
|
||||
unsigned int amount = 0;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
+ if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
+ PHYP_ERROR(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
if ((ncpus = phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0)
|
||||
return 0;
|
||||
|
||||
@@ -3891,6 +3909,12 @@ phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
|
||||
|
||||
}
|
||||
|
||||
+static int
|
||||
+phypDomainSetCPU(virDomainPtr dom, unsigned int nvcpus)
|
||||
+{
|
||||
+ return phypDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
+}
|
||||
+
|
||||
static virDrvOpenStatus
|
||||
phypVIOSDriverOpen(virConnectPtr conn,
|
||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||
@@ -3941,8 +3965,8 @@ static virDriver phypDriver = {
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
phypDomainSetCPU, /* domainSetVcpus */
|
||||
- NULL, /* domainSetVcpusFlags */
|
||||
- NULL, /* domainGetVcpusFlags */
|
||||
+ phypDomainSetVcpusFlags, /* domainSetVcpusFlags */
|
||||
+ phypDomainGetVcpusFlags, /* domainGetVcpusFlags */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
phypGetLparCPUMAX, /* domainGetMaxVcpus */
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index 3d17e04..7a2ea8f 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -5934,13 +5934,22 @@ unsupported:
|
||||
}
|
||||
|
||||
|
||||
-static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
|
||||
+static int
|
||||
+qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
+ unsigned int flags)
|
||||
+{
|
||||
struct qemud_driver *driver = dom->conn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
const char * type;
|
||||
int max;
|
||||
int ret = -1;
|
||||
|
||||
+ if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
+ qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
|
||||
+ flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
qemuDriverLock(driver);
|
||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||
qemuDriverUnlock(driver);
|
||||
@@ -5994,6 +6003,12 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int
|
||||
+qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
|
||||
+{
|
||||
+ return qemudDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
+}
|
||||
+
|
||||
|
||||
static int
|
||||
qemudDomainPinVcpu(virDomainPtr dom,
|
||||
@@ -6150,12 +6165,20 @@ cleanup:
|
||||
}
|
||||
|
||||
|
||||
-static int qemudDomainGetMaxVcpus(virDomainPtr dom) {
|
||||
+static int
|
||||
+qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||
+{
|
||||
struct qemud_driver *driver = dom->conn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
const char *type;
|
||||
int ret = -1;
|
||||
|
||||
+ if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
+ qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
|
||||
+ flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
qemuDriverLock(driver);
|
||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||
qemuDriverUnlock(driver);
|
||||
@@ -6183,6 +6206,13 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int
|
||||
+qemudDomainGetMaxVcpus(virDomainPtr dom)
|
||||
+{
|
||||
+ return qemudDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
+}
|
||||
+
|
||||
static int qemudDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr seclabel)
|
||||
{
|
||||
struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData;
|
||||
@@ -12938,8 +12968,8 @@ static virDriver qemuDriver = {
|
||||
qemudDomainRestore, /* domainRestore */
|
||||
qemudDomainCoreDump, /* domainCoreDump */
|
||||
qemudDomainSetVcpus, /* domainSetVcpus */
|
||||
- NULL, /* domainSetVcpusFlags */
|
||||
- NULL, /* domainGetVcpusFlags */
|
||||
+ qemudDomainSetVcpusFlags, /* domainSetVcpusFlags */
|
||||
+ qemudDomainGetVcpusFlags, /* domainGetVcpusFlags */
|
||||
qemudDomainPinVcpu, /* domainPinVcpu */
|
||||
qemudDomainGetVcpus, /* domainGetVcpus */
|
||||
qemudDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
|
||||
index 6a00558..b70c80d 100644
|
||||
--- a/src/test/test_driver.c
|
||||
+++ b/src/test/test_driver.c
|
||||
@@ -2029,17 +2029,37 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int testDomainGetMaxVcpus(virDomainPtr domain)
|
||||
+static int
|
||||
+testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||
{
|
||||
+ if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
+ testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
return testGetMaxVCPUs(domain->conn, "test");
|
||||
}
|
||||
|
||||
-static int testSetVcpus(virDomainPtr domain,
|
||||
- unsigned int nrCpus) {
|
||||
+static int
|
||||
+testDomainGetMaxVcpus(virDomainPtr domain)
|
||||
+{
|
||||
+ return testDomainGetVcpusFlags(domain, (VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
|
||||
+ unsigned int flags)
|
||||
+{
|
||||
testConnPtr privconn = domain->conn->privateData;
|
||||
virDomainObjPtr privdom = NULL;
|
||||
int ret = -1, maxvcpus;
|
||||
|
||||
+ if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
+ testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
/* Do this first before locking */
|
||||
maxvcpus = testDomainGetMaxVcpus(domain);
|
||||
if (maxvcpus < 0)
|
||||
@@ -2082,6 +2102,12 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int
|
||||
+testSetVcpus(virDomainPtr domain, unsigned int nrCpus)
|
||||
+{
|
||||
+ return testDomainSetVcpusFlags(domain, nrCpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
+}
|
||||
+
|
||||
static int testDomainGetVcpus(virDomainPtr domain,
|
||||
virVcpuInfoPtr info,
|
||||
int maxinfo,
|
||||
@@ -5260,8 +5286,8 @@ static virDriver testDriver = {
|
||||
testDomainRestore, /* domainRestore */
|
||||
testDomainCoreDump, /* domainCoreDump */
|
||||
testSetVcpus, /* domainSetVcpus */
|
||||
- NULL, /* domainSetVcpusFlags */
|
||||
- NULL, /* domainGetVcpusFlags */
|
||||
+ testDomainSetVcpusFlags, /* domainSetVcpusFlags */
|
||||
+ testDomainGetVcpusFlags, /* domainGetVcpusFlags */
|
||||
testDomainPinVcpu, /* domainPinVcpu */
|
||||
testDomainGetVcpus, /* domainGetVcpus */
|
||||
testDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
|
||||
index cb9193a..0cbe8b3 100644
|
||||
--- a/src/vbox/vbox_tmpl.c
|
||||
+++ b/src/vbox/vbox_tmpl.c
|
||||
@@ -1839,13 +1839,21 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
|
||||
+static int
|
||||
+vboxDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
+ unsigned int flags)
|
||||
+{
|
||||
VBOX_OBJECT_CHECK(dom->conn, int, -1);
|
||||
IMachine *machine = NULL;
|
||||
vboxIID *iid = NULL;
|
||||
PRUint32 CPUCount = nvcpus;
|
||||
nsresult rc;
|
||||
|
||||
+ if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
+ vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
#if VBOX_API_VERSION == 2002
|
||||
if (VIR_ALLOC(iid) < 0) {
|
||||
virReportOOMError();
|
||||
@@ -1887,11 +1895,24 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int vboxDomainGetMaxVcpus(virDomainPtr dom) {
|
||||
+static int
|
||||
+vboxDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
|
||||
+{
|
||||
+ return vboxDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+vboxDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||
+{
|
||||
VBOX_OBJECT_CHECK(dom->conn, int, -1);
|
||||
ISystemProperties *systemProperties = NULL;
|
||||
PRUint32 maxCPUCount = 0;
|
||||
|
||||
+ if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
+ vboxError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
/* Currently every domain supports the same number of max cpus
|
||||
* as that supported by vbox and thus take it directly from
|
||||
* the systemproperties.
|
||||
@@ -1909,6 +1930,13 @@ static int vboxDomainGetMaxVcpus(virDomainPtr dom) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int
|
||||
+vboxDomainGetMaxVcpus(virDomainPtr dom)
|
||||
+{
|
||||
+ return vboxDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
+}
|
||||
+
|
||||
static char *vboxDomainDumpXML(virDomainPtr dom, int flags) {
|
||||
VBOX_OBJECT_CHECK(dom->conn, char *, NULL);
|
||||
virDomainDefPtr def = NULL;
|
||||
@@ -8267,8 +8295,8 @@ virDriver NAME(Driver) = {
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
vboxDomainSetVcpus, /* domainSetVcpus */
|
||||
- NULL, /* domainSetVcpusFlags */
|
||||
- NULL, /* domainGetVcpusFlags */
|
||||
+ vboxDomainSetVcpusFlags, /* domainSetVcpusFlags */
|
||||
+ vboxDomainGetVcpusFlags, /* domainGetVcpusFlags */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
vboxDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
|
||||
index 7d67ced..d6c9c57 100644
|
||||
--- a/src/xen/xen_driver.c
|
||||
+++ b/src/xen/xen_driver.c
|
||||
@@ -1069,11 +1069,18 @@ xenUnifiedDomainCoreDump (virDomainPtr dom, const char *to, int flags)
|
||||
}
|
||||
|
||||
static int
|
||||
-xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
|
||||
+xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
|
||||
+ unsigned int flags)
|
||||
{
|
||||
GET_PRIVATE(dom->conn);
|
||||
int i;
|
||||
|
||||
+ if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
+ xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
|
||||
+ flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
/* Try non-hypervisor methods first, then hypervisor direct method
|
||||
* as a last resort.
|
||||
*/
|
||||
@@ -1093,6 +1100,12 @@ xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
|
||||
}
|
||||
|
||||
static int
|
||||
+xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
|
||||
+{
|
||||
+ return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
xenUnifiedDomainPinVcpu (virDomainPtr dom, unsigned int vcpu,
|
||||
unsigned char *cpumap, int maplen)
|
||||
{
|
||||
@@ -1126,11 +1139,17 @@ xenUnifiedDomainGetVcpus (virDomainPtr dom,
|
||||
}
|
||||
|
||||
static int
|
||||
-xenUnifiedDomainGetMaxVcpus (virDomainPtr dom)
|
||||
+xenUnifiedDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
|
||||
{
|
||||
GET_PRIVATE(dom->conn);
|
||||
int i, ret;
|
||||
|
||||
+ if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
+ xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
|
||||
+ flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
||||
if (priv->opened[i] && drivers[i]->domainGetMaxVcpus) {
|
||||
ret = drivers[i]->domainGetMaxVcpus (dom);
|
||||
@@ -1140,6 +1159,13 @@ xenUnifiedDomainGetMaxVcpus (virDomainPtr dom)
|
||||
return -1;
|
||||
}
|
||||
|
||||
+static int
|
||||
+xenUnifiedDomainGetMaxVcpus (virDomainPtr dom)
|
||||
+{
|
||||
+ return xenUnifiedDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
+}
|
||||
+
|
||||
static char *
|
||||
xenUnifiedDomainDumpXML (virDomainPtr dom, int flags)
|
||||
{
|
||||
@@ -1951,8 +1977,8 @@ static virDriver xenUnifiedDriver = {
|
||||
xenUnifiedDomainRestore, /* domainRestore */
|
||||
xenUnifiedDomainCoreDump, /* domainCoreDump */
|
||||
xenUnifiedDomainSetVcpus, /* domainSetVcpus */
|
||||
- NULL, /* domainSetVcpusFlags */
|
||||
- NULL, /* domainGetVcpusFlags */
|
||||
+ xenUnifiedDomainSetVcpusFlags, /* domainSetVcpusFlags */
|
||||
+ xenUnifiedDomainGetVcpusFlags, /* domainGetVcpusFlags */
|
||||
xenUnifiedDomainPinVcpu, /* domainPinVcpu */
|
||||
xenUnifiedDomainGetVcpus, /* domainGetVcpus */
|
||||
xenUnifiedDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
|
||||
index 753169c..7d4ab8d 100644
|
||||
--- a/src/xenapi/xenapi_driver.c
|
||||
+++ b/src/xenapi/xenapi_driver.c
|
||||
@@ -40,6 +40,11 @@
|
||||
#include "xenapi_driver_private.h"
|
||||
#include "xenapi_utils.h"
|
||||
|
||||
+#define VIR_FROM_THIS VIR_FROM_XENAPI
|
||||
+
|
||||
+#define xenapiError(code, ...) \
|
||||
+ virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
|
||||
+ __FUNCTION__, __LINE__, __VA_ARGS__)
|
||||
|
||||
/*
|
||||
* getCapsObject
|
||||
@@ -987,19 +992,26 @@ xenapiDomainGetInfo (virDomainPtr dom, virDomainInfoPtr info)
|
||||
|
||||
|
||||
/*
|
||||
- * xenapiDomainSetVcpus
|
||||
+ * xenapiDomainSetVcpusFlags
|
||||
*
|
||||
* Sets the VCPUs on the domain
|
||||
* Return 0 on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
-xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
|
||||
+xenapiDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
|
||||
+ unsigned int flags)
|
||||
{
|
||||
-
|
||||
/* vm.set_vcpus_max */
|
||||
xen_vm vm;
|
||||
xen_vm_set *vms;
|
||||
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
|
||||
+
|
||||
+ if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
+ xenapiError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
|
||||
+ flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
|
||||
if (vms->size != 1) {
|
||||
xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
|
||||
@@ -1019,6 +1031,18 @@ xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
|
||||
}
|
||||
|
||||
/*
|
||||
+ * xenapiDomainSetVcpus
|
||||
+ *
|
||||
+ * Sets the VCPUs on the domain
|
||||
+ * Return 0 on success or -1 in case of error
|
||||
+ */
|
||||
+static int
|
||||
+xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
|
||||
+{
|
||||
+ return xenapiDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* xenapiDomainPinVcpu
|
||||
*
|
||||
* Dynamically change the real CPUs which can be allocated to a virtual CPU
|
||||
@@ -1140,19 +1164,26 @@ xenapiDomainGetVcpus (virDomainPtr dom,
|
||||
}
|
||||
|
||||
/*
|
||||
- * xenapiDomainGetMaxVcpus
|
||||
+ * xenapiDomainGetVcpusFlags
|
||||
*
|
||||
*
|
||||
- * Returns maximum number of Vcpus on success or -1 in case of error
|
||||
+ * Returns Vcpus count on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
-xenapiDomainGetMaxVcpus (virDomainPtr dom)
|
||||
+xenapiDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
|
||||
{
|
||||
xen_vm vm;
|
||||
xen_vm_set *vms;
|
||||
int64_t maxvcpu = 0;
|
||||
enum xen_vm_power_state state;
|
||||
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
|
||||
+
|
||||
+ if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
+ xenapiError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
|
||||
+ flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
|
||||
if (vms->size != 1) {
|
||||
xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
|
||||
@@ -1176,6 +1207,19 @@ xenapiDomainGetMaxVcpus (virDomainPtr dom)
|
||||
}
|
||||
|
||||
/*
|
||||
+ * xenapiDomainGetMaxVcpus
|
||||
+ *
|
||||
+ *
|
||||
+ * Returns maximum number of Vcpus on success or -1 in case of error
|
||||
+ */
|
||||
+static int
|
||||
+xenapiDomainGetMaxVcpus (virDomainPtr dom)
|
||||
+{
|
||||
+ return xenapiDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* xenapiDomainDumpXML
|
||||
*
|
||||
*
|
||||
@@ -1754,8 +1798,8 @@ static virDriver xenapiDriver = {
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
xenapiDomainSetVcpus, /* domainSetVcpus */
|
||||
- NULL, /* domainSetVcpusFlags */
|
||||
- NULL, /* domainGetVcpusFlags */
|
||||
+ xenapiDomainSetVcpusFlags, /* domainSetVcpusFlags */
|
||||
+ xenapiDomainGetVcpusFlags, /* domainGetVcpusFlags */
|
||||
xenapiDomainPinVcpu, /* domainPinVcpu */
|
||||
xenapiDomainGetVcpus, /* domainGetVcpus */
|
||||
xenapiDomainGetMaxVcpus, /* domainGetMaxVcpus */
|
||||
--
|
||||
1.7.2.3
|
||||
|
388
docs/api_extension/0007-add-virsh-support.patch
Normal file
388
docs/api_extension/0007-add-virsh-support.patch
Normal file
@@ -0,0 +1,388 @@
|
||||
From bf945ee97b72d3b0c4fc2da04530f5294f529d66 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Wed, 29 Sep 2010 15:20:23 -0600
|
||||
Subject: [PATCH 08/15] vcpu: add virsh support
|
||||
|
||||
* tools/virsh.c (cmdSetvcpus): Add new flags. Let invalid
|
||||
commands through to driver, to ease testing of hypervisor argument
|
||||
validation.
|
||||
(cmdMaxvcpus, cmdVcpucount): New commands.
|
||||
(commands): Add new commands.
|
||||
* tools/virsh.pod (setvcpus, vcpucount, maxvcpus): Document new
|
||||
behavior.
|
||||
---
|
||||
tools/virsh.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
|
||||
tools/virsh.pod | 38 ++++++++-
|
||||
2 files changed, 262 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/tools/virsh.c b/tools/virsh.c
|
||||
index 4f8c495..7fb7fbd 100644
|
||||
--- a/tools/virsh.c
|
||||
+++ b/tools/virsh.c
|
||||
@@ -2281,10 +2281,216 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd)
|
||||
}
|
||||
|
||||
/*
|
||||
+ * "maxvcpus" command
|
||||
+ */
|
||||
+static const vshCmdInfo info_maxvcpus[] = {
|
||||
+ {"help", N_("connection vcpu maximum")},
|
||||
+ {"desc", N_("Show maximum number of virtual CPUs for guests on this connection.")},
|
||||
+ {NULL, NULL}
|
||||
+};
|
||||
+
|
||||
+static const vshCmdOptDef opts_maxvcpus[] = {
|
||||
+ {"type", VSH_OT_STRING, 0, N_("domain type")},
|
||||
+ {NULL, 0, 0, NULL}
|
||||
+};
|
||||
+
|
||||
+static int
|
||||
+cmdMaxvcpus(vshControl *ctl, const vshCmd *cmd)
|
||||
+{
|
||||
+ char *type;
|
||||
+ int vcpus;
|
||||
+
|
||||
+ type = vshCommandOptString(cmd, "type", NULL);
|
||||
+
|
||||
+ if (!vshConnectionUsability(ctl, ctl->conn))
|
||||
+ return FALSE;
|
||||
+
|
||||
+ vcpus = virConnectGetMaxVcpus(ctl->conn, type);
|
||||
+ if (vcpus < 0)
|
||||
+ return FALSE;
|
||||
+ vshPrint(ctl, "%d\n", vcpus);
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * "vcpucount" command
|
||||
+ */
|
||||
+static const vshCmdInfo info_vcpucount[] = {
|
||||
+ {"help", N_("domain vcpu counts")},
|
||||
+ {"desc", N_("Returns the number of virtual CPUs used by the domain.")},
|
||||
+ {NULL, NULL}
|
||||
+};
|
||||
+
|
||||
+static const vshCmdOptDef opts_vcpucount[] = {
|
||||
+ {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
|
||||
+ {"maximum", VSH_OT_BOOL, 0, N_("get maximum cap on vcpus")},
|
||||
+ {"current", VSH_OT_BOOL, 0, N_("get current vcpu usage")},
|
||||
+ {"config", VSH_OT_BOOL, 0, N_("get value to be used on next boot")},
|
||||
+ {"live", VSH_OT_BOOL, 0, N_("get value from running domain")},
|
||||
+ {NULL, 0, 0, NULL}
|
||||
+};
|
||||
+
|
||||
+static int
|
||||
+cmdVcpucount(vshControl *ctl, const vshCmd *cmd)
|
||||
+{
|
||||
+ virDomainPtr dom;
|
||||
+ int ret = TRUE;
|
||||
+ int maximum = vshCommandOptBool(cmd, "maximum");
|
||||
+ int current = vshCommandOptBool(cmd, "current");
|
||||
+ int config = vshCommandOptBool(cmd, "config");
|
||||
+ int live = vshCommandOptBool(cmd, "live");
|
||||
+ bool all = maximum + current + config + live == 0;
|
||||
+ int count;
|
||||
+
|
||||
+ if (maximum && current) {
|
||||
+ vshError(ctl, "%s",
|
||||
+ _("--maximum and --current cannot both be specified"));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ if (config && live) {
|
||||
+ vshError(ctl, "%s",
|
||||
+ _("--config and --live cannot both be specified"));
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ /* We want one of each pair of mutually exclusive options; that
|
||||
+ * is, use of flags requires exactly two options. */
|
||||
+ if (maximum + current + config + live == 1) {
|
||||
+ vshError(ctl,
|
||||
+ _("when using --%s, either --%s or --%s must be specified"),
|
||||
+ (maximum ? "maximum" : current ? "current"
|
||||
+ : config ? "config" : "live"),
|
||||
+ maximum + current ? "config" : "maximum",
|
||||
+ maximum + current ? "live" : "current");
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ if (!vshConnectionUsability(ctl, ctl->conn))
|
||||
+ return FALSE;
|
||||
+
|
||||
+ if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
|
||||
+ return FALSE;
|
||||
+
|
||||
+ /* In all cases, try the new API first; if it fails because we are
|
||||
+ * talking to an older client, try a fallback API before giving
|
||||
+ * up. */
|
||||
+ if (all || (maximum && config)) {
|
||||
+ count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_MAXIMUM |
|
||||
+ VIR_DOMAIN_VCPU_CONFIG));
|
||||
+ if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
|
||||
+ || last_error->code == VIR_ERR_INVALID_ARG)) {
|
||||
+ char *tmp;
|
||||
+ char *xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE);
|
||||
+ if (xml && (tmp = strstr(xml, "<vcpu"))) {
|
||||
+ tmp = strchr(tmp, '>');
|
||||
+ if (!tmp || virStrToLong_i(tmp + 1, &tmp, 10, &count) < 0)
|
||||
+ count = -1;
|
||||
+ }
|
||||
+ VIR_FREE(xml);
|
||||
+ }
|
||||
+
|
||||
+ if (count < 0) {
|
||||
+ virshReportError(ctl);
|
||||
+ ret = FALSE;
|
||||
+ } else if (all) {
|
||||
+ vshPrint(ctl, "%-12s %-12s %3d\n", _("maximum"), _("config"),
|
||||
+ count);
|
||||
+ } else {
|
||||
+ vshPrint(ctl, "%d\n", count);
|
||||
+ }
|
||||
+ virFreeError(last_error);
|
||||
+ last_error = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (all || (maximum && live)) {
|
||||
+ count = virDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_MAXIMUM |
|
||||
+ VIR_DOMAIN_VCPU_LIVE));
|
||||
+ if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
|
||||
+ || last_error->code == VIR_ERR_INVALID_ARG)) {
|
||||
+ count = virDomainGetMaxVcpus(dom);
|
||||
+ }
|
||||
+
|
||||
+ if (count < 0) {
|
||||
+ virshReportError(ctl);
|
||||
+ ret = FALSE;
|
||||
+ } else if (all) {
|
||||
+ vshPrint(ctl, "%-12s %-12s %3d\n", _("maximum"), _("live"),
|
||||
+ count);
|
||||
+ } else {
|
||||
+ vshPrint(ctl, "%d\n", count);
|
||||
+ }
|
||||
+ virFreeError(last_error);
|
||||
+ last_error = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (all || (current && config)) {
|
||||
+ count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_VCPU_CONFIG);
|
||||
+ if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
|
||||
+ || last_error->code == VIR_ERR_INVALID_ARG)) {
|
||||
+ char *tmp, *end;
|
||||
+ char *xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE);
|
||||
+ if (xml && (tmp = strstr(xml, "<vcpu"))) {
|
||||
+ end = strchr(tmp, '>');
|
||||
+ if (end) {
|
||||
+ *end = '\0';
|
||||
+ tmp = strstr(tmp, "current=");
|
||||
+ if (!tmp)
|
||||
+ tmp = end + 1;
|
||||
+ else {
|
||||
+ tmp += strlen("current=");
|
||||
+ tmp += *tmp == '\'' || *tmp == '"';
|
||||
+ }
|
||||
+ }
|
||||
+ if (!tmp || virStrToLong_i(tmp, &tmp, 10, &count) < 0)
|
||||
+ count = -1;
|
||||
+ }
|
||||
+ VIR_FREE(xml);
|
||||
+ }
|
||||
+
|
||||
+ if (count < 0) {
|
||||
+ virshReportError(ctl);
|
||||
+ ret = FALSE;
|
||||
+ } else if (all) {
|
||||
+ vshPrint(ctl, "%-12s %-12s %3d\n", _("current"), _("config"),
|
||||
+ count);
|
||||
+ } else {
|
||||
+ vshPrint(ctl, "%d\n", count);
|
||||
+ }
|
||||
+ virFreeError(last_error);
|
||||
+ last_error = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (all || (current && live)) {
|
||||
+ count = virDomainGetVcpusFlags(dom, VIR_DOMAIN_VCPU_LIVE);
|
||||
+ if (count < 0 && (last_error->code == VIR_ERR_NO_SUPPORT
|
||||
+ || last_error->code == VIR_ERR_INVALID_ARG)) {
|
||||
+ virDomainInfo info;
|
||||
+ if (virDomainGetInfo(dom, &info) == 0)
|
||||
+ count = info.nrVirtCpu;
|
||||
+ }
|
||||
+
|
||||
+ if (count < 0) {
|
||||
+ virshReportError(ctl);
|
||||
+ ret = FALSE;
|
||||
+ } else if (all) {
|
||||
+ vshPrint(ctl, "%-12s %-12s %3d\n", _("current"), _("live"),
|
||||
+ count);
|
||||
+ } else {
|
||||
+ vshPrint(ctl, "%d\n", count);
|
||||
+ }
|
||||
+ virFreeError(last_error);
|
||||
+ last_error = NULL;
|
||||
+ }
|
||||
+
|
||||
+ virDomainFree(dom);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* "vcpuinfo" command
|
||||
*/
|
||||
static const vshCmdInfo info_vcpuinfo[] = {
|
||||
- {"help", N_("domain vcpu information")},
|
||||
+ {"help", N_("detailed domain vcpu information")},
|
||||
{"desc", N_("Returns basic information about the domain virtual CPUs.")},
|
||||
{NULL, NULL}
|
||||
};
|
||||
@@ -2514,6 +2720,9 @@ static const vshCmdInfo info_setvcpus[] = {
|
||||
static const vshCmdOptDef opts_setvcpus[] = {
|
||||
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
|
||||
{"count", VSH_OT_DATA, VSH_OFLAG_REQ, N_("number of virtual CPUs")},
|
||||
+ {"maximum", VSH_OT_BOOL, 0, N_("set maximum limit on next boot")},
|
||||
+ {"config", VSH_OT_BOOL, 0, N_("affect next boot")},
|
||||
+ {"live", VSH_OT_BOOL, 0, N_("affect running domain")},
|
||||
{NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -2522,8 +2731,13 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
|
||||
{
|
||||
virDomainPtr dom;
|
||||
int count;
|
||||
- int maxcpu;
|
||||
int ret = TRUE;
|
||||
+ int maximum = vshCommandOptBool(cmd, "maximum");
|
||||
+ int config = vshCommandOptBool(cmd, "config");
|
||||
+ int live = vshCommandOptBool(cmd, "live");
|
||||
+ int flags = ((maximum ? VIR_DOMAIN_VCPU_MAXIMUM : 0) |
|
||||
+ (config ? VIR_DOMAIN_VCPU_CONFIG : 0) |
|
||||
+ (live ? VIR_DOMAIN_VCPU_LIVE : 0));
|
||||
|
||||
if (!vshConnectionUsability(ctl, ctl->conn))
|
||||
return FALSE;
|
||||
@@ -2532,26 +2746,15 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
|
||||
return FALSE;
|
||||
|
||||
count = vshCommandOptInt(cmd, "count", &count);
|
||||
- if (count <= 0) {
|
||||
- vshError(ctl, "%s", _("Invalid number of virtual CPUs."));
|
||||
- virDomainFree(dom);
|
||||
- return FALSE;
|
||||
- }
|
||||
-
|
||||
- maxcpu = virDomainGetMaxVcpus(dom);
|
||||
- if (maxcpu <= 0) {
|
||||
- virDomainFree(dom);
|
||||
- return FALSE;
|
||||
- }
|
||||
-
|
||||
- if (count > maxcpu) {
|
||||
- vshError(ctl, "%s", _("Too many virtual CPUs."));
|
||||
- virDomainFree(dom);
|
||||
- return FALSE;
|
||||
- }
|
||||
|
||||
- if (virDomainSetVcpus(dom, count) != 0) {
|
||||
- ret = FALSE;
|
||||
+ if (!flags) {
|
||||
+ if (virDomainSetVcpus(dom, count) != 0) {
|
||||
+ ret = FALSE;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (virDomainSetVcpusFlags(dom, count, flags) < 0) {
|
||||
+ ret = FALSE;
|
||||
+ }
|
||||
}
|
||||
|
||||
virDomainFree(dom);
|
||||
@@ -9642,6 +9845,7 @@ static const vshCmdDef commands[] = {
|
||||
{"freecell", cmdFreecell, opts_freecell, info_freecell},
|
||||
{"hostname", cmdHostname, NULL, info_hostname},
|
||||
{"list", cmdList, opts_list, info_list},
|
||||
+ {"maxvcpus", cmdMaxvcpus, opts_maxvcpus, info_maxvcpus},
|
||||
{"migrate", cmdMigrate, opts_migrate, info_migrate},
|
||||
{"migrate-setmaxdowntime", cmdMigrateSetMaxDowntime, opts_migrate_setmaxdowntime, info_migrate_setmaxdowntime},
|
||||
|
||||
@@ -9748,6 +9952,7 @@ static const vshCmdDef commands[] = {
|
||||
{"vol-name", cmdVolName, opts_vol_name, info_vol_name},
|
||||
{"vol-key", cmdVolKey, opts_vol_key, info_vol_key},
|
||||
|
||||
+ {"vcpucount", cmdVcpucount, opts_vcpucount, info_vcpucount},
|
||||
{"vcpuinfo", cmdVcpuinfo, opts_vcpuinfo, info_vcpuinfo},
|
||||
{"vcpupin", cmdVcpupin, opts_vcpupin, info_vcpupin},
|
||||
{"version", cmdVersion, NULL, info_version},
|
||||
diff --git a/tools/virsh.pod b/tools/virsh.pod
|
||||
index 943a563..dbcc680 100644
|
||||
--- a/tools/virsh.pod
|
||||
+++ b/tools/virsh.pod
|
||||
@@ -443,7 +443,14 @@ Remove the managed save file for a domain if it exists. The next time the
|
||||
domain is started it will not restore to its previous state but instead will
|
||||
do a full boot.
|
||||
|
||||
-=item B<migrate> optional I<--live> I<--suspend> I<domain-id> I<desturi> I<migrateuri>
|
||||
+=item B<maxvcpus> optional I<type>
|
||||
+
|
||||
+Provide the maximum number of virtual CPUs supported for a guest VM on
|
||||
+this connection. If provided, the I<type> parameter must be a valid
|
||||
+type attribute for the <domain> element of XML.
|
||||
+
|
||||
+=item B<migrate> optional I<--live> I<--suspend> I<domain-id> I<desturi>
|
||||
+I<migrateuri>
|
||||
|
||||
Migrate domain to another host. Add --live for live migration; --suspend
|
||||
leaves the domain paused on the destination host. The I<desturi> is the
|
||||
@@ -521,7 +528,8 @@ Displays the domain memory parameters.
|
||||
|
||||
Allows you to set the domain memory parameters. LXC and QEMU/KVM supports these parameters.
|
||||
|
||||
-=item B<setvcpus> I<domain-id> I<count>
|
||||
+=item B<setvcpus> I<domain-id> I<count> optional I<--maximum> I<--config>
|
||||
+I<--live>
|
||||
|
||||
Change the number of virtual CPUs active in the guest domain. Note that
|
||||
I<count> may be limited by host, hypervisor or limit coming from the
|
||||
@@ -530,6 +538,17 @@ original description of domain.
|
||||
For Xen, you can only adjust the virtual CPUs of a running domain if
|
||||
the domain is paravirtualized.
|
||||
|
||||
+If I<--config> is specified, the change will only affect the next
|
||||
+boot of a domain. If I<--live> is specified, the domain must be
|
||||
+running, and the change takes place immediately. Both flags may be
|
||||
+specified, if supported by the hypervisor. If neither flag is given,
|
||||
+then I<--live> is implied and it is up to the hypervisor whether
|
||||
+I<--config> is also implied.
|
||||
+
|
||||
+If I<--maximum> is specified, then you must use I<--config> and
|
||||
+avoid I<--live>; this flag controls the maximum limit of vcpus that
|
||||
+can be hot-plugged the next time the domain is booted.
|
||||
+
|
||||
=item B<shutdown> I<domain-id>
|
||||
|
||||
Gracefully shuts down a domain. This coordinates with the domain OS
|
||||
@@ -568,6 +587,21 @@ is not available the processes will provide an exit code of 1.
|
||||
Undefine the configuration for an inactive domain. Since it's not running
|
||||
the domain name or UUID must be used as the I<domain-id>.
|
||||
|
||||
+=item B<vcpucount> I<domain-id> optional I<--maximum> I<--current>
|
||||
+I<--config> I<--live>
|
||||
+
|
||||
+Print information about the virtual cpu counts of the given
|
||||
+I<domain-id>. If no flags are specified, all possible counts are
|
||||
+listed in a table; otherwise, the output is limited to just the
|
||||
+numeric value requested.
|
||||
+
|
||||
+I<--maximum> requests information on the maximum cap of vcpus that a
|
||||
+domain can add via B<setvcpus>, while I<--current> shows the current
|
||||
+usage; these two flags cannot both be specified. I<--config>
|
||||
+requests information regarding the next time the domain will be
|
||||
+booted, while I<--live> requires a running domain and lists current
|
||||
+values; these two flags cannot both be specified.
|
||||
+
|
||||
=item B<vcpuinfo> I<domain-id>
|
||||
|
||||
Returns basic information about the domain virtual CPUs, like the number of
|
||||
--
|
||||
1.7.2.3
|
||||
|
519
docs/api_extension/0008-support-new-xml.patch
Normal file
519
docs/api_extension/0008-support-new-xml.patch
Normal file
@@ -0,0 +1,519 @@
|
||||
From 4617eedfaeee2b187a1f14691d25746ba3ff31b6 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Wed, 29 Sep 2010 10:20:07 -0600
|
||||
Subject: [PATCH 07/15] vcpu: support maxvcpu in domain_conf
|
||||
|
||||
Although this patch adds a distinction between maximum vcpus and
|
||||
current vcpus in the XML, the values should be identical for all
|
||||
drivers at this point. Only in subsequent per-driver patches will
|
||||
a distinction be made.
|
||||
|
||||
In general, virDomainGetInfo should prefer the current vcpus.
|
||||
|
||||
* src/conf/domain_conf.h (_virDomainDef): Adjust vcpus to unsigned
|
||||
short, to match virDomainGetInfo limit. Add maxvcpus member.
|
||||
* src/conf/domain_conf.c (virDomainDefParseXML)
|
||||
(virDomainDefFormat): parse and print out vcpu details.
|
||||
* src/xen/xend_internal.c (xenDaemonParseSxpr)
|
||||
(xenDaemonFormatSxpr): Manage both vcpu numbers, and require them
|
||||
to be equal for now.
|
||||
* src/xen/xm_internal.c (xenXMDomainConfigParse)
|
||||
(xenXMDomainConfigFormat): Likewise.
|
||||
* src/phyp/phyp_driver.c (phypDomainDumpXML): Likewise.
|
||||
* src/openvz/openvz_conf.c (openvzLoadDomains): Likewise.
|
||||
* src/openvz/openvz_driver.c (openvzDomainDefineXML)
|
||||
(openvzDomainCreateXML, openvzDomainSetVcpusInternal): Likewise.
|
||||
* src/vbox/vbox_tmpl.c (vboxDomainDumpXML, vboxDomainDefineXML):
|
||||
Likewise.
|
||||
* src/xenapi/xenapi_driver.c (xenapiDomainDumpXML): Likewise.
|
||||
* src/xenapi/xenapi_utils.c (createVMRecordFromXml): Likewise.
|
||||
* src/esx/esx_vmx.c (esxVMX_ParseConfig, esxVMX_FormatConfig):
|
||||
Likewise.
|
||||
* src/qemu/qemu_conf.c (qemuBuildSmpArgStr)
|
||||
(qemuParseCommandLineSmp, qemuParseCommandLine): Likewise.
|
||||
* src/qemu/qemu_driver.c (qemudDomainHotplugVcpus): Likewise.
|
||||
* src/opennebula/one_conf.c (xmlOneTemplate): Likewise.
|
||||
---
|
||||
src/conf/domain_conf.c | 45 +++++++++++++++++++++++++++++++++++++------
|
||||
src/conf/domain_conf.h | 3 +-
|
||||
src/esx/esx_vmx.c | 24 ++++++++++++++--------
|
||||
src/opennebula/one_conf.c | 9 +++++--
|
||||
src/openvz/openvz_conf.c | 7 +++--
|
||||
src/openvz/openvz_driver.c | 15 +++++++++----
|
||||
src/phyp/phyp_driver.c | 2 +-
|
||||
src/qemu/qemu_conf.c | 14 +++++++++++-
|
||||
src/qemu/qemu_driver.c | 5 ++-
|
||||
src/vbox/vbox_tmpl.c | 12 +++++++---
|
||||
src/xen/xend_internal.c | 9 ++++---
|
||||
src/xen/xm_internal.c | 11 ++++++---
|
||||
src/xenapi/xenapi_driver.c | 2 +-
|
||||
src/xenapi/xenapi_utils.c | 4 +-
|
||||
14 files changed, 114 insertions(+), 48 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 78d7a6a..a997e06 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -4203,6 +4203,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
||||
int i, n;
|
||||
long id = -1;
|
||||
virDomainDefPtr def;
|
||||
+ unsigned long count;
|
||||
|
||||
if (VIR_ALLOC(def) < 0) {
|
||||
virReportOOMError();
|
||||
@@ -4287,8 +4288,37 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
||||
&def->mem.swap_hard_limit) < 0)
|
||||
def->mem.swap_hard_limit = 0;
|
||||
|
||||
- if (virXPathULong("string(./vcpu[1])", ctxt, &def->vcpus) < 0)
|
||||
- def->vcpus = 1;
|
||||
+ n = virXPathULong("string(./vcpu[1])", ctxt, &count);
|
||||
+ if (n == -2) {
|
||||
+ virDomainReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
+ _("maximum vcpus must be an integer"));
|
||||
+ goto error;
|
||||
+ } else if (n < 0) {
|
||||
+ def->maxvcpus = 1;
|
||||
+ } else {
|
||||
+ def->maxvcpus = count;
|
||||
+ if (def->maxvcpus != count || count == 0) {
|
||||
+ virDomainReportError(VIR_ERR_XML_ERROR,
|
||||
+ _("invalid maxvcpus %lu"), count);
|
||||
+ goto error;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ n = virXPathULong("string(./vcpu[1]/@current)", ctxt, &count);
|
||||
+ if (n == -2) {
|
||||
+ virDomainReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
+ _("current vcpus must be an integer"));
|
||||
+ goto error;
|
||||
+ } else if (n < 0) {
|
||||
+ def->vcpus = def->maxvcpus;
|
||||
+ } else {
|
||||
+ def->vcpus = count;
|
||||
+ if (def->vcpus != count || count == 0 || def->maxvcpus < count) {
|
||||
+ virDomainReportError(VIR_ERR_XML_ERROR,
|
||||
+ _("invalid current vcpus %lu"), count);
|
||||
+ goto error;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
tmp = virXPathString("string(./vcpu[1]/@cpuset)", ctxt);
|
||||
if (tmp) {
|
||||
@@ -6462,17 +6492,18 @@ char *virDomainDefFormat(virDomainDefPtr def,
|
||||
if (def->cpumask[n] != 1)
|
||||
allones = 0;
|
||||
|
||||
- if (allones) {
|
||||
- virBufferAsprintf(&buf, " <vcpu>%lu</vcpu>\n", def->vcpus);
|
||||
- } else {
|
||||
+ virBufferAddLit(&buf, " <vcpu");
|
||||
+ if (!allones) {
|
||||
char *cpumask = NULL;
|
||||
if ((cpumask =
|
||||
virDomainCpuSetFormat(def->cpumask, def->cpumasklen)) == NULL)
|
||||
goto cleanup;
|
||||
- virBufferAsprintf(&buf, " <vcpu cpuset='%s'>%lu</vcpu>\n",
|
||||
- cpumask, def->vcpus);
|
||||
+ virBufferAsprintf(&buf, " cpuset='%s'", cpumask);
|
||||
VIR_FREE(cpumask);
|
||||
}
|
||||
+ if (def->vcpus != def->maxvcpus)
|
||||
+ virBufferAsprintf(&buf, " current='%u'", def->vcpus);
|
||||
+ virBufferAsprintf(&buf, ">%u</vcpu>\n", def->maxvcpus);
|
||||
|
||||
if (def->os.bootloader) {
|
||||
virBufferEscapeString(&buf, " <bootloader>%s</bootloader>\n",
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index db09c23..5499f28 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -885,7 +885,8 @@ struct _virDomainDef {
|
||||
unsigned long min_guarantee;
|
||||
unsigned long swap_hard_limit;
|
||||
} mem;
|
||||
- unsigned long vcpus;
|
||||
+ unsigned short vcpus;
|
||||
+ unsigned short maxvcpus;
|
||||
int cpumasklen;
|
||||
char *cpumask;
|
||||
|
||||
diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
|
||||
index 7ec8c0e..0a26614 100644
|
||||
--- a/src/esx/esx_vmx.c
|
||||
+++ b/src/esx/esx_vmx.c
|
||||
@@ -50,7 +50,7 @@ def->uuid = <value> <=> uuid.bios = "<value>"
|
||||
def->name = <value> <=> displayName = "<value>"
|
||||
def->mem.max_balloon = <value kilobyte> <=> memsize = "<value megabyte>" # must be a multiple of 4, defaults to 32
|
||||
def->mem.cur_balloon = <value kilobyte> <=> sched.mem.max = "<value megabyte>" # defaults to "unlimited" -> def->mem.cur_balloon = def->mem.max_balloon
|
||||
-def->vcpus = <value> <=> numvcpus = "<value>" # must be 1 or a multiple of 2, defaults to 1
|
||||
+def->maxvcpus = <value> <=> numvcpus = "<value>" # must be 1 or a multiple of 2, defaults to 1
|
||||
def->cpumask = <uint list> <=> sched.cpu.affinity = "<uint list>"
|
||||
|
||||
|
||||
@@ -1075,7 +1075,7 @@ esxVMX_ParseConfig(esxVMX_Context *ctx, virCapsPtr caps, const char *vmx,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- def->vcpus = numvcpus;
|
||||
+ def->maxvcpus = def->vcpus = numvcpus;
|
||||
|
||||
/* vmx:sched.cpu.affinity -> def:cpumask */
|
||||
// VirtualMachine:config.cpuAffinity.affinitySet
|
||||
@@ -2609,16 +2609,22 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
|
||||
(int)(def->mem.cur_balloon / 1024));
|
||||
}
|
||||
|
||||
- /* def:vcpus -> vmx:numvcpus */
|
||||
- if (def->vcpus <= 0 || (def->vcpus % 2 != 0 && def->vcpus != 1)) {
|
||||
+ /* def:maxvcpus -> vmx:numvcpus */
|
||||
+ if (def->vcpus != def->maxvcpus) {
|
||||
+ ESX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
+ _("No support for domain XML entry 'vcpu' attribute "
|
||||
+ "'current'"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ if (def->maxvcpus <= 0 || (def->maxvcpus % 2 != 0 && def->maxvcpus != 1)) {
|
||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Expecting domain XML entry 'vcpu' to be an unsigned "
|
||||
"integer (1 or a multiple of 2) but found %d"),
|
||||
- (int)def->vcpus);
|
||||
+ def->maxvcpus);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- virBufferAsprintf(&buffer, "numvcpus = \"%d\"\n", (int)def->vcpus);
|
||||
+ virBufferAsprintf(&buffer, "numvcpus = \"%d\"\n", def->maxvcpus);
|
||||
|
||||
/* def:cpumask -> vmx:sched.cpu.affinity */
|
||||
if (def->cpumasklen > 0) {
|
||||
@@ -2632,11 +2638,11 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
|
||||
}
|
||||
}
|
||||
|
||||
- if (sched_cpu_affinity_length < def->vcpus) {
|
||||
+ if (sched_cpu_affinity_length < def->maxvcpus) {
|
||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Expecting domain XML attribute 'cpuset' of entry "
|
||||
- "'vcpu' to contains at least %d CPU(s)"),
|
||||
- (int)def->vcpus);
|
||||
+ "'vcpu' to contain at least %d CPU(s)"),
|
||||
+ def->maxvcpus);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
diff --git a/src/opennebula/one_conf.c b/src/opennebula/one_conf.c
|
||||
index 44e28dc..2079c51 100644
|
||||
--- a/src/opennebula/one_conf.c
|
||||
+++ b/src/opennebula/one_conf.c
|
||||
@@ -1,5 +1,7 @@
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
-/* Copyright 2002-2009, Distributed Systems Architecture Group, Universidad
|
||||
+/*
|
||||
+ * Copyright (C) 2010 Red Hat, Inc.
|
||||
+ * Copyright 2002-2009, Distributed Systems Architecture Group, Universidad
|
||||
* Complutense de Madrid (dsa-research.org)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@@ -169,9 +171,10 @@ char* xmlOneTemplate(virDomainDefPtr def)
|
||||
{
|
||||
int i;
|
||||
virBuffer buf= VIR_BUFFER_INITIALIZER;
|
||||
- virBufferAsprintf(&buf,"#OpenNebula Template automatically generated by libvirt\nNAME = %s\nCPU = %ld\nMEMORY = %ld\n",
|
||||
+ virBufferAsprintf(&buf,"#OpenNebula Template automatically generated "
|
||||
+ "by libvirt\nNAME = %s\nCPU = %d\nMEMORY = %ld\n",
|
||||
def->name,
|
||||
- def->vcpus,
|
||||
+ def->maxvcpus,
|
||||
(def->mem.max_balloon)/1024);
|
||||
|
||||
/*Optional Booting OpenNebula Information:*/
|
||||
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
|
||||
index ec11bbc..c84a6f3 100644
|
||||
--- a/src/openvz/openvz_conf.c
|
||||
+++ b/src/openvz/openvz_conf.c
|
||||
@@ -507,11 +507,12 @@ int openvzLoadDomains(struct openvz_driver *driver) {
|
||||
veid);
|
||||
goto cleanup;
|
||||
} else if (ret > 0) {
|
||||
- dom->def->vcpus = strtoI(temp);
|
||||
+ dom->def->maxvcpus = strtoI(temp);
|
||||
}
|
||||
|
||||
- if (ret == 0 || dom->def->vcpus == 0)
|
||||
- dom->def->vcpus = openvzGetNodeCPUs();
|
||||
+ if (ret == 0 || dom->def->maxvcpus == 0)
|
||||
+ dom->def->maxvcpus = openvzGetNodeCPUs();
|
||||
+ dom->def->vcpus = dom->def->maxvcpus;
|
||||
|
||||
/* XXX load rest of VM config data .... */
|
||||
|
||||
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
|
||||
index 0f3cfdf..b7c2754 100644
|
||||
--- a/src/openvz/openvz_driver.c
|
||||
+++ b/src/openvz/openvz_driver.c
|
||||
@@ -925,8 +925,13 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
|
||||
if (openvzDomainSetNetworkConfig(conn, vm->def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
- if (vm->def->vcpus > 0) {
|
||||
- if (openvzDomainSetVcpusInternal(vm, vm->def->vcpus) < 0) {
|
||||
+ if (vm->def->vcpus != vm->def->maxvcpus) {
|
||||
+ openvzError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("current vcpu count must equal maximum"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ if (vm->def->maxvcpus > 0) {
|
||||
+ if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
|
||||
openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Could not set number of virtual cpu"));
|
||||
goto cleanup;
|
||||
@@ -1019,8 +1024,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||
vm->def->id = vm->pid;
|
||||
vm->state = VIR_DOMAIN_RUNNING;
|
||||
|
||||
- if (vm->def->vcpus > 0) {
|
||||
- if (openvzDomainSetVcpusInternal(vm, vm->def->vcpus) < 0) {
|
||||
+ if (vm->def->maxvcpus > 0) {
|
||||
+ if (openvzDomainSetVcpusInternal(vm, vm->def->maxvcpus) < 0) {
|
||||
openvzError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Could not set number of virtual cpu"));
|
||||
goto cleanup;
|
||||
@@ -1249,7 +1254,7 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
|
||||
return -1;
|
||||
}
|
||||
|
||||
- vm->def->vcpus = nvcpus;
|
||||
+ vm->def->maxvcpus = vm->def->vcpus = nvcpus;
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
|
||||
index e284ae0..3d0ed11 100644
|
||||
--- a/src/phyp/phyp_driver.c
|
||||
+++ b/src/phyp/phyp_driver.c
|
||||
@@ -3540,7 +3540,7 @@ phypDomainDumpXML(virDomainPtr dom, int flags)
|
||||
goto err;
|
||||
}
|
||||
|
||||
- if ((def.vcpus =
|
||||
+ if ((def.maxvcpus = def.vcpus =
|
||||
phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0) {
|
||||
VIR_ERROR0(_("Unable to determine domain's CPU."));
|
||||
goto err;
|
||||
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
||||
index 83c0f83..38c8351 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -3711,7 +3711,7 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
- virBufferAsprintf(&buf, "%lu", def->vcpus);
|
||||
+ virBufferAsprintf(&buf, "%u", def->vcpus);
|
||||
|
||||
if ((qemuCmdFlags & QEMUD_CMD_FLAG_SMP_TOPOLOGY)) {
|
||||
/* sockets, cores, and threads are either all zero
|
||||
@@ -3722,11 +3722,18 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
|
||||
virBufferAsprintf(&buf, ",threads=%u", def->cpu->threads);
|
||||
}
|
||||
else {
|
||||
- virBufferAsprintf(&buf, ",sockets=%lu", def->vcpus);
|
||||
+ virBufferAsprintf(&buf, ",sockets=%u", def->maxvcpus);
|
||||
virBufferAsprintf(&buf, ",cores=%u", 1);
|
||||
virBufferAsprintf(&buf, ",threads=%u", 1);
|
||||
}
|
||||
}
|
||||
+ if (def->vcpus != def->maxvcpus) {
|
||||
+ virBufferFreeAndReset(&buf);
|
||||
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("setting current vcpu count less than maximum is "
|
||||
+ "not supported yet"));
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
if (virBufferError(&buf)) {
|
||||
virBufferFreeAndReset(&buf);
|
||||
@@ -6178,6 +6185,8 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
|
||||
}
|
||||
}
|
||||
|
||||
+ dom->maxvcpus = dom->vcpus;
|
||||
+
|
||||
if (sockets && cores && threads) {
|
||||
virCPUDefPtr cpu;
|
||||
|
||||
@@ -6247,6 +6256,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
|
||||
|
||||
def->id = -1;
|
||||
def->mem.cur_balloon = def->mem.max_balloon = 64 * 1024;
|
||||
+ def->maxvcpus = 1;
|
||||
def->vcpus = 1;
|
||||
def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC;
|
||||
def->features = (1 << VIR_DOMAIN_FEATURE_ACPI)
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index 7a2ea8f..c66dc04 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -2425,8 +2425,9 @@ qemuDetectVcpuPIDs(struct qemud_driver *driver,
|
||||
|
||||
if (ncpupids != vm->def->vcpus) {
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("got wrong number of vCPU pids from QEMU monitor. got %d, wanted %d"),
|
||||
- ncpupids, (int)vm->def->vcpus);
|
||||
+ _("got wrong number of vCPU pids from QEMU monitor. "
|
||||
+ "got %d, wanted %d"),
|
||||
+ ncpupids, vm->def->vcpus);
|
||||
VIR_FREE(cpupids);
|
||||
return -1;
|
||||
}
|
||||
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
|
||||
index 0cbe8b3..5a859a4 100644
|
||||
--- a/src/vbox/vbox_tmpl.c
|
||||
+++ b/src/vbox/vbox_tmpl.c
|
||||
@@ -2028,7 +2028,7 @@ static char *vboxDomainDumpXML(virDomainPtr dom, int flags) {
|
||||
def->mem.max_balloon = memorySize * 1024;
|
||||
|
||||
machine->vtbl->GetCPUCount(machine, &CPUCount);
|
||||
- def->vcpus = CPUCount;
|
||||
+ def->maxvcpus = def->vcpus = CPUCount;
|
||||
|
||||
/* Skip cpumasklen, cpumask, onReboot, onPoweroff, onCrash */
|
||||
|
||||
@@ -4598,11 +4598,15 @@ static virDomainPtr vboxDomainDefineXML(virConnectPtr conn, const char *xml) {
|
||||
def->mem.cur_balloon, (unsigned)rc);
|
||||
}
|
||||
|
||||
- rc = machine->vtbl->SetCPUCount(machine, def->vcpus);
|
||||
+ if (def->vcpus != def->maxvcpus) {
|
||||
+ vboxError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("current vcpu count must equal maximum"));
|
||||
+ }
|
||||
+ rc = machine->vtbl->SetCPUCount(machine, def->maxvcpus);
|
||||
if (NS_FAILED(rc)) {
|
||||
vboxError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("could not set the number of virtual CPUs to: %lu, rc=%08x"),
|
||||
- def->vcpus, (unsigned)rc);
|
||||
+ _("could not set the number of virtual CPUs to: %u, rc=%08x"),
|
||||
+ def->maxvcpus, (unsigned)rc);
|
||||
}
|
||||
|
||||
#if VBOX_API_VERSION < 3001
|
||||
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
|
||||
index 5ffc3c8..456b477 100644
|
||||
--- a/src/xen/xend_internal.c
|
||||
+++ b/src/xen/xend_internal.c
|
||||
@@ -2190,7 +2190,8 @@ xenDaemonParseSxpr(virConnectPtr conn,
|
||||
}
|
||||
}
|
||||
|
||||
- def->vcpus = sexpr_int(root, "domain/vcpus");
|
||||
+ def->maxvcpus = sexpr_int(root, "domain/vcpus");
|
||||
+ def->vcpus = def->maxvcpus;
|
||||
|
||||
tmp = sexpr_node(root, "domain/on_poweroff");
|
||||
if (tmp != NULL) {
|
||||
@@ -5649,7 +5650,7 @@ xenDaemonFormatSxprInput(virDomainInputDefPtr input,
|
||||
*
|
||||
* Generate an SEXPR representing the domain configuration.
|
||||
*
|
||||
- * Returns the 0 terminatedi S-Expr string or NULL in case of error.
|
||||
+ * Returns the 0 terminated S-Expr string or NULL in case of error.
|
||||
* the caller must free() the returned value.
|
||||
*/
|
||||
char *
|
||||
@@ -5666,7 +5667,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
|
||||
virBufferAsprintf(&buf, "(name '%s')", def->name);
|
||||
virBufferAsprintf(&buf, "(memory %lu)(maxmem %lu)",
|
||||
def->mem.cur_balloon/1024, def->mem.max_balloon/1024);
|
||||
- virBufferAsprintf(&buf, "(vcpus %lu)", def->vcpus);
|
||||
+ virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
|
||||
|
||||
if (def->cpumask) {
|
||||
char *ranges = virDomainCpuSetFormat(def->cpumask, def->cpumasklen);
|
||||
@@ -5761,7 +5762,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
|
||||
else
|
||||
virBufferAsprintf(&buf, "(kernel '%s')", def->os.loader);
|
||||
|
||||
- virBufferAsprintf(&buf, "(vcpus %lu)", def->vcpus);
|
||||
+ virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
|
||||
|
||||
for (i = 0 ; i < def->os.nBootDevs ; i++) {
|
||||
switch (def->os.bootDevs[i]) {
|
||||
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
|
||||
index 8e42a1c..bf20a64 100644
|
||||
--- a/src/xen/xm_internal.c
|
||||
+++ b/src/xen/xm_internal.c
|
||||
@@ -678,6 +678,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
|
||||
int i;
|
||||
const char *defaultArch, *defaultMachine;
|
||||
int vmlocaltime = 0;
|
||||
+ unsigned long count;
|
||||
|
||||
if (VIR_ALLOC(def) < 0) {
|
||||
virReportOOMError();
|
||||
@@ -770,9 +771,11 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
|
||||
def->mem.cur_balloon *= 1024;
|
||||
def->mem.max_balloon *= 1024;
|
||||
|
||||
-
|
||||
- if (xenXMConfigGetULong(conf, "vcpus", &def->vcpus, 1) < 0)
|
||||
+ if (xenXMConfigGetULong(conf, "vcpus", &count, 1) < 0 ||
|
||||
+ (unsigned short) count != count)
|
||||
goto cleanup;
|
||||
+ def->maxvcpus = count;
|
||||
+ def->vcpus = def->maxvcpus;
|
||||
|
||||
if (xenXMConfigGetString(conf, "cpus", &str, NULL) < 0)
|
||||
goto cleanup;
|
||||
@@ -1650,7 +1653,7 @@ int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus) {
|
||||
if (!(entry = virHashLookup(priv->configCache, filename)))
|
||||
goto cleanup;
|
||||
|
||||
- entry->def->vcpus = vcpus;
|
||||
+ entry->def->maxvcpus = entry->def->vcpus = vcpus;
|
||||
|
||||
/* If this fails, should we try to undo our changes to the
|
||||
* in-memory representation of the config file. I say not!
|
||||
@@ -2241,7 +2244,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
|
||||
if (xenXMConfigSetInt(conf, "memory", def->mem.cur_balloon / 1024) < 0)
|
||||
goto no_memory;
|
||||
|
||||
- if (xenXMConfigSetInt(conf, "vcpus", def->vcpus) < 0)
|
||||
+ if (xenXMConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
|
||||
goto no_memory;
|
||||
|
||||
if ((def->cpumask != NULL) &&
|
||||
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
|
||||
index 7d4ab8d..5ccdede 100644
|
||||
--- a/src/xenapi/xenapi_driver.c
|
||||
+++ b/src/xenapi/xenapi_driver.c
|
||||
@@ -1335,7 +1335,7 @@ xenapiDomainDumpXML (virDomainPtr dom, int flags ATTRIBUTE_UNUSED)
|
||||
} else {
|
||||
defPtr->mem.cur_balloon = memory;
|
||||
}
|
||||
- defPtr->vcpus = xenapiDomainGetMaxVcpus(dom);
|
||||
+ defPtr->maxvcpus = defPtr->vcpus = xenapiDomainGetMaxVcpus(dom);
|
||||
enum xen_on_normal_exit action;
|
||||
if (xen_vm_get_actions_after_shutdown(session, &action, vm)) {
|
||||
defPtr->onPoweroff = xenapiNormalExitEnum2virDomainLifecycle(action);
|
||||
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
|
||||
index be55491..a7e2a4b 100644
|
||||
--- a/src/xenapi/xenapi_utils.c
|
||||
+++ b/src/xenapi/xenapi_utils.c
|
||||
@@ -510,8 +510,8 @@ createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def,
|
||||
else
|
||||
(*record)->memory_dynamic_max = (*record)->memory_static_max;
|
||||
|
||||
- if (def->vcpus) {
|
||||
- (*record)->vcpus_max = (int64_t) def->vcpus;
|
||||
+ if (def->maxvcpus) {
|
||||
+ (*record)->vcpus_max = (int64_t) def->maxvcpus;
|
||||
(*record)->vcpus_at_startup = (int64_t) def->vcpus;
|
||||
}
|
||||
if (def->onPoweroff)
|
||||
--
|
||||
1.7.2.3
|
||||
|
197
docs/api_extension/0009-support-all-flags-in-test-driver.patch
Normal file
197
docs/api_extension/0009-support-all-flags-in-test-driver.patch
Normal file
@@ -0,0 +1,197 @@
|
||||
From 6c9e6b956453d0f0c4ff542ef8a184d663a39266 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Mon, 4 Oct 2010 17:01:12 -0600
|
||||
Subject: [PATCH 09/15] vcpu: support all flags in test driver
|
||||
|
||||
* src/test/test_driver.c (testDomainGetVcpusFlags)
|
||||
(testDomainSetVcpusFlags): Support all flags.
|
||||
(testDomainUpdateVCPUs): Update cpu count here.
|
||||
---
|
||||
src/test/test_driver.c | 128 ++++++++++++++++++++++++++++++++++++++++-------
|
||||
1 files changed, 109 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
|
||||
index b70c80d..a9d3d89 100644
|
||||
--- a/src/test/test_driver.c
|
||||
+++ b/src/test/test_driver.c
|
||||
@@ -450,6 +450,7 @@ testDomainUpdateVCPUs(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
+ dom->def->vcpus = nvcpus;
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
@@ -2032,12 +2033,51 @@ cleanup:
|
||||
static int
|
||||
testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||
{
|
||||
- if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
- testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
+ testConnPtr privconn = domain->conn->privateData;
|
||||
+ virDomainObjPtr vm;
|
||||
+ virDomainDefPtr def;
|
||||
+ int ret = -1;
|
||||
+
|
||||
+ virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_CONFIG |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||
+
|
||||
+ /* Exactly one of LIVE or CONFIG must be set. */
|
||||
+ if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
|
||||
+ testError(VIR_ERR_INVALID_ARG,
|
||||
+ _("invalid flag combination: (0x%x)"), flags);
|
||||
return -1;
|
||||
}
|
||||
|
||||
- return testGetMaxVCPUs(domain->conn, "test");
|
||||
+ testDriverLock(privconn);
|
||||
+ vm = virDomainFindByUUID(&privconn->domains, domain->uuid);
|
||||
+ testDriverUnlock(privconn);
|
||||
+
|
||||
+ if (!vm) {
|
||||
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
+ virUUIDFormat(domain->uuid, uuidstr);
|
||||
+ testError(VIR_ERR_NO_DOMAIN,
|
||||
+ _("no domain with matching uuid '%s'"), uuidstr);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
||||
+ if (!virDomainObjIsActive(vm)) {
|
||||
+ testError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("domain not active"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ def = vm->def;
|
||||
+ } else {
|
||||
+ def = vm->newDef ? vm->newDef : vm->def;
|
||||
+ }
|
||||
+
|
||||
+ ret = (flags & VIR_DOMAIN_VCPU_MAXIMUM) ? def->maxvcpus : def->vcpus;
|
||||
+
|
||||
+cleanup:
|
||||
+ if (vm)
|
||||
+ virDomainObjUnlock(vm);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -2053,21 +2093,30 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
|
||||
{
|
||||
testConnPtr privconn = domain->conn->privateData;
|
||||
virDomainObjPtr privdom = NULL;
|
||||
+ virDomainDefPtr def;
|
||||
int ret = -1, maxvcpus;
|
||||
|
||||
- if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
- testError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"), flags);
|
||||
+ virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_CONFIG |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||
+
|
||||
+ /* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
|
||||
+ * mixed with LIVE. */
|
||||
+ if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
|
||||
+ (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
|
||||
+ (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
|
||||
+ testError(VIR_ERR_INVALID_ARG,
|
||||
+ _("invalid flag combination: (0x%x)"), flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (!nrCpus || (maxvcpus = testGetMaxVCPUs(domain->conn, NULL)) < nrCpus) {
|
||||
+ testError(VIR_ERR_INVALID_ARG,
|
||||
+ _("argument out of range: %d"), nrCpus);
|
||||
return -1;
|
||||
}
|
||||
-
|
||||
- /* Do this first before locking */
|
||||
- maxvcpus = testDomainGetMaxVcpus(domain);
|
||||
- if (maxvcpus < 0)
|
||||
- goto cleanup;
|
||||
|
||||
testDriverLock(privconn);
|
||||
- privdom = virDomainFindByName(&privconn->domains,
|
||||
- domain->name);
|
||||
+ privdom = virDomainFindByUUID(&privconn->domains, domain->uuid);
|
||||
testDriverUnlock(privconn);
|
||||
|
||||
if (privdom == NULL) {
|
||||
@@ -2075,13 +2124,17 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (!virDomainObjIsActive(privdom)) {
|
||||
+ if (!virDomainObjIsActive(privdom) && (flags & VIR_DOMAIN_VCPU_LIVE)) {
|
||||
testError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cannot hotplug vcpus for an inactive domain"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- /* We allow more cpus in guest than host */
|
||||
+ /* We allow more cpus in guest than host, but not more than the
|
||||
+ * domain's starting limit. */
|
||||
+ if ((flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
|
||||
+ VIR_DOMAIN_VCPU_LIVE && privdom->def->maxvcpus < maxvcpus)
|
||||
+ maxvcpus = privdom->def->maxvcpus;
|
||||
if (nrCpus > maxvcpus) {
|
||||
testError(VIR_ERR_INVALID_ARG,
|
||||
"requested cpu amount exceeds maximum (%d > %d)",
|
||||
@@ -2089,12 +2142,49 @@ testDomainSetVcpusFlags(virDomainPtr domain, unsigned int nrCpus,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- /* Update VCPU state for the running domain */
|
||||
- if (testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0) < 0)
|
||||
- goto cleanup;
|
||||
+ switch (flags) {
|
||||
+ case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG:
|
||||
+ def = privdom->def;
|
||||
+ if (virDomainObjIsActive(privdom)) {
|
||||
+ if (privdom->newDef)
|
||||
+ def = privdom->newDef;
|
||||
+ else {
|
||||
+ testError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("no persistent state"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ }
|
||||
+ def->maxvcpus = nrCpus;
|
||||
+ if (nrCpus < def->vcpus)
|
||||
+ def->vcpus = nrCpus;
|
||||
+ ret = 0;
|
||||
+ break;
|
||||
|
||||
- privdom->def->vcpus = nrCpus;
|
||||
- ret = 0;
|
||||
+ case VIR_DOMAIN_VCPU_CONFIG:
|
||||
+ def = privdom->def;
|
||||
+ if (virDomainObjIsActive(privdom)) {
|
||||
+ if (privdom->newDef)
|
||||
+ def = privdom->newDef;
|
||||
+ else {
|
||||
+ testError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("no persistent state"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ }
|
||||
+ def->vcpus = nrCpus;
|
||||
+ ret = 0;
|
||||
+ break;
|
||||
+
|
||||
+ case VIR_DOMAIN_VCPU_LIVE:
|
||||
+ ret = testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0);
|
||||
+ break;
|
||||
+
|
||||
+ case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG:
|
||||
+ ret = testDomainUpdateVCPUs(domain->conn, privdom, nrCpus, 0);
|
||||
+ if (ret == 0 && privdom->newDef)
|
||||
+ privdom->newDef->vcpus = nrCpus;
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
cleanup:
|
||||
if (privdom)
|
||||
--
|
||||
1.7.2.3
|
||||
|
@@ -0,0 +1,122 @@
|
||||
From d67c189e80e6aef7adf13e5763365555cfc1a02a Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Wed, 29 Sep 2010 15:58:47 -0600
|
||||
Subject: [PATCH 10/15] vcpu: improve vcpu support in qemu command line
|
||||
|
||||
* src/qemu/qemu_conf.c (qemuParseCommandLineSmp): Distinguish
|
||||
between vcpus and maxvcpus, for new enough qemu.
|
||||
* tests/qemuargv2xmltest.c (mymain): Add new test.
|
||||
* tests/qemuxml2argvtest.c (mymain): Likewise.
|
||||
* tests/qemuxml2xmltest.c (mymain): Likewise.
|
||||
* tests/qemuxml2argvdata/qemuxml2argv-smp.args: New file.
|
||||
---
|
||||
src/qemu/qemu_conf.c | 13 +++++++++----
|
||||
tests/qemuargv2xmltest.c | 2 ++
|
||||
tests/qemuxml2argvdata/qemuxml2argv-smp.args | 1 +
|
||||
tests/qemuxml2argvtest.c | 2 ++
|
||||
tests/qemuxml2xmltest.c | 2 ++
|
||||
5 files changed, 16 insertions(+), 4 deletions(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-smp.args
|
||||
|
||||
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
|
||||
index 38c8351..ffe184b 100644
|
||||
--- a/src/qemu/qemu_conf.c
|
||||
+++ b/src/qemu/qemu_conf.c
|
||||
@@ -3714,6 +3714,8 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
|
||||
virBufferAsprintf(&buf, "%u", def->vcpus);
|
||||
|
||||
if ((qemuCmdFlags & QEMUD_CMD_FLAG_SMP_TOPOLOGY)) {
|
||||
+ if (def->vcpus != def->maxvcpus)
|
||||
+ virBufferAsprintf(&buf, ",maxcpus=%u", def->maxvcpus);
|
||||
/* sockets, cores, and threads are either all zero
|
||||
* or all non-zero, thus checking one of them is enough */
|
||||
if (def->cpu && def->cpu->sockets) {
|
||||
@@ -3726,12 +3728,12 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
|
||||
virBufferAsprintf(&buf, ",cores=%u", 1);
|
||||
virBufferAsprintf(&buf, ",threads=%u", 1);
|
||||
}
|
||||
- }
|
||||
- if (def->vcpus != def->maxvcpus) {
|
||||
+ } else if (def->vcpus != def->maxvcpus) {
|
||||
virBufferFreeAndReset(&buf);
|
||||
+ /* FIXME - consider hot-unplugging cpus after boot for older qemu */
|
||||
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("setting current vcpu count less than maximum is "
|
||||
- "not supported yet"));
|
||||
+ "not supported with this QEMU binary"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -6153,6 +6155,7 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
|
||||
unsigned int sockets = 0;
|
||||
unsigned int cores = 0;
|
||||
unsigned int threads = 0;
|
||||
+ unsigned int maxcpus = 0;
|
||||
int i;
|
||||
int nkws;
|
||||
char **kws;
|
||||
@@ -6180,12 +6183,14 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
|
||||
cores = n;
|
||||
else if (STREQ(kws[i], "threads"))
|
||||
threads = n;
|
||||
+ else if (STREQ(kws[i], "maxcpus"))
|
||||
+ maxcpus = n;
|
||||
else
|
||||
goto syntax;
|
||||
}
|
||||
}
|
||||
|
||||
- dom->maxvcpus = dom->vcpus;
|
||||
+ dom->maxvcpus = maxcpus ? maxcpus : dom->vcpus;
|
||||
|
||||
if (sockets && cores && threads) {
|
||||
virCPUDefPtr cpu;
|
||||
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
|
||||
index 4f9ec84..d941b0b 100644
|
||||
--- a/tests/qemuargv2xmltest.c
|
||||
+++ b/tests/qemuargv2xmltest.c
|
||||
@@ -221,6 +221,8 @@ mymain(int argc, char **argv)
|
||||
|
||||
DO_TEST("hostdev-pci-address");
|
||||
|
||||
+ DO_TEST("smp");
|
||||
+
|
||||
DO_TEST_FULL("restore-v1", 0, "stdio");
|
||||
DO_TEST_FULL("restore-v2", 0, "stdio");
|
||||
DO_TEST_FULL("restore-v2", 0, "exec:cat");
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-smp.args b/tests/qemuxml2argvdata/qemuxml2argv-smp.args
|
||||
new file mode 100644
|
||||
index 0000000..3ec8f15
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-smp.args
|
||||
@@ -0,0 +1 @@
|
||||
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1,maxcpus=2,sockets=2,cores=1,threads=1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index 92d5b18..551d6c4 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -385,6 +385,8 @@ mymain(int argc, char **argv)
|
||||
|
||||
DO_TEST("qemu-ns", 0);
|
||||
|
||||
+ DO_TEST("smp", QEMUD_CMD_FLAG_SMP_TOPOLOGY);
|
||||
+
|
||||
free(driver.stateDir);
|
||||
virCapabilitiesFree(driver.caps);
|
||||
|
||||
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
||||
index a33d435..cdc4390 100644
|
||||
--- a/tests/qemuxml2xmltest.c
|
||||
+++ b/tests/qemuxml2xmltest.c
|
||||
@@ -180,6 +180,8 @@ mymain(int argc, char **argv)
|
||||
DO_TEST("encrypted-disk");
|
||||
DO_TEST("memtune");
|
||||
|
||||
+ DO_TEST("smp");
|
||||
+
|
||||
/* These tests generate different XML */
|
||||
DO_TEST_DIFFERENT("balloon-device-auto");
|
||||
DO_TEST_DIFFERENT("channel-virtio-auto");
|
||||
--
|
||||
1.7.2.3
|
||||
|
@@ -0,0 +1,169 @@
|
||||
From 28a3605906385cba43df77051dc26e865f237b09 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Wed, 29 Sep 2010 17:40:45 -0600
|
||||
Subject: [PATCH 11/15] vcpu: complete vcpu support in qemu driver
|
||||
|
||||
* src/qemu/qemu_driver.c (qemudDomainSetVcpusFlags)
|
||||
(qemudDomainGetVcpusFlags): Support all feasible flag
|
||||
combinations.
|
||||
---
|
||||
src/qemu/qemu_driver.c | 100 ++++++++++++++++++++++++++++++++++++++++-------
|
||||
1 files changed, 85 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index c66dc04..a9e057f 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -5941,13 +5941,27 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
{
|
||||
struct qemud_driver *driver = dom->conn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
+ virDomainDefPtr def;
|
||||
const char * type;
|
||||
int max;
|
||||
int ret = -1;
|
||||
|
||||
- if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
- qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
|
||||
- flags);
|
||||
+ virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_CONFIG |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||
+
|
||||
+ /* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
|
||||
+ * mixed with LIVE. */
|
||||
+ if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
|
||||
+ (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
|
||||
+ (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
|
||||
+ qemuReportError(VIR_ERR_INVALID_ARG,
|
||||
+ _("invalid flag combination: (0x%x)"), flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (!nvcpus || (unsigned short) nvcpus != nvcpus) {
|
||||
+ qemuReportError(VIR_ERR_INVALID_ARG,
|
||||
+ _("argument out of range: %d"), nvcpus);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -5966,7 +5980,7 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
if (qemuDomainObjBeginJob(vm) < 0)
|
||||
goto cleanup;
|
||||
|
||||
- if (!virDomainObjIsActive(vm)) {
|
||||
+ if (!virDomainObjIsActive(vm) && (flags & VIR_DOMAIN_VCPU_LIVE)) {
|
||||
qemuReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("domain is not running"));
|
||||
goto endjob;
|
||||
@@ -5985,6 +5999,11 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
+ if ((flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
|
||||
+ VIR_DOMAIN_VCPU_LIVE && vm->def->maxvcpus < max) {
|
||||
+ max = vm->def->maxvcpus;
|
||||
+ }
|
||||
+
|
||||
if (nvcpus > max) {
|
||||
qemuReportError(VIR_ERR_INVALID_ARG,
|
||||
_("requested vcpus is greater than max allowable"
|
||||
@@ -5992,7 +6011,49 @@ qemudDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
- ret = qemudDomainHotplugVcpus(vm, nvcpus);
|
||||
+ switch (flags) {
|
||||
+ case VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_CONFIG:
|
||||
+ def = vm->def;
|
||||
+ if (virDomainObjIsActive(vm)) {
|
||||
+ if (vm->newDef)
|
||||
+ def = vm->newDef;
|
||||
+ else{
|
||||
+ qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("no persistent state"));
|
||||
+ goto endjob;
|
||||
+ }
|
||||
+ }
|
||||
+ def->maxvcpus = nvcpus;
|
||||
+ if (nvcpus < vm->newDef->vcpus)
|
||||
+ def->vcpus = nvcpus;
|
||||
+ ret = 0;
|
||||
+ break;
|
||||
+
|
||||
+ case VIR_DOMAIN_VCPU_CONFIG:
|
||||
+ def = vm->def;
|
||||
+ if (virDomainObjIsActive(vm)) {
|
||||
+ if (vm->newDef)
|
||||
+ def = vm->newDef;
|
||||
+ else {
|
||||
+ qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("no persistent state"));
|
||||
+ goto endjob;
|
||||
+ }
|
||||
+ }
|
||||
+ def->vcpus = nvcpus;
|
||||
+ ret = 0;
|
||||
+ break;
|
||||
+
|
||||
+ case VIR_DOMAIN_VCPU_LIVE:
|
||||
+ ret = qemudDomainHotplugVcpus(vm, nvcpus);
|
||||
+ break;
|
||||
+
|
||||
+ case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG:
|
||||
+ ret = qemudDomainHotplugVcpus(vm, nvcpus);
|
||||
+ if (ret == 0 && vm->newDef)
|
||||
+ vm->newDef->vcpus = nvcpus;
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
endjob:
|
||||
if (qemuDomainObjEndJob(vm) == 0)
|
||||
@@ -6171,12 +6232,17 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||
{
|
||||
struct qemud_driver *driver = dom->conn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
- const char *type;
|
||||
+ virDomainDefPtr def;
|
||||
int ret = -1;
|
||||
|
||||
- if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
- qemuReportError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
|
||||
- flags);
|
||||
+ virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_CONFIG |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||
+
|
||||
+ /* Exactly one of LIVE or CONFIG must be set. */
|
||||
+ if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
|
||||
+ qemuReportError(VIR_ERR_INVALID_ARG,
|
||||
+ _("invalid flag combination: (0x%x)"), flags);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -6192,14 +6258,18 @@ qemudDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
- if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
|
||||
- qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
- _("unknown virt type in domain definition '%d'"),
|
||||
- vm->def->virtType);
|
||||
- goto cleanup;
|
||||
+ if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
||||
+ if (!virDomainObjIsActive(vm)) {
|
||||
+ qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("domain not active"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ def = vm->def;
|
||||
+ } else {
|
||||
+ def = vm->newDef ? vm->newDef : vm->def;
|
||||
}
|
||||
|
||||
- ret = qemudGetMaxVCPUs(NULL, type);
|
||||
+ ret = (flags & VIR_DOMAIN_VCPU_MAXIMUM) ? def->maxvcpus : def->vcpus;
|
||||
|
||||
cleanup:
|
||||
if (vm)
|
||||
--
|
||||
1.7.2.3
|
||||
|
@@ -0,0 +1,294 @@
|
||||
From 0fab10e5ed971ab4f960a53e9640b0672f4b8ac3 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Tue, 5 Oct 2010 08:18:52 -0600
|
||||
Subject: [PATCH 12/15] vcpu: improve vcpu support in xen command line
|
||||
|
||||
This patch series focuses on xendConfigVersion 2 (xm_internal) and 3
|
||||
(xend_internal), but leaves out changes for xenapi drivers.
|
||||
|
||||
See this link for more details about vcpu_avail for xm usage.
|
||||
http://lists.xensource.com/archives/html/xen-devel/2009-11/msg01061.html
|
||||
|
||||
This relies on the fact that def->maxvcpus can be at most 32 with xen.
|
||||
|
||||
* src/xen/xend_internal.c (xenDaemonParseSxpr)
|
||||
(sexpr_to_xend_domain_info, xenDaemonFormatSxpr): Use vcpu_avail
|
||||
when current vcpus is less than maximum.
|
||||
* src/xen/xm_internal.c (xenXMDomainConfigParse)
|
||||
(xenXMDomainConfigFormat): Likewise.
|
||||
* tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr: New file.
|
||||
* tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr: Likewise.
|
||||
* tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml: Likewise.
|
||||
* tests/xmconfigdata/test-paravirt-vcpu.cfg: Likewise.
|
||||
* tests/xmconfigdata/test-paravirt-vcpu.xml: Likewise.
|
||||
* tests/xml2sexprtest.c (mymain): New test.
|
||||
* tests/sexpr2xmltest.c (mymain): Likewise.
|
||||
* tests/xmconfigtest.c (mymain): Likewise.
|
||||
---
|
||||
src/xen/xend_internal.c | 19 +++++++++++++--
|
||||
src/xen/xm_internal.c | 10 ++++++-
|
||||
tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr | 1 +
|
||||
tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml | 27 +++++++++++++++++++++
|
||||
tests/sexpr2xmltest.c | 1 +
|
||||
tests/xmconfigdata/test-paravirt-vcpu.cfg | 17 +++++++++++++
|
||||
tests/xmconfigdata/test-paravirt-vcpu.xml | 32 ++++++++++++++++++++++++++
|
||||
tests/xmconfigtest.c | 1 +
|
||||
tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr | 1 +
|
||||
tests/xml2sexprtest.c | 1 +
|
||||
10 files changed, 105 insertions(+), 5 deletions(-)
|
||||
create mode 100644 tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr
|
||||
create mode 100644 tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml
|
||||
create mode 100644 tests/xmconfigdata/test-paravirt-vcpu.cfg
|
||||
create mode 100644 tests/xmconfigdata/test-paravirt-vcpu.xml
|
||||
create mode 100644 tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr
|
||||
|
||||
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
|
||||
index 456b477..dfc6415 100644
|
||||
--- a/src/xen/xend_internal.c
|
||||
+++ b/src/xen/xend_internal.c
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "xen_hypervisor.h"
|
||||
#include "xs_internal.h" /* To extract VNC port & Serial console TTY */
|
||||
#include "memory.h"
|
||||
+#include "count-one-bits.h"
|
||||
|
||||
/* required for cpumap_t */
|
||||
#include <xen/dom0_ops.h>
|
||||
@@ -2191,7 +2192,9 @@ xenDaemonParseSxpr(virConnectPtr conn,
|
||||
}
|
||||
|
||||
def->maxvcpus = sexpr_int(root, "domain/vcpus");
|
||||
- def->vcpus = def->maxvcpus;
|
||||
+ def->vcpus = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
|
||||
+ if (!def->vcpus || def->maxvcpus < def->vcpus)
|
||||
+ def->vcpus = def->maxvcpus;
|
||||
|
||||
tmp = sexpr_node(root, "domain/on_poweroff");
|
||||
if (tmp != NULL) {
|
||||
@@ -2433,7 +2436,7 @@ sexpr_to_xend_domain_info(virDomainPtr domain, const struct sexpr *root,
|
||||
virDomainInfoPtr info)
|
||||
{
|
||||
const char *flags;
|
||||
-
|
||||
+ int vcpus;
|
||||
|
||||
if ((root == NULL) || (info == NULL))
|
||||
return (-1);
|
||||
@@ -2464,7 +2467,11 @@ sexpr_to_xend_domain_info(virDomainPtr domain, const struct sexpr *root,
|
||||
info->state = VIR_DOMAIN_NOSTATE;
|
||||
}
|
||||
info->cpuTime = sexpr_float(root, "domain/cpu_time") * 1000000000;
|
||||
- info->nrVirtCpu = sexpr_int(root, "domain/vcpus");
|
||||
+ vcpus = sexpr_int(root, "domain/vcpus");
|
||||
+ info->nrVirtCpu = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
|
||||
+ if (!info->nrVirtCpu || vcpus < info->nrVirtCpu)
|
||||
+ info->nrVirtCpu = vcpus;
|
||||
+
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -5668,6 +5675,9 @@ xenDaemonFormatSxpr(virConnectPtr conn,
|
||||
virBufferAsprintf(&buf, "(memory %lu)(maxmem %lu)",
|
||||
def->mem.cur_balloon/1024, def->mem.max_balloon/1024);
|
||||
virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
|
||||
+ /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is 32. */
|
||||
+ if (def->vcpus < def->maxvcpus)
|
||||
+ virBufferAsprintf(&buf, "(vcpu_avail %u)", (1U << def->vcpus) - 1);
|
||||
|
||||
if (def->cpumask) {
|
||||
char *ranges = virDomainCpuSetFormat(def->cpumask, def->cpumasklen);
|
||||
@@ -5763,6 +5773,9 @@ xenDaemonFormatSxpr(virConnectPtr conn,
|
||||
virBufferAsprintf(&buf, "(kernel '%s')", def->os.loader);
|
||||
|
||||
virBufferAsprintf(&buf, "(vcpus %u)", def->maxvcpus);
|
||||
+ if (def->vcpus < def->maxvcpus)
|
||||
+ virBufferAsprintf(&buf, "(vcpu_avail %u)",
|
||||
+ (1U << def->vcpus) - 1);
|
||||
|
||||
for (i = 0 ; i < def->os.nBootDevs ; i++) {
|
||||
switch (def->os.bootDevs[i]) {
|
||||
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
|
||||
index bf20a64..f7121ab 100644
|
||||
--- a/src/xen/xm_internal.c
|
||||
+++ b/src/xen/xm_internal.c
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "util.h"
|
||||
#include "memory.h"
|
||||
#include "logging.h"
|
||||
+#include "count-one-bits.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_XENXM
|
||||
|
||||
@@ -772,10 +773,12 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
|
||||
def->mem.max_balloon *= 1024;
|
||||
|
||||
if (xenXMConfigGetULong(conf, "vcpus", &count, 1) < 0 ||
|
||||
- (unsigned short) count != count)
|
||||
+ MAX_VIRT_CPUS < count)
|
||||
goto cleanup;
|
||||
def->maxvcpus = count;
|
||||
- def->vcpus = def->maxvcpus;
|
||||
+ if (xenXMConfigGetULong(conf, "vcpu_avail", &count, -1) < 0)
|
||||
+ goto cleanup;
|
||||
+ def->vcpus = MIN(count_one_bits(count), def->maxvcpus);
|
||||
|
||||
if (xenXMConfigGetString(conf, "cpus", &str, NULL) < 0)
|
||||
goto cleanup;
|
||||
@@ -2246,6 +2249,9 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
|
||||
|
||||
if (xenXMConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
|
||||
goto no_memory;
|
||||
+ if (def->vcpus < def->maxvcpus &&
|
||||
+ xenXMConfigSetInt(conf, "vcpu_avail", (1U << def->vcpus) - 1) < 0)
|
||||
+ goto no_memory;
|
||||
|
||||
if ((def->cpumask != NULL) &&
|
||||
((cpus = virDomainCpuSetFormat(def->cpumask,
|
||||
diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr
|
||||
new file mode 100644
|
||||
index 0000000..2be6822
|
||||
--- /dev/null
|
||||
+++ b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.sexpr
|
||||
@@ -0,0 +1 @@
|
||||
+(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 4)(vcpu_avail 3)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
|
||||
diff --git a/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml
|
||||
new file mode 100644
|
||||
index 0000000..0d6bf11
|
||||
--- /dev/null
|
||||
+++ b/tests/sexpr2xmldata/sexpr2xml-pv-vcpus.xml
|
||||
@@ -0,0 +1,27 @@
|
||||
+<domain type='xen' id='6'>
|
||||
+ <name>pvtest</name>
|
||||
+ <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
|
||||
+ <memory>430080</memory>
|
||||
+ <currentMemory>430080</currentMemory>
|
||||
+ <vcpu current='2'>4</vcpu>
|
||||
+ <os>
|
||||
+ <type>linux</type>
|
||||
+ <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
|
||||
+ <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
|
||||
+ <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os </cmdline>
|
||||
+ </os>
|
||||
+ <clock offset='utc'/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>destroy</on_reboot>
|
||||
+ <on_crash>destroy</on_crash>
|
||||
+ <devices>
|
||||
+ <disk type='file' device='disk'>
|
||||
+ <driver name='file'/>
|
||||
+ <source file='/root/some.img'/>
|
||||
+ <target dev='xvda' bus='xen'/>
|
||||
+ </disk>
|
||||
+ <console type='pty'>
|
||||
+ <target type='xen' port='0'/>
|
||||
+ </console>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
|
||||
index d62b44f..f100dd8 100644
|
||||
--- a/tests/sexpr2xmltest.c
|
||||
+++ b/tests/sexpr2xmltest.c
|
||||
@@ -132,6 +132,7 @@ mymain(int argc, char **argv)
|
||||
DO_TEST("pv-vfb-type-crash", "pv-vfb-type-crash", 3);
|
||||
DO_TEST("fv-autoport", "fv-autoport", 3);
|
||||
DO_TEST("pv-bootloader", "pv-bootloader", 1);
|
||||
+ DO_TEST("pv-vcpus", "pv-vcpus", 1);
|
||||
|
||||
DO_TEST("disk-file", "disk-file", 2);
|
||||
DO_TEST("disk-block", "disk-block", 2);
|
||||
diff --git a/tests/xmconfigdata/test-paravirt-vcpu.cfg b/tests/xmconfigdata/test-paravirt-vcpu.cfg
|
||||
new file mode 100644
|
||||
index 0000000..24c78f4
|
||||
--- /dev/null
|
||||
+++ b/tests/xmconfigdata/test-paravirt-vcpu.cfg
|
||||
@@ -0,0 +1,17 @@
|
||||
+name = "XenGuest1"
|
||||
+uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
|
||||
+maxmem = 579
|
||||
+memory = 394
|
||||
+vcpus = 4
|
||||
+vcpu_avail = 3
|
||||
+bootloader = "/usr/bin/pygrub"
|
||||
+on_poweroff = "destroy"
|
||||
+on_reboot = "restart"
|
||||
+on_crash = "restart"
|
||||
+sdl = 0
|
||||
+vnc = 1
|
||||
+vncunused = 1
|
||||
+vnclisten = "127.0.0.1"
|
||||
+vncpasswd = "123poi"
|
||||
+disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
|
||||
+vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
|
||||
diff --git a/tests/xmconfigdata/test-paravirt-vcpu.xml b/tests/xmconfigdata/test-paravirt-vcpu.xml
|
||||
new file mode 100644
|
||||
index 0000000..0be9456
|
||||
--- /dev/null
|
||||
+++ b/tests/xmconfigdata/test-paravirt-vcpu.xml
|
||||
@@ -0,0 +1,32 @@
|
||||
+<domain type='xen'>
|
||||
+ <name>XenGuest1</name>
|
||||
+ <uuid>c7a5fdb0-cdaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory>592896</memory>
|
||||
+ <currentMemory>403456</currentMemory>
|
||||
+ <vcpu current='2'>4</vcpu>
|
||||
+ <bootloader>/usr/bin/pygrub</bootloader>
|
||||
+ <os>
|
||||
+ <type arch='i686' machine='xenpv'>linux</type>
|
||||
+ </os>
|
||||
+ <clock offset='utc'/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>restart</on_crash>
|
||||
+ <devices>
|
||||
+ <disk type='block' device='disk'>
|
||||
+ <driver name='phy'/>
|
||||
+ <source dev='/dev/HostVG/XenGuest1'/>
|
||||
+ <target dev='xvda' bus='xen'/>
|
||||
+ </disk>
|
||||
+ <interface type='bridge'>
|
||||
+ <mac address='00:16:3e:66:94:9c'/>
|
||||
+ <source bridge='br0'/>
|
||||
+ <script path='vif-bridge'/>
|
||||
+ </interface>
|
||||
+ <console type='pty'>
|
||||
+ <target type='xen' port='0'/>
|
||||
+ </console>
|
||||
+ <input type='mouse' bus='xen'/>
|
||||
+ <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
|
||||
index 221b322..ea00747 100644
|
||||
--- a/tests/xmconfigtest.c
|
||||
+++ b/tests/xmconfigtest.c
|
||||
@@ -210,6 +210,7 @@ mymain(int argc, char **argv)
|
||||
DO_TEST("paravirt-new-pvfb-vncdisplay", 3);
|
||||
DO_TEST("paravirt-net-e1000", 3);
|
||||
DO_TEST("paravirt-net-vifname", 3);
|
||||
+ DO_TEST("paravirt-vcpu", 2);
|
||||
DO_TEST("fullvirt-old-cdrom", 1);
|
||||
DO_TEST("fullvirt-new-cdrom", 2);
|
||||
DO_TEST("fullvirt-utc", 2);
|
||||
diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr
|
||||
new file mode 100644
|
||||
index 0000000..e886545
|
||||
--- /dev/null
|
||||
+++ b/tests/xml2sexprdata/xml2sexpr-pv-vcpus.sexpr
|
||||
@@ -0,0 +1 @@
|
||||
+(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 4)(vcpu_avail 3)(uuid '596a5d21-71f4-8fb2-e068-e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w'))))
|
||||
\ No newline at end of file
|
||||
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
|
||||
index 77cf760..9cf8d39 100644
|
||||
--- a/tests/xml2sexprtest.c
|
||||
+++ b/tests/xml2sexprtest.c
|
||||
@@ -118,6 +118,7 @@ mymain(int argc, char **argv)
|
||||
DO_TEST("pv-vfb-new", "pv-vfb-new", "pvtest", 3);
|
||||
DO_TEST("pv-vfb-new-auto", "pv-vfb-new-auto", "pvtest", 3);
|
||||
DO_TEST("pv-bootloader", "pv-bootloader", "pvtest", 1);
|
||||
+ DO_TEST("pv-vcpus", "pv-vcpus", "pvtest", 1);
|
||||
|
||||
DO_TEST("disk-file", "disk-file", "pvtest", 2);
|
||||
DO_TEST("disk-block", "disk-block", "pvtest", 2);
|
||||
--
|
||||
1.7.2.3
|
||||
|
216
docs/api_extension/0013-improve-getting-xen-vcpu-counts.patch
Normal file
216
docs/api_extension/0013-improve-getting-xen-vcpu-counts.patch
Normal file
@@ -0,0 +1,216 @@
|
||||
From 290ea33111be7bdf1f1381b90de33eb0e67c1a15 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Wed, 6 Oct 2010 17:54:41 -0600
|
||||
Subject: [PATCH 13/15] vcpu: improve support for getting xen vcpu counts
|
||||
|
||||
* src/xen/xen_driver.c (xenUnifiedDomainGetVcpusFlags): Support
|
||||
more flags.
|
||||
* src/xen/xend_internal.h (xenDaemonDomainGetVcpusFlags): New
|
||||
prototype.
|
||||
* src/xen/xm_internal.h (xenXMDomainGetVcpusFlags): Likewise.
|
||||
* src/xen/xend_internal.c (virDomainGetVcpusFlags): New function.
|
||||
* src/xen/xm_internal.c (xenXMDomainGetVcpusFlags): Likewise.
|
||||
---
|
||||
src/xen/xen_driver.c | 31 +++++++++++++++++++--------
|
||||
src/xen/xend_internal.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/xen/xend_internal.h | 2 +
|
||||
src/xen/xm_internal.c | 47 ++++++++++++++++++++++++++++++++++++++++++
|
||||
src/xen/xm_internal.h | 1 +
|
||||
5 files changed, 124 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
|
||||
index d6c9c57..fe2ff86 100644
|
||||
--- a/src/xen/xen_driver.c
|
||||
+++ b/src/xen/xen_driver.c
|
||||
@@ -1142,20 +1142,33 @@ static int
|
||||
xenUnifiedDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
|
||||
{
|
||||
GET_PRIVATE(dom->conn);
|
||||
- int i, ret;
|
||||
+ int ret;
|
||||
|
||||
- if (flags != (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
- xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
|
||||
- flags);
|
||||
+ virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_CONFIG |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||
+
|
||||
+ /* Exactly one of LIVE or CONFIG must be set. */
|
||||
+ if (!(flags & VIR_DOMAIN_VCPU_LIVE) == !(flags & VIR_DOMAIN_VCPU_CONFIG)) {
|
||||
+ xenUnifiedError(VIR_ERR_INVALID_ARG,
|
||||
+ _("invalid flag combination: (0x%x)"), flags);
|
||||
return -1;
|
||||
}
|
||||
|
||||
- for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
||||
- if (priv->opened[i] && drivers[i]->domainGetMaxVcpus) {
|
||||
- ret = drivers[i]->domainGetMaxVcpus (dom);
|
||||
- if (ret != 0) return ret;
|
||||
- }
|
||||
+ if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
|
||||
+ ret = xenDaemonDomainGetVcpusFlags(dom, flags);
|
||||
+ if (ret != -2)
|
||||
+ return ret;
|
||||
+ }
|
||||
+ if (priv->opened[XEN_UNIFIED_XM_OFFSET]) {
|
||||
+ ret = xenXMDomainGetVcpusFlags(dom, flags);
|
||||
+ if (ret != -2)
|
||||
+ return ret;
|
||||
+ }
|
||||
+ if (flags == (VIR_DOMAIN_VCPU_CONFIG | VIR_DOMAIN_VCPU_MAXIMUM))
|
||||
+ return xenHypervisorGetVcpuMax(dom);
|
||||
|
||||
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
|
||||
index dfc6415..3642296 100644
|
||||
--- a/src/xen/xend_internal.c
|
||||
+++ b/src/xen/xend_internal.c
|
||||
@@ -3620,6 +3620,58 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
|
||||
}
|
||||
|
||||
/**
|
||||
+ * xenDaemonDomainGetVcpusFlags:
|
||||
+ * @domain: pointer to domain object
|
||||
+ * @flags: bitwise-ORd from virDomainVcpuFlags
|
||||
+ *
|
||||
+ * Extract information about virtual CPUs of domain according to flags.
|
||||
+ *
|
||||
+ * Returns the number of vcpus on success, -1 if an error message was
|
||||
+ * issued, and -2 if the unified driver should keep trying.
|
||||
+
|
||||
+ */
|
||||
+int
|
||||
+xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||
+{
|
||||
+ struct sexpr *root;
|
||||
+ int ret;
|
||||
+ xenUnifiedPrivatePtr priv;
|
||||
+
|
||||
+ if (domain == NULL || domain->conn == NULL || domain->name == NULL) {
|
||||
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||
+
|
||||
+ /* If xendConfigVersion is 2, then we can only report _LIVE (and
|
||||
+ * xm_internal reports _CONFIG). If it is 3, then _LIVE and
|
||||
+ * _CONFIG are always in sync for a running system. */
|
||||
+ if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
|
||||
+ return -2;
|
||||
+ if (domain->id < 0 && (flags & VIR_DOMAIN_VCPU_LIVE)) {
|
||||
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("domain not active"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
|
||||
+ if (root == NULL)
|
||||
+ return -1;
|
||||
+
|
||||
+ ret = sexpr_int(root, "domain/vcpus");
|
||||
+ if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM)) {
|
||||
+ int vcpus = count_one_bits(sexpr_int(root, "domain/vcpu_avail"));
|
||||
+ if (vcpus)
|
||||
+ ret = MIN(vcpus, ret);
|
||||
+ }
|
||||
+ if (!ret)
|
||||
+ ret = -2;
|
||||
+ sexpr_free(root);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* virDomainGetVcpus:
|
||||
* @domain: pointer to domain object, or NULL for Domain0
|
||||
* @info: pointer to an array of virVcpuInfo structures (OUT)
|
||||
diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
|
||||
index c757716..923cebd 100644
|
||||
--- a/src/xen/xend_internal.h
|
||||
+++ b/src/xen/xend_internal.h
|
||||
@@ -155,6 +155,8 @@ int xenDaemonDomainPinVcpu (virDomainPtr domain,
|
||||
unsigned int vcpu,
|
||||
unsigned char *cpumap,
|
||||
int maplen);
|
||||
+int xenDaemonDomainGetVcpusFlags (virDomainPtr domain,
|
||||
+ unsigned int flags);
|
||||
int xenDaemonDomainGetVcpus (virDomainPtr domain,
|
||||
virVcpuInfoPtr info,
|
||||
int maxinfo,
|
||||
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
|
||||
index f7121ab..4ea4245 100644
|
||||
--- a/src/xen/xm_internal.c
|
||||
+++ b/src/xen/xm_internal.c
|
||||
@@ -1671,6 +1671,53 @@ cleanup:
|
||||
}
|
||||
|
||||
/**
|
||||
+ * xenXMDomainGetVcpusFlags:
|
||||
+ * @domain: pointer to domain object
|
||||
+ * @flags: bitwise-ORd from virDomainVcpuFlags
|
||||
+ *
|
||||
+ * Extract information about virtual CPUs of domain according to flags.
|
||||
+ *
|
||||
+ * Returns the number of vcpus on success, -1 if an error message was
|
||||
+ * issued, and -2 if the unified driver should keep trying.
|
||||
+ */
|
||||
+int
|
||||
+xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
|
||||
+{
|
||||
+ xenUnifiedPrivatePtr priv;
|
||||
+ const char *filename;
|
||||
+ xenXMConfCachePtr entry;
|
||||
+ int ret = -2;
|
||||
+
|
||||
+ if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
|
||||
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (domain->id != -1)
|
||||
+ return -2;
|
||||
+ if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
||||
+ xenXMError(VIR_ERR_OPERATION_FAILED, "%s", _("domain not active"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ priv = domain->conn->privateData;
|
||||
+ xenUnifiedLock(priv);
|
||||
+
|
||||
+ if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ if (!(entry = virHashLookup(priv->configCache, filename)))
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ ret = ((flags & VIR_DOMAIN_VCPU_MAXIMUM) ? entry->def->maxvcpus
|
||||
+ : entry->def->vcpus);
|
||||
+
|
||||
+cleanup:
|
||||
+ xenUnifiedUnlock(priv);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* xenXMDomainPinVcpu:
|
||||
* @domain: pointer to domain object
|
||||
* @vcpu: virtual CPU number (reserved)
|
||||
diff --git a/src/xen/xm_internal.h b/src/xen/xm_internal.h
|
||||
index 3ad3456..3295fbd 100644
|
||||
--- a/src/xen/xm_internal.h
|
||||
+++ b/src/xen/xm_internal.h
|
||||
@@ -45,6 +45,7 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory);
|
||||
int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory);
|
||||
unsigned long xenXMDomainGetMaxMemory(virDomainPtr domain);
|
||||
int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus);
|
||||
+int xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags);
|
||||
int xenXMDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
|
||||
unsigned char *cpumap, int maplen);
|
||||
virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname);
|
||||
--
|
||||
1.7.2.3
|
||||
|
342
docs/api_extension/0014-improve-setting-xen-vcpu-counts.patch
Normal file
342
docs/api_extension/0014-improve-setting-xen-vcpu-counts.patch
Normal file
@@ -0,0 +1,342 @@
|
||||
From e443a003129a172a7332f3cb6e40b3c39363ed5e Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Thu, 14 Oct 2010 16:17:18 -0600
|
||||
Subject: [PATCH 14/15] vcpu: improve support for setting xen vcpu counts
|
||||
|
||||
Tested with RHEL 5.6 (xendConfigVersion 2, where xend_internal
|
||||
controls live domains and xm_internal controls inactive domains).
|
||||
Hopefully this works with xendConfigVersion 3 (where xend_internal
|
||||
controls everything).
|
||||
|
||||
* src/xen/xen_driver.c (xenUnifiedDomainSetVcpusFlags): Support
|
||||
more flags.
|
||||
(xenUnifiedGetMaxVcpus): Export.
|
||||
* src/xen/xm_internal.h (xenXMDomainSetVcpusFlags): New prototype.
|
||||
* src/xen/xend_internal.h (xenDaemonDomainSetVcpusFlags): Likewise.
|
||||
* src/xen/xen_driver.h (xenUnifiedGetMaxVcpus): Likewise.
|
||||
* src/xen/xm_internal.c (xenXMDomainSetVcpusFlags): New function.
|
||||
* src/xen/xend_internal.c (xenDaemonDomainSetVcpusFlags): Likewise.
|
||||
---
|
||||
src/xen/xen_driver.c | 60 ++++++++++++++++++++++++---------
|
||||
src/xen/xen_driver.h | 1 +
|
||||
src/xen/xend_internal.c | 76 +++++++++++++++++++++++++++++++++++++++++++
|
||||
src/xen/xend_internal.h | 3 ++
|
||||
src/xen/xm_internal.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/xen/xm_internal.h | 2 +
|
||||
6 files changed, 208 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
|
||||
index fe2ff86..66e8518 100644
|
||||
--- a/src/xen/xen_driver.c
|
||||
+++ b/src/xen/xen_driver.c
|
||||
@@ -508,7 +508,7 @@ xenUnifiedIsSecure(virConnectPtr conn)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int
|
||||
+int
|
||||
xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type)
|
||||
{
|
||||
GET_PRIVATE(conn);
|
||||
@@ -1073,36 +1073,62 @@ xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
|
||||
unsigned int flags)
|
||||
{
|
||||
GET_PRIVATE(dom->conn);
|
||||
- int i;
|
||||
+ int ret;
|
||||
+
|
||||
+ virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
|
||||
+ VIR_DOMAIN_VCPU_CONFIG |
|
||||
+ VIR_DOMAIN_VCPU_MAXIMUM, -1);
|
||||
|
||||
- if (flags != VIR_DOMAIN_VCPU_LIVE) {
|
||||
- xenUnifiedError(VIR_ERR_INVALID_ARG, _("unsupported flags: (0x%x)"),
|
||||
- flags);
|
||||
+ /* At least one of LIVE or CONFIG must be set. MAXIMUM cannot be
|
||||
+ * mixed with LIVE. */
|
||||
+ if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
|
||||
+ (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
|
||||
+ (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
|
||||
+ xenUnifiedError(VIR_ERR_INVALID_ARG,
|
||||
+ _("invalid flag combination: (0x%x)"), flags);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (!nvcpus || (unsigned short) nvcpus != nvcpus) {
|
||||
+ xenUnifiedError(VIR_ERR_INVALID_ARG,
|
||||
+ _("argument out of range: %d"), nvcpus);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Try non-hypervisor methods first, then hypervisor direct method
|
||||
* as a last resort.
|
||||
*/
|
||||
- for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
|
||||
- if (i != XEN_UNIFIED_HYPERVISOR_OFFSET &&
|
||||
- priv->opened[i] &&
|
||||
- drivers[i]->domainSetVcpus &&
|
||||
- drivers[i]->domainSetVcpus (dom, nvcpus) == 0)
|
||||
- return 0;
|
||||
-
|
||||
- if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] &&
|
||||
- drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainSetVcpus &&
|
||||
- drivers[XEN_UNIFIED_HYPERVISOR_OFFSET]->domainSetVcpus (dom, nvcpus) == 0)
|
||||
- return 0;
|
||||
+ if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
|
||||
+ ret = xenDaemonDomainSetVcpusFlags(dom, nvcpus, flags);
|
||||
+ if (ret != -2)
|
||||
+ return ret;
|
||||
+ }
|
||||
+ if (priv->opened[XEN_UNIFIED_XM_OFFSET]) {
|
||||
+ ret = xenXMDomainSetVcpusFlags(dom, nvcpus, flags);
|
||||
+ if (ret != -2)
|
||||
+ return ret;
|
||||
+ }
|
||||
+ if (flags == VIR_DOMAIN_VCPU_LIVE)
|
||||
+ return xenHypervisorSetVcpus(dom, nvcpus);
|
||||
|
||||
+ xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
|
||||
{
|
||||
- return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
+ unsigned int flags = VIR_DOMAIN_VCPU_LIVE;
|
||||
+ xenUnifiedPrivatePtr priv;
|
||||
+
|
||||
+ /* Per the documented API, it is hypervisor-dependent whether this
|
||||
+ * affects just _LIVE or _LIVE|_CONFIG; in xen's case, that
|
||||
+ * depends on xendConfigVersion. */
|
||||
+ if (dom) {
|
||||
+ priv = dom->conn->privateData;
|
||||
+ if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4)
|
||||
+ flags |= VIR_DOMAIN_VCPU_CONFIG;
|
||||
+ }
|
||||
+ return xenUnifiedDomainSetVcpusFlags(dom, nvcpus, flags);
|
||||
}
|
||||
|
||||
static int
|
||||
diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h
|
||||
index 3e7c1d0..115a26a 100644
|
||||
--- a/src/xen/xen_driver.h
|
||||
+++ b/src/xen/xen_driver.h
|
||||
@@ -220,6 +220,7 @@ int xenUnifiedRemoveDomainInfo(xenUnifiedDomainInfoListPtr info,
|
||||
void xenUnifiedDomainEventDispatch (xenUnifiedPrivatePtr priv,
|
||||
virDomainEventPtr event);
|
||||
unsigned long xenUnifiedVersion(void);
|
||||
+int xenUnifiedGetMaxVcpus(virConnectPtr conn, const char *type);
|
||||
|
||||
# ifndef PROXY
|
||||
void xenUnifiedLock(xenUnifiedPrivatePtr priv);
|
||||
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
|
||||
index 3642296..55c2cc4 100644
|
||||
--- a/src/xen/xend_internal.c
|
||||
+++ b/src/xen/xend_internal.c
|
||||
@@ -3535,6 +3535,82 @@ xenDaemonLookupByID(virConnectPtr conn, int id) {
|
||||
}
|
||||
|
||||
/**
|
||||
+ * xenDaemonDomainSetVcpusFlags:
|
||||
+ * @domain: pointer to domain object
|
||||
+ * @nvcpus: the new number of virtual CPUs for this domain
|
||||
+ * @flags: bitwise-ORd from virDomainVcpuFlags
|
||||
+ *
|
||||
+ * Change virtual CPUs allocation of domain according to flags.
|
||||
+ *
|
||||
+ * Returns 0 on success, -1 if an error message was issued, and -2 if
|
||||
+ * the unified driver should keep trying.
|
||||
+ */
|
||||
+int
|
||||
+xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
|
||||
+ unsigned int flags)
|
||||
+{
|
||||
+ char buf[VIR_UUID_BUFLEN];
|
||||
+ xenUnifiedPrivatePtr priv;
|
||||
+ int max;
|
||||
+
|
||||
+ if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|
||||
+ || (vcpus < 1)) {
|
||||
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
+ return (-1);
|
||||
+ }
|
||||
+
|
||||
+ priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||
+
|
||||
+ if ((domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) ||
|
||||
+ (flags & VIR_DOMAIN_VCPU_MAXIMUM))
|
||||
+ return -2;
|
||||
+
|
||||
+ /* With xendConfigVersion 2, only _LIVE is supported. With
|
||||
+ * xendConfigVersion 3, only _LIVE|_CONFIG is supported for
|
||||
+ * running domains, or _CONFIG for inactive domains. */
|
||||
+ if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
|
||||
+ if (flags & VIR_DOMAIN_VCPU_CONFIG) {
|
||||
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("Xend version does not support modifying "
|
||||
+ "persistent config"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ } else if (domain->id < 0) {
|
||||
+ if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
||||
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("domain not running"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) !=
|
||||
+ (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) {
|
||||
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("Xend only supports modifying both live and "
|
||||
+ "persistent config"));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Unfortunately, xend_op does not validate whether this exceeds
|
||||
+ * the maximum. */
|
||||
+ flags |= VIR_DOMAIN_VCPU_MAXIMUM;
|
||||
+ if ((max = xenDaemonDomainGetVcpusFlags(domain, flags)) < 0) {
|
||||
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("could not determin max vcpus for the domain"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (vcpus > max) {
|
||||
+ virXendError(VIR_ERR_INVALID_ARG,
|
||||
+ _("requested vcpus is greater than max allowable"
|
||||
+ " vcpus for the domain: %d > %d"), vcpus, max);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ snprintf(buf, sizeof(buf), "%d", vcpus);
|
||||
+ return xend_op(domain->conn, domain->name, "op", "set_vcpus", "vcpus",
|
||||
+ buf, NULL);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* xenDaemonDomainSetVcpus:
|
||||
* @domain: pointer to domain object
|
||||
* @nvcpus: the new number of virtual CPUs for this domain
|
||||
diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
|
||||
index 923cebd..53f5d2c 100644
|
||||
--- a/src/xen/xend_internal.h
|
||||
+++ b/src/xen/xend_internal.h
|
||||
@@ -151,6 +151,9 @@ int xenDaemonDomainUndefine(virDomainPtr domain);
|
||||
|
||||
int xenDaemonDomainSetVcpus (virDomainPtr domain,
|
||||
unsigned int vcpus);
|
||||
+int xenDaemonDomainSetVcpusFlags (virDomainPtr domain,
|
||||
+ unsigned int vcpus,
|
||||
+ unsigned int flags);
|
||||
int xenDaemonDomainPinVcpu (virDomainPtr domain,
|
||||
unsigned int vcpu,
|
||||
unsigned char *cpumap,
|
||||
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
|
||||
index 4ea4245..2b8e51e 100644
|
||||
--- a/src/xen/xm_internal.c
|
||||
+++ b/src/xen/xm_internal.c
|
||||
@@ -1670,6 +1670,89 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * xenXMDomainSetVcpusFlags:
|
||||
+ * @domain: pointer to domain object
|
||||
+ * @nvcpus: number of vcpus
|
||||
+ * @flags: bitwise-ORd from virDomainVcpuFlags
|
||||
+ *
|
||||
+ * Change virtual CPUs allocation of domain according to flags.
|
||||
+ *
|
||||
+ * Returns 0 on success, -1 if an error message was issued, and -2 if
|
||||
+ * the unified driver should keep trying.
|
||||
+ */
|
||||
+int
|
||||
+xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
|
||||
+ unsigned int flags)
|
||||
+{
|
||||
+ xenUnifiedPrivatePtr priv;
|
||||
+ const char *filename;
|
||||
+ xenXMConfCachePtr entry;
|
||||
+ int ret = -1;
|
||||
+ int max;
|
||||
+
|
||||
+ if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
|
||||
+ xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (domain->conn->flags & VIR_CONNECT_RO) {
|
||||
+ xenXMError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (domain->id != -1)
|
||||
+ return -2;
|
||||
+ if (flags & VIR_DOMAIN_VCPU_LIVE) {
|
||||
+ xenXMError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("domain is not running"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ priv = domain->conn->privateData;
|
||||
+ xenUnifiedLock(priv);
|
||||
+
|
||||
+ if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ if (!(entry = virHashLookup(priv->configCache, filename)))
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ /* Hypervisor maximum. */
|
||||
+ if ((max = xenUnifiedGetMaxVcpus(domain->conn, NULL)) < 0) {
|
||||
+ xenXMError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("could not determin max vcpus for the domain"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ /* Can't specify a current larger than stored maximum; but
|
||||
+ * reducing maximum can silently reduce current. */
|
||||
+ if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM))
|
||||
+ max = entry->def->maxvcpus;
|
||||
+ if (vcpus > max) {
|
||||
+ xenXMError(VIR_ERR_INVALID_ARG,
|
||||
+ _("requested vcpus is greater than max allowable"
|
||||
+ " vcpus for the domain: %d > %d"), vcpus, max);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
|
||||
+ entry->def->maxvcpus = vcpus;
|
||||
+ if (entry->def->vcpus > vcpus)
|
||||
+ entry->def->vcpus = vcpus;
|
||||
+ } else {
|
||||
+ entry->def->vcpus = vcpus;
|
||||
+ }
|
||||
+
|
||||
+ /* If this fails, should we try to undo our changes to the
|
||||
+ * in-memory representation of the config file. I say not!
|
||||
+ */
|
||||
+ if (xenXMConfigSaveFile(domain->conn, entry->filename, entry->def) < 0)
|
||||
+ goto cleanup;
|
||||
+ ret = 0;
|
||||
+
|
||||
+cleanup:
|
||||
+ xenUnifiedUnlock(priv);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* xenXMDomainGetVcpusFlags:
|
||||
* @domain: pointer to domain object
|
||||
diff --git a/src/xen/xm_internal.h b/src/xen/xm_internal.h
|
||||
index 3295fbd..a46e1a2 100644
|
||||
--- a/src/xen/xm_internal.h
|
||||
+++ b/src/xen/xm_internal.h
|
||||
@@ -45,6 +45,8 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory);
|
||||
int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory);
|
||||
unsigned long xenXMDomainGetMaxMemory(virDomainPtr domain);
|
||||
int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus);
|
||||
+int xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
|
||||
+ unsigned int flags);
|
||||
int xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags);
|
||||
int xenXMDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
|
||||
unsigned char *cpumap, int maplen);
|
||||
--
|
||||
1.7.2.3
|
||||
|
228
docs/api_extension/0015-remove-dead-xen-code.patch
Normal file
228
docs/api_extension/0015-remove-dead-xen-code.patch
Normal file
@@ -0,0 +1,228 @@
|
||||
From b013788742183afec9aa5068d3cfd185a3b5c62e Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Thu, 7 Oct 2010 08:59:27 -0600
|
||||
Subject: [PATCH 15/15] vcpu: remove dead xen code
|
||||
|
||||
* src/xen/xen_driver.h (xenUnifiedDriver): Remove now-unused
|
||||
domainGetMaxVcpus, domainSetVcpus.
|
||||
* src/xen/proxy_internal.c (xenProxyDriver): Likewise.
|
||||
* src/xen/xen_hypervisor.c (xenHypervisorDriver): Likewise.
|
||||
* src/xen/xen_inotify.c (xenInotifyDriver): Likewise.
|
||||
* src/xen/xend_internal.c (xenDaemonDriver)
|
||||
(xenDaemonDomainSetVcpus): Likewise.
|
||||
* src/xen/xm_internal.c (xenXMDriver, xenXMDomainSetVcpus):
|
||||
Likewise.
|
||||
* src/xen/xs_internal.c (xenStoreDriver): Likewise.
|
||||
---
|
||||
src/xen/proxy_internal.c | 2 --
|
||||
src/xen/xen_driver.h | 4 +---
|
||||
src/xen/xen_hypervisor.c | 2 --
|
||||
src/xen/xen_inotify.c | 2 --
|
||||
src/xen/xend_internal.c | 33 ---------------------------------
|
||||
src/xen/xm_internal.c | 43 -------------------------------------------
|
||||
src/xen/xs_internal.c | 2 --
|
||||
7 files changed, 1 insertions(+), 87 deletions(-)
|
||||
|
||||
diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
|
||||
index 335dfc4..4033727 100644
|
||||
--- a/src/xen/proxy_internal.c
|
||||
+++ b/src/xen/proxy_internal.c
|
||||
@@ -67,10 +67,8 @@ struct xenUnifiedDriver xenProxyDriver = {
|
||||
NULL, /* domainSave */
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
- NULL, /* domainSetVcpus */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
- NULL, /* domainGetMaxVcpus */
|
||||
NULL, /* listDefinedDomains */
|
||||
NULL, /* numOfDefinedDomains */
|
||||
NULL, /* domainCreate */
|
||||
diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h
|
||||
index 115a26a..53f97d4 100644
|
||||
--- a/src/xen/xen_driver.h
|
||||
+++ b/src/xen/xen_driver.h
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* xen_unified.c: Unified Xen driver.
|
||||
*
|
||||
- * Copyright (C) 2007 Red Hat, Inc.
|
||||
+ * Copyright (C) 2007, 2010 Red Hat, Inc.
|
||||
*
|
||||
* See COPYING.LIB for the License of this software
|
||||
*
|
||||
@@ -84,10 +84,8 @@ struct xenUnifiedDriver {
|
||||
virDrvDomainSave domainSave;
|
||||
virDrvDomainRestore domainRestore;
|
||||
virDrvDomainCoreDump domainCoreDump;
|
||||
- virDrvDomainSetVcpus domainSetVcpus;
|
||||
virDrvDomainPinVcpu domainPinVcpu;
|
||||
virDrvDomainGetVcpus domainGetVcpus;
|
||||
- virDrvDomainGetMaxVcpus domainGetMaxVcpus;
|
||||
virDrvListDefinedDomains listDefinedDomains;
|
||||
virDrvNumOfDefinedDomains numOfDefinedDomains;
|
||||
virDrvDomainCreate domainCreate;
|
||||
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
|
||||
index 6246513..3797865 100644
|
||||
--- a/src/xen/xen_hypervisor.c
|
||||
+++ b/src/xen/xen_hypervisor.c
|
||||
@@ -784,10 +784,8 @@ struct xenUnifiedDriver xenHypervisorDriver = {
|
||||
NULL, /* domainSave */
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
- xenHypervisorSetVcpus, /* domainSetVcpus */
|
||||
xenHypervisorPinVcpu, /* domainPinVcpu */
|
||||
xenHypervisorGetVcpus, /* domainGetVcpus */
|
||||
- xenHypervisorGetVcpuMax, /* domainGetMaxVcpus */
|
||||
NULL, /* listDefinedDomains */
|
||||
NULL, /* numOfDefinedDomains */
|
||||
NULL, /* domainCreate */
|
||||
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
|
||||
index d24b20f..9507061 100644
|
||||
--- a/src/xen/xen_inotify.c
|
||||
+++ b/src/xen/xen_inotify.c
|
||||
@@ -71,10 +71,8 @@ struct xenUnifiedDriver xenInotifyDriver = {
|
||||
NULL, /* domainSave */
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
- NULL, /* domainSetVcpus */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
- NULL, /* domainGetMaxVcpus */
|
||||
NULL, /* listDefinedDomains */
|
||||
NULL, /* numOfDefinedDomains */
|
||||
NULL, /* domainCreate */
|
||||
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
|
||||
index 55c2cc4..b90c331 100644
|
||||
--- a/src/xen/xend_internal.c
|
||||
+++ b/src/xen/xend_internal.c
|
||||
@@ -3611,37 +3611,6 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
|
||||
}
|
||||
|
||||
/**
|
||||
- * xenDaemonDomainSetVcpus:
|
||||
- * @domain: pointer to domain object
|
||||
- * @nvcpus: the new number of virtual CPUs for this domain
|
||||
- *
|
||||
- * Dynamically change the number of virtual CPUs used by the domain.
|
||||
- *
|
||||
- * Returns 0 for success; -1 (with errno) on error
|
||||
- */
|
||||
-int
|
||||
-xenDaemonDomainSetVcpus(virDomainPtr domain, unsigned int vcpus)
|
||||
-{
|
||||
- char buf[VIR_UUID_BUFLEN];
|
||||
- xenUnifiedPrivatePtr priv;
|
||||
-
|
||||
- if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|
||||
- || (vcpus < 1)) {
|
||||
- virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
- return (-1);
|
||||
- }
|
||||
-
|
||||
- priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||
-
|
||||
- if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
|
||||
- return(-1);
|
||||
-
|
||||
- snprintf(buf, sizeof(buf), "%d", vcpus);
|
||||
- return(xend_op(domain->conn, domain->name, "op", "set_vcpus", "vcpus",
|
||||
- buf, NULL));
|
||||
-}
|
||||
-
|
||||
-/**
|
||||
* xenDaemonDomainPinCpu:
|
||||
* @domain: pointer to domain object
|
||||
* @vcpu: virtual CPU number
|
||||
@@ -5213,10 +5182,8 @@ struct xenUnifiedDriver xenDaemonDriver = {
|
||||
xenDaemonDomainSave, /* domainSave */
|
||||
xenDaemonDomainRestore, /* domainRestore */
|
||||
xenDaemonDomainCoreDump, /* domainCoreDump */
|
||||
- xenDaemonDomainSetVcpus, /* domainSetVcpus */
|
||||
xenDaemonDomainPinVcpu, /* domainPinVcpu */
|
||||
xenDaemonDomainGetVcpus, /* domainGetVcpus */
|
||||
- NULL, /* domainGetMaxVcpus */
|
||||
xenDaemonListDefinedDomains, /* listDefinedDomains */
|
||||
xenDaemonNumOfDefinedDomains,/* numOfDefinedDomains */
|
||||
xenDaemonDomainCreate, /* domainCreate */
|
||||
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
|
||||
index 2b8e51e..430d40b 100644
|
||||
--- a/src/xen/xm_internal.c
|
||||
+++ b/src/xen/xm_internal.c
|
||||
@@ -103,10 +103,8 @@ struct xenUnifiedDriver xenXMDriver = {
|
||||
NULL, /* domainSave */
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
- xenXMDomainSetVcpus, /* domainSetVcpus */
|
||||
xenXMDomainPinVcpu, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
- NULL, /* domainGetMaxVcpus */
|
||||
xenXMListDefinedDomains, /* listDefinedDomains */
|
||||
xenXMNumOfDefinedDomains, /* numOfDefinedDomains */
|
||||
xenXMDomainCreate, /* domainCreate */
|
||||
@@ -1630,47 +1628,6 @@ cleanup:
|
||||
}
|
||||
|
||||
/*
|
||||
- * Set the VCPU count in config
|
||||
- */
|
||||
-int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus) {
|
||||
- xenUnifiedPrivatePtr priv;
|
||||
- const char *filename;
|
||||
- xenXMConfCachePtr entry;
|
||||
- int ret = -1;
|
||||
-
|
||||
- if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
|
||||
- xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
- return (-1);
|
||||
- }
|
||||
- if (domain->conn->flags & VIR_CONNECT_RO)
|
||||
- return (-1);
|
||||
- if (domain->id != -1)
|
||||
- return (-1);
|
||||
-
|
||||
- priv = domain->conn->privateData;
|
||||
- xenUnifiedLock(priv);
|
||||
-
|
||||
- if (!(filename = virHashLookup(priv->nameConfigMap, domain->name)))
|
||||
- goto cleanup;
|
||||
-
|
||||
- if (!(entry = virHashLookup(priv->configCache, filename)))
|
||||
- goto cleanup;
|
||||
-
|
||||
- entry->def->maxvcpus = entry->def->vcpus = vcpus;
|
||||
-
|
||||
- /* If this fails, should we try to undo our changes to the
|
||||
- * in-memory representation of the config file. I say not!
|
||||
- */
|
||||
- if (xenXMConfigSaveFile(domain->conn, entry->filename, entry->def) < 0)
|
||||
- goto cleanup;
|
||||
- ret = 0;
|
||||
-
|
||||
-cleanup:
|
||||
- xenUnifiedUnlock(priv);
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
* xenXMDomainSetVcpusFlags:
|
||||
* @domain: pointer to domain object
|
||||
* @nvcpus: number of vcpus
|
||||
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
|
||||
index 9296f25..a9817b1 100644
|
||||
--- a/src/xen/xs_internal.c
|
||||
+++ b/src/xen/xs_internal.c
|
||||
@@ -67,10 +67,8 @@ struct xenUnifiedDriver xenStoreDriver = {
|
||||
NULL, /* domainSave */
|
||||
NULL, /* domainRestore */
|
||||
NULL, /* domainCoreDump */
|
||||
- NULL, /* domainSetVcpus */
|
||||
NULL, /* domainPinVcpu */
|
||||
NULL, /* domainGetVcpus */
|
||||
- NULL, /* domainGetMaxVcpus */
|
||||
NULL, /* listDefinedDomains */
|
||||
NULL, /* numOfDefinedDomains */
|
||||
NULL, /* domainCreate */
|
||||
--
|
||||
1.7.2.3
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,26 @@
|
||||
<img src="logos/logo-square-powered-256.png" alt="libvirt powered"/>
|
||||
</p>
|
||||
|
||||
<h2><a id="clientserver">Client/Server applications</a></h2>
|
||||
|
||||
<dl>
|
||||
<dt><a href="http://archipelproject.org">Archipel</a></dt>
|
||||
<dd>
|
||||
Archipel is a libvirt-based solution to manage and supervise virtual
|
||||
machines. It uses XMPP for all communication. There is no web
|
||||
service or custom protocol. You just need at least one XMPP server,
|
||||
like eJabberd, to start playing with it. This allows Archipel to
|
||||
work completely real time. You never have to refresh the user
|
||||
interface, you'll be notified as soon as something happens. You can
|
||||
even use your favorite chat clients to command your infrastructure.
|
||||
</dd>
|
||||
<dd>
|
||||
Isn't it great to be able to open a chat conversation with your
|
||||
virtual machine and say things like "How are you today?" or "Hey,
|
||||
please reboot"?
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2><a id="command">Command line tools</a></h2>
|
||||
|
||||
<dl>
|
||||
@@ -99,12 +119,6 @@
|
||||
machines. It is a command line tool for developers that makes it very
|
||||
fast and easy to deploy and re-deploy an environment of vm's.
|
||||
</dd>
|
||||
<dt><a href="https://github.com/virt-lightning/virt-lightning">virt-lightning</a></dt>
|
||||
<dd>
|
||||
Virt-Lightning uses libvirt, cloud-init and libguestfs to allow anyone
|
||||
to quickly start a new VM. Very much like a container CLI, but with a
|
||||
virtual machine.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2><a id="configmgmt">Configuration Management</a></h2>
|
||||
@@ -128,7 +142,7 @@
|
||||
<h2><a id="continuousintegration">Continuous Integration</a></h2>
|
||||
|
||||
<dl>
|
||||
<dt><a href="http://docs.buildbot.net/latest/manual/configuration/workers-libvirt.html">BuildBot</a></dt>
|
||||
<dt><a href="https://buildbot.net/buildbot/docs/current/Libvirt.html">BuildBot</a></dt>
|
||||
<dd>
|
||||
BuildBot is a system to automate the compile/test cycle required
|
||||
by most software projects. CVS commits trigger new builds, run on
|
||||
@@ -359,6 +373,12 @@
|
||||
metrics. It supports pCPU, vCPU, memory, block device, network interface,
|
||||
and performance event metrics for each virtual guest.
|
||||
</dd>
|
||||
<dt><a href="https://community.zenoss.org/docs/DOC-4687">Zenoss</a></dt>
|
||||
<dd>
|
||||
The Zenoss libvirt Zenpack adds support for monitoring virtualization
|
||||
servers. It has been tested with KVM, QEMU, VMware ESX, and VMware
|
||||
GSX.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2><a id="provisioning">Provisioning</a></h2>
|
||||
@@ -463,6 +483,17 @@
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2><a id="mobile">Mobile applications</a></h2>
|
||||
|
||||
<dl>
|
||||
<dt><a href="https://market.android.com/details?id=vm.manager">VM Manager</a></dt>
|
||||
<dd>
|
||||
VM Manager is VM (libvirt) manager (over SSH) application. VM Manager
|
||||
is an application for libvirt VM / Domain management over SSH.
|
||||
Please keep in mind that this software is under heavy development.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2><a id="other">Other</a></h2>
|
||||
|
||||
<dl>
|
||||
|
@@ -129,9 +129,11 @@ credentials=defgrp</pre>
|
||||
<li><code>libvirt</code> - used for connections to a libvirtd
|
||||
server, which is configured with SASL auth</li>
|
||||
<li><code>ssh</code> - used for connections to a Phyp server
|
||||
over SSH, but the Phyp driver has been removed</li>
|
||||
over SSH</li>
|
||||
<li><code>esx</code> - used for connections to an ESX or
|
||||
VirtualCenter server</li>
|
||||
<li><code>xen</code> - used for connections to a Xen Enterprise
|
||||
sever using XenAPI</li>
|
||||
</ol>
|
||||
|
||||
<p>
|
||||
@@ -182,29 +184,15 @@ Default policy will still allow any application to connect to the RO socket.
|
||||
</p>
|
||||
<p>
|
||||
The default policy can be overridden by creating a new policy file in the
|
||||
<code>/etc/polkit-1/rules.d</code> directory. Information on the options
|
||||
available can be found by reading the <code>polkit(8)</code> man page. The
|
||||
two libvirt actions are named <code>org.libvirt.unix.manage</code> for full
|
||||
management access, and <code>org.libvirt.unix.monitor</code> for read-only
|
||||
access.
|
||||
</p>
|
||||
<p>
|
||||
As an example, creating <code>/etc/polkit-1/rules.d/80-libvirt-manage.rules</code>
|
||||
with the following gives the user <code>fred</code> full management access
|
||||
when accessing from an active local session:
|
||||
</p>
|
||||
<pre>polkit.addRule(function(action, subject) {
|
||||
if (action.id == "org.libvirt.unix.manage" &&
|
||||
subject.local && subject.active && subject.user == "fred") {
|
||||
return polkit.Result.YES;
|
||||
}
|
||||
});</pre>
|
||||
<p>
|
||||
Older versions of PolicyKit used policy files ending with .pkla in the
|
||||
local override directory <code>/etc/polkit-1/localauthority/50-local.d/</code>.
|
||||
Compatibility with this older format is provided by <a
|
||||
href="https://pagure.io/polkit-pkla-compat">polkit-pkla-compat</a>. As an
|
||||
example, this gives the user <code>fred</code> full management access:
|
||||
Policy files should have a unique name ending with .pkla. Using reverse DNS
|
||||
naming works well. Information on the options available can be found by
|
||||
reading the pklocalauthority man page. The two libvirt daemon actions
|
||||
available are named <code>org.libvirt.unix.manage</code> for full management
|
||||
access, and <code>org.libvirt.unix.monitor</code> for read-only access.
|
||||
</p>
|
||||
<p>
|
||||
As an example, this gives the user <code>fred</code> full management access:
|
||||
</p>
|
||||
<pre>[Allow fred libvirt management permissions]
|
||||
Identity=unix-user:fred
|
||||
@@ -212,6 +200,10 @@ Action=org.libvirt.unix.manage
|
||||
ResultAny=yes
|
||||
ResultInactive=yes
|
||||
ResultActive=yes</pre>
|
||||
<p>
|
||||
Further examples of PolicyKit setup can be found on the
|
||||
<a href="http://wiki.libvirt.org/page/SSHPolicyKitSetup">wiki page</a>.
|
||||
</p>
|
||||
<h2><a id="ACL_server_sasl">SASL pluggable authentication</a></h2>
|
||||
|
||||
<p>
|
||||
@@ -274,7 +266,7 @@ to turn on SASL auth in these listeners.
|
||||
</p>
|
||||
<p>
|
||||
Since the libvirt SASL config file defaults to using GSSAPI (Kerberos), a
|
||||
config change is required to enable plain password auth. This is done by
|
||||
config change is rquired to enable plain password auth. This is done by
|
||||
editting <code>/etc/sasl2/libvirt.conf</code> to set the <code>mech_list</code>
|
||||
parameter to <code>scram-sha-1</code>.
|
||||
</p>
|
||||
@@ -317,7 +309,7 @@ in these scenarios - only the plain TCP listener needs encryption
|
||||
Some operating systems do not install the SASL kerberos plugin by default. It
|
||||
may be necessary to install a sub-package such as <code>cyrus-sasl-gssapi</code>.
|
||||
To check whether the Kerberos plugin is installed run the <code>pluginviewer</code>
|
||||
program and verify that <code>gssapi</code> is listed, e.g.:
|
||||
program and verify that <code>gssapi</code> is listed,eg:
|
||||
</p>
|
||||
<pre>
|
||||
# pluginviewer
|
||||
@@ -359,7 +351,7 @@ kadmin.local: quit
|
||||
<p>
|
||||
Any client application wishing to connect to a Kerberos enabled libvirt server
|
||||
merely needs to run <code>kinit</code> to gain a user principal. This may well
|
||||
be done automatically when a user logs into a desktop session, if PAM is set up
|
||||
be done automatically when a user logs into a desktop session, if PAM is setup
|
||||
to authenticate against Kerberos.
|
||||
</p>
|
||||
</body>
|
||||
|
@@ -23,13 +23,12 @@
|
||||
|
||||
<p>
|
||||
The QEMU driver is capable of using the <code>cpuset</code>,
|
||||
<code>cpu</code>, <code>cpuacct</code>, <code>memory</code>,
|
||||
<code>blkio</code> and <code>devices</code> controllers.
|
||||
None of them are compulsory. If any controller is not mounted,
|
||||
the resource management APIs which use it will cease to operate.
|
||||
It is possible to explicitly turn off use of a controller,
|
||||
even when mounted, via the <code>/etc/libvirt/qemu.conf</code>
|
||||
configuration file.
|
||||
<code>cpu</code>, <code>memory</code>, <code>blkio</code> and
|
||||
<code>devices</code> controllers. None of them are compulsory.
|
||||
If any controller is not mounted, the resource management APIs
|
||||
which use it will cease to operate. It is possible to explicitly
|
||||
turn off use of a controller, even when mounted, via the
|
||||
<code>/etc/libvirt/qemu.conf</code> configuration file.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -76,13 +75,11 @@
|
||||
<p>
|
||||
The systemd convention is for the scope name of virtual machines / containers
|
||||
to be of the general format <code>machine-$NAME.scope</code>. Libvirt forms the
|
||||
<code>$NAME</code> part of this by concatenating the driver type with the id
|
||||
and truncated name of the guest, and then escaping any systemd reserved
|
||||
characters.
|
||||
<code>$NAME</code> part of this by concatenating the driver type with the name
|
||||
of the guest, and then escaping any systemd reserved characters.
|
||||
So for a guest <code>demo</code> running under the <code>lxc</code> driver,
|
||||
we get a <code>$NAME</code> of <code>lxc-12345-demo</code> which when escaped
|
||||
is <code>lxc\x2d12345\x2ddemo</code>. So the complete scope name is
|
||||
<code>machine-lxc\x2d12345\x2ddemo.scope</code>.
|
||||
we get a <code>$NAME</code> of <code>lxc-demo</code> which when escaped is
|
||||
<code>lxc\x2ddemo</code>. So the complete scope name is <code>machine-lxc\x2ddemo.scope</code>.
|
||||
The scope names map directly to the cgroup directory names.
|
||||
</p>
|
||||
|
||||
@@ -115,19 +112,19 @@ $ROOT
|
||||
|
|
||||
+- machine.slice
|
||||
|
|
||||
+- machine-qemu\x2d1\x2dvm1.scope
|
||||
+- machine-qemu\x2dvm1.scope
|
||||
| |
|
||||
| +- emulator
|
||||
| +- vcpu0
|
||||
| +- vcpu1
|
||||
|
|
||||
+- machine-qemu\x2d2\x2dvm2.scope
|
||||
+- machine-qemu\x2dvm2.scope
|
||||
| |
|
||||
| +- emulator
|
||||
| +- vcpu0
|
||||
| +- vcpu1
|
||||
|
|
||||
+- machine-qemu\x2d3\x2dvm3.scope
|
||||
+- machine-qemu\x2dvm3.scope
|
||||
| |
|
||||
| +- emulator
|
||||
| +- vcpu0
|
||||
@@ -137,15 +134,15 @@ $ROOT
|
||||
| |
|
||||
| +- machine-engineering-testing.slice
|
||||
| | |
|
||||
| | +- machine-lxc\x2d11111\x2dcontainer1.scope
|
||||
| | +- machine-lxc\x2dcontainer1.scope
|
||||
| |
|
||||
| +- machine-engineering-production.slice
|
||||
| |
|
||||
| +- machine-lxc\x2d22222\x2dcontainer2.scope
|
||||
| +- machine-lxc\x2dcontainer2.scope
|
||||
|
|
||||
+- machine-marketing.slice
|
||||
|
|
||||
+- machine-lxc\x2d33333\x2dcontainer3.scope
|
||||
+- machine-lxc\x2dcontainer3.scope
|
||||
</pre>
|
||||
|
||||
<h3><a id="currentLayoutGeneric">Non-systemd cgroups layout</a></h3>
|
||||
@@ -155,33 +152,40 @@ $ROOT
|
||||
named <code>$VMNAME.libvirt-{qemu,lxc}</code>. Each consumer is associated
|
||||
with exactly one partition, which also have a corresponding cgroup usually
|
||||
named <code>$PARTNAME.partition</code>. The exceptions to this naming rule
|
||||
is the top level default partition for virtual machines and containers
|
||||
<code>/machine</code>.
|
||||
are the three top level default partitions, named <code>/system</code> (for
|
||||
system services), <code>/user</code> (for user login sessions) and
|
||||
<code>/machine</code> (for virtual machines and containers). By default
|
||||
every consumer will of course be associated with the <code>/machine</code>
|
||||
partition.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Given this, a possible non-systemd cgroups layout involving 3 qemu guests,
|
||||
Given this, a possible systemd cgroups layout involving 3 qemu guests,
|
||||
3 lxc containers and 2 custom child slices, would be:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ROOT
|
||||
|
|
||||
+- system
|
||||
| |
|
||||
| +- libvirtd.service
|
||||
|
|
||||
+- machine
|
||||
|
|
||||
+- qemu-1-vm1.libvirt-qemu
|
||||
+- vm1.libvirt-qemu
|
||||
| |
|
||||
| +- emulator
|
||||
| +- vcpu0
|
||||
| +- vcpu1
|
||||
|
|
||||
+- qeme-2-vm2.libvirt-qemu
|
||||
+- vm2.libvirt-qemu
|
||||
| |
|
||||
| +- emulator
|
||||
| +- vcpu0
|
||||
| +- vcpu1
|
||||
|
|
||||
+- qemu-3-vm3.libvirt-qemu
|
||||
+- vm3.libvirt-qemu
|
||||
| |
|
||||
| +- emulator
|
||||
| +- vcpu0
|
||||
@@ -191,15 +195,15 @@ $ROOT
|
||||
| |
|
||||
| +- testing.partition
|
||||
| | |
|
||||
| | +- lxc-11111-container1.libvirt-lxc
|
||||
| | +- container1.libvirt-lxc
|
||||
| |
|
||||
| +- production.partition
|
||||
| |
|
||||
| +- lxc-22222-container2.libvirt-lxc
|
||||
| +- container2.libvirt-lxc
|
||||
|
|
||||
+- marketing.partition
|
||||
|
|
||||
+- lxc-33333-container3.libvirt-lxc
|
||||
+- container3.libvirt-lxc
|
||||
</pre>
|
||||
|
||||
<h2><a id="customPartiton">Using custom partitions</a></h2>
|
||||
|
@@ -9,15 +9,13 @@
|
||||
<h2><a id="compiling">Compiling a release tarball</a></h2>
|
||||
|
||||
<p>
|
||||
libvirt uses the standard configure/make/install steps and mandates
|
||||
that the build directory is different that the source directory:
|
||||
libvirt uses the standard configure/make/install steps:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ xz -c libvirt-x.x.x.tar.xz | tar xvf -
|
||||
$ cd libvirt-x.x.x
|
||||
$ mkdir build && cd build
|
||||
$ ../configure</pre>
|
||||
$ ./configure</pre>
|
||||
|
||||
<p>
|
||||
The <i>configure</i> script can be given options to change its default
|
||||
@@ -30,7 +28,7 @@ $ ../configure</pre>
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ ../configure <i>--help</i></pre>
|
||||
$ ./configure <i>--help</i></pre>
|
||||
|
||||
<p>
|
||||
When you have determined which options you want to use (if any),
|
||||
@@ -51,7 +49,7 @@ $ ../configure <i>--help</i></pre>
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
$ ../configure <i>[possible options]</i>
|
||||
$ ./configure <i>[possible options]</i>
|
||||
$ make
|
||||
$ <b>sudo</b> <i>make install</i></pre>
|
||||
|
||||
@@ -127,7 +125,7 @@ $ make
|
||||
<pre>
|
||||
$ su -
|
||||
# service libvirtd stop (or systemctl stop libvirtd.service)
|
||||
# /home/to/your/checkout/src/libvirtd
|
||||
# /home/to/your/checkout/daemon/libvirtd
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
|
@@ -6,14 +6,14 @@
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<h2><a id="description">Description</a></h2>
|
||||
<h2><a name="description">Description</a></h2>
|
||||
|
||||
<p>
|
||||
libvirt-dbus wraps libvirt API to provide a high-level object-oriented
|
||||
API better suited for dbus-based applications.
|
||||
</p>
|
||||
|
||||
<h2><a id="git">GIT source repository</a></h2>
|
||||
<h2><a name="git">GIT source repository</a></h2>
|
||||
<p>
|
||||
The D-Bus bindings source code is maintained in a
|
||||
<a href="https://git-scm.com/">git</a> repository available on
|
||||
@@ -32,7 +32,7 @@ git clone https://libvirt.org/git/libvirt-dbus.git
|
||||
<a href="https://libvirt.org/git/?p=libvirt-dbus.git">https://libvirt.org/git/?p=libvirt-dbus.git</a>
|
||||
</pre>
|
||||
|
||||
<h2><a id="usage">Usage</a></h2>
|
||||
<h2><a name="usage">Usage</a></h2>
|
||||
|
||||
<p>
|
||||
libvirt-dbus exports libvirt API using D-Bus objects with methods and
|
||||
|
132
docs/devhelp/devhelp.xsl
Normal file
132
docs/devhelp/devhelp.xsl
Normal file
@@ -0,0 +1,132 @@
|
||||
<?xml version="1.0"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
||||
xmlns="http://www.devhelp.net/book"
|
||||
xmlns:exsl="http://exslt.org/common"
|
||||
xmlns:str="http://exslt.org/strings"
|
||||
extension-element-prefixes="exsl str"
|
||||
exclude-result-prefixes="exsl str">
|
||||
<!-- The stylesheet for the html pages -->
|
||||
<xsl:import href="html.xsl"/>
|
||||
|
||||
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
|
||||
|
||||
<!-- Build keys for all symbols -->
|
||||
<xsl:key name="symbols" match="/api/symbols/*" use="@name"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:document xmlns="http://www.devhelp.net/book" href="libvirt.devhelp"
|
||||
method="xml" encoding="UTF-8" indent="yes">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:document>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="/api">
|
||||
<book title="{@name} Reference Manual" link="index.html" author="" name="{@name}">
|
||||
<xsl:apply-templates select="files"/>
|
||||
<xsl:apply-templates select="symbols"/>
|
||||
</book>
|
||||
<xsl:call-template name="generate_index"/>
|
||||
<xsl:call-template name="generate_general"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="/api/files">
|
||||
<chapters>
|
||||
<sub name="API" link="general.html">
|
||||
<xsl:apply-templates select="file"/>
|
||||
</sub>
|
||||
</chapters>
|
||||
</xsl:template>
|
||||
<xsl:template match="/api/files/file">
|
||||
<xsl:variable name="module" select="@name"/>
|
||||
<xsl:variable name="prev" select="string(preceding-sibling::file[position()=1]/@name)"/>
|
||||
<xsl:variable name="next" select="string(following-sibling::file[position()=1]/@name)"/>
|
||||
<sub name="{@name}" link="libvirt-{@name}.html"/>
|
||||
<xsl:document xmlns="" href="libvirt-{@name}.html" method="xml" indent="yes" encoding="UTF-8">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title><xsl:value-of select="concat(@name, ': ', summary)"/></title>
|
||||
<meta name="generator" content="Libvirt devhelp stylesheet"/>
|
||||
<link rel="start" href="index.html" title="libvirt Reference Manual"/>
|
||||
<link rel="up" href="general.html" title="API"/>
|
||||
<link rel="stylesheet" href="style.css" type="text/css"/>
|
||||
<link rel="chapter" href="general.html" title="API"/>
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
|
||||
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
|
||||
<tr valign="middle">
|
||||
<xsl:if test="$prev != ''">
|
||||
<td><a accesskey="p" href="libvirt-{$prev}.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"/></a></td>
|
||||
</xsl:if>
|
||||
<td><a accesskey="u" href="general.html"><img src="up.png" width="24" height="24" border="0" alt="Up"/></a></td>
|
||||
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"/></a></td>
|
||||
<xsl:if test="$next != ''">
|
||||
<td><a accesskey="n" href="libvirt-{$next}.html"><img src="right.png" width="24" height="24" border="0" alt="Next"/></a></td>
|
||||
</xsl:if>
|
||||
<th width="100%" align="center">libvirt Reference Manual</th>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><span class="refentrytitle"><xsl:value-of select="@name"/></span></h2>
|
||||
<p><xsl:value-of select="@name"/> - <xsl:value-of select="summary"/></p>
|
||||
<p><xsl:value-of select="description"/></p>
|
||||
<xsl:if test="deprecated">
|
||||
<p> WARNING: this module is deprecated !</p>
|
||||
</xsl:if>
|
||||
<p>Author(s): <xsl:value-of select="author"/></p>
|
||||
<div class="refsynopsisdiv">
|
||||
<h2>Synopsis</h2>
|
||||
<pre class="synopsis">
|
||||
<xsl:apply-templates mode="synopsis" select="exports"/>
|
||||
</pre>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<h2>Description</h2>
|
||||
</div>
|
||||
<div class="refsect1" lang="en">
|
||||
<h2>Details</h2>
|
||||
<div class="refsect2" lang="en">
|
||||
<xsl:apply-templates mode="details" select="/api/symbols/macro[@file=$module]"/>
|
||||
<xsl:apply-templates mode="details" select="/api/symbols/typedef[@file=$module] | /api/symbols/struct[@file=$module]"/>
|
||||
<xsl:apply-templates mode="details" select="/api/symbols/functype[@file=$module]"/>
|
||||
<xsl:apply-templates mode="details" select="/api/symbols/variable[@file=$module]"/>
|
||||
<xsl:apply-templates mode="details" select="/api/symbols/function[@file=$module]"/>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:document>
|
||||
</xsl:template>
|
||||
<xsl:template match="/api/symbols">
|
||||
<functions>
|
||||
<xsl:apply-templates select="macro"/>
|
||||
<xsl:apply-templates select="enum"/>
|
||||
<xsl:apply-templates select="typedef"/>
|
||||
<xsl:apply-templates select="struct"/>
|
||||
<xsl:apply-templates select="functype"/>
|
||||
<xsl:apply-templates select="variable"/>
|
||||
<xsl:apply-templates select="function"/>
|
||||
</functions>
|
||||
</xsl:template>
|
||||
<xsl:template match="/api/symbols/functype">
|
||||
<function name="{@name}" link="libvirt-{@file}.html#{@name}"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="/api/symbols/function">
|
||||
<function name="{@name} ()" link="libvirt-{@file}.html#{@name}"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="/api/symbols/typedef">
|
||||
<function name="{@name}" link="libvirt-{@file}.html#{@name}"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="/api/symbols/enum">
|
||||
<function name="{@name}" link="libvirt-{@file}.html#{@name}"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="/api/symbols/struct">
|
||||
<function name="{@name}" link="libvirt-{@file}.html#{@name}"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="/api/symbols/macro">
|
||||
<function name="{@name}" link="libvirt-{@file}.html#{@name}"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="/api/symbols/variable">
|
||||
<function name="{@name}" link="libvirt-{@file}.html#{@name}"/>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
BIN
docs/devhelp/home.png
Normal file
BIN
docs/devhelp/home.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 654 B |
577
docs/devhelp/html.xsl
Normal file
577
docs/devhelp/html.xsl
Normal file
@@ -0,0 +1,577 @@
|
||||
<?xml version="1.0"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
||||
xmlns:exsl="http://exslt.org/common"
|
||||
xmlns:str="http://exslt.org/strings"
|
||||
extension-element-prefixes="exsl str"
|
||||
exclude-result-prefixes="exsl str">
|
||||
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
|
||||
|
||||
<!-- This is convoluted but needed to force the current document to
|
||||
be the API one and not the result tree from the tokenize() result,
|
||||
because the keys are only defined on the main document -->
|
||||
<xsl:template mode="dumptoken" match='*'>
|
||||
<xsl:param name="token"/>
|
||||
<xsl:variable name="ref" select="key('symbols', $token)"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$ref">
|
||||
<a href="libvirt-{$ref/@file}.html#{$ref/@name}"><xsl:value-of select="$token"/></a>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$token"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- dumps a string, making cross-reference links -->
|
||||
<xsl:template name="dumptext">
|
||||
<xsl:param name="text"/>
|
||||
<xsl:variable name="ctxt" select='.'/>
|
||||
<!-- <xsl:value-of select="$text"/> -->
|
||||
<xsl:for-each select="str:tokenize($text, ' 	')">
|
||||
<xsl:apply-templates select="$ctxt" mode='dumptoken'>
|
||||
<xsl:with-param name="token" select="string(.)"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
|
||||
The following builds the Synopsis section
|
||||
|
||||
-->
|
||||
<xsl:template mode="synopsis" match="function">
|
||||
<xsl:variable name="name" select="string(@name)"/>
|
||||
<xsl:variable name="nlen" select="string-length($name)"/>
|
||||
<xsl:variable name="tlen" select="string-length(return/@type)"/>
|
||||
<xsl:variable name="blen" select="(($nlen + 8) - (($nlen + 8) mod 8)) + (($tlen + 8) - (($tlen + 8) mod 8))"/>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="return/@type"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text>	</xsl:text>
|
||||
<a href="#{@name}"><xsl:value-of select="@name"/></a>
|
||||
<xsl:if test="$blen - 40 < -8">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$blen - 40 < 0">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>	(</xsl:text>
|
||||
<xsl:if test="not(arg)">
|
||||
<xsl:text>void</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:for-each select="arg">
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="@type"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text>, </xsl:text><br/>
|
||||
<xsl:if test="$blen - 40 > 8">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$blen - 40 > 0">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>					 </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<xsl:text>);</xsl:text>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="synopsis" match="functype">
|
||||
<xsl:variable name="name" select="string(@name)"/>
|
||||
<xsl:variable name="nlen" select="string-length($name)"/>
|
||||
<xsl:variable name="tlen" select="string-length(return/@type)"/>
|
||||
<xsl:variable name="blen" select="(($nlen + 8) - (($nlen + 8) mod 8)) + (($tlen + 8) - (($tlen + 8) mod 8))"/>
|
||||
<xsl:text>typedef </xsl:text>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="return/@type"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
<a href="#{@name}"><xsl:value-of select="@name"/></a>
|
||||
<xsl:if test="$blen - 40 < -8">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$blen - 40 < 0">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>	(</xsl:text>
|
||||
<xsl:if test="not(arg)">
|
||||
<xsl:text>void</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:for-each select="arg">
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="@type"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text>, </xsl:text><br/>
|
||||
<xsl:if test="$blen - 40 > 8">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$blen - 40 > 0">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>					 </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<xsl:text>);</xsl:text>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="synopsis" match="exports[@type='function']">
|
||||
<xsl:variable name="def" select="key('symbols',@symbol)"/>
|
||||
<xsl:apply-templates mode="synopsis" select="$def"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="synopsis" match="exports[@type='typedef']">
|
||||
<xsl:text>typedef </xsl:text>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="string(key('symbols',@symbol)/@type)"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
<a href="#{@symbol}"><xsl:value-of select="@symbol"/></a>
|
||||
<xsl:text>;
|
||||
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="synopsis" match="exports[@type='macro']">
|
||||
<xsl:variable name="def" select="key('symbols',@symbol)"/>
|
||||
<xsl:text>#define </xsl:text>
|
||||
<a href="#{@symbol}"><xsl:value-of select="@symbol"/></a>
|
||||
<xsl:if test="$def/arg">
|
||||
<xsl:text>(</xsl:text>
|
||||
<xsl:for-each select="$def/arg">
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<xsl:text>)</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>;
|
||||
</xsl:text>
|
||||
</xsl:template>
|
||||
<xsl:template mode="synopsis" match="exports[@type='enum']">
|
||||
</xsl:template>
|
||||
<xsl:template mode="synopsis" match="exports[@type='struct']">
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
|
||||
The following builds the Details section
|
||||
|
||||
-->
|
||||
<xsl:template mode="details" match="struct">
|
||||
<xsl:variable name="name" select="string(@name)"/>
|
||||
<div class="refsect2" lang="en">
|
||||
<h3><a name="{$name}">Structure </a><xsl:value-of select="$name"/></h3>
|
||||
<pre class="programlisting">
|
||||
<xsl:value-of select="@type"/><xsl:text> {
|
||||
</xsl:text>
|
||||
<xsl:if test="not(field)">
|
||||
<xsl:text>The content of this structure is not made public by the API.
|
||||
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:for-each select="field">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="@type"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text>	</xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:if test="@info != ''">
|
||||
<xsl:text>	: </xsl:text>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="substring(@info, 1, 70)"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:for-each>
|
||||
<xsl:text>} </xsl:text>
|
||||
<xsl:value-of select="$name"/>
|
||||
<xsl:text>;
|
||||
</xsl:text>
|
||||
</pre>
|
||||
<p>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="info"/>
|
||||
</xsl:call-template>
|
||||
</p><xsl:text>
|
||||
</xsl:text>
|
||||
</div><hr/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="details" match="typedef[@type != 'enum']">
|
||||
<xsl:variable name="name" select="string(@name)"/>
|
||||
<div class="refsect2" lang="en">
|
||||
<h3><a name="{$name}">Typedef </a><xsl:value-of select="$name"/></h3>
|
||||
<pre class="programlisting">
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="string(@type)"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$name"/>
|
||||
<xsl:text>;
|
||||
</xsl:text>
|
||||
</pre>
|
||||
<p>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="info"/>
|
||||
</xsl:call-template>
|
||||
</p><xsl:text>
|
||||
</xsl:text>
|
||||
</div><hr/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="details" match="variable">
|
||||
<xsl:variable name="name" select="string(@name)"/>
|
||||
<div class="refsect2" lang="en">
|
||||
<h3><a name="{$name}">Variable </a><xsl:value-of select="$name"/></h3>
|
||||
<pre class="programlisting">
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="string(@type)"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$name"/>
|
||||
<xsl:text>;
|
||||
</xsl:text>
|
||||
</pre>
|
||||
<p>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="info"/>
|
||||
</xsl:call-template>
|
||||
</p><xsl:text>
|
||||
</xsl:text>
|
||||
</div><hr/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="details" match="typedef[@type = 'enum']">
|
||||
<xsl:variable name="name" select="string(@name)"/>
|
||||
<div class="refsect2" lang="en">
|
||||
<h3><a name="{$name}">Enum </a><xsl:value-of select="$name"/></h3>
|
||||
<pre class="programlisting">
|
||||
<xsl:text>enum </xsl:text>
|
||||
<a href="#{$name}"><xsl:value-of select="$name"/></a>
|
||||
<xsl:text> {
|
||||
</xsl:text>
|
||||
<xsl:for-each select="/api/symbols/enum[@type=$name]">
|
||||
<xsl:sort select="@value" data-type="number" order="ascending"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<a name="{@name}"><xsl:value-of select="@name"/></a>
|
||||
<xsl:if test="@value">
|
||||
<xsl:text> = </xsl:text>
|
||||
<xsl:value-of select="@value"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="@info">
|
||||
<xsl:text> /* </xsl:text>
|
||||
<xsl:value-of select="@info"/>
|
||||
<xsl:text> */</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</xsl:for-each>
|
||||
<xsl:text>};
|
||||
</xsl:text>
|
||||
</pre>
|
||||
<p>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="info"/>
|
||||
</xsl:call-template>
|
||||
</p><xsl:text>
|
||||
</xsl:text>
|
||||
</div><hr/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="details" match="macro">
|
||||
<xsl:variable name="name" select="string(@name)"/>
|
||||
<div class="refsect2" lang="en">
|
||||
<h3><a name="{$name}">Macro </a><xsl:value-of select="$name"/></h3>
|
||||
<pre class="programlisting">
|
||||
<xsl:text>#define </xsl:text>
|
||||
<a href="#{$name}"><xsl:value-of select="$name"/></a>
|
||||
<xsl:if test="arg">
|
||||
<xsl:text>(</xsl:text>
|
||||
<xsl:for-each select="arg">
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<xsl:text>)</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>;
|
||||
</xsl:text>
|
||||
</pre>
|
||||
<p>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="info"/>
|
||||
</xsl:call-template>
|
||||
</p>
|
||||
<xsl:if test="arg">
|
||||
<div class="variablelist"><table border="0"><col align="left"/><tbody>
|
||||
<xsl:for-each select="arg">
|
||||
<tr>
|
||||
<td><span class="term"><i><tt><xsl:value-of select="@name"/></tt></i>:</span></td>
|
||||
<td>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="@info"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</tbody></table></div>
|
||||
</xsl:if>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</div><hr/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="details" match="function">
|
||||
<xsl:variable name="name" select="string(@name)"/>
|
||||
<xsl:variable name="nlen" select="string-length($name)"/>
|
||||
<xsl:variable name="tlen" select="string-length(return/@type)"/>
|
||||
<xsl:variable name="blen" select="(($nlen + 8) - (($nlen + 8) mod 8)) + (($tlen + 8) - (($tlen + 8) mod 8))"/>
|
||||
<div class="refsect2" lang="en">
|
||||
<h3><a name="{$name}"></a><xsl:value-of select="$name"/> ()</h3>
|
||||
<pre class="programlisting">
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="return/@type"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text>	</xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:if test="$blen - 40 < -8">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$blen - 40 < 0">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>	(</xsl:text>
|
||||
<xsl:if test="not(arg)">
|
||||
<xsl:text>void</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:for-each select="arg">
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="@type"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text>, </xsl:text><br/>
|
||||
<xsl:if test="$blen - 40 > 8">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$blen - 40 > 0">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>					 </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<xsl:text>)</xsl:text><br/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</pre>
|
||||
<p>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="info"/>
|
||||
</xsl:call-template>
|
||||
</p><xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:if test="arg | return/@info">
|
||||
<div class="variablelist"><table border="0"><col align="left"/><tbody>
|
||||
<xsl:for-each select="arg">
|
||||
<tr>
|
||||
<td><span class="term"><i><tt><xsl:value-of select="@name"/></tt></i>:</span></td>
|
||||
<td>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="@info"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
<xsl:if test="return/@info">
|
||||
<tr>
|
||||
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
|
||||
<td>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="return/@info"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:if>
|
||||
</tbody></table></div>
|
||||
</xsl:if>
|
||||
</div><hr/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="details" match="functype">
|
||||
<xsl:variable name="name" select="string(@name)"/>
|
||||
<xsl:variable name="nlen" select="string-length($name)"/>
|
||||
<xsl:variable name="tlen" select="string-length(return/@type)"/>
|
||||
<xsl:variable name="blen" select="(($nlen + 8) - (($nlen + 8) mod 8)) + (($tlen + 8) - (($tlen + 8) mod 8))"/>
|
||||
<div class="refsect2" lang="en">
|
||||
<h3><a name="{$name}"></a>Function type <xsl:value-of select="$name"/> </h3>
|
||||
<pre class="programlisting">
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="return/@type"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text>	</xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:if test="$blen - 40 < -8">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$blen - 40 < 0">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>	(</xsl:text>
|
||||
<xsl:if test="not(arg)">
|
||||
<xsl:text>void</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:for-each select="arg">
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="@type"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:if test="position() != last()">
|
||||
<xsl:text>, </xsl:text><br/>
|
||||
<xsl:if test="$blen - 40 > 8">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="$blen - 40 > 0">
|
||||
<xsl:text>	</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>					 </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
<xsl:text>)</xsl:text><br/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
</pre>
|
||||
<p>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="info"/>
|
||||
</xsl:call-template>
|
||||
</p><xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:if test="arg | return/@info">
|
||||
<div class="variablelist"><table border="0"><col align="left"/><tbody>
|
||||
<xsl:for-each select="arg">
|
||||
<tr>
|
||||
<td><span class="term"><i><tt><xsl:value-of select="@name"/></tt></i>:</span></td>
|
||||
<td>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="@info"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
<xsl:if test="return/@info">
|
||||
<tr>
|
||||
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
|
||||
<td>
|
||||
<xsl:call-template name="dumptext">
|
||||
<xsl:with-param name="text" select="return/@info"/>
|
||||
</xsl:call-template>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:if>
|
||||
</tbody></table></div>
|
||||
</xsl:if>
|
||||
</div><hr/>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
|
||||
The following builds the general.html page
|
||||
|
||||
-->
|
||||
<xsl:template name="generate_general">
|
||||
<xsl:variable name="next" select="string(/api/files/file[position()=1]/@name)"/>
|
||||
<xsl:document xmlns="" href="general.html" method="xml" indent="yes" encoding="UTF-8">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title><xsl:value-of select="concat(@name, ': ', summary)"/></title>
|
||||
<meta name="generator" content="Libvirt devhelp stylesheet"/>
|
||||
<link rel="start" href="index.html" title="libvirt Reference Manual"/>
|
||||
<link rel="up" href="index.html" title="libvirt Reference Manual"/>
|
||||
<link rel="stylesheet" href="style.css" type="text/css"/>
|
||||
<link rel="chapter" href="index.html" title="libvirt Reference Manual"/>
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
|
||||
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
|
||||
<tr valign="middle">
|
||||
<td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up"/></a></td>
|
||||
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"/></a></td>
|
||||
<xsl:if test="$next != ''">
|
||||
<td><a accesskey="n" href="libvirt-{$next}.html"><img src="right.png" width="24" height="24" border="0" alt="Next"/></a></td>
|
||||
</xsl:if>
|
||||
<th width="100%" align="center">libvirt Reference Manual</th>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><span class="refentrytitle">libvirt API Modules</span></h2>
|
||||
<p>
|
||||
<xsl:for-each select="/api/files/file">
|
||||
<a href="libvirt-{@name}.html"><xsl:value-of select="@name"/></a> - <xsl:value-of select="summary"/><br/>
|
||||
</xsl:for-each>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:document>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
|
||||
The following builds the index.html page
|
||||
|
||||
-->
|
||||
<xsl:template name="generate_index">
|
||||
<xsl:document xmlns="" href="index.html" method="xml" indent="yes" encoding="UTF-8">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>libvirt Reference Manual</title>
|
||||
<meta name="generator" content="Libvirt devhelp stylesheet"/>
|
||||
<link rel="stylesheet" href="style.css" type="text/css"/>
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
|
||||
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
|
||||
<tr valign="middle">
|
||||
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"/></a></td>
|
||||
<td><a accesskey="n" href="general.html"><img src="right.png" width="24" height="24" border="0" alt="Next"/></a></td>
|
||||
<th width="100%" align="center">libvirt Reference Manual</th>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><span class="refentrytitle">libvirt Reference Manual</span></h2>
|
||||
<p>Libvir is a C toolkit to interact with the virtualization capabilities of
|
||||
recent versions of Linux (and other OSes). It is free software available
|
||||
under the <a href="http://www.opensource.org/licenses/lgpl-license.html">GNU
|
||||
Lesser General Public License</a>. Virtualization of the Linux Operating
|
||||
System means the ability to run multiple instances of Operating Systems
|
||||
concurrently on a single hardware system where the basic resources are driven
|
||||
by a Linux instance. The library aim at providing long term stable C API
|
||||
initially for the <a href="http://www.cl.cam.ac.uk/Research/SRG/netos/xen/index.html">Xen
|
||||
paravirtualization</a> but should be able to integrate other virtualization
|
||||
mechanisms if needed.</p>
|
||||
<p> If you get lost searching for some specific API use, try
|
||||
<a href="https://libvirt.org/search.php">the online search
|
||||
engine</a> hosted on <a href="https://libvirt.org/">libvirt.org</a>
|
||||
it indexes the project page, the APIs as well as the mailing-list archives. </p>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:document>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
BIN
docs/devhelp/left.png
Normal file
BIN
docs/devhelp/left.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 459 B |
BIN
docs/devhelp/right.png
Normal file
BIN
docs/devhelp/right.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 472 B |
66
docs/devhelp/style.css
Normal file
66
docs/devhelp/style.css
Normal file
@@ -0,0 +1,66 @@
|
||||
.synopsis, .classsynopsis
|
||||
{
|
||||
background: #eeeeee;
|
||||
border: solid 1px #aaaaaa;
|
||||
padding: 0.5em;
|
||||
}
|
||||
.programlisting
|
||||
{
|
||||
background: #eeeeff;
|
||||
border: solid 1px #aaaaff;
|
||||
padding: 0.5em;
|
||||
}
|
||||
.variablelist
|
||||
{
|
||||
padding: 4px;
|
||||
margin-left: 3em;
|
||||
}
|
||||
.variablelist td:first-child
|
||||
{
|
||||
vertical-align: top;
|
||||
}
|
||||
table.navigation
|
||||
{
|
||||
background: #ffeeee;
|
||||
border: solid 1px #ffaaaa;
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
.navigation a
|
||||
{
|
||||
color: #770000;
|
||||
}
|
||||
.navigation a:visited
|
||||
{
|
||||
color: #550000;
|
||||
}
|
||||
.navigation .title
|
||||
{
|
||||
font-size: 200%;
|
||||
}
|
||||
div.refnamediv
|
||||
{
|
||||
margin-top: 2em;
|
||||
}
|
||||
div.gallery-float
|
||||
{
|
||||
float: left;
|
||||
padding: 10px;
|
||||
}
|
||||
div.gallery-float img
|
||||
{
|
||||
border-style: none;
|
||||
}
|
||||
div.gallery-spacer
|
||||
{
|
||||
clear: both;
|
||||
}
|
||||
a
|
||||
{
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover
|
||||
{
|
||||
text-decoration: underline;
|
||||
color: #FF0000;
|
||||
}
|
BIN
docs/devhelp/up.png
Normal file
BIN
docs/devhelp/up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 406 B |
@@ -9,9 +9,6 @@
|
||||
<dt><a href="apps.html">Applications</a></dt>
|
||||
<dd>Applications known to use libvirt</dd>
|
||||
|
||||
<dt><a href="manpages/index.html">Manual pages</a></dt>
|
||||
<dd>Manual pages for libvirt tools / daemons</dd>
|
||||
|
||||
<dt><a href="windows.html">Windows</a></dt>
|
||||
<dd>Downloads for Windows</dd>
|
||||
|
||||
@@ -21,9 +18,6 @@
|
||||
<dt><a href="remote.html">Remote access</a></dt>
|
||||
<dd>Enable remote access over TCP</dd>
|
||||
|
||||
<dt><a href="tlscerts.html">TLS certs</a></dt>
|
||||
<dd>Generate and deploy x509 certificates for TLS</dd>
|
||||
|
||||
<dt><a href="auth.html">Authentication</a></dt>
|
||||
<dd>Configure authentication for the libvirt daemon</dd>
|
||||
|
||||
@@ -54,27 +48,11 @@
|
||||
<div class="panel">
|
||||
<h2>Application development</h2>
|
||||
<dl>
|
||||
<dt><a href="html/index.html">API reference</a></dt>
|
||||
<dd>Reference manual for the C public API, split in
|
||||
<a href="html/libvirt-libvirt-common.html">common</a>,
|
||||
<a href="html/libvirt-libvirt-domain.html">domain</a>,
|
||||
<a href="html/libvirt-libvirt-domain-checkpoint.html">domain checkpoint</a>,
|
||||
<a href="html/libvirt-libvirt-domain-snapshot.html">domain snapshot</a>,
|
||||
<a href="html/libvirt-virterror.html">error</a>,
|
||||
<a href="html/libvirt-libvirt-event.html">event</a>,
|
||||
<a href="html/libvirt-libvirt-host.html">host</a>,
|
||||
<a href="html/libvirt-libvirt-interface.html">interface</a>,
|
||||
<a href="html/libvirt-libvirt-network.html">network</a>,
|
||||
<a href="html/libvirt-libvirt-nodedev.html">node device</a>,
|
||||
<a href="html/libvirt-libvirt-nwfilter.html">network filter</a>,
|
||||
<a href="html/libvirt-libvirt-secret.html">secret</a>,
|
||||
<a href="html/libvirt-libvirt-storage.html">storage</a>,
|
||||
<a href="html/libvirt-libvirt-stream.html">stream</a>
|
||||
and
|
||||
<a href="html/index-admin.html">admin</a>,
|
||||
<a href="html/index-qemu.html">QEMU</a>,
|
||||
<a href="html/index-lxc.html">LXC</a> libs
|
||||
</dd>
|
||||
<dt><a href="devguide.html">Development Guide</a></dt>
|
||||
<dd>A guide and reference for developing with libvirt</dd>
|
||||
|
||||
<dt><a href="virshcmdref.html">Virsh Commands</a></dt>
|
||||
<dd>Command reference for virsh</dd>
|
||||
|
||||
<dt><a href="bindings.html">Language bindings and API modules</a></dt>
|
||||
<dd>Bindings of the libvirt API for
|
||||
@@ -94,25 +72,43 @@
|
||||
<dd>Description of the XML schemas for
|
||||
<a href="formatdomain.html">domains</a>,
|
||||
<a href="formatnetwork.html">networks</a>,
|
||||
<a href="formatnetworkport.html">network ports</a>,
|
||||
<a href="formatnwfilter.html">network filtering</a>,
|
||||
<a href="formatstorage.html">storage</a>,
|
||||
<a href="formatstorageencryption.html">storage encryption</a>,
|
||||
<a href="formatcaps.html">capabilities</a>,
|
||||
<a href="formatdomaincaps.html">domain capabilities</a>,
|
||||
<a href="formatstoragecaps.html">storage pool capabilities</a>,
|
||||
<a href="formatnode.html">node devices</a>,
|
||||
<a href="formatsecret.html">secrets</a>,
|
||||
<a href="formatsnapshot.html">snapshots</a>,
|
||||
<a href="formatcheckpoint.html">checkpoints</a>,
|
||||
<a href="formatbackup.html">backup jobs</a></dd>
|
||||
<a href="formatsnapshot.html">snapshots</a></dd>
|
||||
|
||||
<dt><a href="uri.html">URI format</a></dt>
|
||||
<dd>The URI formats used for connecting to libvirt</dd>
|
||||
|
||||
<dt><a href="locking.html">Disk locking</a></dt>
|
||||
<dd>Ensuring exclusive guest access to disks with
|
||||
<a href="locking-lockd.html">virtlockd</a> or
|
||||
<a href="locking-sanlock.html">Sanlock</a></dd>
|
||||
|
||||
<dt><a href="cgroups.html">CGroups</a></dt>
|
||||
<dd>Control groups integration</dd>
|
||||
|
||||
<dt><a href="html/index.html">API reference</a></dt>
|
||||
<dd>Reference manual for the C public API, split in
|
||||
<a href="html/libvirt-libvirt-common.html">common</a>,
|
||||
<a href="html/libvirt-libvirt-domain.html">domain</a>,
|
||||
<a href="html/libvirt-libvirt-domain-snapshot.html">domain snapshot</a>,
|
||||
<a href="html/libvirt-virterror.html">error</a>,
|
||||
<a href="html/libvirt-libvirt-event.html">event</a>,
|
||||
<a href="html/libvirt-libvirt-host.html">host</a>,
|
||||
<a href="html/libvirt-libvirt-interface.html">interface</a>,
|
||||
<a href="html/libvirt-libvirt-network.html">network</a>,
|
||||
<a href="html/libvirt-libvirt-nodedev.html">node device</a>,
|
||||
<a href="html/libvirt-libvirt-nwfilter.html">network filter</a>,
|
||||
<a href="html/libvirt-libvirt-secret.html">secret</a>,
|
||||
<a href="html/libvirt-libvirt-storage.html">storage</a>,
|
||||
<a href="html/libvirt-libvirt-stream.html">stream</a>
|
||||
</dd>
|
||||
|
||||
<dt><a href="drivers.html">Drivers</a></dt>
|
||||
<dd>Hypervisor specific driver information</dd>
|
||||
|
||||
@@ -122,8 +118,8 @@
|
||||
<dt><a href="hvsupport.html">Driver support</a></dt>
|
||||
<dd>matrix of API support per hypervisor per release</dd>
|
||||
|
||||
<dt><a href="kbase.html">Knowledge Base</a></dt>
|
||||
<dd>Task oriented guides to key features</dd>
|
||||
<dt><a href="secureusage.html">Secure usage</a></dt>
|
||||
<dd>Secure usage of the libvirt APIs</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -133,12 +129,6 @@
|
||||
<dt><a href="hacking.html">Contributor guidelines</a></dt>
|
||||
<dd>General hacking guidelines for contributors</dd>
|
||||
|
||||
<dt><a href="styleguide.html">Docs style guide</a></dt>
|
||||
<dd>Style guidelines for reStructuredText docs</dd>
|
||||
|
||||
<dt><a href="strategy.html">Project strategy</a></dt>
|
||||
<dd>Sets a vision for future direction & technical choices</dd>
|
||||
|
||||
<dt><a href="bugs.html">Bug reports</a></dt>
|
||||
<dd>How and where to report bugs and request features</dd>
|
||||
|
||||
@@ -166,6 +156,9 @@
|
||||
<dt><a href="internals/locking.html">Lock managers</a></dt>
|
||||
<dd>Use lock managers to protect disk content</dd>
|
||||
|
||||
<dt><a href="internals/oomtesting.html">Out of memory testing</a></dt>
|
||||
<dd>Simulating OOM conditions in the test suite</dd>
|
||||
|
||||
<dt><a href="testsuites.html">Functional testing</a></dt>
|
||||
<dd>Testing libvirt with <a href="testtck.html">TCK test suite</a> and
|
||||
<a href="testapi.html">Libvirt-test-API</a></dd>
|
||||
|
@@ -27,7 +27,8 @@
|
||||
<tr>
|
||||
<td>libvirt</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt.git;a=summary">libvirt</a>
|
||||
@@ -47,7 +48,8 @@
|
||||
<tr>
|
||||
<td>C#</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/csharp/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/csharp/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/csharp/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-csharp.git;a=summary">libvirt</a>
|
||||
@@ -61,7 +63,8 @@
|
||||
<tr>
|
||||
<td>Go</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/go/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/go/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/go/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-go.git;a=summary">libvirt</a>
|
||||
@@ -77,7 +80,8 @@
|
||||
<tr>
|
||||
<td>Java</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/java/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/java/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/java/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-java.git;a=summary">libvirt</a>
|
||||
@@ -91,7 +95,8 @@
|
||||
<tr>
|
||||
<td>OCaml</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/ocaml/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/ocaml/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/ocaml/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-ocaml.git;a=summary">libvirt</a>
|
||||
@@ -105,7 +110,7 @@
|
||||
<tr>
|
||||
<td>Perl (Sys::Virt)</td>
|
||||
<td>
|
||||
<a href="https://metacpan.org/release/Sys-Virt/">cpan</a>
|
||||
<a href="http://search.cpan.org/dist/Sys-Virt/">cpan</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-perl.git;a=summary">libvirt</a>
|
||||
@@ -115,14 +120,15 @@
|
||||
<a href="https://github.com/libvirt/libvirt-perl">github</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://metacpan.org/release/Sys-Virt/">api ref</a>
|
||||
<a href="http://search.cpan.org/dist/Sys-Virt/">api ref</a>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-perl.git;a=blob;f=Changes;hb=HEAD">changes</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PHP</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/php/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/php/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/php/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-php.git;a=summary">libvirt</a>
|
||||
@@ -136,7 +142,8 @@
|
||||
<tr>
|
||||
<td>Python</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/python/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/python/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/python/">https</a>
|
||||
<a href="https://pypi.python.org/pypi/libvirt-python">pypi</a>
|
||||
</td>
|
||||
<td>
|
||||
@@ -151,7 +158,8 @@
|
||||
<tr>
|
||||
<td>Ruby</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/ruby/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/ruby/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/ruby/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=ruby-libvirt.git;a=summary">libvirt</a>
|
||||
@@ -165,7 +173,8 @@
|
||||
<tr>
|
||||
<td>Rust</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/rust/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/rust/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/rust/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-rust.git;a=summary">libvirt</a>
|
||||
@@ -182,7 +191,8 @@
|
||||
<tr>
|
||||
<td>GLib / GConfig / GObject</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/glib/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/glib/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/glib/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-glib.git;a=summary">libvirt</a>
|
||||
@@ -196,7 +206,8 @@
|
||||
<tr>
|
||||
<td>Go XML</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/go/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/go/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/go/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-go-xml.git;a=summary">libvirt</a>
|
||||
@@ -212,7 +223,8 @@
|
||||
<tr>
|
||||
<td>D-Bus</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/dbus/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/dbus/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/dbus/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-dbus.git;a=summary">libvirt</a>
|
||||
@@ -226,7 +238,8 @@
|
||||
<tr>
|
||||
<td>Console Proxy</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/consoleproxy/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/consoleproxy/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/consoleproxy/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-console-proxy.git;a=summary">libvirt</a>
|
||||
@@ -240,7 +253,8 @@
|
||||
<tr>
|
||||
<td>CIM provider</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/CIM/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/CIM/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/CIM/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-cim.git;a=summary">libvirt</a>
|
||||
@@ -254,7 +268,8 @@
|
||||
<tr>
|
||||
<td>CIM utils</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/CIM/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/CIM/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/CIM/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libcmpiutil.git;a=summary">libvirt</a>
|
||||
@@ -268,7 +283,8 @@
|
||||
<tr>
|
||||
<td>SNMP</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/snmp/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/snmp/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/snmp/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-snmp.git;a=summary">libvirt</a>
|
||||
@@ -282,7 +298,8 @@
|
||||
<tr>
|
||||
<td>Application Sandbox</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/sandbox/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/sandbox/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/sandbox/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-sandbox.git;a=summary">libvirt</a>
|
||||
@@ -299,7 +316,8 @@
|
||||
<tr>
|
||||
<td>TCK</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/sources/tck/">libvirt</a>
|
||||
<a href="ftp://libvirt.org/libvirt/tck/">ftp</a>
|
||||
<a href="https://libvirt.org/sources/tck/">https</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="https://libvirt.org/git/?p=libvirt-tck.git;a=summary">libvirt</a>
|
||||
@@ -404,11 +422,14 @@
|
||||
|
||||
<p>
|
||||
Most modules have releases made available for download on the project
|
||||
site via HTTPS. Some modules are instead made available at alternative
|
||||
locations, for example, the Perl binding is made available only on CPAN.
|
||||
site, via FTP, HTTP or HTTPS. Some modules are instead made available
|
||||
at alternative locations, for example, the Perl binding is made
|
||||
available only on CPAN.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="ftp://libvirt.org/libvirt/">libvirt.org FTP server</a></li>
|
||||
<li><a href="https://libvirt.org/sources/">libvirt.org HTTP server</a></li>
|
||||
<li><a href="https://libvirt.org/sources/">libvirt.org HTTPS server</a></li>
|
||||
</ul>
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
<ul>
|
||||
<li><a href="#hypervisor">Hypervisor drivers</a></li>
|
||||
<li><a href="storage.html">Storage drivers</a></li>
|
||||
<li><a href="#storage">Storage drivers</a></li>
|
||||
<li><a href="drvnodedev.html">Node device driver</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -29,14 +29,30 @@
|
||||
<li><strong><a href="drvopenvz.html">OpenVZ</a></strong></li>
|
||||
<li><strong><a href="drvqemu.html">QEMU</a></strong></li>
|
||||
<li><strong><a href="drvtest.html">Test</a></strong> - Used for testing</li>
|
||||
<li><strong><a href="drvuml.html">UML</a></strong> - User Mode Linux</li>
|
||||
<li><strong><a href="drvvbox.html">VirtualBox</a></strong></li>
|
||||
<li><strong><a href="drvesx.html">VMware ESX</a></strong></li>
|
||||
<li><strong><a href="drvvmware.html">VMware Workstation/Player</a></strong></li>
|
||||
<li><strong><a href="drvxen.html">Xen</a></strong></li>
|
||||
<li><strong><a href="drvhyperv.html">Microsoft Hyper-V</a></strong></li>
|
||||
<li><strong><a href="drvphyp.html">IBM PowerVM (phyp)</a></strong></li>
|
||||
<li><strong><a href="drvvirtuozzo.html">Virtuozzo</a></strong></li>
|
||||
<li><strong><a href="drvbhyve.html">Bhyve</a></strong> - The BSD Hypervisor</li>
|
||||
</ul>
|
||||
|
||||
<h2><a id="storage">Storage drivers</a></h2>
|
||||
|
||||
<ul>
|
||||
<li><strong><a href="storage.html#StorageBackendDir">Directory backend</a></strong></li>
|
||||
<li><strong><a href="storage.html#StorageBackendFS">Local filesystem backend</a></strong></li>
|
||||
<li><strong><a href="storage.html#StorageBackendNetFS">Network filesystem backend</a></strong></li>
|
||||
<li><strong><a href="storage.html#StorageBackendLogical">Logical Volume Manager (LVM) backend</a></strong></li>
|
||||
<li><strong><a href="storage.html#StorageBackendDisk">Disk backend</a></strong></li>
|
||||
<li><strong><a href="storage.html#StorageBackendISCSI">iSCSI backend</a></strong></li>
|
||||
<li><strong><a href="storage.html#StorageBackendSCSI">SCSI backend</a></strong></li>
|
||||
<li><strong><a href="storage.html#StorageBackendMultipath">Multipath backend</a></strong></li>
|
||||
<li><strong><a href="storage.html#StorageBackendRBD">RBD (RADOS Block Device) backend</a></strong></li>
|
||||
<li><strong><a href="storage.html#StorageBackendSheepdog">Sheepdog backend</a></strong></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -462,32 +462,5 @@ Example:</p>
|
||||
</domain>
|
||||
</pre>
|
||||
|
||||
<h3><a id="bhyvecommand">Pass-through of arbitrary bhyve commands</a></h3>
|
||||
|
||||
<p><span class="since">Since 5.1.0</span>, it's possible to pass additional command-line
|
||||
arguments to the bhyve process when starting the domain using the
|
||||
<code><bhyve:commandline></code> element under <code>domain</code>.
|
||||
To supply an argument, use the element <code><bhyve:arg></code> with
|
||||
the attribute <code>value</code> set to additional argument to be added.
|
||||
The arg element may be repeated multiple times. To use this XML addition, it is necessary
|
||||
to issue an XML namespace request (the special <code>xmlns:<i>name</i></code> attribute)
|
||||
that pulls in <code>http://libvirt.org/schemas/domain/bhyve/1.0</code>;
|
||||
typically, the namespace is given the name of <code>bhyve</code>.
|
||||
</p>
|
||||
<p>Example:</p>
|
||||
<pre>
|
||||
<domain type="bhyve" xmlns:bhyve="http://libvirt.org/schemas/domain/bhyve/1.0">
|
||||
...
|
||||
<bhyve:commandline>
|
||||
<bhyve:arg value='-somebhyvearg'/>
|
||||
</bhyve:commandline>
|
||||
</domain>
|
||||
</pre>
|
||||
|
||||
<p>Note that these extensions are for testing and development purposes only.
|
||||
They are <b>unsupported</b>, using them may result in inconsistent state,
|
||||
and upgrading either bhyve or libvirtd maybe break behavior of a domain that
|
||||
was relying on a specific commands pass-through.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -337,9 +337,7 @@ error: invalid argument in libvirt was built without the 'esx' driver
|
||||
Memory size has to be a multiple of 4096
|
||||
</li>
|
||||
<li>
|
||||
Number of virtual CPU has to be 1 or a multiple of 2.
|
||||
<span class="since">Since 4.10.0</span> any number of vCPUs is
|
||||
supported.
|
||||
Number of virtual CPU has to be 1 or a multiple of 2
|
||||
</li>
|
||||
<li>
|
||||
Valid MAC address prefixes are <code>00:0c:29</code> and
|
||||
|
50
docs/drvphyp.html.in
Normal file
50
docs/drvphyp.html.in
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1>IBM PowerVM hypervisor driver (phyp)</h1>
|
||||
<ul id="toc"></ul>
|
||||
<p>
|
||||
The IBM PowerVM driver can manage both HMC and IVM PowerVM
|
||||
guests. VIOS connections are tunneled through HMC.
|
||||
</p>
|
||||
|
||||
|
||||
<h2><a id="project">Project Links</a></h2>
|
||||
<ul>
|
||||
<li>
|
||||
The <a href="http://www-03.ibm.com/systems/power/software/virtualization/index.html">IBM
|
||||
PowerVM</a> hypervisor
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a id="uri">Connections to the PowerVM driver</a></h2>
|
||||
<p>
|
||||
Some example remote connection URIs for the driver are:
|
||||
</p>
|
||||
<pre>
|
||||
phyp://user@hmc/system (HMC connection)
|
||||
phyp://user@ivm/system (IVM connection)
|
||||
</pre>
|
||||
<p>
|
||||
<strong>Note</strong>: In contrast to other drivers, the
|
||||
PowerVM (or phyp) driver is a client-side-only driver,
|
||||
internally using ssh to connect to the specified hmc or ivm
|
||||
server. Therefore, the <a href="remote.html">remote transport
|
||||
mechanism</a> provided by the remote driver and libvirtd will
|
||||
not work, and you cannot use URIs like
|
||||
<code>phyp+ssh://example.com</code>.
|
||||
</p>
|
||||
|
||||
|
||||
<h3><a id="uriformat">URI Format</a></h3>
|
||||
<p>
|
||||
URIs have this general form (<code>[...]</code> marks an
|
||||
optional part, <code>{...|...}</code> marks a mandatory choice).
|
||||
</p>
|
||||
<pre>
|
||||
phyp://[username@]{hmc|ivm}/managed_system
|
||||
</pre>
|
||||
|
||||
</body></html>
|
@@ -8,7 +8,7 @@
|
||||
|
||||
<p>
|
||||
The libvirt KVM/QEMU driver can manage any QEMU emulator from
|
||||
version 1.5.0 or later.
|
||||
version 0.12.0 or later.
|
||||
</p>
|
||||
|
||||
<h2><a id="project">Project Links</a></h2>
|
||||
@@ -38,7 +38,7 @@
|
||||
<li>
|
||||
<strong>KVM hypervisor</strong>: The driver will probe <code>/usr/bin</code>
|
||||
for the presence of <code>qemu-kvm</code> and <code>/dev/kvm</code> device
|
||||
node. If both are found, then KVM fully virtualized, hardware accelerated
|
||||
node. If both are found, then KVM fullyvirtualized, hardware accelerated
|
||||
guests will be available.
|
||||
</li>
|
||||
</ul>
|
||||
@@ -187,29 +187,41 @@ chmod o+x /path/to/directory
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
The libvirt maintainers <strong>strongly recommend against</strong>
|
||||
running QEMU as the root user/group. This should not be required
|
||||
in most supported usage scenarios, as libvirt will generally do the
|
||||
right thing to grant QEMU access to files it is permitted to
|
||||
use when it is running non-root.
|
||||
</p>
|
||||
|
||||
<h3><a id="securitycap">Linux process capabilities</a></h3>
|
||||
|
||||
<p>
|
||||
In versions of libvirt prior to 6.0.0, even if QEMU was configured
|
||||
to run as the root user / group, libvirt would strip all process
|
||||
capabilities. This meant that QEMU could only read/write files
|
||||
owned by root, or with open permissions. In reality, stripping
|
||||
capabilities did not have any security benefit, as it was trivial
|
||||
to get commands to run in another context with full capabilities,
|
||||
for example, by creating a cronjob.
|
||||
The libvirt QEMU driver has a build time option allowing it to use
|
||||
the <a href="http://people.redhat.com/sgrubb/libcap-ng/index.html">libcap-ng</a>
|
||||
library to manage process capabilities. If this build option is
|
||||
enabled, then the QEMU driver will use this to ensure that all
|
||||
process capabilities are dropped before executing a QEMU virtual
|
||||
machine. Process capabilities are what gives the 'root' account
|
||||
its high power, in particular the CAP_DAC_OVERRIDE capability
|
||||
is what allows a process running as 'root' to access files owned
|
||||
by any user.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Thus since 6.0.0, if QEMU is running as root, it will keep all
|
||||
process capabilities. Behaviour when QEMU is running non-root
|
||||
is unchanged, it still has no capabilities.
|
||||
If the QEMU driver is configured to run virtual machines as non-root,
|
||||
then they will already lose all their process capabilities at time
|
||||
of startup. The Linux capability feature is thus aimed primarily at
|
||||
the scenario where the QEMU processes are running as root. In this
|
||||
case, before launching a QEMU virtual machine, libvirtd will use
|
||||
libcap-ng APIs to drop all process capabilities. It is important
|
||||
for administrators to note that this implies the QEMU process will
|
||||
<strong>only</strong> be able to access files owned by root, and
|
||||
not files owned by any other user.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Thus, if a vendor / distributor has configured their libvirt package
|
||||
to run as 'qemu' by default, a number of changes will be required
|
||||
before an administrator can change a host to run guests as root.
|
||||
In particular it will be necessary to change ownership on the
|
||||
directories <code>/var/run/libvirt/qemu/</code>,
|
||||
<code>/var/lib/libvirt/qemu/</code> and
|
||||
<code>/var/cache/libvirt/qemu/</code> back to root, in addition
|
||||
to changing the <code>/etc/libvirt/qemu.conf</code> settings.
|
||||
</p>
|
||||
|
||||
<h3><a id="securityselinux">SELinux basic confinement</a></h3>
|
||||
@@ -364,7 +376,7 @@ chmod o+x /path/to/directory
|
||||
<h3><a id="securityacl">Cgroups device ACLs</a></h3>
|
||||
|
||||
<p>
|
||||
Linux kernels have a capability known as "cgroups" which is used
|
||||
Recent Linux kernels have a capability known as "cgroups" which is used
|
||||
for resource management. It is implemented via a number of "controllers",
|
||||
each controller covering a specific task/functional area. One of the
|
||||
available controllers is the "devices" controller, which is able to
|
||||
@@ -383,8 +395,9 @@ chmod o+x /path/to/directory
|
||||
<pre>
|
||||
/dev/null, /dev/full, /dev/zero,
|
||||
/dev/random, /dev/urandom,
|
||||
/dev/ptmx, /dev/kvm,
|
||||
/dev/rtc, /dev/hpet
|
||||
/dev/ptmx, /dev/kvm, /dev/kqemu,
|
||||
/dev/rtc, /dev/hpet, /dev/net/tun,
|
||||
/dev/sev
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
@@ -414,10 +427,6 @@ mount -t cgroup none /dev/cgroup -o devices
|
||||
|
||||
<h3><a id="xmlimport">Converting from QEMU args to domain XML</a></h3>
|
||||
|
||||
<p>
|
||||
<b>Note:</b> this operation is <span class="removed"> deleted as of
|
||||
5.5.0</span> and will return an error.
|
||||
</p>
|
||||
<p>
|
||||
The <code>virsh domxml-from-native</code> provides a way to
|
||||
convert an existing set of QEMU args into a guest description
|
||||
@@ -431,17 +440,82 @@ mount -t cgroup none /dev/cgroup -o devices
|
||||
examples) or by manually crafting XML to pass to virsh.
|
||||
</p>
|
||||
|
||||
<pre>$ cat > demo.args <<EOF
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test \
|
||||
LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 \
|
||||
-nographic -monitor pty -no-acpi -boot c -hda \
|
||||
/dev/HostVG/QEMUGuest1 -net none -serial none \
|
||||
-parallel none -usb
|
||||
EOF
|
||||
|
||||
$ virsh domxml-from-native qemu-argv demo.args
|
||||
<domain type='qemu'>
|
||||
<uuid>00000000-0000-0000-0000-000000000000</uuid>
|
||||
<memory>219136</memory>
|
||||
<currentMemory>219136</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch='i686' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
</disk>
|
||||
</devices>
|
||||
</domain>
|
||||
</pre>
|
||||
|
||||
<p>NB, don't include the literal \ in the args, put everything on one line</p>
|
||||
|
||||
<h3><a id="xmlexport">Converting from domain XML to QEMU args</a></h3>
|
||||
|
||||
<p>
|
||||
The <code>virsh domxml-to-native</code> provides a way to convert a
|
||||
guest description using libvirt Domain XML, into a set of QEMU args
|
||||
that can be run manually. Note that currently the command line formatted
|
||||
by libvirt is no longer suited for manually running qemu as the
|
||||
configuration expects various resources and open file descriptors passed
|
||||
to the process which are usually prepared by libvirtd.
|
||||
that can be run manually.
|
||||
</p>
|
||||
|
||||
<pre>$ cat > demo.xml <<EOF
|
||||
<domain type='qemu'>
|
||||
<name>QEMUGuest1</name>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<memory>219200</memory>
|
||||
<currentMemory>219200</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch='i686' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
</disk>
|
||||
</devices>
|
||||
</domain>
|
||||
EOF
|
||||
|
||||
$ virsh domxml-to-native qemu-argv demo.xml
|
||||
LC_ALL=C PATH=/usr/bin:/bin HOME=/home/test \
|
||||
USER=test LOGNAME=test /usr/bin/qemu -S -M pc \
|
||||
-no-kqemu -m 214 -smp 1 -name QEMUGuest1 -nographic \
|
||||
-monitor pty -no-acpi -boot c -drive \
|
||||
file=/dev/HostVG/QEMUGuest1,if=ide,index=0 -net none \
|
||||
-serial none -parallel none -usb
|
||||
</pre>
|
||||
|
||||
<h2><a id="qemucommand">Pass-through of arbitrary qemu
|
||||
commands</a></h2>
|
||||
|
||||
@@ -466,8 +540,7 @@ mount -t cgroup none /dev/cgroup -o devices
|
||||
qemu guest (<span class="since">Since 0.8.3</span>),
|
||||
and <code>virDomainQemuAttach</code>, for registering a qemu
|
||||
domain that was manually started so that it can then be managed
|
||||
by libvirtd (<span class="since">Since 0.9.4</span>,
|
||||
<span class="removed">removed as of 5.5.0</span>).
|
||||
by libvirtd (<span class="since">Since 0.9.4</span>).
|
||||
</p>
|
||||
<p>Additionally, the following XML additions allow fine-tuning of
|
||||
the command line given to qemu when starting a domain
|
||||
@@ -508,36 +581,6 @@ mount -t cgroup none /dev/cgroup -o devices
|
||||
<qemu:env name='QEMU_ENV' value='VAL'/>
|
||||
</qemu:commandline>
|
||||
</domain>
|
||||
</pre>
|
||||
|
||||
<h2><a id="xmlnsfeatures">QEMU feature configuration for testing</a></h2>
|
||||
|
||||
<p>
|
||||
In some cases e.g. when developing a new feature or for testing it may
|
||||
be required to control a given qemu feature (or qemu capability) to test
|
||||
it before it's complete or disable it for debugging purposes.
|
||||
<span class="since">Since 5.5.0</span> it's possible to use the same
|
||||
special qemu namespace as above
|
||||
(<code>http://libvirt.org/schemas/domain/qemu/1.0</code>) and use
|
||||
<code><qemu:capabilities></code> element to add
|
||||
(<code><qemu:add capability="capname"/></code>) or remove
|
||||
(<code><qemu:del capability="capname"/></code>) capability bits.
|
||||
The naming of the feature bits is the same libvirt uses in the status
|
||||
XML. Note that this feature is meant for experiments only and should
|
||||
_not_ be used in production.
|
||||
</p>
|
||||
|
||||
<p>Example:</p><pre>
|
||||
<domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
|
||||
<name>testvm</name>
|
||||
|
||||
[...]
|
||||
|
||||
<qemu:capabilities>
|
||||
<qemu:add capability='blockdev'/>
|
||||
<qemu:del capability='drive'/>
|
||||
</qemu:capabilities>
|
||||
</domain>
|
||||
</pre>
|
||||
|
||||
<h2><a id="xmlconfig">Example domain XML config</a></h2>
|
||||
|
93
docs/drvuml.html.in
Normal file
93
docs/drvuml.html.in
Normal file
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1>User Mode Linux driver</h1>
|
||||
|
||||
<p>
|
||||
The UML driver for libvirt allows use and management of paravirtualized
|
||||
guests built for User Mode Linux. UML requires no special support in
|
||||
the host kernel, so can be used by any user of any linux system, provided
|
||||
they have enough free RAM for their guest's needs, though there are
|
||||
certain restrictions on network connectivity unless the administrator
|
||||
has pre-created TAP devices.
|
||||
</p>
|
||||
|
||||
<h2><a id="project">Project Links</a></h2>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
The <a href="http://user-mode-linux.sourceforge.net/">User
|
||||
Mode Linux</a> paravirtualized kernel
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2>Connections to UML driver</h2>
|
||||
|
||||
<p>
|
||||
The libvirt UML driver follows the QEMU driver in providing two
|
||||
types of connection. There is one privileged instance per host,
|
||||
which runs as root. This is called the "system" instance, and allows
|
||||
full use of all host resources. Then, there is a per-user unprivileged
|
||||
"session", instance. This has more restricted capabilities, and may
|
||||
require the host administrator to setup certain resources ahead of
|
||||
time to allow full integration with the network. Example connection
|
||||
URIs are
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
uml:///session (local access to per-user instance)
|
||||
uml+unix:///session (local access to per-user instance)
|
||||
|
||||
uml:///system (local access to system instance)
|
||||
uml+unix:///system (local access to system instance)
|
||||
uml://example.com/system (remote access, TLS/x509)
|
||||
uml+tcp://example.com/system (remote access, SASl/Kerberos)
|
||||
uml+ssh://root@example.com/system (remote access, SSH tunnelled)
|
||||
</pre>
|
||||
|
||||
<h2>Example XML configuration</h2>
|
||||
|
||||
<p>
|
||||
User mode Linux driver only supports directly kernel boot at
|
||||
this time. A future driver enhancement may allow a paravirt
|
||||
bootloader in a similar style to Xen's pygrub. For now though,
|
||||
the UML kernel must be stored on the host and referenced
|
||||
explicitly in the "os" element. Since UML is a paravirtualized
|
||||
technology, the kernel "type" is set to "uml"
|
||||
</p>
|
||||
|
||||
<p>
|
||||
There is not yet support for networking in the driver, but
|
||||
disks can be specified in the usual libvirt manner. The main
|
||||
variation is the target device naming scheme "ubd0", and
|
||||
bus type of "uml".
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Once booted the primary console is connected to a PTY, and
|
||||
thus accessible with "virsh console" or equivalent tools
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<domain type='uml'>
|
||||
<name>demo</name>
|
||||
<uuid>b4433fc2-a22e-ffb3-0a3d-9c173b395800</uuid>
|
||||
<memory>500000</memory>
|
||||
<currentMemory>500000</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64'>uml</type>
|
||||
<kernel>/home/berrange/linux-uml-2.6.26-x86_64</kernel>
|
||||
</os>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<source file='/home/berrange/FedoraCore6-AMD64-root_fs'/>
|
||||
<target dev='ubd0' bus='uml'/>
|
||||
</disk>
|
||||
<console type='pty'/>
|
||||
</devices>
|
||||
</domain>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@@ -8,7 +8,7 @@
|
||||
|
||||
<p>
|
||||
The libvirt libxl driver provides the ability to manage virtual
|
||||
machines on any Xen release from 4.6.0 onwards.
|
||||
machines on any Xen release from 4.4.0 onwards.
|
||||
</p>
|
||||
|
||||
<h2><a id="project">Project Links</a></h2>
|
||||
@@ -58,7 +58,8 @@ xen+ssh://root@example.com/system (remote access, SSH tunnelled)
|
||||
original Xen virtual machine config format used by the legacy
|
||||
xm/xend toolstack. The second, known as <code>xen-sxpr</code>,
|
||||
is also one of the original formats that was used by xend's
|
||||
legacy HTTP RPC service (<span class='removed'>removed in 5.6.0</span>)
|
||||
legacy HTTP RPC service. For compatibility, import and export
|
||||
of these legacy formats is supported by the libxl driver.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@@ -129,44 +129,6 @@ MASQUERADE all -- * * 192.168.122.0/24 !192.168.122.0/24</pre>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3><a id="fw-firewalld-and-virtual-network-driver">firewalld and the virtual network driver</a>
|
||||
</h3>
|
||||
<p>
|
||||
If <a href="https://firewalld.org">firewalld</a> is active on
|
||||
the host, libvirt will attempt to place the bridge interface of
|
||||
a libvirt virtual network into the firewalld zone named
|
||||
"libvirt" (thus making all guest->host traffic on that network
|
||||
subject to the rules of the "libvirt" zone). This is done
|
||||
because, if firewalld is using its nftables backend (available
|
||||
since firewalld 0.6.0) the default firewalld zone (which would
|
||||
be used if libvirt didn't explicitly set the zone) prevents
|
||||
forwarding traffic from guests through the bridge, as well as
|
||||
preventing DHCP, DNS, and most other traffic from guests to
|
||||
host. The zone named "libvirt" is installed into the firewalld
|
||||
configuration by libvirt (not by firewalld), and allows
|
||||
forwarded traffic through the bridge as well as DHCP, DNS, TFTP,
|
||||
and SSH traffic to the host - depending on firewalld's backend
|
||||
this will be implemented via either iptables or nftables
|
||||
rules. libvirt's own rules outlined above will *always* be
|
||||
iptables rules regardless of which backend is in use by
|
||||
firewalld.
|
||||
</p>
|
||||
<p>
|
||||
NB: It is possible to manually set the firewalld zone for a
|
||||
network's interface with the "zone" attribute of the network's
|
||||
"bridge" element.
|
||||
</p>
|
||||
<p>
|
||||
NB: Prior to libvirt 5.1.0, the firewalld "libvirt" zone did not
|
||||
exist, and prior to firewalld 0.7.0 a feature crucial to making
|
||||
the "libvirt" zone operate properly (rich rule priority
|
||||
settings) was not implemented in firewalld. In cases where one
|
||||
or the other of the two packages is missing the necessary
|
||||
functionality, it's still possible to have functional guest
|
||||
networking by setting the firewalld backend to "iptables" (in
|
||||
firewalld prior to 0.6.0, this was the only backend available).
|
||||
</p>
|
||||
|
||||
<h3><a id="fw-network-filter-driver">The network filter driver</a>
|
||||
</h3>
|
||||
<p>This driver provides a fully configurable network filtering capability
|
||||
|
@@ -17,17 +17,13 @@
|
||||
<li><a href="formatdomain.html">Domains</a></li>
|
||||
<li><a href="formatnetwork.html">Networks</a></li>
|
||||
<li><a href="formatnwfilter.html">Network filtering</a></li>
|
||||
<li><a href="formatnetworkport.html">Network ports</a></li>
|
||||
<li><a href="formatstorage.html">Storage</a></li>
|
||||
<li><a href="formatstorageencryption.html">Storage encryption</a></li>
|
||||
<li><a href="formatcaps.html">Capabilities</a></li>
|
||||
<li><a href="formatdomaincaps.html">Domain capabilities</a></li>
|
||||
<li><a href="formatstoragecaps.html">Storage Pool capabilities</a></li>
|
||||
<li><a href="formatnode.html">Node devices</a></li>
|
||||
<li><a href="formatsecret.html">Secrets</a></li>
|
||||
<li><a href="formatsnapshot.html">Snapshots</a></li>
|
||||
<li><a href="formatcheckpoint.html">Checkpoints</a></li>
|
||||
<li><a href="formatbackup.html">Backup jobs</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Command line validation</h2>
|
||||
|
@@ -1,175 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1>Backup XML format</h1>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<h2><a id="BackupAttributes">Backup XML</a></h2>
|
||||
|
||||
<p>
|
||||
Creating a backup, whether full or incremental, is done
|
||||
via <code>virDomainBackupBegin()</code>, which takes an XML
|
||||
description of the actions to perform, as well as an optional
|
||||
second XML document <a href="formatcheckpoint.html">describing a
|
||||
checkpoint</a> to create at the same point in time. See
|
||||
also <a href="domainstatecapture.html">a comparison</a> between
|
||||
the various state capture APIs.
|
||||
</p>
|
||||
<p>
|
||||
There are two general modes for backups: a push mode (where the
|
||||
hypervisor writes out the data to the destination file, which
|
||||
may be local or remote), and a pull mode (where the hypervisor
|
||||
creates an NBD server that a third-party client can then read as
|
||||
needed, and which requires the use of temporary storage,
|
||||
typically local, until the backup is complete).
|
||||
</p>
|
||||
<p>
|
||||
The instructions for beginning a backup job are provided as
|
||||
attributes and elements of the
|
||||
top-level <code>domainbackup</code> element. This element
|
||||
includes an optional attribute <code>mode</code> which can be
|
||||
either "push" or "pull" (default
|
||||
push). <code>virDomainBackupGetXMLDesc()</code> can be used to
|
||||
see the actual values selected for elements omitted during
|
||||
creation (for example, learning which port the NBD server is
|
||||
using in the pull model or what file names libvirt generated
|
||||
when none were supplied). The following child elements and attributes
|
||||
are supported:
|
||||
</p>
|
||||
<dl>
|
||||
<dt><code>incremental</code></dt>
|
||||
<dd>An optional element giving the name of an existing
|
||||
checkpoint of the domain, which will be used to make this
|
||||
backup an incremental one. In the push model, only changes
|
||||
since the named checkpoint are written to the destination. In
|
||||
the pull model, the NBD server uses the
|
||||
NBD_OPT_SET_META_CONTEXT extension to advertise to the client
|
||||
which portions of the export contain changes since the named
|
||||
checkpoint. If omitted, a full backup is performed.
|
||||
</dd>
|
||||
<dt><code>server</code></dt>
|
||||
<dd>Present only for a pull mode backup. Contains the same
|
||||
attributes as
|
||||
the <a href="formatdomain.html#elementsDisks"><code>protocol</code>
|
||||
element of a disk</a> attached via NBD in the domain (such as
|
||||
transport, socket, name, port, or tls), necessary to set up an
|
||||
NBD server that exposes the content of each disk at the time
|
||||
the backup is started.
|
||||
</dd>
|
||||
<dt><code>disks</code></dt>
|
||||
<dd>An optional listing of instructions for disks participating
|
||||
in the backup (if omitted, all disks participate and libvirt
|
||||
attempts to generate filenames by appending the current
|
||||
timestamp as a suffix). If the entire element was omitted on
|
||||
input, then all disks participate in the backup, otherwise,
|
||||
only the disks explicitly listed which do not also
|
||||
use <code>backup='no'</code> will participate. On output, this
|
||||
is the state of each of the domain's disk in relation to the
|
||||
backup operation.
|
||||
<dl>
|
||||
<dt><code>disk</code></dt>
|
||||
<dd>This sub-element describes the backup properties of a
|
||||
specific disk, with the following attributes and child
|
||||
elements:
|
||||
<dl>
|
||||
<dt><code>name</code></dt>
|
||||
<dd>A mandatory attribute which must match
|
||||
the <code><target dev='name'/></code>
|
||||
of one of
|
||||
the <a href="formatdomain.html#elementsDisks">disk
|
||||
devices</a> specified for the domain at the time of
|
||||
the checkpoint.</dd>
|
||||
<dt><code>backup</code></dt>
|
||||
<dd>Setting this attribute to <code>yes</code>(default) specifies
|
||||
that the disk should take part in the backup and using
|
||||
<code>no</code> excludes the disk from the backup.</dd>
|
||||
<dt><code>type</code></dt>
|
||||
<dd>A mandatory attribute to describe the type of the
|
||||
disk, except when <code>backup='no'</code> is
|
||||
used. Valid values include <code>file</code>,
|
||||
<code>block</code>, or <code>network</code>.
|
||||
Similar to a disk declaration for a domain, the choice of type
|
||||
controls what additional sub-elements are needed to describe
|
||||
the destination (such as <code>protocol</code> for a
|
||||
network destination).</dd>
|
||||
<dt><code>target</code></dt>
|
||||
<dd>Valid only for push mode backups, this is the
|
||||
primary sub-element that describes the file name of
|
||||
the backup destination, similar to
|
||||
the <code>source</code> sub-element of a domain
|
||||
disk. An optional sub-element <code>driver</code> can
|
||||
also be used, with an attribute <code>type</code> to
|
||||
specify a destination format different from
|
||||
qcow2. </dd>
|
||||
<dt><code>scratch</code></dt>
|
||||
<dd>Valid only for pull mode backups, this is the
|
||||
primary sub-element that describes the file name of
|
||||
the local scratch file to be used in facilitating the
|
||||
backup, and is similar to the <code>source</code>
|
||||
sub-element of a domain disk. Currently only <code>file</code>
|
||||
and <code>block</code> scratch storage is supported. The
|
||||
<code>file</code> scratch file is created and deleted by
|
||||
libvirt in the given location. A <code>block</code> scratch
|
||||
device must exist prior to starting the backup and is formatted.
|
||||
The block device must have enough space for the corresponding
|
||||
disk data including format overhead.
|
||||
|
||||
If <code>VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL</code> flag is
|
||||
used the file for a scratch of <code>file</code> type must
|
||||
exist with the correct format and size to hold the copy and is
|
||||
used without modification. The file is not deleted after the
|
||||
backup but the contents of the file don't make sense outside
|
||||
of the backup. The same applies for the block device which
|
||||
must be formatted appropriately.</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2><a id="example">Examples</a></h2>
|
||||
|
||||
<p>Use <code>virDomainBackupBegin()</code> to perform a full
|
||||
backup using push mode. The example lets libvirt pick the
|
||||
destination and format for 'vda', fully specifies that we want a
|
||||
raw backup of 'vdb', and omits 'vdc' from the operation.
|
||||
</p>
|
||||
<pre>
|
||||
<domainbackup>
|
||||
<disks>
|
||||
<disk name='vda' backup='yes'/>
|
||||
<disk name='vdb' type='file'>
|
||||
<target file='/path/to/vdb.backup'/>
|
||||
<driver type='raw'/>
|
||||
</disk>
|
||||
<disk name='vdc' backup='no'/>
|
||||
</disks>
|
||||
</domainbackup>
|
||||
</pre>
|
||||
|
||||
<p>If the previous full backup also passed a parameter describing
|
||||
<a href="formatcheckpoint.html">checkpoint XML</a> that resulted
|
||||
in a checkpoint named <code>1525889631</code>, we can make
|
||||
another call to <code>virDomainBackupBegin()</code> to perform
|
||||
an incremental backup of just the data changed since that
|
||||
checkpoint, this time using the following XML to start a pull
|
||||
model export of the 'vda' and 'vdb' disks, where a third-party
|
||||
NBD client connecting to '/path/to/server' completes the backup
|
||||
(omitting 'vdc' from the explicit list has the same effect as
|
||||
the backup='no' from the previous example):
|
||||
</p>
|
||||
<pre>
|
||||
<domainbackup mode="pull">
|
||||
<incremental>1525889631</incremental>
|
||||
<server transport="unix" socket="/path/to/server"/>
|
||||
<disks>
|
||||
<disk name='vda' backup='yes' type='file'>
|
||||
<scratch file='/path/to/file1.scratch'/>
|
||||
</disk>
|
||||
</disks>
|
||||
</domainbackup>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@@ -74,44 +74,24 @@
|
||||
is able to run. Possible values are:
|
||||
<dl>
|
||||
<dt><code>xen</code></dt>
|
||||
<dd>for XEN PV</dd>
|
||||
<dd>for XEN</dd>
|
||||
|
||||
<dt><code>linux</code></dt>
|
||||
<dd>legacy alias for <code>xen</code></dd>
|
||||
|
||||
<dt><code>xenpvh</code></dt>
|
||||
<dd>for XEN PVH</dd>
|
||||
|
||||
<dt><code>hvm</code></dt>
|
||||
<dd>Unmodified operating system</dd>
|
||||
|
||||
<dt><code>exe</code></dt>
|
||||
<dd>Container based virtualization</dd>
|
||||
|
||||
<dt><code>uml</code></dt>
|
||||
<dd>User Mode Linux</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
|
||||
<dt><code>arch</code></dt>
|
||||
<dd>This element brings some information on supported guest
|
||||
architecture. Possible subelements are:
|
||||
<dl>
|
||||
<dt><code>wordsize</code></dt><dd>Size of CPU word in bits, for example 64.</dd>
|
||||
<dt><code>emulator</code></dt><dd>Emulator (device model) path, for
|
||||
use in <a href="formatdomain.html#elementEmulator">emulator</a>
|
||||
element of domain XML.</dd>
|
||||
<dt><code>loader</code></dt><dd>Loader path, for use in
|
||||
<a href="formatdomain.html#elementLoader">loader</a> element of domain
|
||||
XML.</dd>
|
||||
<dt><code>machine</code></dt><dd>Machine type, for use in
|
||||
<a href="formatdomain.html#attributeOSTypeMachine">machine</a>
|
||||
attribute of os/type element in domain XML. For example Xen
|
||||
supports <code>xenfv</code> for HVM, <code>xenpv</code> for
|
||||
PV, or <code>xenpvh</code> for PVH.</dd>
|
||||
<dt><code>domain</code></dt><dd>The <code>type</code> attribute of
|
||||
this element specifies the type of hypervisor required to run the
|
||||
domain. Use in <a href="formatdomain.html#attributeDomainType">type</a>
|
||||
attribute of the domain root element.</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dd>This element brings some information on supported guest architecture.</dd>
|
||||
|
||||
<dt><code>features</code></dt>
|
||||
<dd>This optional element encases possible features that can be used
|
||||
|
@@ -1,198 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1>Checkpoint XML format</h1>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<h2><a id="CheckpointAttributes">Checkpoint XML</a></h2>
|
||||
|
||||
<p>
|
||||
One method of capturing domain disk backups is via the use of
|
||||
incremental backups. Right now, incremental backups are only
|
||||
supported for the QEMU hypervisor when using qcow2 disks at the
|
||||
active layer; if other disk formats are in use, capturing disk
|
||||
backups requires different libvirt APIs
|
||||
(see <a href="kbase/domainstatecapture.html">domain state
|
||||
capture</a> for a comparison between APIs).
|
||||
</p>
|
||||
<p>
|
||||
Libvirt is able to facilitate incremental backups by tracking
|
||||
disk checkpoints, which are points in time against which it is
|
||||
easy to compute which portion of the disk has changed. Given a
|
||||
full backup (a backup created from the creation of the disk to a
|
||||
given point in time), coupled with the creation of a disk
|
||||
checkpoint at that time, and an incremental backup (a backup
|
||||
created from just the dirty portion of the disk between the
|
||||
first checkpoint and the second backup operation), it is
|
||||
possible to do an offline reconstruction of the state of the
|
||||
disk at the time of the second backup without having to copy as
|
||||
much data as a second full backup would require. Most disk
|
||||
checkpoints are created in conjunction with a backup
|
||||
via <code>virDomainBackupBegin()</code>, although a future API
|
||||
addition of <code>virDomainSnapshotCreateXML2()</code> will also
|
||||
make this possible when creating external snapshots; however,
|
||||
libvirt also exposes enough support to create disk checkpoints
|
||||
independently from a backup operation
|
||||
via <code>virDomainCheckpointCreateXML()</code> <span class="since">since
|
||||
5.6.0</span>. Likewise, the creation of checkpoints when
|
||||
external snapshots exist is currently forbidden, although future
|
||||
work will make it possible to integrate these two concepts.
|
||||
</p>
|
||||
<p>
|
||||
Attributes of libvirt checkpoints are stored as child elements
|
||||
of the <code>domaincheckpoint</code> element. At checkpoint
|
||||
creation time, normally only
|
||||
the <code>name</code>, <code>description</code>,
|
||||
and <code>disks</code> elements are settable. The rest of the
|
||||
fields are ignored on creation and will be filled in by libvirt
|
||||
in for informational purposes
|
||||
by <code>virDomainCheckpointGetXMLDesc()</code>. However, when
|
||||
redefining a checkpoint, with
|
||||
the <code>VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE</code> flag
|
||||
of <code>virDomainCheckpointCreateXML()</code>, all of the XML
|
||||
fields described here are relevant on input, even the fields
|
||||
that are normally described as readonly for output.
|
||||
</p>
|
||||
<p>
|
||||
The top-level <code>domaincheckpoint</code> element may contain
|
||||
the following elements:
|
||||
</p>
|
||||
<dl>
|
||||
<dt><code>name</code></dt>
|
||||
<dd>The optional name for this checkpoint. If the name is
|
||||
omitted, libvirt will create a name based on the time of the
|
||||
creation.
|
||||
</dd>
|
||||
<dt><code>description</code></dt>
|
||||
<dd>An optional human-readable description of the checkpoint.
|
||||
If the description is omitted when initially creating the
|
||||
checkpoint, then this field will be empty.
|
||||
</dd>
|
||||
<dt><code>disks</code></dt>
|
||||
<dd>On input, this is an optional listing of specific
|
||||
instructions for disk checkpoints; it is needed when making a
|
||||
checkpoint on only a subset of the disks associated with a
|
||||
domain. In particular, since QEMU checkpoints require qcow2
|
||||
disks, this element may be needed on input for excluding guest
|
||||
disks that are not in qcow2 format. If the entire element was
|
||||
omitted on input, then all disks participate in the
|
||||
checkpoint, otherwise, only the disks explicitly listed which
|
||||
do not also use <code>checkpoint='no'</code> will
|
||||
participate. On output, this is the checkpoint state of each
|
||||
of the domain's disks.
|
||||
<dl>
|
||||
<dt><code>disk</code></dt>
|
||||
<dd>This sub-element describes the checkpoint properties of
|
||||
a specific disk with the following attributes:
|
||||
<dl>
|
||||
<dt><code>name</code></dt>
|
||||
<dd>A mandatory attribute which must match either
|
||||
the <code><target dev='name'/></code> or an
|
||||
unambiguous <code><source file='name'/></code>
|
||||
of one of
|
||||
the <a href="formatdomain.html#elementsDisks">disk
|
||||
devices</a> specified for the domain at the time of
|
||||
the checkpoint.</dd>
|
||||
<dt><code>checkpoint</code></dt>
|
||||
<dd>An optional attribute; possible values
|
||||
are <code>no</code> when the disk does not participate
|
||||
in this checkpoint; or <code>bitmap</code> if the disk
|
||||
will track all changes since the creation of this
|
||||
checkpoint via a bitmap.</dd>
|
||||
<dt><code>bitmap</code></dt>
|
||||
<dd>The attribute <code>bitmap</code> is only valid
|
||||
if <code>checkpoint='bitmap'</code>; it describes the
|
||||
name of the tracking bitmap (defaulting to the
|
||||
checkpoint name).</dd>
|
||||
<dt><code>size</code></dt>
|
||||
<dd>The attribute <code>size</code> is ignored on input;
|
||||
on output, it is only present if
|
||||
the <code>VIR_DOMAIN_CHECKPOINT_XML_SIZE</code> flag
|
||||
was used to perform a dynamic query of the estimated
|
||||
size in bytes of the changes made since the checkpoint
|
||||
was created.</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt><code>creationTime</code></dt>
|
||||
<dd>A readonly representation of the time this checkpoint was
|
||||
created. The time is specified in seconds since the Epoch,
|
||||
UTC (i.e. Unix time).
|
||||
</dd>
|
||||
<dt><code>parent</code></dt>
|
||||
<dd>Readonly, present if this checkpoint has a parent. The
|
||||
parent name is given by the sub-element <code>name</code>. The
|
||||
parent relationship allows tracking a list of related checkpoints.
|
||||
</dd>
|
||||
<dt><code>domain</code></dt>
|
||||
<dd>A readonly representation of the
|
||||
inactive <a href="formatdomain.html">domain configuration</a>
|
||||
at the time the checkpoint was created. This element may be
|
||||
omitted for output brevity by supplying
|
||||
the <code>VIR_DOMAIN_CHECKPOINT_XML_NO_DOMAIN</code> flag, but
|
||||
the resulting XML is no longer viable for use with
|
||||
the <code>VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE</code> flag
|
||||
of <code>virDomainCheckpointCreateXML()</code>. The domain
|
||||
will have security-sensitive information omitted unless the
|
||||
flag <code>VIR_DOMAIN_CHECKPOINT_XML_SECURE</code> is provided
|
||||
on a read-write connection.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h2><a id="example">Examples</a></h2>
|
||||
|
||||
<p>Using this XML to create a checkpoint of just vda on a qemu
|
||||
domain with two disks and a prior checkpoint:</p>
|
||||
<pre>
|
||||
<domaincheckpoint>
|
||||
<description>Completion of updates after OS install</description>
|
||||
<disks>
|
||||
<disk name='vda' checkpoint='bitmap'/>
|
||||
<disk name='vdb' checkpoint='no'/>
|
||||
</disks>
|
||||
</domaincheckpoint></pre>
|
||||
|
||||
<p>will result in XML similar to this from
|
||||
<code>virDomainCheckpointGetXMLDesc()</code>:</p>
|
||||
<pre>
|
||||
<domaincheckpoint>
|
||||
<name>1525889631</name>
|
||||
<description>Completion of updates after OS install</description>
|
||||
<parent>
|
||||
<name>1525111885</name>
|
||||
</parent>
|
||||
<creationTime>1525889631</creationTime>
|
||||
<disks>
|
||||
<disk name='vda' checkpoint='bitmap' bitmap='1525889631'/>
|
||||
<disk name='vdb' checkpoint='no'/>
|
||||
</disks>
|
||||
<domain type='qemu'>
|
||||
<name>fedora</name>
|
||||
<uuid>93a5c045-6457-2c09-e56c-927cdf34e178</uuid>
|
||||
<memory>1048576</memory>
|
||||
...
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<driver name='qemu' type='qcow2'/>
|
||||
<source file='/path/to/file1'/>
|
||||
<target dev='vda' bus='virtio'/>
|
||||
</disk>
|
||||
<disk type='file' device='disk' snapshot='external'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source file='/path/to/file2'/>
|
||||
<target dev='vdb' bus='virtio'/>
|
||||
</disk>
|
||||
...
|
||||
</devices>
|
||||
</domain>
|
||||
</domaincheckpoint></pre>
|
||||
|
||||
<p>With that checkpoint created, the qcow2 image is now tracking
|
||||
all changes that occur in the image since the checkpoint via
|
||||
the persistent bitmap named <code>1525889631</code>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
@@ -37,17 +37,6 @@
|
||||
management application to choose an appropriate mode for a pass-through
|
||||
host device as well as which adapter to utilize.</p>
|
||||
|
||||
<p>Some XML elements may be entirely omitted from the domaincapabilities
|
||||
XML, depending on what the libvirt driver has filled in. Applications
|
||||
should only act on what is explicitly reported in the domaincapabilities
|
||||
XML. For example, if <disk supported='yes'/> is present, you can safely
|
||||
assume the driver supports <disk> devices. If <disk supported='no'/> is
|
||||
present, you can safely assume the driver does NOT support <disk>
|
||||
devices. If the <disk> block is omitted entirely, the driver is not
|
||||
indicating one way or the other whether it supports <disk> devices, and
|
||||
applications should not interpret the missing block to mean any thing in
|
||||
particular.</p>
|
||||
|
||||
<h2><a id="elements">Element and attribute overview</a></h2>
|
||||
|
||||
<p> A new query interface was added to the virConnect API's to retrieve the
|
||||
@@ -119,10 +108,6 @@
|
||||
<domainCapabilities>
|
||||
...
|
||||
<os supported='yes'>
|
||||
<enum name='firmware'>
|
||||
<value>bios</value>
|
||||
<value>efi</value>
|
||||
</enum>
|
||||
<loader supported='yes'>
|
||||
<value>/usr/share/OVMF/OVMF_CODE.fd</value>
|
||||
<enum name='type'>
|
||||
@@ -133,61 +118,29 @@
|
||||
<value>yes</value>
|
||||
<value>no</value>
|
||||
</enum>
|
||||
<enum name='secure'>
|
||||
<value>yes</value>
|
||||
<value>no</value>
|
||||
</enum>
|
||||
</loader>
|
||||
</os>
|
||||
...
|
||||
<domainCapabilities>
|
||||
</pre>
|
||||
|
||||
<p>The <code>firmware</code> enum corresponds to the
|
||||
<code>firmware</code> attribute of the <code>os</code> element in
|
||||
the domain XML. The presence of this enum means libvirt is capable
|
||||
of the so-called firmware auto-selection feature. And the listed
|
||||
firmware values represent the accepted input in the domain
|
||||
XML. Note that the <code>firmware</code> enum reports only those
|
||||
values for which a firmware "descriptor file" exists on the host.
|
||||
Firmware descriptor file is a small JSON document that describes
|
||||
details about a given BIOS or UEFI binary on the host, e.g. the
|
||||
fimware binary path, its architecture, supported machine types,
|
||||
NVRAM template, etc. This ensures that the reported values won't
|
||||
cause a failure on guest boot.
|
||||
</p>
|
||||
|
||||
<p>For the <code>loader</code> element, the following can occur:</p>
|
||||
|
||||
<dl>
|
||||
<dt><code>value</code></dt>
|
||||
<dd>List of known firmware binary paths. Currently this is used
|
||||
only to advertise the known location of OVMF binaries for
|
||||
QEMU. OVMF binaries will only be listed if they actually exist on
|
||||
host.</dd>
|
||||
<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>
|
||||
<dd>Whether the boot loader is a typical BIOS (<code>rom</code>)
|
||||
or a UEFI firmware (<code>pflash</code>). Each <code>value</code>
|
||||
sub-element under the <code>type</code> enum represents a possible
|
||||
value for the <code>type</code> attribute for the <loader/>
|
||||
element in the domain XML. E.g. the presence
|
||||
of <code>pfalsh</code> under the <code>type</code> enum means that
|
||||
a domain XML can use UEFI firmware via: <loader/>
|
||||
type="pflash" ...>/path/to/the/firmware/binary/</loader>.
|
||||
</dd>
|
||||
<dd>Whether loader is a typical BIOS (<code>rom</code>) or
|
||||
an UEFI binary (<code>pflash</code>). This refers to
|
||||
<code>type</code> attribute of the <loader/>
|
||||
element.</dd>
|
||||
|
||||
<dt><code>readonly</code></dt>
|
||||
<dd>Options for the <code>readonly</code> attribute of the
|
||||
<loader/> element in the domain XML.</dd>
|
||||
|
||||
<dt><code>secure</code></dt>
|
||||
<dd>Options for the <code>secure</code> attribute of the
|
||||
<loader/> element in the domain XML. Note that the
|
||||
value <code>yes</code> is listed only if libvirt detects a
|
||||
firmware descriptor file that has path to an OVMF binary that
|
||||
supports Secure boot, and lists its architecture and supported
|
||||
machine type.</dd>
|
||||
<loader/> element.</dd>
|
||||
</dl>
|
||||
|
||||
<h3><a id="elementsCPU">CPU configuration</a></h3>
|
||||
@@ -325,6 +278,7 @@
|
||||
<value>virtio</value>
|
||||
<value>xen</value>
|
||||
<value>usb</value>
|
||||
<value>uml</value>
|
||||
<value>sata</value>
|
||||
<value>sd</value>
|
||||
</enum>
|
||||
@@ -463,41 +417,6 @@
|
||||
element.</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<h4><a id="elementsRNG">RNG device</a></h4>
|
||||
<p>RNG device capabilities are exposed under the
|
||||
<code>rng</code> element. For instance:</p>
|
||||
|
||||
<pre>
|
||||
<domainCapabilities>
|
||||
...
|
||||
<devices>
|
||||
<rng supported='yes'>
|
||||
<enum name='model'>
|
||||
<value>virtio</value>
|
||||
<value>virtio-transitional</value>
|
||||
<value>virtio-non-transitional</value>
|
||||
</enum>
|
||||
<enum name='backendModel'>
|
||||
<value>random</value>
|
||||
<value>egd</value>
|
||||
</enum>
|
||||
</rng>
|
||||
...
|
||||
</devices>
|
||||
</domainCapabilities>
|
||||
</pre>
|
||||
|
||||
<dl>
|
||||
<dt><code>model</code></dt>
|
||||
<dd>Options for the <code>model</code> attribute of the
|
||||
<rng> element.</dd>
|
||||
<dt><code>backendModel</code></dt>
|
||||
<dd>Options for the <code>model</code> attribute of the
|
||||
<rng><backend> element.</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<h3><a id="elementsFeatures">Features</a></h3>
|
||||
|
||||
<p>One more set of XML elements describe the supported features and
|
||||
@@ -516,8 +435,6 @@
|
||||
</gic>
|
||||
<vmcoreinfo supported='yes'/>
|
||||
<genid supported='yes'/>
|
||||
<backingStoreInput supported='yes'/>
|
||||
<backup supported='yes'/>
|
||||
<sev>
|
||||
<cbitpos>47</cbitpos>
|
||||
<reduced-phys-bits>1</reduced-phys-bits>
|
||||
@@ -554,20 +471,6 @@
|
||||
|
||||
<p>Reports whether the genid feature can be used by the domain.</p>
|
||||
|
||||
<h4><a id="featureBackingStoreInput">backingStoreInput</a></h4>
|
||||
|
||||
<p>Reports whether the hypervisor will obey the <backingStore>
|
||||
elements configured for a <disk> when booting the guest, hotplugging
|
||||
the disk to a running guest, or similar.
|
||||
</p>
|
||||
|
||||
<h4><a id="featureBackup">backup</a></h4>
|
||||
|
||||
<p>Reports whether the hypervisor supports the backup, checkpoint, and
|
||||
related features. (<code>virDomainBackupBegin</code>,
|
||||
<code>virDomainCheckpointCreateXML</code> etc).
|
||||
</p>
|
||||
|
||||
<h4><a id="elementsSEV">SEV capabilities</a></h4>
|
||||
|
||||
<p>AMD Secure Encrypted Virtualization (SEV) capabilities are exposed under
|
||||
@@ -578,9 +481,10 @@
|
||||
encrypted with a key unique to that VM.</p>
|
||||
|
||||
<p>
|
||||
For more details on the SEV feature, please follow resources in the
|
||||
AMD developer's document store. In order to use SEV with libvirt have
|
||||
a look at <a href="formatdomain.html#launchSecurity">SEV in domain XML</a>
|
||||
For more details on SEV feature see:
|
||||
<a href="https://support.amd.com/TechDocs/55766_SEV-KM%20API_Specification.pdf">
|
||||
SEV API spec</a> and <a href="http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/12/AMD_Memory_Encryption_Whitepaper_v7-Public.pdf">
|
||||
SEV White Paper</a>
|
||||
</p>
|
||||
|
||||
<dl>
|
||||
|
@@ -107,13 +107,13 @@
|
||||
may also be connected to the LAN. When defining
|
||||
a new network with a <code><forward></code> mode of
|
||||
|
||||
"nat", "route", or "open" (or an isolated network with
|
||||
"nat" or "route" (or an isolated network with
|
||||
no <code><forward></code> element), libvirt will
|
||||
automatically generate a unique name for the bridge device if
|
||||
none is given, and this name will be permanently stored in the
|
||||
network configuration so that that the same name will be used
|
||||
every time the network is started. For these types of networks
|
||||
(nat, route, open, and isolated), a bridge name beginning with the
|
||||
(nat, routed, and isolated), a bridge name beginning with the
|
||||
prefix "virbr" is recommended (and that is what is
|
||||
auto-generated), but not enforced.
|
||||
Attribute <code>stp</code> specifies if Spanning Tree Protocol
|
||||
@@ -152,23 +152,6 @@
|
||||
<span class="since">Since 1.2.11, requires kernel 3.17 or
|
||||
newer</span>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The optional <code>zone</code> attribute of
|
||||
the <code>bridge</code> element is used to specify
|
||||
the <a href="https://firewalld.org">firewalld</a>
|
||||
zone for the bridge of a network with <code>forward</code>
|
||||
mode of "nat", "route", "open", or one with
|
||||
no <code>forward</code> specified. By default, the bridges
|
||||
of all virtual networks with these forward modes are placed
|
||||
in the firewalld zone named "libvirt", which permits
|
||||
incoming DNS, DHCP, TFTP, and SSH to the host from guests on
|
||||
the network. This behavior can be changed either by
|
||||
modifying the libvirt zone (using firewalld management
|
||||
tools), or by placing the network in a different zone (which
|
||||
will also be managed using firewalld tools).
|
||||
<span class="since">Since 5.1.0</span>
|
||||
</p>
|
||||
</dd>
|
||||
|
||||
<dt><code>mtu</code></dt>
|
||||
@@ -1096,28 +1079,6 @@
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h3><a id="elementsNamespaces">Network namespaces</a></h3>
|
||||
|
||||
<p>
|
||||
A special XML namespace is available for passing options directly to the
|
||||
underlying dnsmasq configuration file. Usage of XML namespaces comes with no
|
||||
support guarantees, so use at your own risk.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This example XML will pass the option strings <code>foo=bar</code> and
|
||||
<code>cname=*.foo.example.com,master.example.com</code> directly to the
|
||||
underlying dnsmasq instance.
|
||||
<pre>
|
||||
<network xmlns:dnsmasq='http://libvirt.org/schemas/network/dnsmasq/1.0'>
|
||||
...
|
||||
<dnsmasq:options>
|
||||
<dnsmasq:option value="foo=bar"/>
|
||||
<dnsmasq:option value="cname=*.foo.example.com,master.example.com"/>
|
||||
</dnsmasq:options>
|
||||
</network></pre>
|
||||
</p>
|
||||
|
||||
<h2><a id="examples">Example configuration</a></h2>
|
||||
|
||||
<h3><a id="examplesNAT">NAT based network</a></h3>
|
||||
|
@@ -1,212 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1>Network XML format</h1>
|
||||
|
||||
<ul id="toc">
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
This page provides an introduction to the network port XML format.
|
||||
This stores information about the connection between a virtual
|
||||
interface of a virtual domain, and the virtual network it is
|
||||
attached to.
|
||||
</p>
|
||||
|
||||
<h2><a id="elements">Element and attribute overview</a></h2>
|
||||
|
||||
<p>
|
||||
The root element required for all virtual network ports is
|
||||
named <code>networkport</code> and has no configurable attributes
|
||||
The network port XML format is available <span class="since">since
|
||||
5.5.0</span>
|
||||
</p>
|
||||
|
||||
<h3><a id="elementsMetadata">General metadata</a></h3>
|
||||
|
||||
<p>
|
||||
The first elements provide basic metadata about the virtual
|
||||
network port.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<networkport
|
||||
<uuid>7ae63b5f-fe96-4af0-a7c3-da04ba1b3f54</uuid>
|
||||
<owner>
|
||||
<uuid>06578fc1-c686-46fa-bc2c-220893b466a6</uuid>
|
||||
<name>myguest<name>
|
||||
</owner>
|
||||
<group>webfront<group>
|
||||
<mac address='52:54:0:7b:35:93'/>
|
||||
...</pre>
|
||||
|
||||
<dl>
|
||||
<dt><code>uuid</code></dt>
|
||||
<dd>The content of the <code>uuid</code> element provides
|
||||
a globally unique identifier for the virtual network port.
|
||||
The format must be RFC 4122 compliant, eg <code>3e3fce45-4f53-4fa7-bb32-11f34168b82b</code>.
|
||||
If omitted when defining/creating a new network port, a random
|
||||
UUID is generated.</dd>
|
||||
<dd>The <code>owner</code> node records the domain object that
|
||||
is the owner of the network port. It contains two child nodes:
|
||||
<dl>
|
||||
<dt><code>uuid</code></dt>
|
||||
<dd>The content of the <code>uuid</code> element provides
|
||||
a globally unique identifier for the virtual domain.</dd>
|
||||
<dt><code>name</code></dt>
|
||||
<dd>The unique name of the virtual domain</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt><code>group</code></dt>
|
||||
<dd>The port group in the virtual network to which the
|
||||
port belongs. Can be omitted if no port groups are
|
||||
defined on the network.</dd>
|
||||
<dt><code>mac</code></dt>
|
||||
<dd>The <code>address</code> attribute provides the MAC
|
||||
address of the virtual port that will be see by the
|
||||
guest. The MAC address must not start with 0xFE as this
|
||||
byte is reserved for use on the host side of the port.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h3><a id="elementsCommon">Common elements</a></h3>
|
||||
|
||||
<p>
|
||||
The following elements are common to one or more of the plug
|
||||
types listed later
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<bandwidth>
|
||||
<inbound average='1000' peak='5000' floor='200' burst='1024'/>
|
||||
<outbound average='128' peak='256' burst='256'/>
|
||||
</bandwidth>
|
||||
<rxfilters trustGuest='yes'/>
|
||||
<virtualport type='802.1Qbg'>
|
||||
<parameters managerid='11' typeid='1193047' typeidversion='2'/>
|
||||
</virtualport>
|
||||
...</pre>
|
||||
|
||||
<dl>
|
||||
<dt><code>bandwidth</code></dt>
|
||||
<dd>This part of the network port XML provides setting quality of service.
|
||||
Incoming and outgoing traffic can be shaped independently.
|
||||
The <code>bandwidth</code> element and its child elements are described
|
||||
in the <a href="formatnetwork.html#elementQoS">QoS</a> section of
|
||||
the Network XML. In addition the <code>classID</code> attribute may
|
||||
exist to provide the ID of the traffic shaping class that is active.
|
||||
</dd>
|
||||
<dt><code>rxfilters</code></dt>
|
||||
<dd>The <code>rxfilters</code> element property
|
||||
<code>trustGuest</code> provides the
|
||||
capability for the host to detect and trust reports from the
|
||||
guest regarding changes to the interface mac address and receive
|
||||
filters by setting the attribute to <code>yes</code>. The default
|
||||
setting for the attribute is <code>no</code> for security
|
||||
reasons and support depends on the guest network device model as
|
||||
well as the type of connection on the host - currently it is
|
||||
only supported for the virtio device model and for macvtap
|
||||
connections on the host.
|
||||
</dd>
|
||||
<dt><code>virtualport</code></dt>
|
||||
<dd>The <code>virtualport</code> element describes metadata that
|
||||
needs to be provided to the underlying network subsystem. It
|
||||
is described in the domain XML
|
||||
<a href="formatdomain.html#elementsNICS">interface documentation</a>.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<h3><a id="elementsPlug">Plugs</a></h3>
|
||||
|
||||
<p>
|
||||
The <code>plug</code> element has varying content depending
|
||||
on the value of the <code>type</code> attribute.
|
||||
</p>
|
||||
|
||||
<h4><a id="elementsPlugNetwork">Network</a></h4>
|
||||
|
||||
<p>
|
||||
The <code>network</code> plug type refers to a managed virtual
|
||||
network plug that is based on a traditional software bridge
|
||||
device privately managed by libvirt.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<plug type='network' bridge='virbr0'/>
|
||||
...</pre>
|
||||
|
||||
<p>
|
||||
The <code>bridge</code> attribute provides the name of the
|
||||
privately managed bridge device associated with the virtual
|
||||
network.
|
||||
</p>
|
||||
|
||||
<h4><a id="elementsPlugNetwork">Bridge</a></h4>
|
||||
|
||||
<p>
|
||||
The <code>bridge</code> plug type refers to an externally
|
||||
managed traditional software bridge.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<plug type='bridge' bridge='br2'/>
|
||||
...</pre>
|
||||
|
||||
<p>
|
||||
The <code>bridge</code> attribute provides the name of the
|
||||
externally managed bridge device associated with the virtual
|
||||
network.
|
||||
</p>
|
||||
|
||||
<h4><a id="elementsPlugNetwork">Direct</a></h4>
|
||||
|
||||
<p>
|
||||
The <code>direct</code> plug type refers to a connection
|
||||
directly to a physical network interface.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<plug type='direct' dev='ens3' mode='vepa'/>
|
||||
...</pre>
|
||||
|
||||
<p>
|
||||
The <code>dev</code> attribute provides the name of the
|
||||
physical network interface to which the port will be
|
||||
connected. The <code>mode</code> attribute describes
|
||||
how the connection will be setup and takes the same
|
||||
values described in the
|
||||
<a href="formatdomain.html#elementsNICSDirect">domain XML</a>.
|
||||
</p>
|
||||
|
||||
<h4><a id="elementsPlugNetwork">Host PCI</a></h4>
|
||||
|
||||
<p>
|
||||
The <code>hostdev-pci</code> plug type refers to the
|
||||
passthrough of a physical PCI device rather than emulation.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<plug type='hostdev-pci' managed='yes'>
|
||||
<driver name='vfio'/>
|
||||
<address domain='0x0001' bus='0x02' slot='0x03' function='0x4'/>
|
||||
</plug>
|
||||
...</pre>
|
||||
|
||||
<p>
|
||||
The <code>managed</code> attribute indicates who is responsible for
|
||||
managing the PCI device in the host. When set to the value <code>yes</code>
|
||||
libvirt is responsible for automatically detaching the device from host
|
||||
drivers and resetting it if needed. If the value is <code>no</code>,
|
||||
some other party must ensure the device is not attached to any
|
||||
host drivers.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -70,10 +70,6 @@
|
||||
<dd>Describes a device on the host's PCI bus. Sub-elements
|
||||
include:
|
||||
<dl>
|
||||
<dt><code>class</code></dt>
|
||||
<dd>Optional element for combined class, subclass and
|
||||
programming interface codes as 6-digit hexadecimal number.
|
||||
<span class="since">Since 5.2.0</span></dd>
|
||||
<dt><code>domain</code></dt>
|
||||
<dd>Which domain the device belongs to.</dd>
|
||||
<dt><code>bus</code></dt>
|
||||
@@ -385,7 +381,6 @@
|
||||
<name>igb</name>
|
||||
</driver>
|
||||
<capability type='pci'>
|
||||
<class>0x020000</class>
|
||||
<domain>0</domain>
|
||||
<bus>2</bus>
|
||||
<slot>0</slot>
|
||||
|
@@ -2265,7 +2265,7 @@ echo 3 > /proc/sys/net/netfilter/nf_conntrack_icmp_timeout
|
||||
to the incoming and outgoing direction. All this is related to the ftp
|
||||
data traffic originating from TCP port 20 of the VM. This then leads to
|
||||
the following solution
|
||||
<span class="since">(since 0.8.5 (QEMU, KVM))</span>:
|
||||
<span class="since">(since 0.8.5 (QEMU, KVM, UML))</span>:
|
||||
</p>
|
||||
<pre>
|
||||
<filter name='test-eth0'>
|
||||
|
@@ -42,8 +42,8 @@
|
||||
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>,
|
||||
<code>tls</code>, and <code>vtpm</code> are defined. Specific usage
|
||||
categories are described below.
|
||||
and <code>tls</code> are defined. Specific usage categories
|
||||
are described below.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@@ -322,63 +322,6 @@ Secret 718c71bd-67b5-4a2b-87ec-a24e8ca200dc created
|
||||
<pre>
|
||||
# MYSECRET=`printf %s "letmein" | base64`
|
||||
# virsh secret-set-value 718c71bd-67b5-4a2b-87ec-a24e8ca200dc $MYSECRET
|
||||
Secret value set
|
||||
|
||||
</pre>
|
||||
|
||||
<h3><a id="vTPMUsageType">Usage type "vtpm"</a></h3>
|
||||
|
||||
<p>
|
||||
This secret is associated with a virtualized TPM (vTPM) and serves
|
||||
as a passphrase for deriving a key from for encrypting the state
|
||||
of the vTPM.
|
||||
The <code><usage type='vtpm'></code> element must contain
|
||||
a single <code>name</code> element that specifies a usage name
|
||||
for the secret. The vTPM secret can then be used by UUID
|
||||
via the <code><encryption></code> element of
|
||||
a <a href="formatdomain.html#elementsTpm">tpm</a> when using an
|
||||
emulator.
|
||||
<span class="since">Since 5.6.0</span>. The following is an example
|
||||
of the steps to be taken. First create a vtpm-secret.xml file: </p>
|
||||
|
||||
<pre>
|
||||
# cat vtpm-secret.xml
|
||||
<secret ephemeral='no' private='yes'>
|
||||
<description>sample vTPM secret</description>
|
||||
<usage type='vtpm'>
|
||||
<name>VTPM_example</name>
|
||||
</usage>
|
||||
</secret>
|
||||
|
||||
# virsh secret-define vtpm-secret.xml
|
||||
Secret 6dd3e4a5-1d76-44ce-961f-f119f5aad935 created
|
||||
|
||||
# virsh secret-list
|
||||
UUID Usage
|
||||
----------------------------------------------------------------------------------------
|
||||
6dd3e4a5-1d76-44ce-961f-f119f5aad935 vtpm VTPM_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 decrypt the vTPM state.
|
||||
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 "open sesame" | base64`
|
||||
# virsh secret-set-value 6dd3e4a5-1d76-44ce-961f-f119f5aad935 $MYSECRET
|
||||
Secret value set
|
||||
|
||||
</pre>
|
||||
|
@@ -9,9 +9,7 @@
|
||||
<h2><a id="SnapshotAttributes">Snapshot XML</a></h2>
|
||||
|
||||
<p>
|
||||
Snapshots are one form
|
||||
of <a href="kbase/domainstatecapture.html">domain state
|
||||
capture</a>. There are several types of snapshots:
|
||||
There are several types of snapshots:
|
||||
</p>
|
||||
<dl>
|
||||
<dt>disk snapshot</dt>
|
||||
@@ -35,7 +33,7 @@
|
||||
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>full system</dt>
|
||||
<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
|
||||
@@ -57,12 +55,11 @@
|
||||
as <code>virDomainSaveImageGetXMLDesc()</code> to work with
|
||||
those files.
|
||||
</p>
|
||||
<p>Full system snapshots are created
|
||||
by <code>virDomainSnapshotCreateXML()</code> with no flags, while
|
||||
<p>System checkpoints are created
|
||||
by <code>virDomainSnapshotCreateXML()</code> with no flags, and
|
||||
disk snapshots are created by the same function with
|
||||
the <code>VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY</code>
|
||||
flag. Regardless of the flags provided, restoration of the
|
||||
snapshot is handled by
|
||||
the <code>VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY</code> flag; in
|
||||
both cases, they are restored by
|
||||
the <code>virDomainRevertToSnapshot()</code> function. For
|
||||
these types of snapshots, libvirt tracks each snapshot as a
|
||||
separate <code>virDomainSnapshotPtr</code> object, and maintains
|
||||
@@ -81,8 +78,7 @@
|
||||
redefining a snapshot (<span class="since">since 0.9.5</span>),
|
||||
with the <code>VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE</code> flag
|
||||
of <code>virDomainSnapshotCreateXML()</code>, all of the XML
|
||||
described here is relevant on input, even the fields that are
|
||||
normally described as readonly for output.
|
||||
described here is relevant.
|
||||
</p>
|
||||
<p>
|
||||
Snapshots are maintained in a hierarchy. A domain can have a
|
||||
@@ -93,9 +89,7 @@
|
||||
sets that snapshot as current, and the prior current snapshot is
|
||||
the parent of the new snapshot. Branches in the hierarchy can
|
||||
be formed by reverting to a snapshot with a child, then creating
|
||||
another snapshot. For now, the creation of external snapshots
|
||||
when checkpoints exist is forbidden, although future work will
|
||||
make it possible to integrate these two concepts.
|
||||
another snapshot.
|
||||
</p>
|
||||
<p>
|
||||
The top-level <code>domainsnapshot</code> element may contain
|
||||
@@ -103,14 +97,16 @@
|
||||
</p>
|
||||
<dl>
|
||||
<dt><code>name</code></dt>
|
||||
<dd>The optional name for this snapshot. If the name is
|
||||
omitted, libvirt will create a name based on the time of the
|
||||
creation.
|
||||
<dd>The name for this snapshot. If the name is specified when
|
||||
initially creating the snapshot, then the snapshot will have
|
||||
that particular name. If the name is omitted when initially
|
||||
creating the snapshot, then libvirt will make up a name for
|
||||
the snapshot, based on the time when it was created.
|
||||
</dd>
|
||||
<dt><code>description</code></dt>
|
||||
<dd>An optional human-readable description of the snapshot. If
|
||||
the description is omitted when initially creating the
|
||||
snapshot, then this field will be empty.
|
||||
<dd>A human-readable description of the snapshot. If the
|
||||
description is omitted when initially creating the snapshot,
|
||||
then this field will be empty.
|
||||
</dd>
|
||||
<dt><code>memory</code></dt>
|
||||
<dd>On input, this is an optional request for how to handle VM
|
||||
@@ -132,10 +128,13 @@
|
||||
what file name is created in an external snapshot. On output,
|
||||
this is fully populated to show the state of each disk in the
|
||||
snapshot, including any properties that were generated by the
|
||||
hypervisor defaults. For full system snapshots, this field is
|
||||
ignored on input and omitted on output (a full system snapshot
|
||||
implies that all disks participate in the snapshot process).
|
||||
This element has a list of <code>disk</code>
|
||||
hypervisor defaults. For system checkpoints, this field is
|
||||
ignored on input and omitted on output (a system checkpoint
|
||||
implies that all disks participate in the snapshot process,
|
||||
and since the current implementation only does internal system
|
||||
checkpoints, there are no extra details to add); a future
|
||||
release may allow the use of <code>disks</code> with a system
|
||||
checkpoint. This element has a list of <code>disk</code>
|
||||
sub-elements, describing anywhere from zero to all of the
|
||||
disks associated with the domain. <span class="since">Since
|
||||
0.9.5</span>
|
||||
@@ -144,8 +143,8 @@
|
||||
<dd>This sub-element describes the snapshot properties of a
|
||||
specific disk. The attribute <code>name</code> is
|
||||
mandatory, and must match either the <code><target
|
||||
dev='name'/></code> (recommended) or an unambiguous
|
||||
<code><source file='name'/></code> of one of
|
||||
dev='name'/></code> or an unambiguous <code><source
|
||||
file='name'/></code> of one of
|
||||
the <a href="formatdomain.html#elementsDisks">disk
|
||||
devices</a> specified for the domain at the time of the
|
||||
snapshot. The attribute <code>snapshot</code> is
|
||||
@@ -174,12 +173,6 @@
|
||||
snapshots, the original file name becomes the read-only
|
||||
snapshot, and the new file name contains the read-write
|
||||
delta of all disk changes since the snapshot.
|
||||
<p/>
|
||||
The <code>source</code> element also may contain the
|
||||
<code>seclabel</code> element (described in the
|
||||
<a href="formatdomain.html#seclabel">domain XML documentation</a>)
|
||||
which can be used to override the domain security labeling policy
|
||||
for <code>source</code>.
|
||||
</dd>
|
||||
<dt><code>driver</code></dt>
|
||||
<dd>An optional sub-element <code>driver</code>,
|
||||
@@ -187,7 +180,6 @@
|
||||
as qcow2), of the new file created by the external
|
||||
snapshot of the new file.
|
||||
</dd>
|
||||
<dt><code>seclabel</code></dt>
|
||||
</dl>
|
||||
|
||||
<span class="since">Since 1.2.2</span> the <code>disk</code> element
|
||||
@@ -209,50 +201,45 @@
|
||||
</dl>
|
||||
</dd>
|
||||
<dt><code>creationTime</code></dt>
|
||||
<dd>A readonly representation of the time this snapshot was
|
||||
created. The time is specified in seconds since the Epoch,
|
||||
UTC (i.e. Unix time).
|
||||
<dd>The time this snapshot was created. The time is specified
|
||||
in seconds since the Epoch, UTC (i.e. Unix time). Readonly.
|
||||
</dd>
|
||||
<dt><code>state</code></dt>
|
||||
<dd>A readonly representation of the state of the domain at the
|
||||
time this snapshot was taken. If a full system snapshot was
|
||||
created, then this is the state of the domain at that
|
||||
time. When the domain is reverted to this snapshot, the
|
||||
domain's state will default to this state, unless overridden
|
||||
by <code>virDomainRevertToSnapshot()</code> flags to revert to
|
||||
a running or paused state. Additionally, this field can be the
|
||||
value "disk-snapshot" (<span class="since">since 0.9.5</span>)
|
||||
when it represents only a disk snapshot (no VM memory state),
|
||||
and reverting to this snapshot will default to an inactive
|
||||
guest.
|
||||
<dd>The state of the domain at the time this snapshot was taken.
|
||||
If the snapshot was created as a system checkpoint, then this
|
||||
is the state of the domain at that time; when the domain is
|
||||
reverted to this snapshot, the domain's state will default to
|
||||
whatever is in this field unless additional flags are passed
|
||||
to <code>virDomainRevertToSnapshot()</code>. Additionally,
|
||||
this field can be the value "disk-snapshot"
|
||||
(<span class="since">since 0.9.5</span>) when it represents
|
||||
only a disk snapshot (no VM memory state), and reverting to this
|
||||
snapshot will default to an inactive guest. Readonly.
|
||||
</dd>
|
||||
<dt><code>parent</code></dt>
|
||||
<dd>Readonly, present only if this snapshot has a parent. The
|
||||
parent name is given by the sub-element <code>name</code>. The
|
||||
parent relationship allows tracking a tree of related snapshots.
|
||||
<dd>The parent of this snapshot. If present, this element
|
||||
contains exactly one child element, name. This specifies the
|
||||
name of the parent snapshot of this snapshot, and is used to
|
||||
represent trees of snapshots. Readonly.
|
||||
</dd>
|
||||
<dt><code>domain</code></dt>
|
||||
<dd>A readonly representation of the domain that this snapshot
|
||||
was taken against. Older versions of libvirt stored only a
|
||||
single child element, uuid; reverting to a snapshot like this
|
||||
is risky if the current state of the domain differs from the
|
||||
state that the domain was created in, and requires the use of
|
||||
the <code>VIR_DOMAIN_SNAPSHOT_REVERT_FORCE</code> flag
|
||||
<dd>The domain that this snapshot was taken against. Older
|
||||
versions of libvirt stored only a single child element, uuid;
|
||||
reverting to a snapshot like this is risky if the current
|
||||
state of the domain differs from the state that the domain was
|
||||
created in, and requires the use of the
|
||||
<code>VIR_DOMAIN_SNAPSHOT_REVERT_FORCE</code> flag
|
||||
in <code>virDomainRevertToSnapshot()</code>. Newer versions
|
||||
of libvirt (<span class="since">since 0.9.5</span>) store the
|
||||
entire inactive <a href="formatdomain.html">domain
|
||||
configuration</a> at the time of the snapshot
|
||||
(<span class="since">since 0.9.5</span>). The domain will have
|
||||
security-sensitive information omitted
|
||||
unless the flag <code>VIR_DOMAIN_SNAPSHOT_XML_SECURE</code> is
|
||||
provided on a read-write connection.
|
||||
of libvirt (<span class="since">since 0.9.5</span>) store the entire
|
||||
inactive <a href="formatdomain.html">domain configuration</a>
|
||||
at the time of the snapshot (<span class="since">since
|
||||
0.9.5</span>). Readonly.
|
||||
</dd>
|
||||
<dt><code>cookie</code></dt>
|
||||
<dd>An optional readonly representation of a save image cookie
|
||||
containing additional data libvirt may need to properly
|
||||
restore a domain from an active snapshot when such data cannot
|
||||
be stored directly in the <code>domain</code> to maintain
|
||||
compatibility with older libvirt or hypervisor.
|
||||
<dd>Save image cookie containing additional data libvirt may need to
|
||||
properly restore a domain from an active snapshot when such data
|
||||
cannot be stored directly in the <code>domain</code> to maintain
|
||||
compatibility with older libvirt or hypervisor. Readonly.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@@ -264,15 +251,10 @@
|
||||
<domainsnapshot>
|
||||
<description>Snapshot of OS install and updates</description>
|
||||
<disks>
|
||||
<disk name='vda'>
|
||||
<disk name='/path/to/old'>
|
||||
<source file='/path/to/new'/>
|
||||
</disk>
|
||||
<disk name='vdb' snapshot='no'/>
|
||||
<disk name='vdc'>
|
||||
<source file='/path/to/newc'>
|
||||
<seclabel model='dac' relabel='no'/>
|
||||
</source>
|
||||
</disk>
|
||||
</disks>
|
||||
</domainsnapshot></pre>
|
||||
|
||||
|
@@ -19,15 +19,14 @@
|
||||
a single attribute <code>type</code>, which is one of <code>dir</code>,
|
||||
<code>fs</code>, <code>netfs</code>, <code>disk</code>,
|
||||
<code>iscsi</code>, <code>logical</code>, <code>scsi</code>
|
||||
(all <span class="since">since 0.4.1</span>),
|
||||
<code>mpath</code> (<span class="since">since 0.7.1</span>),
|
||||
<code>rbd</code> (<span class="since">since 0.9.13</span>),
|
||||
<code>sheepdog</code> (<span class="since">since 0.10.0</span>),
|
||||
<code>gluster</code> (<span class="since">since 1.2.0</span>),
|
||||
<code>zfs</code> (<span class="since">since 1.2.8</span>),
|
||||
<code>vstorage</code> (<span class="since">since 3.1.0</span>),
|
||||
or <code>iscsi-direct</code> (<span class="since">since 4.7.0</span>).
|
||||
This corresponds to the
|
||||
(all <span class="since">since 0.4.1</span>), <code>mpath</code>
|
||||
(<span class="since">since 0.7.1</span>), <code>rbd</code>
|
||||
(<span class="since">since 0.9.13</span>), <code>sheepdog</code>
|
||||
(<span class="since">since 0.10.0</span>),
|
||||
<code>gluster</code> (<span class="since">since
|
||||
1.2.0</span>), <code>zfs</code> (<span class="since">since
|
||||
1.2.8</span>) or <code>vstorage</code> (<span class="since">since
|
||||
3.1.0</span>). This corresponds to the
|
||||
storage backend drivers listed further along in this document.
|
||||
</p>
|
||||
<h3><a id="StoragePoolFirst">General metadata</a></h3>
|
||||
@@ -122,26 +121,15 @@
|
||||
</source>
|
||||
...</pre>
|
||||
|
||||
<pre>
|
||||
...
|
||||
<source>
|
||||
<host name='localhost'/>
|
||||
<dir path='/var/lib/libvirt/images'/>
|
||||
<format type='nfs'/>
|
||||
<protocol ver='3'/>
|
||||
</source>
|
||||
...</pre>
|
||||
|
||||
<dl>
|
||||
<dt><code>device</code></dt>
|
||||
<dd>Provides the source for pools backed by physical devices
|
||||
(pool types <code>fs</code>, <code>logical</code>, <code>disk</code>,
|
||||
<code>iscsi</code>, <code>iscsi-direct</code>, <code>zfs</code>,
|
||||
<code>vstorage</code>).
|
||||
<code>iscsi</code>, <code>zfs</code>, <code>vstorage</code>).
|
||||
May be repeated multiple times depending on backend driver. Contains
|
||||
a required attribute <code>path</code> which is either the fully
|
||||
qualified path to the block device node or for <code>iscsi</code>
|
||||
or <code>iscsi-direct</code> the iSCSI Qualified Name (IQN).
|
||||
the iSCSI Qualified Name (IQN).
|
||||
<span class="since">Since 0.4.1</span>
|
||||
<p>An optional attribute <code>part_separator</code> for each
|
||||
<code>path</code> may be supplied. Valid values for the attribute
|
||||
@@ -346,7 +334,6 @@
|
||||
<dt><code>host</code></dt>
|
||||
<dd>Provides the source for pools backed by storage from a
|
||||
remote server (pool types <code>netfs</code>, <code>iscsi</code>,
|
||||
<code>iscsi-direct</code>,
|
||||
<code>rbd</code>, <code>sheepdog</code>, <code>gluster</code>). Will be
|
||||
used in combination with a <code>directory</code>
|
||||
or <code>device</code> element. Contains an attribute <code>name</code>
|
||||
@@ -361,19 +348,11 @@
|
||||
server. See the <a href="storage.html">storage driver page</a> for
|
||||
any restrictions for specific storage backends.
|
||||
<span class="since">Since 0.4.1</span></dd>
|
||||
<dt><code>initiator</code></dt>
|
||||
<dd>Required by the <code>iscsi-direct</code> pool in order to provide
|
||||
the iSCSI Qualified Name (IQN) to communicate with the pool's
|
||||
<code>device</code> target IQN. There is one sub-element
|
||||
<code>iqn</code> with the <code>name</code> attribute to describe
|
||||
the IQN for the initiator.
|
||||
<span class="since">Since 4.7.0</span></dd>
|
||||
<dt><code>auth</code></dt>
|
||||
<dd>If present, the <code>auth</code> element provides the
|
||||
authentication credentials needed to access the source by the
|
||||
setting of the <code>type</code> attribute (pool
|
||||
types <code>iscsi</code>, <code>iscsi-direct</code>, <code>rbd</code>).
|
||||
The <code>type</code>
|
||||
types <code>iscsi</code>, <code>rbd</code>). The <code>type</code>
|
||||
must be either "chap" or "ceph". Use "ceph" for
|
||||
Ceph RBD (Rados Block Device) network sources and use "iscsi" for CHAP
|
||||
(Challenge-Handshake Authentication Protocol) iSCSI
|
||||
@@ -407,12 +386,6 @@
|
||||
LVM metadata type. All drivers are required to have a default
|
||||
value for this, so it is optional. <span class="since">Since 0.4.1</span></dd>
|
||||
|
||||
<dt><code>protocol</code></dt>
|
||||
<dd>For a <code>netfs</code> Storage Pool provide a mechanism to
|
||||
define which NFS protocol version number will be used to contact
|
||||
the server's NFS service. The attribute <code>ver</code> accepts
|
||||
an unsigned integer as the version number to use.
|
||||
<span class="since">Since 5.1.0</span></dd>
|
||||
<dt><code>vendor</code></dt>
|
||||
<dd>Provides optional information about the vendor of the
|
||||
storage device. This contains a single
|
||||
@@ -478,8 +451,8 @@
|
||||
The <code>owner</code> element contains the numeric user ID.
|
||||
The <code>group</code> element contains the numeric group ID.
|
||||
If <code>owner</code> or <code>group</code> aren't specified when
|
||||
creating a directory, the UID and GID of the libvirtd process are used.
|
||||
The <code>label</code> element contains the MAC (eg SELinux)
|
||||
creating a directory, the values are inherited from the parent
|
||||
directory. The <code>label</code> element contains the MAC (eg SELinux)
|
||||
label string.
|
||||
<span class="since">Since 0.4.1</span>
|
||||
For running directory or filesystem based pools, these fields
|
||||
@@ -508,145 +481,6 @@
|
||||
device, measured in bytes. <span class="since">Since 0.4.1</span>
|
||||
</p>
|
||||
|
||||
<h3><a id="StoragePoolRefresh">Refresh overrides</a></h3>
|
||||
|
||||
<p>
|
||||
The optional <code>refresh</code> element can control how the pool and
|
||||
associated volumes are refreshed (pool type <code>rbd</code>). The
|
||||
<code>allocation</code> attribute of the <code>volume</code> child element
|
||||
controls the method used for computing the allocation of a volume. The
|
||||
valid attribute values are <code>default</code> to compute the actual
|
||||
usage or <code>capacity</code> to use the logical capacity for cases where
|
||||
computing the allocation is too expensive. The following XML snippet
|
||||
shows the syntax:
|
||||
<pre>
|
||||
<pool type="rbd">
|
||||
<name>myrbdpool</name>
|
||||
...
|
||||
<source/>
|
||||
...
|
||||
<refresh>
|
||||
<volume allocation='capacity'/>
|
||||
</refresh>
|
||||
...
|
||||
</pool>
|
||||
</pre>
|
||||
<span class="since">Since 5.2.0</span>
|
||||
</p>
|
||||
|
||||
<h3><a id="StoragePoolNamespaces">Storage Pool Namespaces</a></h3>
|
||||
|
||||
<p>
|
||||
Usage of Storage Pool Namespaces provides a mechanism to provide
|
||||
pool type specific data in a free form or arbitrary manner via
|
||||
XML syntax targeted solely for the needs of the specific pool type
|
||||
which is not otherwise supported in standard XML. For the "fs" and
|
||||
"netfs" pool types this provides a mechanism to provide additional
|
||||
mount options on the command line. For the "rbd" pool this provides
|
||||
a mechanism to override default settings for RBD configuration options.
|
||||
</p>
|
||||
<p>
|
||||
Usage of namespaces comes with no support guarantees. It is intended
|
||||
for developers testing out a concept prior to requesting an explicitly
|
||||
supported XML option in libvirt, and thus should never be used in
|
||||
production.
|
||||
</p>
|
||||
<dl>
|
||||
<dt><code>fs:mount_opts</code></dt>
|
||||
<dd>Provides an XML namespace mechanism to optionally utilize
|
||||
specifically named options for the mount command via the "-o"
|
||||
option for the <code>fs</code> or <code>netfs</code> type storage
|
||||
pools. In order to designate that the Storage Pool will be using
|
||||
the mechanism, the <code>pool</code> element must be modified to
|
||||
provide the XML namespace attribute syntax as follows:
|
||||
|
||||
<p>
|
||||
xmlns:fs='http://libvirt.org/schemas/storagepool/fs/1.0'
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>fs:mount_opts</code> defines the mount options by
|
||||
specifying multiple <code>fs:option</code> subelements with
|
||||
the attribute <code>name</code> specifying the mount option to
|
||||
be added. The value of the named option is not checked since
|
||||
it's possible options don't exist on all distributions. It is
|
||||
expected that proper and valid options will be supplied for the
|
||||
target host.
|
||||
</p>
|
||||
|
||||
The following XML snippet shows the syntax required in order to
|
||||
utilize for a netfs pool:
|
||||
<pre>
|
||||
<pool type="netfs" xmlns:fs='http://libvirt.org/schemas/storagepool/fs/1.0'>
|
||||
<name>nfsimages</name>
|
||||
...
|
||||
<source>
|
||||
...
|
||||
</source>
|
||||
...
|
||||
<target>
|
||||
...
|
||||
</target>
|
||||
<fs:mount_opts>
|
||||
<fs:option name='sync'/>
|
||||
<fs:option name='lazytime'/>
|
||||
</fs:mount_opts>
|
||||
</pool>
|
||||
...</pre>
|
||||
|
||||
<span class="since">Since 5.1.0.</span></dd>
|
||||
|
||||
<dt><code>rbd:config_opts</code></dt>
|
||||
<dd>Provides an XML namespace mechanism to optionally utilize
|
||||
specifically named options for the RBD configuration options
|
||||
via the rados_conf_set API for the <code>rbd</code> type
|
||||
storage pools. In order to designate that the Storage Pool
|
||||
will be using the mechanism, the <code>pool</code> element
|
||||
must be modified to provide the XML namespace attribute
|
||||
syntax as follows:
|
||||
|
||||
<p>
|
||||
xmlns:rbd='http://libvirt.org/schemas/storagepool/rbd/1.0'
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>rbd:config_opts</code> defines the configuration options
|
||||
by specifying multiple <code>rbd:option</code> subelements with
|
||||
the attribute <code>name</code> specifying the configuration option
|
||||
to be added and <code>value</code> specifying the configuration
|
||||
option value. The name and value for each option is only checked
|
||||
to be not empty. The name and value provided are not checked since
|
||||
it's possible options don't exist on all distributions. It is
|
||||
expected that proper and valid options will be supplied for the
|
||||
target host.
|
||||
</p>
|
||||
|
||||
The following XML snippet shows the syntax required in order to
|
||||
utilize
|
||||
<pre>
|
||||
<pool type="rbd" xmlns:rbd='http://libvirt.org/schemas/storagepool/rbd/1.0'>
|
||||
<name>myrbdpool</name>
|
||||
...
|
||||
<source>
|
||||
...
|
||||
</source>
|
||||
...
|
||||
<target>
|
||||
...
|
||||
</target>
|
||||
...
|
||||
<rbd:config_opts>
|
||||
<rbd:option name='client_mount_timeout' value='45'/>
|
||||
<rbd:option name='rados_mon_op_timeout' value='20'/>
|
||||
<rbd:option name='rados_osd_op_timeout' value='10'/>
|
||||
</rbd:config_opts>
|
||||
</pool>
|
||||
</pre>
|
||||
|
||||
<span class="since">Since 5.1.0.</span></dd>
|
||||
|
||||
</dl>
|
||||
|
||||
<h2><a id="StorageVol">Storage volume XML</a></h2>
|
||||
<p>
|
||||
A storage volume will generally be either a file or a device
|
||||
@@ -802,8 +636,8 @@
|
||||
The <code>owner</code> element contains the numeric user ID.
|
||||
The <code>group</code> element contains the numeric group ID.
|
||||
If <code>owner</code> or <code>group</code> aren't specified when
|
||||
creating a supported volume, the UID and GID of the libvirtd process
|
||||
are used. The <code>label</code> element contains the MAC (eg SELinux)
|
||||
creating a supported volume, the values are inherited from the parent
|
||||
directory. The <code>label</code> element contains the MAC (eg SELinux)
|
||||
label string.
|
||||
For existing directory or filesystem based volumes, these fields
|
||||
will be filled with the values used by the existing file.
|
||||
|
@@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
<h1>Storage Pool Capabilities XML format</h1>
|
||||
|
||||
<ul id="toc"></ul>
|
||||
|
||||
<h2><a id="Overview">Overview</a></h2>
|
||||
|
||||
<p>The Storage Pool Capabilities XML will provide the information
|
||||
to determine what types of Storage Pools exist, whether the pool is
|
||||
supported, and if relevant the source format types, the required
|
||||
source elements, and the target volume format types. </p>
|
||||
|
||||
<p>The Storage Pool Capabilities XML provides more information than the
|
||||
<a href="/html/libvirt-libvirt-host.html#virConnectGetCapabilities">
|
||||
<code>virConnectGetCapabilities</code>
|
||||
</a>
|
||||
which only provides an enumerated list of supported pool types.</p>
|
||||
|
||||
<h2><a id="elements">Element and attribute overview</a></h2>
|
||||
|
||||
<p>A query interface was added to the virConnect API's to retrieve the
|
||||
XML listing of the set of Storage Pool Capabilities
|
||||
(<span class="since">Since 5.2.0</span>):</p>
|
||||
|
||||
<pre>
|
||||
<a href="/html/libvirt-libvirt-domain.html#virConnectGetStoragePoolCapabilities">virConnectGetStoragePoolCapabilities</a>
|
||||
</pre>
|
||||
|
||||
<p>The root element that emulator capability XML document starts with is
|
||||
named <code>storagepoolCapabilities</code>. There will be any number of
|
||||
<code>pool</code> child elements with two attributes <code>type</code>
|
||||
and <code>supported</code>. Each <code>pool</code> element may have
|
||||
a <code>poolOptions</code> or <code>volOptions</code> subelements to
|
||||
describe the available features. Sample XML output is:</p>
|
||||
|
||||
<pre>
|
||||
<storagepoolCapabilities>
|
||||
<pool type='dir' supported='yes'>
|
||||
<volOptions>
|
||||
<defaultFormat type='raw'</>
|
||||
<enum name='targetFormatType'>
|
||||
<value>none</value>
|
||||
<value>raw</value>
|
||||
...
|
||||
</enum>
|
||||
</volOptions>
|
||||
</pool>
|
||||
<pool type='fs' supported='yes'>
|
||||
<poolOptions>
|
||||
<defaultFormat type='auto'</>
|
||||
<enum name='sourceFormatType'>
|
||||
<value>auto</value>
|
||||
<value>ext2</value>
|
||||
...
|
||||
</enum>
|
||||
</poolOptions>
|
||||
<volOptions>
|
||||
<defaultFormat type='raw'</>
|
||||
<enum name='targetFormatType'>
|
||||
<value>none</value>
|
||||
<value>raw</value>
|
||||
...
|
||||
</enum>
|
||||
</volOptions>
|
||||
</pool>
|
||||
...
|
||||
</storagepoolCapabilities>
|
||||
</pre>
|
||||
|
||||
<p>The following section decribes subelements of the
|
||||
<code>poolOptions</code> and <code>volOptions</code> subelements </p>:
|
||||
|
||||
<dl>
|
||||
<dt><code>defaultFormat</code></dt>
|
||||
<dd>For the <code>poolOptions</code>, the <code>type</code> attribute
|
||||
describes the default format name used for the pool source. For the
|
||||
<code>volOptions</code>, the <code>type</code> attribute describes
|
||||
the default volume name used for each volume.
|
||||
</dd>
|
||||
<dl>
|
||||
<dt><code>enum</code></dt>
|
||||
<dd>Each enum uses a name from the list below with any number of
|
||||
<code>value</code> value subelements describing the valid values.
|
||||
<dl>
|
||||
<dt><code>sourceFormatType</code></dt>
|
||||
<dd>Lists all the possible <code>poolOptions</code> source
|
||||
pool format types.
|
||||
</dd>
|
||||
<dt><code>targetFormatType</code></dt>
|
||||
<dd>Lists all the possible <code>volOptions</code> target volume
|
||||
format types.
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
</dl>
|
||||
</body>
|
||||
</html>
|
124
docs/genaclperms.pl
Executable file
124
docs/genaclperms.pl
Executable file
@@ -0,0 +1,124 @@
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
# Copyright (C) 2013 Red Hat, Inc.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my @objects = (
|
||||
"CONNECT", "DOMAIN", "INTERFACE",
|
||||
"NETWORK","NODE_DEVICE", "NWFILTER",
|
||||
"SECRET", "STORAGE_POOL", "STORAGE_VOL",
|
||||
);
|
||||
|
||||
my %class;
|
||||
|
||||
foreach my $object (@objects) {
|
||||
my $class = lc $object;
|
||||
|
||||
$class =~ s/(^\w|_\w)/uc $1/eg;
|
||||
$class =~ s/_//g;
|
||||
$class =~ s/Nwfilter/NWFilter/;
|
||||
$class = "vir" . $class . "Ptr";
|
||||
|
||||
$class{$object} = $class;
|
||||
}
|
||||
|
||||
my $objects = join ("|", @objects);
|
||||
|
||||
my %opts;
|
||||
my $in_opts = 0;
|
||||
|
||||
my %perms;
|
||||
|
||||
while (<>) {
|
||||
if ($in_opts) {
|
||||
if (m,\*/,) {
|
||||
$in_opts = 0;
|
||||
} elsif (/\*\s*\@(\w+):\s*(.*?)\s*$/) {
|
||||
$opts{$1} = $2;
|
||||
}
|
||||
} elsif (m,/\*\*,) {
|
||||
$in_opts = 1;
|
||||
} elsif (/VIR_ACCESS_PERM_($objects)_((?:\w|_)+),/) {
|
||||
my $object = $1;
|
||||
my $perm = lc $2;
|
||||
next if $perm eq "last";
|
||||
|
||||
$perm =~ s/_/-/g;
|
||||
|
||||
$perms{$object} = {} unless exists $perms{$object};
|
||||
$perms{$object}->{$perm} = {
|
||||
desc => $opts{desc},
|
||||
message => $opts{message},
|
||||
anonymous => $opts{anonymous}
|
||||
};
|
||||
%opts = ();
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<body>
|
||||
EOF
|
||||
|
||||
foreach my $object (sort { $a cmp $b } keys %perms) {
|
||||
my $class = $class{$object};
|
||||
my $olink = lc "object_" . $object;
|
||||
print <<EOF;
|
||||
<h3><a name="$olink">$class</a></h3>
|
||||
<table class="acl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Permission</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
EOF
|
||||
|
||||
foreach my $perm (sort { $a cmp $b } keys %{$perms{$object}}) {
|
||||
my $description = $perms{$object}->{$perm}->{desc};
|
||||
|
||||
die "missing description for $object.$perm" unless
|
||||
defined $description;
|
||||
|
||||
my $plink = lc "perm_" . $object . "_" . $perm;
|
||||
$plink =~ s/-/_/g;
|
||||
|
||||
print <<EOF;
|
||||
<tr>
|
||||
<td><a name="$plink">$perm</a></td>
|
||||
<td>$description</td>
|
||||
</tr>
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
</tbody>
|
||||
</table>
|
||||
EOF
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
@@ -72,11 +72,11 @@ h6 {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
code, pre, tt {
|
||||
code, pre {
|
||||
font-family: LibvirtOverpassMono;
|
||||
}
|
||||
|
||||
dd code, p code, tt {
|
||||
dd code, p code {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
|
@@ -1,25 +0,0 @@
|
||||
# Silly mistakes, mostly found in S-o-b or R-b tags.
|
||||
|
||||
"jdenemar redhat com" jdenemar@redhat.com
|
||||
"pkrempa@redhat st.com" pkrempa@redhat.com
|
||||
jyang@redhat jyang@redhat.com
|
||||
wangjie88.huawei.com wangjie88@huawei.com
|
||||
|
||||
# This is information that's already present in .mailmap, and having to
|
||||
# duplicate it is annoying. Unfortunately gitdm doesn't parse .mailmap
|
||||
# and the format is different, so we can't just point it to the file
|
||||
# either.
|
||||
|
||||
cedric.bosdonnat@free.fr cbosdonnat@suse.com
|
||||
dan@berrange.com berrange@redhat.com
|
||||
fabiano@fidencio.org fidencio@redhat.com
|
||||
intrigeri+libvirt@boum.org intrigeri@boum.org
|
||||
jim@meyering.net meyering@redhat.com
|
||||
laine@laine.org laine@redhat.com
|
||||
redhat@adrb.pl adrian.brzezinski@eo.pl
|
||||
shilei.massclouds@gmx.com shi_lei@massclouds.com
|
||||
|
||||
# This deviates from what's found in .mailmap, but it makes more sense as
|
||||
# far as gitdm is concerned since Jim was employed by Novell at the time.
|
||||
|
||||
jfehlig@linux-ypgk.site jfehlig@novell.com
|
@@ -1,11 +0,0 @@
|
||||
canonical.com
|
||||
|
||||
# Having an @ubuntu.com email address doesn't necessarily imply you're
|
||||
# a Canonical employee; these people, however, seem to have been employed
|
||||
# by Canonical at the time they contributed to libvirt.
|
||||
|
||||
jamie@ubuntu.com
|
||||
serge.hallyn@ubuntu.com
|
||||
smoser@ubuntu.com
|
||||
soren@ubuntu.com
|
||||
wgrant@ubuntu.com
|
@@ -1,2 +0,0 @@
|
||||
datto.com
|
||||
dattobackup.com
|
@@ -1,4 +0,0 @@
|
||||
dreamhost.com
|
||||
dreamhost.net
|
||||
newdream.com
|
||||
newdream.net
|
@@ -1,7 +0,0 @@
|
||||
ibm.com
|
||||
|
||||
# These IBM employees used their personal email address when contributing
|
||||
# to libvirt and we don't have the corresponding @ibm.com address on file.
|
||||
|
||||
danielhb413@gmail.com
|
||||
jcfaracco@gmail.com
|
@@ -1,2 +0,0 @@
|
||||
nec.co.jp
|
||||
nec.com
|
@@ -1,102 +0,0 @@
|
||||
6wind.com 6WIND
|
||||
active.by ActiveCloud
|
||||
aero.org Aerospace
|
||||
akamai.com Akamai
|
||||
amd.com AMD
|
||||
anchor.net.au Anchor
|
||||
aristanetworks.com Arista Networks
|
||||
arpnetworks.com ARP Networks
|
||||
av-test.de AV-TEST
|
||||
b1-systems.de B1 Systems
|
||||
baidu.com Baidu
|
||||
brightbox.co.uk Brightbox
|
||||
cisco.com Cisco
|
||||
citrix.com Citrix
|
||||
cloudwatt.com Cloudwatt
|
||||
codethink.co.uk Codethink
|
||||
cumulusnetworks.com Cumulus Networks
|
||||
dataductus.se Data Ductus
|
||||
datagravity.com DataGravity
|
||||
dell.com Dell
|
||||
designassembly.de Coffee-Break-Games
|
||||
diateam.net DIATEAM
|
||||
eldorado.org.br ELDORADO
|
||||
endocode.com Endocode
|
||||
eo.pl eo Networks
|
||||
ericsson.com Ericsson
|
||||
fb.com Facebook
|
||||
firewall-services.com Firewall-Services
|
||||
freescale.com Freescale
|
||||
fujitsu.com Fujitsu
|
||||
gluster.com Gluster
|
||||
gridcentric.ca Gridcentric
|
||||
h3c.com H3C
|
||||
hde.co.jp HDE
|
||||
hds.com Hitachi Data Systems
|
||||
hitachi.com Hitachi
|
||||
hoster-ok.com hoster-ok.com
|
||||
hp.com HP
|
||||
huawei.com Huawei
|
||||
inktank.com Inktank Storage
|
||||
intel.com Intel
|
||||
intellilink.co.jp NTT DATA INTELLILINK
|
||||
invisiblethingslab.com Invisible Things Lab
|
||||
jtan.com JTAN
|
||||
juniper.net Juniper Networks
|
||||
laposte.net La Poste
|
||||
le.com Le.com
|
||||
linaro.org Linaro
|
||||
linutronix.de Linutronix
|
||||
linux2go.dk Linux2Go
|
||||
liquidweb.com Liquid Web
|
||||
massclouds.com MassClouds
|
||||
mellanox.com Mellanox
|
||||
midokura.com Midokura
|
||||
mirantis.com Mirantis
|
||||
munzinger.de Munzinger Archiv
|
||||
netease.com NetEase
|
||||
netzquadrat.de [netzquadrat]
|
||||
nicira.com Nicira
|
||||
nimboxx.com NIMBOXX
|
||||
novell.com Novell
|
||||
ntt.co.jp NTT Group
|
||||
ohmu.fi OHMU
|
||||
open-minds.org OpenThink
|
||||
oracle.com Oracle
|
||||
os-t.de OpenSource Training
|
||||
otb.bg Open Technologies Bulgaria
|
||||
outscale.com OUTSCALE
|
||||
parallels.com Parallels
|
||||
petalogix.com PetaLogix
|
||||
quobyte.com Quobyte
|
||||
ravellosystems.com Ravello Systems
|
||||
samsung.com Samsung
|
||||
sde.cz SDE
|
||||
semihalf.com Semihalf
|
||||
siemens.com Siemens
|
||||
smartjog.com SmartJog
|
||||
solarflare.com Solarflare
|
||||
ssatr.ch Swiss Satellite Radio
|
||||
sun.com Sun Microsystems
|
||||
tabit.pro Tabit
|
||||
taobao.com Taobao
|
||||
tdf.fr TDF
|
||||
tencent.com Tencent
|
||||
transip.nl TransIP
|
||||
tresys.com Tresys
|
||||
uniudc.com Tsinghua Uniudc
|
||||
univention.de Univention
|
||||
veritas.com Veritas
|
||||
vhgroup.net VHGroup
|
||||
virtualopensystems.com Virtual Open Systems
|
||||
websense.com Websense
|
||||
wiktel.com Wikstrom Telephone Company
|
||||
windriver.com Wind River
|
||||
winhong.com Winhong
|
||||
xmission.com XMission
|
||||
xs4all.nl XS4ALL
|
||||
yadro.com YADRO
|
||||
yandex.ru Yandex
|
||||
yunify.com Yunify
|
||||
zstack.io ZStack
|
||||
zte.com.cn ZTE
|
@@ -1,6 +0,0 @@
|
||||
redhat.com
|
||||
|
||||
# These Red Hat employees used their personal email address when contributing
|
||||
# to libvirt and we don't have the corresponding @redhat.com address on file.
|
||||
|
||||
lkundrak@v3.sk
|
@@ -1,7 +0,0 @@
|
||||
suse.com
|
||||
suse.de
|
||||
|
||||
# These SUSE employees used their personal email address when contributing
|
||||
# to libvirt and we don't have the corresponding @suse.com address on file.
|
||||
|
||||
olaf@aepfle.de
|
@@ -1,2 +0,0 @@
|
||||
openvz.org
|
||||
virtuozzo.com
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user