mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-10-23 23:34:16 +03:00
Compare commits
140 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53347378e6 | ||
|
|
caa4c280cd | ||
|
|
ff4c47a9f4 | ||
|
|
ea02b58400 | ||
|
|
99f80c55e1 | ||
|
|
7b2ebecb6b | ||
|
|
4df52fea7e | ||
|
|
5c3be42813 | ||
|
|
99edd11a00 | ||
|
|
44681b7ae6 | ||
|
|
81367d3642 | ||
|
|
662b9afee9 | ||
|
|
f8f58f32f6 | ||
|
|
6744541e97 | ||
|
|
68ef4ec5c1 | ||
|
|
f4067eef11 | ||
|
|
2cd6df52da | ||
|
|
9fb6aff0f0 | ||
|
|
b4a32e5103 | ||
|
|
586eeca178 | ||
|
|
f945ae0efe | ||
|
|
6c3c5c099c | ||
|
|
cb3de69f0d | ||
|
|
34a7476f00 | ||
|
|
cd199c9bf7 | ||
|
|
a6e4fe019f | ||
|
|
4dc06610fc | ||
|
|
58e916ffaf | ||
|
|
74909e9648 | ||
|
|
40df40f35a | ||
|
|
2e4d173b49 | ||
|
|
4a4c73d217 | ||
|
|
39953c18d1 | ||
|
|
d5ef3cbb2c | ||
|
|
fa3eb97fdc | ||
|
|
1ab886e4fa | ||
|
|
9528a72494 | ||
|
|
3e6e96f09a | ||
|
|
7b977a87a7 | ||
|
|
c0063662e2 | ||
|
|
1ba74670cb | ||
|
|
d1f13a90a5 | ||
|
|
76e51193e3 | ||
|
|
5c5ec4ca9e | ||
|
|
07518f77bd | ||
|
|
26295a0ea7 | ||
|
|
079a8dc4e6 | ||
|
|
eb9aaa26a8 | ||
|
|
770ffbf857 | ||
|
|
f3ac5d6a6c | ||
|
|
a6584eb6f7 | ||
|
|
9a51c50048 | ||
|
|
5741803ceb | ||
|
|
64be645161 | ||
|
|
e89b42ccc6 | ||
|
|
c22a4bb523 | ||
|
|
0099781e80 | ||
|
|
06f7fec561 | ||
|
|
c46e1a92ce | ||
|
|
ac3dbf5a68 | ||
|
|
c0fa258b3d | ||
|
|
d035796675 | ||
|
|
4ee196bf30 | ||
|
|
404e42d3c6 | ||
|
|
ee7a60854b | ||
|
|
a267bb501b | ||
|
|
7d2cf48532 | ||
|
|
e60d286b8e | ||
|
|
a45823210d | ||
|
|
eb8382fa5f | ||
|
|
82dce08750 | ||
|
|
5290876dbc | ||
|
|
6fb8fbad9f | ||
|
|
9a7a699896 | ||
|
|
ee89fc6e7a | ||
|
|
bb8ebbbc08 | ||
|
|
66899258e1 | ||
|
|
9372343f7c | ||
|
|
b84e9ef24b | ||
|
|
328ad9e678 | ||
|
|
e5db3c4df2 | ||
|
|
0206984abb | ||
|
|
999a873db0 | ||
|
|
d7eb40d779 | ||
|
|
e2b6bd5032 | ||
|
|
00cf7e08e7 | ||
|
|
b64d62c6b8 | ||
|
|
e6c69718e2 | ||
|
|
14aa9d65c1 | ||
|
|
b4fefefc1b | ||
|
|
24d194ad59 | ||
|
|
54032910dc | ||
|
|
acf257deb5 | ||
|
|
affa75e640 | ||
|
|
fec2c786e7 | ||
|
|
4a03dc50a3 | ||
|
|
2c1a8f02bf | ||
|
|
d598dced1c | ||
|
|
075f66e304 | ||
|
|
77fa00888f | ||
|
|
4f4812f8a4 | ||
|
|
a8eaab32e1 | ||
|
|
e50d84614a | ||
|
|
51521556b0 | ||
|
|
83c279a74c | ||
|
|
f0cb1b96cf | ||
|
|
3ed4dba49d | ||
|
|
4a3bd30e50 | ||
|
|
9e5c5fbdc6 | ||
|
|
2eef8aa8ec | ||
|
|
ca20811984 | ||
|
|
779742f4b5 | ||
|
|
a4b924b579 | ||
|
|
10283d240c | ||
|
|
edf314d710 | ||
|
|
79be4dbecb | ||
|
|
85cf1ad5aa | ||
|
|
58211ca54d | ||
|
|
93fb942198 | ||
|
|
4b4c101232 | ||
|
|
27ae007f9f | ||
|
|
3f06ae4171 | ||
|
|
96a808f476 | ||
|
|
06cea21924 | ||
|
|
b2e6de689f | ||
|
|
643c549734 | ||
|
|
819d2168d8 | ||
|
|
87bacf5df2 | ||
|
|
9e41bdf4d0 | ||
|
|
93e5f04e19 | ||
|
|
0712608387 | ||
|
|
e1d8f411f7 | ||
|
|
93fd967f38 | ||
|
|
d9d3a88cb7 | ||
|
|
26c8c3ed35 | ||
|
|
17f509a4d4 | ||
|
|
e63b32e22d | ||
|
|
075eb526c9 | ||
|
|
966cc92222 | ||
|
|
271250831b |
@@ -1,40 +0,0 @@
|
|||||||
-I@abs_top_builddir@
|
|
||||||
-I@abs_top_srcdir@
|
|
||||||
-I@abs_top_builddir@/gnulib/lib
|
|
||||||
-I@abs_top_srcdir@/gnulib/lib
|
|
||||||
-I@abs_top_builddir@/include
|
|
||||||
-I@abs_top_srcdir@/include
|
|
||||||
-I@abs_top_builddir@/src
|
|
||||||
-I@abs_top_srcdir@/src
|
|
||||||
-I@abs_top_builddir@/src/access
|
|
||||||
-I@abs_top_srcdir@/src/access
|
|
||||||
-I@abs_top_builddir@/src/admin
|
|
||||||
-I@abs_top_srcdir@/src/admin
|
|
||||||
-I@abs_top_builddir@/src/bhyve
|
|
||||||
-I@abs_top_srcdir@/src/bhyve
|
|
||||||
-I@abs_top_builddir@/src/conf
|
|
||||||
-I@abs_top_srcdir@/src/conf
|
|
||||||
-I@abs_top_builddir@/src/libxl
|
|
||||||
-I@abs_top_srcdir@/src/libxl
|
|
||||||
-I@abs_top_builddir@/src/locking
|
|
||||||
-I@abs_top_srcdir@/src/locking
|
|
||||||
-I@abs_top_builddir@/src/logging
|
|
||||||
-I@abs_top_srcdir@/src/logging
|
|
||||||
-I@abs_top_builddir@/src/lxc
|
|
||||||
-I@abs_top_srcdir@/src/lxc
|
|
||||||
-I@abs_top_builddir@/src/qemu
|
|
||||||
-I@abs_top_srcdir@/src/qemu
|
|
||||||
-I@abs_top_builddir@/src/remote
|
|
||||||
-I@abs_top_srcdir@/src/remote
|
|
||||||
-I@abs_top_builddir@/src/rpc
|
|
||||||
-I@abs_top_srcdir@/src/rpc
|
|
||||||
-I@abs_top_builddir@/src/secret
|
|
||||||
-I@abs_top_srcdir@/src/secret
|
|
||||||
-I@abs_top_builddir@/src/security
|
|
||||||
-I@abs_top_srcdir@/src/security
|
|
||||||
-I@abs_top_builddir@/src/util
|
|
||||||
-I@abs_top_srcdir@/src/util
|
|
||||||
-I@abs_top_builddir@/src/vmx
|
|
||||||
-I@abs_top_srcdir@/src/vmx
|
|
||||||
-I@abs_top_builddir@/src/xenconfig
|
|
||||||
-I@abs_top_srcdir@/src/xenconfig
|
|
||||||
1
.ctags
1
.ctags
@@ -3,4 +3,3 @@
|
|||||||
--exclude=*.html
|
--exclude=*.html
|
||||||
--exclude=*.html.in
|
--exclude=*.html.in
|
||||||
--langmap=c:+.h.in
|
--langmap=c:+.h.in
|
||||||
--c-kinds=+p
|
|
||||||
|
|||||||
71
.gitignore
vendored
71
.gitignore
vendored
@@ -1,7 +1,5 @@
|
|||||||
*#*#
|
*#*#
|
||||||
*.#*#
|
*.#*#
|
||||||
*.[187]
|
|
||||||
*.[187].in
|
|
||||||
*.a
|
*.a
|
||||||
*.cov
|
*.cov
|
||||||
*.exe
|
*.exe
|
||||||
@@ -11,7 +9,6 @@
|
|||||||
*.gcov
|
*.gcov
|
||||||
*.html
|
*.html
|
||||||
*.i
|
*.i
|
||||||
*.init
|
|
||||||
*.la
|
*.la
|
||||||
*.lo
|
*.lo
|
||||||
*.loT
|
*.loT
|
||||||
@@ -21,12 +18,9 @@
|
|||||||
*.pyc
|
*.pyc
|
||||||
*.rej
|
*.rej
|
||||||
*.s
|
*.s
|
||||||
*.service
|
|
||||||
*.socket
|
|
||||||
*.swp
|
*.swp
|
||||||
*~
|
*~
|
||||||
.#*
|
.#*
|
||||||
.color_coded
|
|
||||||
.deps
|
.deps
|
||||||
.dirstamp
|
.dirstamp
|
||||||
.gdb_history
|
.gdb_history
|
||||||
@@ -36,7 +30,7 @@
|
|||||||
.lvimrc
|
.lvimrc
|
||||||
.memdump
|
.memdump
|
||||||
.sc-start-sc_*
|
.sc-start-sc_*
|
||||||
.ycm_extra_conf.py
|
/ABOUT-NLS
|
||||||
/AUTHORS
|
/AUTHORS
|
||||||
/ChangeLog
|
/ChangeLog
|
||||||
/GNUmakefile
|
/GNUmakefile
|
||||||
@@ -44,7 +38,8 @@
|
|||||||
/NEWS
|
/NEWS
|
||||||
/aclocal.m4
|
/aclocal.m4
|
||||||
/autom4te.cache
|
/autom4te.cache
|
||||||
/build-aux/*
|
/build-aux
|
||||||
|
/build-aux/
|
||||||
/build/
|
/build/
|
||||||
/confdefs.h
|
/confdefs.h
|
||||||
/config.cache
|
/config.cache
|
||||||
@@ -58,6 +53,18 @@
|
|||||||
/configure
|
/configure
|
||||||
/configure.lineno
|
/configure.lineno
|
||||||
/conftest.*
|
/conftest.*
|
||||||
|
/daemon/*_dispatch.h
|
||||||
|
/daemon/libvirt_qemud
|
||||||
|
/daemon/libvirtd
|
||||||
|
/daemon/libvirtd*.logrotate
|
||||||
|
/daemon/libvirtd.8
|
||||||
|
/daemon/libvirtd.8.in
|
||||||
|
/daemon/libvirtd.init
|
||||||
|
/daemon/libvirtd.pod
|
||||||
|
/daemon/libvirtd.policy
|
||||||
|
/daemon/libvirtd.service
|
||||||
|
/daemon/libvirtd.socket
|
||||||
|
/daemon/test_libvirtd.aug
|
||||||
/docs/aclperms.htmlinc
|
/docs/aclperms.htmlinc
|
||||||
/docs/apibuild.py.stamp
|
/docs/apibuild.py.stamp
|
||||||
/docs/devhelp/libvirt.devhelp
|
/docs/devhelp/libvirt.devhelp
|
||||||
@@ -67,16 +74,8 @@
|
|||||||
/docs/libvirt-lxc-*.xml
|
/docs/libvirt-lxc-*.xml
|
||||||
/docs/libvirt-qemu-*.xml
|
/docs/libvirt-qemu-*.xml
|
||||||
/docs/libvirt-refs.xml
|
/docs/libvirt-refs.xml
|
||||||
/docs/news.html.in
|
|
||||||
/docs/search.php
|
/docs/search.php
|
||||||
/docs/todo.html.in
|
/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/object-events/event-test
|
||||||
/examples/dominfo/info1
|
/examples/dominfo/info1
|
||||||
/examples/domsuspend/suspend
|
/examples/domsuspend/suspend
|
||||||
@@ -84,13 +83,12 @@
|
|||||||
/examples/domtop/domtop
|
/examples/domtop/domtop
|
||||||
/examples/hellolibvirt/hellolibvirt
|
/examples/hellolibvirt/hellolibvirt
|
||||||
/examples/openauth/openauth
|
/examples/openauth/openauth
|
||||||
/examples/rename/rename
|
|
||||||
/gnulib/lib/*
|
/gnulib/lib/*
|
||||||
/gnulib/m4/*
|
/gnulib/m4/*
|
||||||
/gnulib/tests/*
|
/gnulib/tests/*
|
||||||
/include/libvirt/libvirt-common.h
|
/include/libvirt/libvirt.h
|
||||||
/libtool
|
/libtool
|
||||||
/libvirt-*.tar.xz
|
/libvirt-*.tar.gz
|
||||||
/libvirt-[0-9]*
|
/libvirt-[0-9]*
|
||||||
/libvirt*.pc
|
/libvirt*.pc
|
||||||
/libvirt.spec
|
/libvirt.spec
|
||||||
@@ -100,10 +98,7 @@
|
|||||||
/maint.mk
|
/maint.mk
|
||||||
/mingw-libvirt.spec
|
/mingw-libvirt.spec
|
||||||
/mkinstalldirs
|
/mkinstalldirs
|
||||||
/po/*gmo
|
/po/*
|
||||||
/po/*po
|
|
||||||
!/po/*.mini.po
|
|
||||||
/po/*pot
|
|
||||||
/proxy/
|
/proxy/
|
||||||
/python/
|
/python/
|
||||||
/run
|
/run
|
||||||
@@ -119,7 +114,6 @@
|
|||||||
/src/access/viraccessapicheckqemu.h
|
/src/access/viraccessapicheckqemu.h
|
||||||
/src/admin/admin_client.h
|
/src/admin/admin_client.h
|
||||||
/src/admin/admin_protocol.[ch]
|
/src/admin/admin_protocol.[ch]
|
||||||
/src/admin/admin_server_dispatch_stubs.h
|
|
||||||
/src/esx/*.generated.*
|
/src/esx/*.generated.*
|
||||||
/src/hyperv/*.generated.*
|
/src/hyperv/*.generated.*
|
||||||
/src/libvirt*.def
|
/src/libvirt*.def
|
||||||
@@ -135,8 +129,6 @@
|
|||||||
/src/libvirt_*helper
|
/src/libvirt_*helper
|
||||||
/src/libvirt_*probes.h
|
/src/libvirt_*probes.h
|
||||||
/src/libvirt_lxc
|
/src/libvirt_lxc
|
||||||
/src/libvirtd
|
|
||||||
/src/libvirtd*.logrotate
|
|
||||||
/src/locking/libxl-lockd.conf
|
/src/locking/libxl-lockd.conf
|
||||||
/src/locking/libxl-sanlock.conf
|
/src/locking/libxl-sanlock.conf
|
||||||
/src/locking/lock_daemon_dispatch_stubs.h
|
/src/locking/lock_daemon_dispatch_stubs.h
|
||||||
@@ -144,8 +136,6 @@
|
|||||||
/src/locking/qemu-lockd.conf
|
/src/locking/qemu-lockd.conf
|
||||||
/src/locking/qemu-sanlock.conf
|
/src/locking/qemu-sanlock.conf
|
||||||
/src/locking/test_libvirt_sanlock.aug
|
/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_controller_dispatch.h
|
||||||
/src/lxc/lxc_monitor_dispatch.h
|
/src/lxc/lxc_monitor_dispatch.h
|
||||||
/src/lxc/lxc_monitor_protocol.c
|
/src/lxc/lxc_monitor_protocol.c
|
||||||
@@ -155,39 +145,36 @@
|
|||||||
/src/qemu/test_libvirtd_qemu.aug
|
/src/qemu/test_libvirtd_qemu.aug
|
||||||
/src/remote/*_client_bodies.h
|
/src/remote/*_client_bodies.h
|
||||||
/src/remote/*_protocol.[ch]
|
/src/remote/*_protocol.[ch]
|
||||||
/src/remote/*_stubs.h
|
|
||||||
/src/rpc/virkeepaliveprotocol.[ch]
|
/src/rpc/virkeepaliveprotocol.[ch]
|
||||||
/src/rpc/virnetprotocol.[ch]
|
/src/rpc/virnetprotocol.[ch]
|
||||||
/src/test_libvirt*.aug
|
/src/test_libvirt*.aug
|
||||||
/src/test_virtlockd.aug
|
/src/test_virtlockd.aug
|
||||||
/src/test_virtlogd.aug
|
/src/util/virkeymaps.h
|
||||||
/src/util/virkeycodetable*.h
|
|
||||||
/src/util/virkeynametable*.h
|
|
||||||
/src/virt-aa-helper
|
/src/virt-aa-helper
|
||||||
/src/virtlockd
|
/src/virtlockd
|
||||||
/src/virtlogd
|
/src/virtlockd.8
|
||||||
/src/virt-guest-shutdown.target
|
/src/virtlockd.8.in
|
||||||
|
/src/virtlockd.init
|
||||||
/tests/*.log
|
/tests/*.log
|
||||||
/tests/*.pid
|
/tests/*.pid
|
||||||
/tests/*.trs
|
/tests/*.trs
|
||||||
/tests/*test
|
|
||||||
/tests/commandhelper
|
/tests/commandhelper
|
||||||
/tests/qemucapsprobe
|
/tests/*test
|
||||||
!/tests/virsh-self-test
|
!/tests/*schematest
|
||||||
!/tests/virt-aa-helper-test
|
!/tests/virt-aa-helper-test
|
||||||
!/tests/virt-admin-self-test
|
|
||||||
/tests/objectlocking
|
/tests/objectlocking
|
||||||
/tests/objectlocking-files.txt
|
/tests/objectlocking-files.txt
|
||||||
/tests/objectlocking.cm[ix]
|
/tests/objectlocking.cm[ix]
|
||||||
/tests/reconnect
|
/tests/reconnect
|
||||||
/tests/ssh
|
/tests/ssh
|
||||||
/tests/test_file_access.txt
|
|
||||||
/tests/test_conf
|
/tests/test_conf
|
||||||
|
/tools/*.[18]
|
||||||
|
/tools/libvirt-guests.init
|
||||||
|
/tools/libvirt-guests.service
|
||||||
/tools/libvirt-guests.sh
|
/tools/libvirt-guests.sh
|
||||||
/tools/virt-login-shell
|
/tools/virt-login-shell
|
||||||
/tools/virsh
|
/tools/virsh
|
||||||
/tools/virsh-*-edit.c
|
/tools/virsh-*-edit.c
|
||||||
/tools/virt-admin
|
|
||||||
/tools/virt-*-validate
|
/tools/virt-*-validate
|
||||||
/tools/virt-sanlock-cleanup
|
/tools/virt-sanlock-cleanup
|
||||||
/tools/wireshark/src/plugin.c
|
/tools/wireshark/src/plugin.c
|
||||||
@@ -209,7 +196,9 @@ stamp-h
|
|||||||
stamp-h.in
|
stamp-h.in
|
||||||
stamp-h1
|
stamp-h1
|
||||||
tags
|
tags
|
||||||
!/build-aux/*.pl
|
|
||||||
!/gnulib/lib/Makefile.am
|
!/gnulib/lib/Makefile.am
|
||||||
!/gnulib/tests/Makefile.am
|
!/gnulib/tests/Makefile.am
|
||||||
!/m4/virt-*.m4
|
!/m4/virt-*.m4
|
||||||
|
!/po/*.po
|
||||||
|
!/po/POTFILES.in
|
||||||
|
!/po/libvirt.pot
|
||||||
|
|||||||
5
.gitmodules
vendored
5
.gitmodules
vendored
@@ -1,6 +1,3 @@
|
|||||||
[submodule "gnulib"]
|
[submodule "gnulib"]
|
||||||
path = .gnulib
|
path = .gnulib
|
||||||
url = https://git.savannah.gnu.org/git/gnulib.git/
|
url = git://git.sv.gnu.org/gnulib.git
|
||||||
[submodule "keycodemapdb"]
|
|
||||||
path = src/keycodemapdb
|
|
||||||
url = https://gitlab.com/keycodemap/keycodemapdb.git
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
[gitpublishprofile "default"]
|
|
||||||
base = master
|
|
||||||
to = libvir-list@redhat.com
|
|
||||||
2
.gnulib
2
.gnulib
Submodule .gnulib updated: 68df637b5f...f39477dba7
18
.mailmap
18
.mailmap
@@ -20,6 +20,7 @@
|
|||||||
<jfehlig@suse.com> <jfehlig@novell.com>
|
<jfehlig@suse.com> <jfehlig@novell.com>
|
||||||
<jfehlig@suse.com> <jfehlig@linux-ypgk.site>
|
<jfehlig@suse.com> <jfehlig@linux-ypgk.site>
|
||||||
<jclift@redhat.com> <justin@salasaga.org>
|
<jclift@redhat.com> <justin@salasaga.org>
|
||||||
|
<berrange@redhat.com> <dan@berrange.com>
|
||||||
<soren@linux2go.dk> <soren@canonical.com>
|
<soren@linux2go.dk> <soren@canonical.com>
|
||||||
<cfergeau@redhat.com> <teuf@gnome.org>
|
<cfergeau@redhat.com> <teuf@gnome.org>
|
||||||
<wency@cn.fujitsu.com> <wency cn fujitsu com>
|
<wency@cn.fujitsu.com> <wency cn fujitsu com>
|
||||||
@@ -38,11 +39,6 @@
|
|||||||
<zhlcindy@linux.vnet.ibm.com> <zhlcindy@gmail.com>
|
<zhlcindy@linux.vnet.ibm.com> <zhlcindy@gmail.com>
|
||||||
<serge.hallyn@canonical.com> <serue@us.ibm.com>
|
<serge.hallyn@canonical.com> <serue@us.ibm.com>
|
||||||
<pritesh.kothari@sun.com> <Pritesh.Kothari@Sun.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>
|
|
||||||
|
|
||||||
# Name consolidation:
|
# Name consolidation:
|
||||||
# Preferred author spelling <preferred email>
|
# Preferred author spelling <preferred email>
|
||||||
@@ -60,16 +56,8 @@ Aurelien Rougemont <beorn@binaries.fr>
|
|||||||
Serge E. Hallyn <serge.hallyn@canonical.com>
|
Serge E. Hallyn <serge.hallyn@canonical.com>
|
||||||
Henrik Persson E <henrik.e.persson@ericsson.com>
|
Henrik Persson E <henrik.e.persson@ericsson.com>
|
||||||
Philipp Hahn <hahn@univention.de>
|
Philipp Hahn <hahn@univention.de>
|
||||||
|
Marco Bozzolan <bozzolan@gmail.com>
|
||||||
|
Marco Bozzolan <redshift@gmx.com>
|
||||||
Pritesh Kothari <pritesh.kothari@sun.com>
|
Pritesh Kothari <pritesh.kothari@sun.com>
|
||||||
Wang Yufei (James) <james.wangyufei@huawei.com>
|
Wang Yufei (James) <james.wangyufei@huawei.com>
|
||||||
Deepak C Shetty <dpkshetty@gmail.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>
|
|
||||||
|
|||||||
111
.travis.yml
111
.travis.yml
@@ -1,111 +0,0 @@
|
|||||||
sudo: required
|
|
||||||
language: generic
|
|
||||||
|
|
||||||
branches:
|
|
||||||
except:
|
|
||||||
- /^.*-maint$/
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- services:
|
|
||||||
- docker
|
|
||||||
env:
|
|
||||||
- IMAGE="ubuntu-18"
|
|
||||||
- DISTCHECK_CONFIGURE_FLAGS="--with-init-script=systemd"
|
|
||||||
- DOCKER_CMD="$LINUX_CMD"
|
|
||||||
- services:
|
|
||||||
- docker
|
|
||||||
env:
|
|
||||||
- IMAGE="centos-7"
|
|
||||||
- DISTCHECK_CONFIGURE_FLAGS="--with-init-script=upstart"
|
|
||||||
- DOCKER_CMD="$LINUX_CMD"
|
|
||||||
- services:
|
|
||||||
- docker
|
|
||||||
env:
|
|
||||||
- IMAGE="fedora-rawhide"
|
|
||||||
- MINGW="mingw32"
|
|
||||||
- DOCKER_CMD="$MINGW_CMD"
|
|
||||||
- services:
|
|
||||||
- docker
|
|
||||||
env:
|
|
||||||
- IMAGE="fedora-rawhide"
|
|
||||||
- MINGW="mingw64"
|
|
||||||
- DOCKER_CMD="$MINGW_CMD"
|
|
||||||
- compiler: clang
|
|
||||||
language: c
|
|
||||||
os: osx
|
|
||||||
env:
|
|
||||||
- PATH="/usr/local/opt/gettext/bin:/usr/local/opt/ccache/libexec:/usr/local/opt/rpcgen/bin:$PATH"
|
|
||||||
script:
|
|
||||||
/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
|
|
||||||
# to prevent IRC notifications from github forks. This was created using:
|
|
||||||
# $ travis encrypt -r "libvirt/libvirt" "irc.oftc.net#virt"
|
|
||||||
channels:
|
|
||||||
- secure: "hUPdkLxX7nh75+clpnk4U0XLExLfV9DFKSvQSAUtf5JtDNMslj7AeOCf2wcbkNsEhkiF557odTAnov1s5m1w/yaa56zbjFAh5agzqRKya3QjqsrvlBKw/WuN+l82iMNLLeebTgCPAXrbAbGWH8YmYssp/7+eMsnKaVh84EQQNbMCHlLg6ovE26Fs18mZ6J5RC3OPa1vbv+xkdCHvGg/Oyp4K8bpU7RYyimA56jdxI/OfdTH9HxntHYSzykR7hDbyzZhdIlAUyRKReQVjcV5+R8fdDL/1imyGA/88KTztMeKXpZ5Rf+Ss3vYLZb6qsLLegCZ4AU/q0vvbWxjpZGJZoeyrVpfBTZdYGIzmLTMl9GYXXa/gDwFlbvRDiPDG4TIy6GlMUROinj7KRKEHu1fWRYu012ife5OjidxcwrTnz21vYaCv3AKWPpMPxwIzQPkY1hex9uLLX6z+TrAxxDLF+7UzRT9w2RLFBkLYlj2aDVrLAVb/ynRsxDz5CGzC61FSQVft2e308SkGjdn8YxvguCuXv+N70Fu1cvFyh5XYeHb4fbBRo0Ctzaec78leHlQvRGWKJxXDXRkE2lvvBc7YbBNSAYh7Fs8Y+zY7l7rMxvXdrt3nuaNQhe74V3yhxPDAld66qmAn9TYMmaZW2f5/KKKILLbCa0t2MxiAc6L2OI8="
|
|
||||||
on_success: change
|
|
||||||
on_failure: always
|
|
||||||
email:
|
|
||||||
# The list name 'libvirt-ci@redhat.com" is encrypted against libvirt/libvirt
|
|
||||||
# to prevent IRC notifications from github forks. This was created using:
|
|
||||||
# $ travis encrypt -r "libvirt/libvirt" "libvirt-ci@redhat.com"
|
|
||||||
recipients:
|
|
||||||
- secure: "QcU9eP96P0RlDNzVRZl/4sxyydPStGzECrpgJhr2IPB/7pHk23yaBrmUsq9S830tB+jwLGma1IscNB8uf7Sf7WY+cYIpfR8v030OffWnaipo/Gcs0dpnlfURWHjOFQI3RJzGEihsqvbwUFOwsM+3IDyO3qdWaiT6cN2Tj9ROlwYCySSX5YWzLyX7arBZ4lp8ESs7ohQaEwp2cegnMP2oGPJJe4SebvlCDjHZbjkU5aEradwUWnRQDJZWTKknpNLArVFxN2/ixp6f/MGY4DmkHoDweio6mHIPN5zTs5Jt32aiX6wDBa+bBa4v8TCRqzhYkQ63ZZhNV8bY5Uf9ufTdyvt96yIANyakd85b1QpMdAX76IyJi1l0/Uub6DTQZAcq3vK7iPjGeTVSpyoXrqTfGy4JxMjqDoocpWvv8ALX1wrYI/HfN2R2Aepw9jModTimOsebYhJ1yMhSt8qnh5AQNftGKL2JBKoA1LWdU2YJ5fO1bGjKNiVEkGFQTPYFWrYCUY5JcT+s5WCzNeMNm8s9na8liYhGl3WtS3rPr5M8bof+BMsBhG2hQ0loduc94x2GkvyhQZUgRbqrwNR+y4hn+rWFC3hBzzyiAULs43vY/PJ+eBdKEf3VAc0MkhQ8GgXGSA61fR6aXYonroI/WnBVItwDmUnnMfSziZXxk09GLl4="
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
flags = [
|
|
||||||
'-I@abs_top_builddir@',
|
|
||||||
'-I@abs_top_srcdir@',
|
|
||||||
'-I@abs_top_builddir@/gnulib/lib',
|
|
||||||
'-I@abs_top_srcdir@/gnulib/lib',
|
|
||||||
'-I@abs_top_builddir@/include',
|
|
||||||
'-I@abs_top_srcdir@/include',
|
|
||||||
'-I@abs_top_builddir@/src',
|
|
||||||
'-I@abs_top_srcdir@/src',
|
|
||||||
'-I@abs_top_builddir@/src/access',
|
|
||||||
'-I@abs_top_srcdir@/src/access',
|
|
||||||
'-I@abs_top_builddir@/src/admin',
|
|
||||||
'-I@abs_top_srcdir@/src/admin',
|
|
||||||
'-I@abs_top_builddir@/src/bhyve',
|
|
||||||
'-I@abs_top_srcdir@/src/bhyve',
|
|
||||||
'-I@abs_top_builddir@/src/conf',
|
|
||||||
'-I@abs_top_srcdir@/src/conf',
|
|
||||||
'-I@abs_top_builddir@/src/libxl',
|
|
||||||
'-I@abs_top_srcdir@/src/libxl',
|
|
||||||
'-I@abs_top_builddir@/src/locking',
|
|
||||||
'-I@abs_top_srcdir@/src/locking',
|
|
||||||
'-I@abs_top_builddir@/src/logging',
|
|
||||||
'-I@abs_top_srcdir@/src/logging',
|
|
||||||
'-I@abs_top_builddir@/src/lxc',
|
|
||||||
'-I@abs_top_srcdir@/src/lxc',
|
|
||||||
'-I@abs_top_builddir@/src/qemu',
|
|
||||||
'-I@abs_top_srcdir@/src/qemu',
|
|
||||||
'-I@abs_top_builddir@/src/remote',
|
|
||||||
'-I@abs_top_srcdir@/src/remote',
|
|
||||||
'-I@abs_top_builddir@/src/rpc',
|
|
||||||
'-I@abs_top_srcdir@/src/rpc',
|
|
||||||
'-I@abs_top_builddir@/src/secret',
|
|
||||||
'-I@abs_top_srcdir@/src/secret',
|
|
||||||
'-I@abs_top_builddir@/src/security',
|
|
||||||
'-I@abs_top_srcdir@/src/security',
|
|
||||||
'-I@abs_top_builddir@/src/util',
|
|
||||||
'-I@abs_top_srcdir@/src/util',
|
|
||||||
'-I@abs_top_builddir@/src/vmx',
|
|
||||||
'-I@abs_top_srcdir@/src/vmx',
|
|
||||||
'-I@abs_top_builddir@/src/xenconfig',
|
|
||||||
'-I@abs_top_srcdir@/src/xenconfig',
|
|
||||||
]
|
|
||||||
|
|
||||||
def FlagsForFile(filename, **kwargs):
|
|
||||||
return { 'flags': flags, 'do_cache': True }
|
|
||||||
14
AUTHORS.in
14
AUTHORS.in
@@ -8,14 +8,13 @@ Daniel Veillard <veillard@redhat.com> or <daniel@veillard.com>
|
|||||||
The primary maintainers and people with commit access rights:
|
The primary maintainers and people with commit access rights:
|
||||||
|
|
||||||
Alex Jia <ajia@redhat.com>
|
Alex Jia <ajia@redhat.com>
|
||||||
Andrea Bolognani <abologna@redhat.com>
|
|
||||||
Cédric Bosdonnat <cbosdonnat@suse.com>
|
Cédric Bosdonnat <cbosdonnat@suse.com>
|
||||||
Christian Ehrhardt <christian.ehrhardt@canonical.com>
|
|
||||||
Christophe Fergeau <cfergeau@redhat.com>
|
Christophe Fergeau <cfergeau@redhat.com>
|
||||||
Claudio Bley <claudio.bley@gmail.com>
|
Claudio Bley <claudio.bley@gmail.com>
|
||||||
Cole Robinson <crobinso@redhat.com>
|
Cole Robinson <crobinso@redhat.com>
|
||||||
Daniel P. Berrangé <berrange@redhat.com>
|
Daniel Berrange <berrange@redhat.com>
|
||||||
Daniel Veillard <veillard@redhat.com>
|
Daniel Veillard <veillard@redhat.com>
|
||||||
|
Dmitry Guryanov <dguryanov@parallels.com>
|
||||||
Doug Goldstein <cardoe@gentoo.org>
|
Doug Goldstein <cardoe@gentoo.org>
|
||||||
Eric Blake <eblake@redhat.com>
|
Eric Blake <eblake@redhat.com>
|
||||||
Erik Skultety <eskultet@redhat.com>
|
Erik Skultety <eskultet@redhat.com>
|
||||||
@@ -25,14 +24,11 @@ Ján Tomko <jtomko@redhat.com>
|
|||||||
Jim Fehlig <jfehlig@suse.com>
|
Jim Fehlig <jfehlig@suse.com>
|
||||||
Jiří Denemark <jdenemar@redhat.com>
|
Jiří Denemark <jdenemar@redhat.com>
|
||||||
John Ferlan <jferlan@redhat.com>
|
John Ferlan <jferlan@redhat.com>
|
||||||
Katerina Koukiou <kkoukiou@redhat.com>
|
|
||||||
Laine Stump <laine@redhat.com>
|
Laine Stump <laine@redhat.com>
|
||||||
Mark McLoughlin <markmc@redhat.com>
|
Mark McLoughlin <markmc@redhat.com>
|
||||||
Martin Kletzander <mkletzan@redhat.com>
|
Martin Kletzander <mkletzan@redhat.com>
|
||||||
Matthias Bolte <matthias.bolte@googlemail.com>
|
Matthias Bolte <matthias.bolte@googlemail.com>
|
||||||
Maxim Nestratov <mnestratov@virtuozzo.com>
|
|
||||||
Michal Prívozník <mprivozn@redhat.com>
|
Michal Prívozník <mprivozn@redhat.com>
|
||||||
Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
|
|
||||||
Pavel Hrdina <phrdina@redhat.com>
|
Pavel Hrdina <phrdina@redhat.com>
|
||||||
Peter Krempa <pkrempa@redhat.com>
|
Peter Krempa <pkrempa@redhat.com>
|
||||||
Richard W.M. Jones <rjones@redhat.com>
|
Richard W.M. Jones <rjones@redhat.com>
|
||||||
@@ -48,7 +44,6 @@ Chris Lalancette <clalance@redhat.com>
|
|||||||
Dan Smith <danms@us.ibm.com>
|
Dan Smith <danms@us.ibm.com>
|
||||||
Dave Allan <dallan@redhat.com>
|
Dave Allan <dallan@redhat.com>
|
||||||
Dave Leskovec <dlesko@linux.vnet.ibm.com>
|
Dave Leskovec <dlesko@linux.vnet.ibm.com>
|
||||||
Dmitry Guryanov <dguryanov@parallels.com>
|
|
||||||
Guannan Ren <gren@redhat.com>
|
Guannan Ren <gren@redhat.com>
|
||||||
Jim Meyering <meyering@redhat.com>
|
Jim Meyering <meyering@redhat.com>
|
||||||
John Levon <john.levon@sun.com>
|
John Levon <john.levon@sun.com>
|
||||||
@@ -63,6 +58,7 @@ Amit Shah <amit.shah@redhat.com>
|
|||||||
Andrew Puch <apuch@redhat.com>
|
Andrew Puch <apuch@redhat.com>
|
||||||
Anton Protopopov <aspsk2@gmail.com>
|
Anton Protopopov <aspsk2@gmail.com>
|
||||||
Ben Guthro <ben.guthro@gmail.com>
|
Ben Guthro <ben.guthro@gmail.com>
|
||||||
|
Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
|
||||||
Daniel Hokka Zakrisson <daniel@hozac.com>
|
Daniel Hokka Zakrisson <daniel@hozac.com>
|
||||||
Dan Wendlandt <dan@nicira.com>
|
Dan Wendlandt <dan@nicira.com>
|
||||||
David Lively <dlively@virtualiron.com>
|
David Lively <dlively@virtualiron.com>
|
||||||
@@ -91,7 +87,9 @@ Stefan de Konink <dekonink@kinkrsoftware.nl>
|
|||||||
Takahashi Tomohiro <takatom@jp.fujitsu.com>
|
Takahashi Tomohiro <takatom@jp.fujitsu.com>
|
||||||
Tatsuro Enokura <fj7716hz@aa.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
|
The libvirt logo was designed by Diana Fong
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ modified by someone else and passed on, the recipients should know
|
|||||||
that what they have is not the original version, so that the original
|
that what they have is not the original version, so that the original
|
||||||
author's reputation will not be affected by problems that might be
|
author's reputation will not be affected by problems that might be
|
||||||
introduced by others.
|
introduced by others.
|
||||||
|
|
||||||
Finally, software patents pose a constant threat to the existence of
|
Finally, software patents pose a constant threat to the existence of
|
||||||
any free program. We wish to make sure that a company cannot
|
any free program. We wish to make sure that a company cannot
|
||||||
effectively restrict the users of a free program by obtaining a
|
effectively restrict the users of a free program by obtaining a
|
||||||
@@ -111,7 +111,7 @@ modification follow. Pay close attention to the difference between a
|
|||||||
"work based on the library" and a "work that uses the library". The
|
"work based on the library" and a "work that uses the library". The
|
||||||
former contains code derived from the library, whereas the latter must
|
former contains code derived from the library, whereas the latter must
|
||||||
be combined with the library in order to run.
|
be combined with the library in order to run.
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ Library.
|
|||||||
You may charge a fee for the physical act of transferring a copy,
|
You may charge a fee for the physical act of transferring a copy,
|
||||||
and you may at your option offer warranty protection in exchange for a
|
and you may at your option offer warranty protection in exchange for a
|
||||||
fee.
|
fee.
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Library or any portion
|
2. You may modify your copy or copies of the Library or any portion
|
||||||
of it, thus forming a work based on the Library, and copy and
|
of it, thus forming a work based on the Library, and copy and
|
||||||
distribute such modifications or work under the terms of Section 1
|
distribute such modifications or work under the terms of Section 1
|
||||||
@@ -216,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the
|
|||||||
ordinary GNU General Public License has appeared, then you can specify
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
that version instead if you wish.) Do not make any other change in
|
that version instead if you wish.) Do not make any other change in
|
||||||
these notices.
|
these notices.
|
||||||
|
|
||||||
Once this change is made in a given copy, it is irreversible for
|
Once this change is made in a given copy, it is irreversible for
|
||||||
that copy, so the ordinary GNU General Public License applies to all
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
subsequent copies and derivative works made from that copy.
|
subsequent copies and derivative works made from that copy.
|
||||||
@@ -267,7 +267,7 @@ Library will still fall under Section 6.)
|
|||||||
distribute the object code for the work under the terms of Section 6.
|
distribute the object code for the work under the terms of Section 6.
|
||||||
Any executables containing that work also fall under Section 6,
|
Any executables containing that work also fall under Section 6,
|
||||||
whether or not they are linked directly with the Library itself.
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
6. As an exception to the Sections above, you may also combine or
|
6. As an exception to the Sections above, you may also combine or
|
||||||
link a "work that uses the Library" with the Library to produce a
|
link a "work that uses the Library" with the Library to produce a
|
||||||
work containing portions of the Library, and distribute that work
|
work containing portions of the Library, and distribute that work
|
||||||
@@ -329,7 +329,7 @@ restrictions of other proprietary libraries that do not normally
|
|||||||
accompany the operating system. Such a contradiction means you cannot
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
use both them and the Library together in an executable that you
|
use both them and the Library together in an executable that you
|
||||||
distribute.
|
distribute.
|
||||||
|
|
||||||
7. You may place library facilities that are a work based on the
|
7. You may place library facilities that are a work based on the
|
||||||
Library side-by-side in a single library together with other library
|
Library side-by-side in a single library together with other library
|
||||||
facilities not covered by this License, and distribute such a combined
|
facilities not covered by this License, and distribute such a combined
|
||||||
@@ -370,7 +370,7 @@ subject to these terms and conditions. You may not impose any further
|
|||||||
restrictions on the recipients' exercise of the rights granted herein.
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
You are not responsible for enforcing compliance by third parties with
|
You are not responsible for enforcing compliance by third parties with
|
||||||
this License.
|
this License.
|
||||||
|
|
||||||
11. If, as a consequence of a court judgment or allegation of patent
|
11. If, as a consequence of a court judgment or allegation of patent
|
||||||
infringement or for any other reason (not limited to patent issues),
|
infringement or for any other reason (not limited to patent issues),
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
@@ -422,7 +422,7 @@ conditions either of that version or of any later version published by
|
|||||||
the Free Software Foundation. If the Library does not specify a
|
the Free Software Foundation. If the Library does not specify a
|
||||||
license version number, you may choose any version ever published by
|
license version number, you may choose any version ever published by
|
||||||
the Free Software Foundation.
|
the Free Software Foundation.
|
||||||
|
|
||||||
14. If you wish to incorporate parts of the Library into other free
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
programs whose distribution conditions are incompatible with these,
|
programs whose distribution conditions are incompatible with these,
|
||||||
write to the author to ask for permission. For software which is
|
write to the author to ask for permission. For software which is
|
||||||
@@ -456,7 +456,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|||||||
DAMAGES.
|
DAMAGES.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Libraries
|
How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
If you develop a new library, and you want it to be of the greatest
|
If you develop a new library, and you want it to be of the greatest
|
||||||
|
|||||||
102
Makefile.am
102
Makefile.am
@@ -19,14 +19,19 @@
|
|||||||
LCOV = lcov
|
LCOV = lcov
|
||||||
GENHTML = genhtml
|
GENHTML = genhtml
|
||||||
|
|
||||||
SUBDIRS = . gnulib/lib include/libvirt src tools docs gnulib/tests \
|
SUBDIRS = . gnulib/lib include src daemon tools docs gnulib/tests \
|
||||||
tests po examples
|
tests po examples/object-events examples/hellolibvirt \
|
||||||
|
examples/dominfo examples/domsuspend examples/apparmor \
|
||||||
XZ_OPT ?= -v -T0
|
examples/xml/nwfilter examples/openauth examples/systemtap \
|
||||||
export XZ_OPT
|
tools/wireshark examples/dommigrate \
|
||||||
|
examples/lxcconvert examples/domtop
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
|
XML_EXAMPLES = \
|
||||||
|
$(patsubst $(srcdir)/%,%,$(wildcard $(addprefix $(srcdir)/examples/xml/, \
|
||||||
|
test/*.xml storage/*.xml)))
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
config-post.h \
|
config-post.h \
|
||||||
ChangeLog-old \
|
ChangeLog-old \
|
||||||
@@ -36,51 +41,45 @@ EXTRA_DIST = \
|
|||||||
libvirt-qemu.pc.in \
|
libvirt-qemu.pc.in \
|
||||||
libvirt-lxc.pc.in \
|
libvirt-lxc.pc.in \
|
||||||
libvirt-admin.pc.in \
|
libvirt-admin.pc.in \
|
||||||
|
autobuild.sh \
|
||||||
Makefile.nonreentrant \
|
Makefile.nonreentrant \
|
||||||
autogen.sh \
|
autogen.sh \
|
||||||
cfg.mk \
|
cfg.mk \
|
||||||
run.in \
|
run.in \
|
||||||
README.md \
|
AUTHORS.in \
|
||||||
AUTHORS.in
|
$(XML_EXAMPLES)
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc libvirt-admin.pc
|
pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc
|
||||||
|
|
||||||
NEWS: \
|
NEWS: $(top_srcdir)/docs/news.xsl $(top_srcdir)/docs/news.html.in
|
||||||
$(srcdir)/docs/news.xml \
|
$(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \
|
||||||
$(srcdir)/docs/news-ascii.xsl \
|
$(XSLTPROC) --nonet $(top_srcdir)/docs/news.xsl \
|
||||||
$(srcdir)/docs/reformat-news.py
|
$(top_srcdir)/docs/news.html.in \
|
||||||
$(AM_V_GEN) \
|
| perl -0777 -pe 's/\n\n+$$/\n/' \
|
||||||
if [ -x $(XSLTPROC) ]; then \
|
| perl -pe 's/[ \t]+$$//' \
|
||||||
$(XSLTPROC) --nonet \
|
> $@-t && mv $@-t $@ ; fi
|
||||||
$(srcdir)/docs/news-ascii.xsl \
|
|
||||||
$(srcdir)/docs/news.xml \
|
$(top_srcdir)/HACKING: $(top_srcdir)/docs/hacking1.xsl \
|
||||||
>$@-tmp \
|
$(top_srcdir)/docs/hacking2.xsl \
|
||||||
|| { rm -f $@-tmp; exit 1; }; \
|
$(top_srcdir)/docs/wrapstring.xsl \
|
||||||
$(PYTHON) $(srcdir)/docs/reformat-news.py $@-tmp >$@ \
|
$(top_srcdir)/docs/hacking.html.in
|
||||||
|| { rm -f $@-tmp; exit 1; }; \
|
$(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \
|
||||||
rm -f $@-tmp; \
|
$(XSLTPROC) --nonet $(top_srcdir)/docs/hacking1.xsl \
|
||||||
fi
|
$(top_srcdir)/docs/hacking.html.in | \
|
||||||
EXTRA_DIST += \
|
$(XSLTPROC) --nonet $(top_srcdir)/docs/hacking2.xsl - \
|
||||||
$(srcdir)/docs/news.xml \
|
| perl -0777 -pe 's/\n\n+$$/\n/' \
|
||||||
$(srcdir)/docs/news-ascii.xsl \
|
> $@-t && mv $@-t $@ ; fi;
|
||||||
$(srcdir)/docs/reformat-news.py
|
|
||||||
|
|
||||||
rpm: clean
|
rpm: clean
|
||||||
@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.xz)
|
@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz)
|
||||||
|
|
||||||
srpm: clean
|
|
||||||
@(unset CDPATH ; $(MAKE) dist && rpmbuild -ts $(distdir).tar.xz)
|
|
||||||
|
|
||||||
check-local: all tests
|
check-local: all tests
|
||||||
|
|
||||||
check-access:
|
|
||||||
@($(MAKE) $(AM_MAKEFLAGS) -C tests check-access)
|
|
||||||
|
|
||||||
cov: clean-cov
|
cov: clean-cov
|
||||||
$(MKDIR_P) $(top_builddir)/coverage
|
mkdir $(top_builddir)/coverage
|
||||||
$(LCOV) -c -o $(top_builddir)/coverage/libvirt.info.tmp \
|
$(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
|
-d $(top_builddir)/tests
|
||||||
$(LCOV) -r $(top_builddir)/coverage/libvirt.info.tmp \
|
$(LCOV) -r $(top_builddir)/coverage/libvirt.info.tmp \
|
||||||
-o $(top_builddir)/coverage/libvirt.info
|
-o $(top_builddir)/coverage/libvirt.info
|
||||||
@@ -93,6 +92,9 @@ clean-cov:
|
|||||||
|
|
||||||
MAINTAINERCLEANFILES = .git-module-status
|
MAINTAINERCLEANFILES = .git-module-status
|
||||||
|
|
||||||
|
# disable this check
|
||||||
|
distuninstallcheck:
|
||||||
|
|
||||||
dist-hook: gen-ChangeLog gen-AUTHORS
|
dist-hook: gen-ChangeLog gen-AUTHORS
|
||||||
|
|
||||||
# Generate the ChangeLog file (with all entries since the switch to git)
|
# Generate the ChangeLog file (with all entries since the switch to git)
|
||||||
@@ -100,26 +102,18 @@ dist-hook: gen-ChangeLog gen-AUTHORS
|
|||||||
gen_start_date = 2009-07-04
|
gen_start_date = 2009-07-04
|
||||||
.PHONY: gen-ChangeLog
|
.PHONY: gen-ChangeLog
|
||||||
gen-ChangeLog:
|
gen-ChangeLog:
|
||||||
$(AM_V_GEN)if test -d .git; then \
|
$(AM_V_GEN)if test -d .git; then \
|
||||||
$(top_srcdir)/build-aux/gitlog-to-changelog \
|
$(top_srcdir)/build-aux/gitlog-to-changelog \
|
||||||
--since=$(gen_start_date) > $(distdir)/cl-t; \
|
--since=$(gen_start_date) > $(distdir)/cl-t; \
|
||||||
rm -f $(distdir)/ChangeLog; \
|
rm -f $(distdir)/ChangeLog; \
|
||||||
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
|
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
.PHONY: gen-AUTHORS
|
.PHONY: gen-AUTHORS
|
||||||
gen-AUTHORS:
|
gen-AUTHORS:
|
||||||
$(AM_V_GEN)\
|
$(AM_V_GEN)if test -d $(srcdir)/.git; then \
|
||||||
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'" \
|
||||||
cd $(srcdir) && \
|
< $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp && \
|
||||||
git log --pretty=format:'%aN <%aE>' | sort -u \
|
mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS ; \
|
||||||
) > 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; \
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
## <http://www.gnu.org/licenses/>.
|
## <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#
|
#
|
||||||
# Generated by running the following on Fedora 26:
|
# Generated by running the following on Fedora 9:
|
||||||
#
|
#
|
||||||
# nm -D --defined-only /lib64/libc.so.6 \
|
# nm -D --defined-only /lib/libc.so.6 \
|
||||||
# | grep '_r$' \
|
# | grep '_r$' \
|
||||||
# | awk '{print $3}' \
|
# | awk '{print $3}' \
|
||||||
# | grep -v __ \
|
# | grep -v __ \
|
||||||
@@ -43,7 +43,6 @@ NON_REENTRANT += ether_ntoa
|
|||||||
NON_REENTRANT += fcvt
|
NON_REENTRANT += fcvt
|
||||||
NON_REENTRANT += fgetgrent
|
NON_REENTRANT += fgetgrent
|
||||||
NON_REENTRANT += fgetpwent
|
NON_REENTRANT += fgetpwent
|
||||||
NON_REENTRANT += fgetsgent
|
|
||||||
NON_REENTRANT += fgetspent
|
NON_REENTRANT += fgetspent
|
||||||
NON_REENTRANT += getaliasbyname
|
NON_REENTRANT += getaliasbyname
|
||||||
NON_REENTRANT += getaliasent
|
NON_REENTRANT += getaliasent
|
||||||
@@ -73,8 +72,6 @@ NON_REENTRANT += getrpcent
|
|||||||
NON_REENTRANT += getservbyname
|
NON_REENTRANT += getservbyname
|
||||||
NON_REENTRANT += getservbyport
|
NON_REENTRANT += getservbyport
|
||||||
NON_REENTRANT += getservent
|
NON_REENTRANT += getservent
|
||||||
NON_REENTRANT += getsgent
|
|
||||||
NON_REENTRANT += getsgnam
|
|
||||||
NON_REENTRANT += getspent
|
NON_REENTRANT += getspent
|
||||||
NON_REENTRANT += getspnam
|
NON_REENTRANT += getspnam
|
||||||
NON_REENTRANT += getutent
|
NON_REENTRANT += getutent
|
||||||
@@ -98,7 +95,6 @@ NON_REENTRANT += random
|
|||||||
NON_REENTRANT += rand
|
NON_REENTRANT += rand
|
||||||
NON_REENTRANT += seed48
|
NON_REENTRANT += seed48
|
||||||
NON_REENTRANT += setstate
|
NON_REENTRANT += setstate
|
||||||
NON_REENTRANT += sgetsgent
|
|
||||||
NON_REENTRANT += sgetspent
|
NON_REENTRANT += sgetspent
|
||||||
NON_REENTRANT += srand48
|
NON_REENTRANT += srand48
|
||||||
NON_REENTRANT += srandom
|
NON_REENTRANT += srandom
|
||||||
@@ -117,11 +113,3 @@ NON_REENTRANT += inet_nsap_ntoa
|
|||||||
NON_REENTRANT += inet_ntoa
|
NON_REENTRANT += inet_ntoa
|
||||||
NON_REENTRANT += inet_ntop
|
NON_REENTRANT += inet_ntop
|
||||||
NON_REENTRANT += inet_pton
|
NON_REENTRANT += inet_pton
|
||||||
|
|
||||||
# Separate two nothings by space to get one space in a variable
|
|
||||||
space =
|
|
||||||
space +=
|
|
||||||
# The space needs to be in a variable otherwise it would be ignored.
|
|
||||||
# And there must be no spaces around the commas because they would
|
|
||||||
# not be ignored, logically.
|
|
||||||
NON_REENTRANT_RE=$(subst $(space),|,$(NON_REENTRANT))
|
|
||||||
|
|||||||
13
README
Normal file
13
README
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
LibVirt : simple API for virtualization
|
||||||
|
|
||||||
|
Libvirt is a C toolkit to interact with the virtualization capabilities
|
||||||
|
of recent versions of Linux (and other OSes). It is free software
|
||||||
|
available under the GNU Lesser General Public License. Virtualization of
|
||||||
|
the Linux Operating System means the ability to run multiple instances of
|
||||||
|
Operating Systems concurrently on a single hardware system where the basic
|
||||||
|
resources are driven by a Linux instance. The library aim at providing
|
||||||
|
long term stable C API initially for the Xen paravirtualization but
|
||||||
|
should be able to integrate other virtualization mechanisms if needed.
|
||||||
|
|
||||||
|
Daniel Veillard <veillard@redhat.com>
|
||||||
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
These notes intend to help people working on the checked-out sources.
|
These notes intend to help people working on the checked-out sources.
|
||||||
These requirements do not apply when building from a distribution tarball.
|
These requirements do not apply when building from a distribution tarball.
|
||||||
See also docs/hacking.html (after building libvirt using the information
|
See also HACKING for more detailed libvirt contribution guidelines.
|
||||||
included in this file) for more detailed contribution guidelines.
|
|
||||||
|
|
||||||
* Requirements
|
* Requirements
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ few prerequisites, later, a plain `git pull && make' should be sufficient.
|
|||||||
|
|
||||||
You can get a copy of the source repository like this:
|
You can get a copy of the source repository like this:
|
||||||
|
|
||||||
$ git clone https://libvirt.org/git/libvirt.git
|
$ git clone git://libvirt.org/libvirt
|
||||||
$ cd libvirt
|
$ cd libvirt
|
||||||
|
|
||||||
As an optional step, if you already have a copy of the gnulib git
|
As an optional step, if you already have a copy of the gnulib git
|
||||||
|
|||||||
83
README.md
83
README.md
@@ -1,83 +0,0 @@
|
|||||||
[](https://travis-ci.org/libvirt/libvirt)
|
|
||||||
[](https://bestpractices.coreinfrastructure.org/projects/355)
|
|
||||||
|
|
||||||
Libvirt API for virtualization
|
|
||||||
==============================
|
|
||||||
|
|
||||||
Libvirt provides a portable, long term stable C API for managing the
|
|
||||||
virtualization technologies provided by many operating systems. It
|
|
||||||
includes support for QEMU, KVM, Xen, LXC, bhyve, Virtuozzo, VMware
|
|
||||||
vCenter and ESX, VMware Desktop, Hyper-V, VirtualBox and the POWER
|
|
||||||
Hypervisor.
|
|
||||||
|
|
||||||
For some of these hypervisors, it provides a stateful management
|
|
||||||
daemon which runs on the virtualization host allowing access to the
|
|
||||||
API both by non-privileged local users and remote users.
|
|
||||||
|
|
||||||
Layered packages provide bindings of the libvirt C API into other
|
|
||||||
languages including Python, Perl, PHP, Go, Java, OCaml, as well as
|
|
||||||
mappings into object systems such as GObject, CIM and SNMP.
|
|
||||||
|
|
||||||
Further information about the libvirt project can be found on the
|
|
||||||
website:
|
|
||||||
|
|
||||||
[https://libvirt.org](https://libvirt.org)
|
|
||||||
|
|
||||||
|
|
||||||
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.1 (or later). See the files `COPYING.LESSER`
|
|
||||||
and `COPYING` for full license terms & conditions.
|
|
||||||
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
|
|
||||||
Libvirt uses the GNU Autotools build system, so in general can be built
|
|
||||||
and installed with the usual commands. For example, to build in a manner
|
|
||||||
that is suitable for installing as root, use:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
|
|
||||||
$ make
|
|
||||||
$ sudo make install
|
|
||||||
```
|
|
||||||
|
|
||||||
While to build & install as an unprivileged user
|
|
||||||
|
|
||||||
```
|
|
||||||
$ ./configure --prefix=$HOME/usr
|
|
||||||
$ make
|
|
||||||
$ make install
|
|
||||||
```
|
|
||||||
|
|
||||||
The libvirt code relies on a large number of 3rd party libraries. These will
|
|
||||||
be detected during execution of the `configure` script and a summary printed
|
|
||||||
which lists any missing (optional) dependencies.
|
|
||||||
|
|
||||||
|
|
||||||
Contributing
|
|
||||||
------------
|
|
||||||
|
|
||||||
The libvirt project welcomes contributions in many ways. For most components
|
|
||||||
the best way to contribute is to send patches to the primary development
|
|
||||||
mailing list. Further guidance on this can be found on the website:
|
|
||||||
|
|
||||||
[https://libvirt.org/contribute.html](https://libvirt.org/contribute.html)
|
|
||||||
|
|
||||||
|
|
||||||
Contact
|
|
||||||
-------
|
|
||||||
|
|
||||||
The libvirt project has two primary mailing lists:
|
|
||||||
|
|
||||||
* libvirt-users@redhat.com (**for user discussions**)
|
|
||||||
* libvir-list@redhat.com (**for development only**)
|
|
||||||
|
|
||||||
Further details on contacting the project are available on the website:
|
|
||||||
|
|
||||||
[https://libvirt.org/contact.html](https://libvirt.org/contact.html)
|
|
||||||
22
TODO
Normal file
22
TODO
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
libvirt TODO list
|
||||||
|
=================
|
||||||
|
|
||||||
|
The TODO list changes frequently, so is maintained online
|
||||||
|
in the libvirt bugzilla
|
||||||
|
|
||||||
|
http://bugzilla.redhat.com/
|
||||||
|
|
||||||
|
Search against
|
||||||
|
|
||||||
|
Product: Virtualization Tools
|
||||||
|
Component: libvirt
|
||||||
|
Subject: RFE
|
||||||
|
|
||||||
|
Or browse dependent bugs under
|
||||||
|
|
||||||
|
https://bugzilla.redhat.com/show_bug.cgi?id=libvirtTodo
|
||||||
|
|
||||||
|
Summarized reports automatically generated from bugzilla
|
||||||
|
and provided online at
|
||||||
|
|
||||||
|
http://libvirt.org/todo.html
|
||||||
122
autobuild.sh
Executable file
122
autobuild.sh
Executable file
@@ -0,0 +1,122 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -v
|
||||||
|
|
||||||
|
# Make things clean.
|
||||||
|
|
||||||
|
test -n "$1" && RESULTS=$1 || RESULTS=results.log
|
||||||
|
: ${AUTOBUILD_INSTALL_ROOT=$HOME/builder}
|
||||||
|
|
||||||
|
# If run under the autobuilder, we must use --nodeps with rpmbuild;
|
||||||
|
# but this can lead to odd error diagnosis for normal development.
|
||||||
|
nodeps=
|
||||||
|
if test "${AUTOBUILD_COUNTER+set}"; then
|
||||||
|
nodeps=--nodeps
|
||||||
|
fi
|
||||||
|
|
||||||
|
test -f Makefile && make -k distclean || :
|
||||||
|
rm -rf coverage
|
||||||
|
|
||||||
|
rm -rf build
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
|
||||||
|
# Run with options not normally exercised by the rpm build, for
|
||||||
|
# more complete code coverage.
|
||||||
|
../autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \
|
||||||
|
--enable-expensive-tests \
|
||||||
|
--enable-test-coverage \
|
||||||
|
--disable-nls \
|
||||||
|
--enable-werror \
|
||||||
|
--enable-static
|
||||||
|
|
||||||
|
# If the MAKEFLAGS envvar does not yet include a -j option,
|
||||||
|
# add -jN where N depends on the number of processors.
|
||||||
|
case $MAKEFLAGS in
|
||||||
|
*-j*) ;;
|
||||||
|
*) n=$(getconf _NPROCESSORS_ONLN 2> /dev/null)
|
||||||
|
test "$n" -gt 0 || n=1
|
||||||
|
n=$(expr $n + 1)
|
||||||
|
MAKEFLAGS="$MAKEFLAGS -j$n"
|
||||||
|
export MAKEFLAGS
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
# set -o pipefail is a bashism; this use of exec is the POSIX alternative
|
||||||
|
exec 3>&1
|
||||||
|
st=$(
|
||||||
|
exec 4>&1 >&3
|
||||||
|
{ make check syntax-check 2>&1 3>&- 4>&-; echo $? >&4; } | tee "$RESULTS"
|
||||||
|
)
|
||||||
|
exec 3>&-
|
||||||
|
test "$st" = 0
|
||||||
|
test -x /usr/bin/lcov && make cov
|
||||||
|
|
||||||
|
rm -f *.tar.gz
|
||||||
|
make dist
|
||||||
|
|
||||||
|
if test -n "$AUTOBUILD_COUNTER" ; then
|
||||||
|
EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER"
|
||||||
|
else
|
||||||
|
NOW=`date +"%s"`
|
||||||
|
EXTRA_RELEASE=".$USER$NOW"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -f /usr/bin/rpmbuild ; then
|
||||||
|
rpmbuild $nodeps \
|
||||||
|
--define "extra_release $EXTRA_RELEASE" \
|
||||||
|
--define "_sourcedir `pwd`" \
|
||||||
|
-ba --clean libvirt.spec
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Test mingw32 cross-compile
|
||||||
|
if test -x /usr/bin/i686-w64-mingw32-gcc ; then
|
||||||
|
make distclean
|
||||||
|
|
||||||
|
PKG_CONFIG_LIBDIR="/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-w64-mingw32/sys-root/mingw/share/pkgconfig" \
|
||||||
|
PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig" \
|
||||||
|
CC="i686-w64-mingw32-gcc" \
|
||||||
|
../configure \
|
||||||
|
--build=$(uname -m)-w64-linux \
|
||||||
|
--host=i686-w64-mingw32 \
|
||||||
|
--prefix="$AUTOBUILD_INSTALL_ROOT/i686-w64-mingw32/sys-root/mingw" \
|
||||||
|
--enable-expensive-tests \
|
||||||
|
--enable-werror
|
||||||
|
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Test mingw64 cross-compile
|
||||||
|
if test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
|
||||||
|
make distclean
|
||||||
|
|
||||||
|
PKG_CONFIG_LIBDIR="/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/x86_64-w64-mingw32/sys-root/mingw/share/pkgconfig" \
|
||||||
|
PKG_CONFIG_PATH="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig" \
|
||||||
|
CC="x86_64-w64-mingw32-gcc" \
|
||||||
|
../configure \
|
||||||
|
--build=$(uname -m)-w64-linux \
|
||||||
|
--host=x86_64-w64-mingw32 \
|
||||||
|
--prefix="$AUTOBUILD_INSTALL_ROOT/x86_64-w64-mingw32/sys-root/mingw" \
|
||||||
|
--enable-expensive-tests \
|
||||||
|
--enable-werror
|
||||||
|
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test -x /usr/bin/i686-w64-mingw32-gcc && test -x /usr/bin/x86_64-w64-mingw32-gcc ; then
|
||||||
|
if test -f /usr/bin/rpmbuild ; then
|
||||||
|
rpmbuild $nodeps \
|
||||||
|
--define "extra_release $EXTRA_RELEASE" \
|
||||||
|
--define "_sourcedir `pwd`" \
|
||||||
|
-ba --clean mingw-libvirt.spec
|
||||||
|
fi
|
||||||
|
fi
|
||||||
269
autogen.sh
269
autogen.sh
@@ -1,208 +1,117 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Run this to generate all the initial makefiles, etc.
|
# Run this to generate all the initial makefiles, etc.
|
||||||
|
|
||||||
die()
|
set -e
|
||||||
{
|
|
||||||
echo "error: $1" >&2
|
srcdir=`dirname "$0"`
|
||||||
|
test -z "$srcdir" && srcdir=.
|
||||||
|
|
||||||
|
THEDIR=`pwd`
|
||||||
|
cd "$srcdir"
|
||||||
|
|
||||||
|
test -f src/libvirt.c || {
|
||||||
|
echo "You must run this script in the top-level libvirt directory"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
starting_point=$(pwd)
|
|
||||||
|
|
||||||
srcdir=$(dirname "$0")
|
EXTRA_ARGS=
|
||||||
test "$srcdir" || srcdir=.
|
|
||||||
|
|
||||||
cd "$srcdir" || {
|
|
||||||
die "Failed to cd into $srcdir"
|
|
||||||
}
|
|
||||||
|
|
||||||
test -f src/libvirt.c || {
|
|
||||||
die "$0 must live in the top-level libvirt directory"
|
|
||||||
}
|
|
||||||
|
|
||||||
dry_run=
|
|
||||||
no_git=
|
no_git=
|
||||||
gnulib_srcdir=
|
if test "x$1" = "x--no-git"; then
|
||||||
extra_args=
|
no_git=" $1"
|
||||||
while test "$#" -gt 0; do
|
shift
|
||||||
case "$1" in
|
case "$1 $2" in
|
||||||
--dry-run)
|
--gnulib-srcdir=*) no_git="$no_git $1"; shift ;;
|
||||||
# This variable will serve both as an indicator of the fact that
|
--gnulib-srcdir\ *) no_git="$no_git $1=$2"; shift; shift;;
|
||||||
# a dry run has been requested, and to store the result of the
|
esac
|
||||||
# dry run. It will be ultimately used as return code for the
|
fi
|
||||||
# script: 0 means no action is necessary, 2 means that autogen.sh
|
if test -z "$NOCONFIGURE" ; then
|
||||||
# needs to be executed, and 1 is reserved for failures
|
if test "x$1" = "x--system"; then
|
||||||
dry_run=0
|
shift
|
||||||
shift
|
prefix=/usr
|
||||||
;;
|
libdir=$prefix/lib
|
||||||
--no-git)
|
sysconfdir=/etc
|
||||||
no_git=" $1"
|
localstatedir=/var
|
||||||
shift
|
if [ -d /usr/lib64 ]; then
|
||||||
;;
|
libdir=$prefix/lib64
|
||||||
--gnulib-srcdir=*)
|
fi
|
||||||
gnulib_srcdir=" $1"
|
EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir"
|
||||||
shift
|
echo "Running ./configure with $EXTRA_ARGS $@"
|
||||||
;;
|
else
|
||||||
--gnulib-srcdir)
|
if test -z "$*" && test ! -f "$THEDIR/config.status"; then
|
||||||
gnulib_srcdir=" $1=$2"
|
echo "I am going to run ./configure with no arguments - if you wish"
|
||||||
shift
|
echo "to pass any to it, please specify them on the $0 command line."
|
||||||
shift
|
fi
|
||||||
;;
|
fi
|
||||||
--system)
|
fi
|
||||||
prefix=/usr
|
|
||||||
sysconfdir=/etc
|
|
||||||
localstatedir=/var
|
|
||||||
if test -d $prefix/lib64; then
|
|
||||||
libdir=$prefix/lib64
|
|
||||||
else
|
|
||||||
libdir=$prefix/lib
|
|
||||||
fi
|
|
||||||
extra_args="--prefix=$prefix --localstatedir=$localstatedir"
|
|
||||||
extra_args="$extra_args --sysconfdir=$sysconfdir --libdir=$libdir"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# All remaining arguments will be passed to configure verbatim
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
no_git="$no_git$gnulib_srcdir"
|
|
||||||
|
|
||||||
gnulib_hash()
|
# Compute the hash we'll use to determine whether rerunning bootstrap
|
||||||
|
# is required. The first is just the SHA1 that selects a gnulib snapshot.
|
||||||
|
# The second ensures that whenever we change the set of gnulib modules used
|
||||||
|
# by this package, we rerun bootstrap to pull in the matching set of files.
|
||||||
|
# The third ensures that whenever we change the set of local gnulib diffs,
|
||||||
|
# we rerun bootstrap to pull in those diffs.
|
||||||
|
bootstrap_hash()
|
||||||
{
|
{
|
||||||
local no_git=$1
|
|
||||||
|
|
||||||
if test "$no_git"; then
|
if test "$no_git"; then
|
||||||
echo "no-git"
|
echo no-git
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
git submodule status | sed 's/^[ +-]//;s/ .*//'
|
||||||
# Compute the hash we'll use to determine whether rerunning bootstrap
|
|
||||||
# is required. The first is just the SHA1 that selects a gnulib snapshot.
|
|
||||||
# The second ensures that whenever we change the set of gnulib modules used
|
|
||||||
# by this package, we rerun bootstrap to pull in the matching set of files.
|
|
||||||
# The third ensures that whenever we change the set of local gnulib diffs,
|
|
||||||
# we rerun bootstrap to pull in those diffs.
|
|
||||||
git submodule status .gnulib | awk '{ print $1 }'
|
|
||||||
git hash-object bootstrap.conf
|
git hash-object bootstrap.conf
|
||||||
git ls-tree -d HEAD gnulib/local | awk '{ print $3 }'
|
git ls-tree -d HEAD gnulib/local | awk '{print $3}'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Only look into git submodules if we're in a git checkout
|
# Ensure that whenever we pull in a gnulib update or otherwise change to a
|
||||||
|
# different version (i.e., when switching branches), we also rerun ./bootstrap.
|
||||||
|
# Also, running 'make rpm' tends to litter the po/ directory, and some people
|
||||||
|
# like to run 'git clean -x -f po' to fix it; but only ./bootstrap regenerates
|
||||||
|
# the required file po/Makevars.
|
||||||
|
# Only run bootstrap from a git checkout, never from a tarball.
|
||||||
if test -d .git || test -f .git; then
|
if test -d .git || test -f .git; then
|
||||||
|
curr_status=.git-module-status t=
|
||||||
# Check for dirty submodules
|
if test "$no_git"; then
|
||||||
if test -z "$CLEAN_SUBMODULE"; then
|
t=no-git
|
||||||
for path in $(git submodule status | awk '{ print $2 }'); do
|
elif test -d .gnulib; then
|
||||||
case "$(git diff "$path")" in
|
t=$(bootstrap_hash; git diff .gnulib)
|
||||||
*-dirty*)
|
|
||||||
echo "error: $path is dirty, please investigate" >&2
|
|
||||||
echo "set CLEAN_SUBMODULE to discard submodule changes" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
if test "$CLEAN_SUBMODULE" && test -z "$no_git"; then
|
case $t:${CLEAN_SUBMODULE+set} in
|
||||||
if test -z "$dry_run"; then
|
*:set) ;;
|
||||||
echo "Cleaning up submodules..."
|
*-dirty*)
|
||||||
git submodule foreach 'git clean -dfqx && git reset --hard' || {
|
echo "error: gnulib submodule is dirty, please investigate" 2>&1
|
||||||
die "Cleaning up submodules failed"
|
echo "set env-var CLEAN_SUBMODULE to discard gnulib changes" 2>&1
|
||||||
}
|
exit 1 ;;
|
||||||
fi
|
esac
|
||||||
fi
|
# Keep this test in sync with cfg.mk:_update_required
|
||||||
|
if test "$t" = "$(cat $curr_status 2>/dev/null)" \
|
||||||
# Update all submodules. If any of the submodules has not been
|
&& test -f "po/Makevars" && test -f AUTHORS; then
|
||||||
# initialized yet, it will be initialized now; moreover, any submodule
|
# good, it's up to date, all we need is autoreconf
|
||||||
# with uncommitted changes will be returned to the expected state
|
autoreconf -if
|
||||||
echo "Updating submodules..."
|
|
||||||
git submodule update --init || {
|
|
||||||
die "Updating submodules failed"
|
|
||||||
}
|
|
||||||
|
|
||||||
# The expected hash, eg. the one computed after the last
|
|
||||||
# successful bootstrap run, is stored on disk
|
|
||||||
state_file=.git-module-status
|
|
||||||
expected_hash=$(cat "$state_file" 2>/dev/null)
|
|
||||||
actual_hash=$(gnulib_hash "$no_git")
|
|
||||||
|
|
||||||
if test "$actual_hash" = "$expected_hash" && test -f AUTHORS; then
|
|
||||||
# The gnulib hash matches our expectations, and all the files
|
|
||||||
# that can only be generated through bootstrap are present:
|
|
||||||
# we just need to run autoreconf. Unless we're performing a
|
|
||||||
# dry run, of course...
|
|
||||||
if test -z "$dry_run"; then
|
|
||||||
echo "Running autoreconf..."
|
|
||||||
autoreconf -if || {
|
|
||||||
die "autoreconf failed"
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
# Whenever the gnulib submodule or any of the related bits
|
if test -z "$no_git" && test ${CLEAN_SUBMODULE+set}; then
|
||||||
# has been changed in some way (see gnulib_hash) we need to
|
echo cleaning up submodules...
|
||||||
# run bootstrap again. If we're performing a dry run, we
|
git submodule foreach 'git clean -dfqx && git reset --hard'
|
||||||
# change the return code instead to signal our caller
|
|
||||||
if test "$dry_run"; then
|
|
||||||
dry_run=2
|
|
||||||
else
|
|
||||||
echo "Running bootstrap..."
|
|
||||||
./bootstrap$no_git --bootstrap-sync || {
|
|
||||||
die "bootstrap failed"
|
|
||||||
}
|
|
||||||
gnulib_hash >"$state_file"
|
|
||||||
fi
|
fi
|
||||||
|
echo running bootstrap$no_git...
|
||||||
|
./bootstrap$no_git --bootstrap-sync && bootstrap_hash > $curr_status \
|
||||||
|
|| { echo "Failed to bootstrap, please investigate."; exit 1; }
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# When performing a dry run, we can stop here
|
test -n "$NOCONFIGURE" && exit 0
|
||||||
test "$dry_run" && exit "$dry_run"
|
|
||||||
|
|
||||||
# If asked not to run configure, we can stop here
|
cd "$THEDIR"
|
||||||
test "$NOCONFIGURE" && exit 0
|
|
||||||
|
|
||||||
cd "$starting_point" || {
|
if test "x$OBJ_DIR" != x; then
|
||||||
die "Failed to cd into $starting_point"
|
mkdir -p "$OBJ_DIR"
|
||||||
}
|
cd "$OBJ_DIR"
|
||||||
|
|
||||||
if test "$OBJ_DIR"; then
|
|
||||||
mkdir -p "$OBJ_DIR" || {
|
|
||||||
die "Failed to create $OBJ_DIR"
|
|
||||||
}
|
|
||||||
cd "$OBJ_DIR" || {
|
|
||||||
die "Failed to cd into $OBJ_DIR"
|
|
||||||
}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure we can find GNU make and tell the user
|
if test -z "$*" && test -z "$EXTRA_ARGS" && test -f config.status; then
|
||||||
# the right command to run
|
./config.status --recheck
|
||||||
MAKE=
|
|
||||||
for cmd in make gmake; do
|
|
||||||
if $cmd -v 2>&1 | grep -q "GNU Make"; then
|
|
||||||
MAKE=$cmd
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
test "$MAKE" || {
|
|
||||||
die "GNU make is required to build libvirt"
|
|
||||||
}
|
|
||||||
|
|
||||||
if test -z "$*" && test -z "$extra_args" && test -f config.status; then
|
|
||||||
echo "Running config.status..."
|
|
||||||
./config.status --recheck || {
|
|
||||||
die "config.status failed"
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
if test -z "$*" && test -z "$extra_args"; then
|
$srcdir/configure $EXTRA_ARGS "$@"
|
||||||
echo "I am going to run configure with no arguments - if you wish"
|
fi && {
|
||||||
echo "to pass any to it, please specify them on the $0 command line."
|
echo
|
||||||
else
|
echo "Now type 'make' to compile libvirt."
|
||||||
echo "Running configure with $extra_args $@"
|
}
|
||||||
fi
|
|
||||||
"$srcdir/configure" $extra_args "$@" || {
|
|
||||||
die "configure failed"
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Now type '$MAKE' to compile libvirt."
|
|
||||||
|
|||||||
320
bootstrap
320
bootstrap
@@ -1,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Print a version string.
|
# Print a version string.
|
||||||
scriptversion=2018-07-01.02; # UTC
|
scriptversion=2014-12-08.12; # UTC
|
||||||
|
|
||||||
# Bootstrap this package from checked-out sources.
|
# Bootstrap this package from checked-out sources.
|
||||||
|
|
||||||
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
|
# Copyright (C) 2003-2015 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,7 +17,7 @@ scriptversion=2018-07-01.02; # UTC
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Originally written by Paul Eggert. The canonical version of this
|
# Originally written by Paul Eggert. The canonical version of this
|
||||||
# script is maintained as build-aux/bootstrap in gnulib, however, to
|
# script is maintained as build-aux/bootstrap in gnulib, however, to
|
||||||
@@ -42,13 +42,11 @@ export LC_ALL
|
|||||||
|
|
||||||
local_gl_dir=gl
|
local_gl_dir=gl
|
||||||
|
|
||||||
# Honor $PERL, but work even if there is none.
|
# Honour $PERL, but work even if there is none
|
||||||
PERL="${PERL-perl}"
|
PERL="${PERL-perl}"
|
||||||
|
|
||||||
me=$0
|
me=$0
|
||||||
|
|
||||||
default_gnulib_url=git://git.sv.gnu.org/gnulib
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Usage: $me [OPTION]...
|
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
|
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
|
||||||
are honored.
|
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.
|
Running without arguments will suffice in most cases.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@@ -142,6 +109,9 @@ die() { warn_ "$@"; exit 1; }
|
|||||||
|
|
||||||
# Configuration.
|
# Configuration.
|
||||||
|
|
||||||
|
# Name of the Makefile.am
|
||||||
|
gnulib_mk=gnulib.mk
|
||||||
|
|
||||||
# List of gnulib modules needed.
|
# List of gnulib modules needed.
|
||||||
gnulib_modules=
|
gnulib_modules=
|
||||||
|
|
||||||
@@ -171,7 +141,7 @@ po_download_command_format=\
|
|||||||
# Fallback for downloading .po files (if rsync fails).
|
# Fallback for downloading .po files (if rsync fails).
|
||||||
po_download_command_format2=\
|
po_download_command_format2=\
|
||||||
"wget --mirror -nd -q -np -A.po -P '%s' \
|
"wget --mirror -nd -q -np -A.po -P '%s' \
|
||||||
https://translationproject.org/latest/%s/"
|
http://translationproject.org/latest/%s/"
|
||||||
|
|
||||||
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
|
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
|
||||||
# fall back to the package name (1st argument with munging)
|
# fall back to the package name (1st argument with munging)
|
||||||
@@ -200,15 +170,7 @@ source_base=lib
|
|||||||
m4_base=m4
|
m4_base=m4
|
||||||
doc_base=doc
|
doc_base=doc
|
||||||
tests_base=tests
|
tests_base=tests
|
||||||
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
|
|
||||||
"
|
|
||||||
|
|
||||||
# Additional gnulib-tool options to use. Use "\newline" to break lines.
|
# Additional gnulib-tool options to use. Use "\newline" to break lines.
|
||||||
gnulib_tool_option_extras=
|
gnulib_tool_option_extras=
|
||||||
@@ -302,18 +264,24 @@ case "$0" in
|
|||||||
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
*) test -r "$0.conf" && . ./"$0.conf" ;;
|
||||||
esac
|
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
|
if test "$vc_ignore" = auto; then
|
||||||
vc_ignore=
|
vc_ignore=
|
||||||
test -d .git && vc_ignore=.gitignore
|
test -d .git && vc_ignore=.gitignore
|
||||||
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
|
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
|
||||||
fi
|
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.
|
# Translate configuration into internal form.
|
||||||
|
|
||||||
# Parse options.
|
# Parse options.
|
||||||
@@ -450,30 +418,28 @@ sort_ver() { # sort -V is not generally available
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
get_version_sed='
|
|
||||||
# Move version to start of line.
|
|
||||||
s/.*[v ]\([0-9]\)/\1/
|
|
||||||
|
|
||||||
# Skip lines that do not start with version.
|
|
||||||
/^[0-9]/!d
|
|
||||||
|
|
||||||
# Remove characters after the version.
|
|
||||||
s/[^.a-z0-9-].*//
|
|
||||||
|
|
||||||
# The first component must be digits only.
|
|
||||||
s/^\([0-9]*\)[a-z-].*/\1/
|
|
||||||
|
|
||||||
#the following essentially does s/5.005/5.5/
|
|
||||||
s/\.0*\([1-9]\)/.\1/g
|
|
||||||
p
|
|
||||||
q'
|
|
||||||
|
|
||||||
get_version() {
|
get_version() {
|
||||||
app=$1
|
app=$1
|
||||||
|
|
||||||
$app --version >/dev/null 2>&1 || { $app --version; return 1; }
|
$app --version >/dev/null 2>&1 || { $app --version; return 1; }
|
||||||
|
|
||||||
$app --version 2>&1 | sed -n "$get_version_sed"
|
$app --version 2>&1 |
|
||||||
|
sed -n '# Move version to start of line.
|
||||||
|
s/.*[v ]\([0-9]\)/\1/
|
||||||
|
|
||||||
|
# Skip lines that do not start with version.
|
||||||
|
/^[0-9]/!d
|
||||||
|
|
||||||
|
# Remove characters after the version.
|
||||||
|
s/[^.a-z0-9-].*//
|
||||||
|
|
||||||
|
# The first component must be digits only.
|
||||||
|
s/^\([0-9]*\)[a-z-].*/\1/
|
||||||
|
|
||||||
|
#the following essentially does s/5.005/5.5/
|
||||||
|
s/\.0*\([1-9]\)/.\1/g
|
||||||
|
p
|
||||||
|
q'
|
||||||
}
|
}
|
||||||
|
|
||||||
check_versions() {
|
check_versions() {
|
||||||
@@ -644,94 +610,85 @@ git_modules_config () {
|
|||||||
test -f .gitmodules && git config --file .gitmodules "$@"
|
test -f .gitmodules && git config --file .gitmodules "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
if $use_gnulib; then
|
if $use_git; then
|
||||||
if $use_git; then
|
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
||||||
gnulib_path=$(git_modules_config submodule.gnulib.path)
|
test -z "$gnulib_path" && gnulib_path=gnulib
|
||||||
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
|
fi
|
||||||
|
GNULIB_SRCDIR=$gnulib_path
|
||||||
# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
|
;;
|
||||||
# submodule, for use in the rest of the script.
|
*)
|
||||||
|
# Use GNULIB_SRCDIR directly or as a reference.
|
||||||
case ${GNULIB_SRCDIR--} in
|
if $use_git && test -d "$GNULIB_SRCDIR"/.git && \
|
||||||
-)
|
git_modules_config submodule.gnulib.url >/dev/null; then
|
||||||
# Note that $use_git is necessarily true in this case.
|
echo "$0: getting gnulib files..."
|
||||||
if git_modules_config submodule.gnulib.url >/dev/null; then
|
if git submodule -h|grep -- --reference > /dev/null; then
|
||||||
echo "$0: getting gnulib files..."
|
# Prefer the one-liner available in git 1.6.4 or newer.
|
||||||
git submodule init -- "$gnulib_path" || exit $?
|
git submodule update --init --reference "$GNULIB_SRCDIR" \
|
||||||
git submodule update -- "$gnulib_path" || exit $?
|
"$gnulib_path" || exit $?
|
||||||
|
else
|
||||||
elif [ ! -d "$gnulib_path" ]; then
|
# This fallback allows at least git 1.5.5.
|
||||||
echo "$0: getting gnulib files..."
|
if test -f "$gnulib_path"/gnulib-tool; then
|
||||||
|
# Since file already exists, assume submodule init already complete.
|
||||||
trap cleanup_gnulib 1 2 13 15
|
git submodule update -- "$gnulib_path" || exit $?
|
||||||
|
else
|
||||||
shallow=
|
# Older git can't clone into an empty directory.
|
||||||
if test -z "$GNULIB_REVISION"; then
|
rmdir "$gnulib_path" 2>/dev/null
|
||||||
git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
|
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
|
||||||
git clone $shallow ${GNULIB_URL:-$default_gnulib_url} "$gnulib_path" \
|
|
||||||
|| cleanup_gnulib
|
|
||||||
|
|
||||||
trap - 1 2 13 15
|
|
||||||
fi
|
fi
|
||||||
GNULIB_SRCDIR=$gnulib_path
|
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
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
# $GNULIB_SRCDIR now points to the version of gnulib to use, and
|
||||||
# we no longer need to use git or $gnulib_path below here.
|
# we no longer need to use git or $gnulib_path below here.
|
||||||
|
|
||||||
if $bootstrap_sync; then
|
if $bootstrap_sync; then
|
||||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||||
echo "$0: updating bootstrap and restarting..."
|
echo "$0: updating bootstrap and restarting..."
|
||||||
case $(sh -c 'echo "$1"' -- a) in
|
case $(sh -c 'echo "$1"' -- a) in
|
||||||
a) ignored=--;;
|
a) ignored=--;;
|
||||||
*) ignored=ignored;;
|
*) ignored=ignored;;
|
||||||
esac
|
esac
|
||||||
exec sh -c \
|
exec sh -c \
|
||||||
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
||||||
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||||
"$0" "$@" --no-bootstrap-sync
|
"$0" "$@" --no-bootstrap-sync
|
||||||
}
|
}
|
||||||
fi
|
|
||||||
|
|
||||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
|
||||||
<$gnulib_tool || exit $?
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||||
|
<$gnulib_tool || exit $?
|
||||||
|
|
||||||
# Get translations.
|
# Get translations.
|
||||||
|
|
||||||
download_po_files() {
|
download_po_files() {
|
||||||
@@ -740,7 +697,7 @@ download_po_files() {
|
|||||||
echo "$me: getting translations into $subdir for $domain..."
|
echo "$me: getting translations into $subdir for $domain..."
|
||||||
cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
|
cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
|
||||||
eval "$cmd" && return
|
eval "$cmd" && return
|
||||||
# Fallback to HTTPS.
|
# Fallback to HTTP.
|
||||||
cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
|
cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
|
||||||
eval "$cmd"
|
eval "$cmd"
|
||||||
}
|
}
|
||||||
@@ -831,9 +788,9 @@ symlink_to_dir()
|
|||||||
# Leave any existing symlink alone, if it already points to the source,
|
# Leave any existing symlink alone, if it already points to the source,
|
||||||
# so that broken build tools that care about symlink times
|
# so that broken build tools that care about symlink times
|
||||||
# aren't confused into doing unnecessary builds. Conversely, if the
|
# aren't confused into doing unnecessary builds. Conversely, if the
|
||||||
# existing symlink's timestamp is older than the source, make it afresh,
|
# existing symlink's time stamp is older than the source, make it afresh,
|
||||||
# so that broken tools aren't confused into skipping needed builds. See
|
# so that broken tools aren't confused into skipping needed builds. See
|
||||||
# <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
|
# <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>.
|
||||||
test -h "$dst" &&
|
test -h "$dst" &&
|
||||||
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
|
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
|
||||||
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
|
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
|
||||||
@@ -939,33 +896,32 @@ fi
|
|||||||
|
|
||||||
# Import from gnulib.
|
# Import from gnulib.
|
||||||
|
|
||||||
if $use_gnulib; then
|
gnulib_tool_options="\
|
||||||
gnulib_tool_options="\
|
--import\
|
||||||
--no-changelog\
|
--no-changelog\
|
||||||
--aux-dir=$build_aux\
|
--aux-dir $build_aux\
|
||||||
--doc-base=$doc_base\
|
--doc-base $doc_base\
|
||||||
--lib=$gnulib_name\
|
--lib $gnulib_name\
|
||||||
--m4-base=$m4_base/\
|
--m4-base $m4_base/\
|
||||||
--source-base=$source_base/\
|
--source-base $source_base/\
|
||||||
--tests-base=$tests_base\
|
--tests-base $tests_base\
|
||||||
--local-dir=$local_gl_dir\
|
--local-dir $local_gl_dir\
|
||||||
$gnulib_tool_option_extras\
|
$gnulib_tool_option_extras\
|
||||||
"
|
"
|
||||||
if test $use_libtool = 1; then
|
if test $use_libtool = 1; then
|
||||||
case "$gnulib_tool_options " in
|
case "$gnulib_tool_options " in
|
||||||
*' --libtool '*) ;;
|
*' --libtool '*) ;;
|
||||||
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
|
||||||
esac
|
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
|
|
||||||
fi
|
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 \
|
bootstrap_post_import_hook \
|
||||||
|| die "bootstrap_post_import_hook failed"
|
|| die "bootstrap_post_import_hook failed"
|
||||||
@@ -1062,9 +1018,9 @@ bootstrap_epilogue
|
|||||||
echo "$0: done. Now you can run './configure'."
|
echo "$0: done. Now you can run './configure'."
|
||||||
|
|
||||||
# Local variables:
|
# Local variables:
|
||||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
# time-stamp-start: "scriptversion="
|
# time-stamp-start: "scriptversion="
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
# time-stamp-time-zone: "UTC0"
|
# time-stamp-time-zone: "UTC"
|
||||||
# time-stamp-end: "; # UTC"
|
# time-stamp-end: "; # UTC"
|
||||||
# End:
|
# End:
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ connect
|
|||||||
configmake
|
configmake
|
||||||
count-leading-zeros
|
count-leading-zeros
|
||||||
count-one-bits
|
count-one-bits
|
||||||
|
crypto/md5
|
||||||
|
crypto/sha256
|
||||||
dirname-lgpl
|
dirname-lgpl
|
||||||
environ
|
environ
|
||||||
execinfo
|
execinfo
|
||||||
@@ -52,10 +54,10 @@ func
|
|||||||
getaddrinfo
|
getaddrinfo
|
||||||
getcwd-lgpl
|
getcwd-lgpl
|
||||||
gethostname
|
gethostname
|
||||||
getopt-posix
|
|
||||||
getpass
|
getpass
|
||||||
getpeername
|
getpeername
|
||||||
getsockname
|
getsockname
|
||||||
|
gettext-h
|
||||||
gettimeofday
|
gettimeofday
|
||||||
gitlog-to-changelog
|
gitlog-to-changelog
|
||||||
gnumakefile
|
gnumakefile
|
||||||
@@ -90,6 +92,7 @@ pthread
|
|||||||
pthread_sigmask
|
pthread_sigmask
|
||||||
recv
|
recv
|
||||||
regex
|
regex
|
||||||
|
random_r
|
||||||
sched
|
sched
|
||||||
secure_getenv
|
secure_getenv
|
||||||
send
|
send
|
||||||
@@ -117,7 +120,6 @@ time_r
|
|||||||
timegm
|
timegm
|
||||||
ttyname_r
|
ttyname_r
|
||||||
uname
|
uname
|
||||||
unsetenv
|
|
||||||
useless-if-before-free
|
useless-if-before-free
|
||||||
usleep
|
usleep
|
||||||
vasprintf
|
vasprintf
|
||||||
@@ -126,9 +128,18 @@ vc-list-files
|
|||||||
vsnprintf
|
vsnprintf
|
||||||
waitpid
|
waitpid
|
||||||
warnings
|
warnings
|
||||||
wcwidth
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
||||||
|
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
||||||
|
--flag=virAsprintf:2:c-format\\\
|
||||||
|
--from-code=UTF-8\\\
|
||||||
|
'
|
||||||
|
|
||||||
|
# This is not a GNU package, so the default bug address is invalid,
|
||||||
|
# and the translation project is not in use.
|
||||||
|
MSGID_BUGS_ADDRESS=libvir-list@redhat.com
|
||||||
|
COPYRIGHT_HOLDER='Red Hat, Inc.'
|
||||||
SKIP_PO=true
|
SKIP_PO=true
|
||||||
|
|
||||||
# Enable copy-mode for MSYS/MinGW. MSYS' ln doesn't work well in the way
|
# Enable copy-mode for MSYS/MinGW. MSYS' ln doesn't work well in the way
|
||||||
@@ -137,6 +148,31 @@ if test -n "$MSYSTEM"; then
|
|||||||
copy=true
|
copy=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If "AM_GNU_GETTEXT(external" or "AM_GNU_GETTEXT([external]"
|
||||||
|
# appears in configure.ac, exclude some unnecessary files.
|
||||||
|
# Without grep's -E option (not portable enough, pre-configure),
|
||||||
|
# the following test is ugly. Also, this depends on the existence
|
||||||
|
# of configure.ac, not the obsolescent-named configure.in. But if
|
||||||
|
# you're using this infrastructure, you should care about such things.
|
||||||
|
|
||||||
|
gettext_external=0
|
||||||
|
grep '^[ ]*AM_GNU_GETTEXT(external\>' configure.ac > /dev/null &&
|
||||||
|
gettext_external=1
|
||||||
|
grep '^[ ]*AM_GNU_GETTEXT(\[external\]' configure.ac > /dev/null &&
|
||||||
|
gettext_external=1
|
||||||
|
|
||||||
|
if test $gettext_external = 1; then
|
||||||
|
# Gettext supplies these files, but we don't need them since
|
||||||
|
# we don't have an intl subdirectory.
|
||||||
|
excluded_files='
|
||||||
|
m4/glibc2.m4
|
||||||
|
m4/intdiv0.m4
|
||||||
|
m4/lcmessage.m4
|
||||||
|
m4/uintmax_t.m4
|
||||||
|
m4/ulonglong.m4
|
||||||
|
m4/visibility.m4
|
||||||
|
'
|
||||||
|
fi
|
||||||
|
|
||||||
# Tell gnulib to:
|
# Tell gnulib to:
|
||||||
# require LGPLv2+
|
# require LGPLv2+
|
||||||
@@ -160,21 +196,35 @@ local_gl_dir=gnulib/local
|
|||||||
# Build prerequisites
|
# Build prerequisites
|
||||||
# Note that some of these programs are only required for 'make dist' to
|
# Note that some of these programs are only required for 'make dist' to
|
||||||
# succeed from a fresh git checkout; not all of these programs are
|
# succeed from a fresh git checkout; not all of these programs are
|
||||||
# required to run 'make dist' on a tarball.
|
# required to run 'make dist' on a tarball. As a special case, we want
|
||||||
|
# to require the equivalent of the Fedora python-devel package, but
|
||||||
|
# RHEL 5 lacks the witness python-config package; we hack around that
|
||||||
|
# old environment below.
|
||||||
buildreq="\
|
buildreq="\
|
||||||
autoconf 2.59
|
autoconf 2.59
|
||||||
automake 1.9.6
|
automake 1.9.6
|
||||||
|
autopoint -
|
||||||
|
gettext 0.17
|
||||||
git 1.5.5
|
git 1.5.5
|
||||||
gzip -
|
gzip -
|
||||||
libtool -
|
libtool -
|
||||||
patch -
|
patch -
|
||||||
perl 5.5
|
perl 5.5
|
||||||
|
perl::XML::XPath -
|
||||||
pkg-config -
|
pkg-config -
|
||||||
|
python-config -
|
||||||
rpcgen -
|
rpcgen -
|
||||||
tar -
|
tar -
|
||||||
xmllint -
|
xmllint -
|
||||||
xsltproc -
|
xsltproc -
|
||||||
"
|
"
|
||||||
|
# Use rpm as a fallback to bypass the bootstrap probe for python-config,
|
||||||
|
# for the sake of RHEL 5; without requiring it on newer systems that
|
||||||
|
# have python-config to begin with.
|
||||||
|
if `(${PYTHON_CONFIG-python-config} --version;
|
||||||
|
test $? -lt 126 || rpm -q python-devel) >/dev/null 2>&1`; then
|
||||||
|
PYTHON_CONFIG=true
|
||||||
|
fi
|
||||||
|
|
||||||
# Automake requires that ChangeLog and AUTHORS exist.
|
# Automake requires that ChangeLog and AUTHORS exist.
|
||||||
touch AUTHORS ChangeLog || exit 1
|
touch AUTHORS ChangeLog || exit 1
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env perl
|
#!/usr/bin/perl
|
||||||
#
|
#
|
||||||
# augeas-gentest.pl: Generate an augeas test file, from an
|
# augeas-gentest.pl: Generate an augeas test file, from an
|
||||||
# example config file + test file template
|
# example config file + test file template
|
||||||
|
|||||||
204
build-aux/bracket-spacing.pl
Executable file
204
build-aux/bracket-spacing.pl
Executable file
@@ -0,0 +1,204 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#
|
||||||
|
# bracket-spacing.pl: Report any usage of 'function (..args..)'
|
||||||
|
# Also check for other syntax issues, such as correct use of ';'
|
||||||
|
#
|
||||||
|
# This library is free software; you can redistribute it and/or
|
||||||
|
# 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;
|
||||||
|
|
||||||
|
my $ret = 0;
|
||||||
|
my $incomment = 0;
|
||||||
|
|
||||||
|
foreach my $file (@ARGV) {
|
||||||
|
# Per-file variables for multiline Curly Bracket (cb_) check
|
||||||
|
my $cb_linenum = 0;
|
||||||
|
my $cb_code = "";
|
||||||
|
my $cb_scolon = 0;
|
||||||
|
|
||||||
|
open FILE, $file;
|
||||||
|
|
||||||
|
while (defined (my $line = <FILE>)) {
|
||||||
|
my $data = $line;
|
||||||
|
# For temporary modifications
|
||||||
|
my $tmpdata;
|
||||||
|
|
||||||
|
# Kill any quoted , ; = or "
|
||||||
|
$data =~ s/'[";,=]'/'X'/g;
|
||||||
|
|
||||||
|
# Kill any quoted strings
|
||||||
|
$data =~ s,"([^\\\"]|\\.)*","XXX",g;
|
||||||
|
|
||||||
|
# Kill any C++ style comments
|
||||||
|
$data =~ s,//.*$,//,;
|
||||||
|
|
||||||
|
next if $data =~ /^#/;
|
||||||
|
|
||||||
|
# Kill contents of multi-line comments
|
||||||
|
# and detect end of multi-line comments
|
||||||
|
if ($incomment) {
|
||||||
|
if ($data =~ m,\*/,) {
|
||||||
|
$incomment = 0;
|
||||||
|
$data =~ s,^.*\*/,*/,;
|
||||||
|
} else {
|
||||||
|
$data = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Kill single line comments, and detect
|
||||||
|
# start of multi-line comments
|
||||||
|
if ($data =~ m,/\*.*\*/,) {
|
||||||
|
$data =~ s,/\*.*\*/,/* */,;
|
||||||
|
} elsif ($data =~ m,/\*,) {
|
||||||
|
$incomment = 1;
|
||||||
|
$data =~ s,/\*.*,/*,;
|
||||||
|
}
|
||||||
|
|
||||||
|
# We need to match things like
|
||||||
|
#
|
||||||
|
# int foo (int bar, bool wizz);
|
||||||
|
# foo (bar, wizz);
|
||||||
|
#
|
||||||
|
# but not match things like:
|
||||||
|
#
|
||||||
|
# typedef int (*foo)(bar wizz)
|
||||||
|
#
|
||||||
|
# we can't do this (efficiently) without
|
||||||
|
# missing things like
|
||||||
|
#
|
||||||
|
# foo (*bar, wizz);
|
||||||
|
#
|
||||||
|
# We also don't want to spoil the $data so it can be used
|
||||||
|
# later on.
|
||||||
|
$tmpdata = $data;
|
||||||
|
while ($tmpdata =~ /(\w+)\s\((?!\*)/) {
|
||||||
|
my $kw = $1;
|
||||||
|
|
||||||
|
# Allow space after keywords only
|
||||||
|
if ($kw =~ /^(if|for|while|switch|return)$/) {
|
||||||
|
$tmpdata =~ s/($kw\s\()/XXX(/;
|
||||||
|
} else {
|
||||||
|
print "Whitespace after non-keyword:\n";
|
||||||
|
print "$file:$.: $line";
|
||||||
|
$ret = 1;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Require whitespace immediately after keywords,
|
||||||
|
# but none after the opening bracket
|
||||||
|
if ($data =~ /\b(if|for|while|switch|return)\(/ ||
|
||||||
|
$data =~ /\b(if|for|while|switch|return)\s+\(\s/) {
|
||||||
|
print "No whitespace after keyword:\n";
|
||||||
|
print "$file:$.: $line";
|
||||||
|
$ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Forbid whitespace between )( of a function typedef
|
||||||
|
if ($data =~ /\(\*\w+\)\s+\(/) {
|
||||||
|
print "Whitespace between ')' and '(':\n";
|
||||||
|
print "$file:$.: $line";
|
||||||
|
$ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Forbid whitespace following ( or prior to )
|
||||||
|
if ($data =~ /\S\s+\)/ ||
|
||||||
|
$data =~ /\(\s+\S/) {
|
||||||
|
print "Whitespace after '(' or before ')':\n";
|
||||||
|
print "$file:$.: $line";
|
||||||
|
$ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Forbid whitespace before ";" or ",". Things like below are allowed:
|
||||||
|
#
|
||||||
|
# 1) The expression is empty for "for" loop. E.g.
|
||||||
|
# for (i = 0; ; i++)
|
||||||
|
#
|
||||||
|
# 2) An empty statement. E.g.
|
||||||
|
# while (write(statuswrite, &status, 1) == -1 &&
|
||||||
|
# errno == EINTR)
|
||||||
|
# ;
|
||||||
|
#
|
||||||
|
if ($data =~ /[^;\s]\s+[;,]/) {
|
||||||
|
print "Whitespace before (semi)colon:\n";
|
||||||
|
print "$file:$.: $line";
|
||||||
|
$ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Require EOL, macro line continuation, or whitespace after ";".
|
||||||
|
# Allow "for (;;)" as an exception.
|
||||||
|
if ($data =~ /;[^ \\\n;)]/) {
|
||||||
|
print "Invalid character after semicolon:\n";
|
||||||
|
print "$file:$.: $line";
|
||||||
|
$ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Require EOL, space, or enum/struct end after comma.
|
||||||
|
if ($data =~ /,[^ \\\n)}]/) {
|
||||||
|
print "Invalid character after comma:\n";
|
||||||
|
print "$file:$.: $line";
|
||||||
|
$ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Require spaces around assignment '=', compounds and '=='
|
||||||
|
# with the exception of virAssertCmpInt()
|
||||||
|
$tmpdata = $data;
|
||||||
|
$tmpdata =~ s/(virAssertCmpInt\(.* ).?=,/$1op,/;
|
||||||
|
if ($tmpdata =~ /[^ ]\b[!<>&|\-+*\/%\^=]?=[^=]/ ||
|
||||||
|
$tmpdata =~ /=[^= \\\n]/) {
|
||||||
|
print "Spacing around '=' or '==':\n";
|
||||||
|
print "$file:$.: $line";
|
||||||
|
$ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# One line conditional statements with one line bodies should
|
||||||
|
# not use curly brackets.
|
||||||
|
if ($data =~ /^\s*(if|while|for)\b.*\{$/) {
|
||||||
|
$cb_linenum = $.;
|
||||||
|
$cb_code = $line;
|
||||||
|
$cb_scolon = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
# We need to check for exactly one semicolon inside the body,
|
||||||
|
# because empty statements (e.g. with comment only) are
|
||||||
|
# allowed
|
||||||
|
if ($cb_linenum == $. - 1 && $data =~ /^[^;]*;[^;]*$/) {
|
||||||
|
$cb_code .= $line;
|
||||||
|
$cb_scolon = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($data =~ /^\s*}\s*$/ &&
|
||||||
|
$cb_linenum == $. - 2 &&
|
||||||
|
$cb_scolon) {
|
||||||
|
|
||||||
|
print "Curly brackets around single-line body:\n";
|
||||||
|
print "$file:$cb_linenum-$.:\n$cb_code$line";
|
||||||
|
$ret = 1;
|
||||||
|
|
||||||
|
# There _should_ be no need to reset the values; but to
|
||||||
|
# keep my inner peace...
|
||||||
|
$cb_linenum = 0;
|
||||||
|
$cb_scolon = 0;
|
||||||
|
$cb_code = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close FILE;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit $ret;
|
||||||
@@ -1,380 +0,0 @@
|
|||||||
#!/usr/bin/env perl
|
|
||||||
#
|
|
||||||
# check-spacing.pl: Report any usage of 'function (..args..)'
|
|
||||||
# Also check for other syntax issues, such as correct use of ';'
|
|
||||||
#
|
|
||||||
# This library is free software; you can redistribute it and/or
|
|
||||||
# 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;
|
|
||||||
|
|
||||||
#
|
|
||||||
# CheckFunctionBody:
|
|
||||||
# $_[0]: $data(in)
|
|
||||||
# $_[1]: $location(in), which format is file-path:line-num:line-code
|
|
||||||
# $_[2]: $fn_linenum(inout), maintains start line-num of function body
|
|
||||||
# Returns 0 in case of success or 1 on failure
|
|
||||||
#
|
|
||||||
# Check incorrect indentation and blank first line in function body.
|
|
||||||
# For efficiency, it only checks the first line of function body.
|
|
||||||
# But it's enough for most cases.
|
|
||||||
# (It could be better that we use *state* to declare @fn_linenum and
|
|
||||||
# move it into this subroutine. But *state* requires version >= v5.10.)
|
|
||||||
#
|
|
||||||
sub CheckFunctionBody {
|
|
||||||
my $ret = 0;
|
|
||||||
my ($data, $location, $fn_linenum) = @_;
|
|
||||||
|
|
||||||
# Check first line of function block
|
|
||||||
if ($$fn_linenum) {
|
|
||||||
if ($$data =~ /^\s*$/) {
|
|
||||||
print "Blank line before content in function body:\n$$location";
|
|
||||||
$ret = 1;
|
|
||||||
} elsif ($$data !~ /^[ ]{4}\S/) {
|
|
||||||
unless ($$data =~ /^[ ]\w+:$/ || $$data =~ /^}/) {
|
|
||||||
print "Incorrect indentation in function body:\n$$location";
|
|
||||||
$ret = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$$fn_linenum = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Detect start of function block
|
|
||||||
if ($$data =~ /^{$/) {
|
|
||||||
$$fn_linenum = $.;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# KillComments:
|
|
||||||
# $_[0]: $data(inout)
|
|
||||||
# $_[1]: $incomment(inout)
|
|
||||||
#
|
|
||||||
# Remove all content of comments
|
|
||||||
# (Also, the @incomment could be declared with *state* and move it in.)
|
|
||||||
#
|
|
||||||
sub KillComments {
|
|
||||||
my ($data, $incomment) = @_;
|
|
||||||
|
|
||||||
# Kill contents of multi-line comments
|
|
||||||
# and detect end of multi-line comments
|
|
||||||
if ($$incomment) {
|
|
||||||
if ($$data =~ m,\*/,) {
|
|
||||||
$$incomment = 0;
|
|
||||||
$$data =~ s,^.*\*/,*/,;
|
|
||||||
} else {
|
|
||||||
$$data = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Kill single line comments, and detect
|
|
||||||
# start of multi-line comments
|
|
||||||
if ($$data =~ m,/\*.*\*/,) {
|
|
||||||
$$data =~ s,/\*.*\*/,/* */,;
|
|
||||||
} elsif ($$data =~ m,/\*,) {
|
|
||||||
$$incomment = 1;
|
|
||||||
$$data =~ s,/\*.*,/*,;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# CheckWhiteSpaces:
|
|
||||||
# $_[0]: $data(in)
|
|
||||||
# $_[1]: $location(in), which format is file-path:line-num:line-code
|
|
||||||
# Returns 0 in case of success or 1 on failure
|
|
||||||
#
|
|
||||||
# Check whitespaces according to code spec of libvirt.
|
|
||||||
#
|
|
||||||
sub CheckWhiteSpaces {
|
|
||||||
my $ret = 0;
|
|
||||||
my ($data, $location) = @_;
|
|
||||||
|
|
||||||
# We need to match things like
|
|
||||||
#
|
|
||||||
# int foo (int bar, bool wizz);
|
|
||||||
# foo (bar, wizz);
|
|
||||||
#
|
|
||||||
# but not match things like:
|
|
||||||
#
|
|
||||||
# typedef int (*foo)(bar wizz)
|
|
||||||
#
|
|
||||||
# we can't do this (efficiently) without
|
|
||||||
# missing things like
|
|
||||||
#
|
|
||||||
# foo (*bar, wizz);
|
|
||||||
#
|
|
||||||
# We also don't want to spoil the $data so it can be used
|
|
||||||
# later on.
|
|
||||||
|
|
||||||
# For temporary modifications
|
|
||||||
my $tmpdata = $$data;
|
|
||||||
while ($tmpdata =~ /(\w+)\s\((?!\*)/) {
|
|
||||||
my $kw = $1;
|
|
||||||
|
|
||||||
# Allow space after keywords only
|
|
||||||
if ($kw =~ /^(?:if|for|while|switch|return)$/) {
|
|
||||||
$tmpdata =~ s/(?:$kw\s\()/XXX(/;
|
|
||||||
} else {
|
|
||||||
print "Whitespace after non-keyword:\n$$location";
|
|
||||||
$ret = 1;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Require whitespace immediately after keywords
|
|
||||||
if ($$data =~ /\b(?:if|for|while|switch|return)\(/) {
|
|
||||||
print "No whitespace after keyword:\n$$location";
|
|
||||||
$ret = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Forbid whitespace between )( of a function typedef
|
|
||||||
if ($$data =~ /\(\*\w+\)\s+\(/) {
|
|
||||||
print "Whitespace between ')' and '(':\n$$location";
|
|
||||||
$ret = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Forbid whitespace following ( or prior to )
|
|
||||||
# but allow whitespace before ) on a single line
|
|
||||||
# (optionally followed by a semicolon)
|
|
||||||
if (($$data =~ /\s\)/ && not $$data =~ /^\s+\);?$/) ||
|
|
||||||
$$data =~ /\((?!$)\s/) {
|
|
||||||
print "Whitespace after '(' or before ')':\n$$location";
|
|
||||||
$ret = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Forbid whitespace before ";" or ",". Things like below are allowed:
|
|
||||||
#
|
|
||||||
# 1) The expression is empty for "for" loop. E.g.
|
|
||||||
# for (i = 0; ; i++)
|
|
||||||
#
|
|
||||||
# 2) An empty statement. E.g.
|
|
||||||
# while (write(statuswrite, &status, 1) == -1 &&
|
|
||||||
# errno == EINTR)
|
|
||||||
# ;
|
|
||||||
#
|
|
||||||
if ($$data =~ /\s[;,]/) {
|
|
||||||
unless ($$data =~ /\S; ; / ||
|
|
||||||
$$data =~ /^\s+;/) {
|
|
||||||
print "Whitespace before semicolon or comma:\n$$location";
|
|
||||||
$ret = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Require EOL, macro line continuation, or whitespace after ";".
|
|
||||||
# Allow "for (;;)" as an exception.
|
|
||||||
if ($$data =~ /;[^ \\\n;)]/) {
|
|
||||||
print "Invalid character after semicolon:\n$$location";
|
|
||||||
$ret = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Require EOL, space, or enum/struct end after comma.
|
|
||||||
if ($$data =~ /,[^ \\\n)}]/) {
|
|
||||||
print "Invalid character after comma:\n$$location";
|
|
||||||
$ret = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Require spaces around assignment '=', compounds and '=='
|
|
||||||
if ($$data =~ /[^ ]\b[!<>&|\-+*\/%\^=]?=/ ||
|
|
||||||
$$data =~ /=[^= \\\n]/) {
|
|
||||||
print "Spacing around '=' or '==':\n$$location";
|
|
||||||
$ret = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# CheckCurlyBrackets:
|
|
||||||
# $_[0]: $data(in)
|
|
||||||
# $_[1]: $file(in)
|
|
||||||
# $_[2]: $line(in)
|
|
||||||
# $_[3]: $cb_linenum(inout)
|
|
||||||
# $_[4]: $cb_code(inout)
|
|
||||||
# $_[5]: $cb_scolon(inout)
|
|
||||||
# Returns 0 in case of success or 1 on failure
|
|
||||||
#
|
|
||||||
# Check whitespaces according to code spec of libvirt.
|
|
||||||
#
|
|
||||||
sub CheckCurlyBrackets {
|
|
||||||
my $ret = 0;
|
|
||||||
my ($data, $file, $line, $cb_linenum, $cb_code, $cb_scolon) = @_;
|
|
||||||
|
|
||||||
# One line conditional statements with one line bodies should
|
|
||||||
# not use curly brackets.
|
|
||||||
if ($$data =~ /^\s*(if|while|for)\b.*\{$/) {
|
|
||||||
$$cb_linenum = $.;
|
|
||||||
$$cb_code = $$line;
|
|
||||||
$$cb_scolon = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# We need to check for exactly one semicolon inside the body,
|
|
||||||
# because empty statements (e.g. with comment only) are
|
|
||||||
# allowed
|
|
||||||
if ($$cb_linenum == $. - 1 && $$data =~ /^[^;]*;[^;]*$/) {
|
|
||||||
$$cb_code .= $$line;
|
|
||||||
$$cb_scolon = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($$data =~ /^\s*}\s*$/ &&
|
|
||||||
$$cb_linenum == $. - 2 &&
|
|
||||||
$$cb_scolon) {
|
|
||||||
|
|
||||||
print "Curly brackets around single-line body:\n";
|
|
||||||
print "$$file:$$cb_linenum-$.:\n$$cb_code$$line";
|
|
||||||
$ret = 1;
|
|
||||||
|
|
||||||
# There _should_ be no need to reset the values; but to
|
|
||||||
# keep my inner peace...
|
|
||||||
$$cb_linenum = 0;
|
|
||||||
$$cb_scolon = 0;
|
|
||||||
$$cb_code = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
|
||||||
# CheckMisalignment:
|
|
||||||
# $_[0]: $data(in)
|
|
||||||
# $_[1]: $file(in)
|
|
||||||
# $_[2]: $line(in)
|
|
||||||
# $_[3]: @paren_stack(inout), which maintains information
|
|
||||||
# of the parenthesis
|
|
||||||
# Returns 0 in case of success or 1 on failure
|
|
||||||
#
|
|
||||||
# Check misaligned stuff in parenthesis:
|
|
||||||
# 1. For misaligned arguments of function
|
|
||||||
# 2. For misaligned conditions of [if|while|switch|...]
|
|
||||||
#
|
|
||||||
sub CheckMisalignment {
|
|
||||||
my $ret = 0;
|
|
||||||
my ($data, $file, $line, $paren_stack) = @_;
|
|
||||||
|
|
||||||
# Check alignment based on @paren_stack
|
|
||||||
if (@$paren_stack) {
|
|
||||||
if ($$data =~ /(\S+.*$)/) {
|
|
||||||
my $pos = $$paren_stack[-1][0];
|
|
||||||
my $linenum = $$paren_stack[-1][1];
|
|
||||||
my $code = $$paren_stack[-1][2];
|
|
||||||
if ($pos + 1 != length($`)) {
|
|
||||||
my $pad = "";
|
|
||||||
if ($. > $linenum + 1) {
|
|
||||||
$pad = " " x $pos . " ...\n";
|
|
||||||
}
|
|
||||||
print "Misaligned line in parenthesis:\n";
|
|
||||||
print "$$file:$linenum-$.:\n$code$pad$$line\n";
|
|
||||||
$ret = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Maintain @paren_stack
|
|
||||||
if ($$data =~ /.*[()]/) {
|
|
||||||
my $pos = 0;
|
|
||||||
my $temp = $$data;
|
|
||||||
|
|
||||||
# Kill the content between matched parenthesis and themselves
|
|
||||||
# within the current line.
|
|
||||||
$temp =~ s,(\((?:[^()]++|(?R))*+\)),"X" x (length $&),ge;
|
|
||||||
|
|
||||||
# Pop a item for the open-paren when finding close-paren
|
|
||||||
while (($pos = index($temp, "\)", $pos)) >= 0) {
|
|
||||||
if (@$paren_stack) {
|
|
||||||
pop(@$paren_stack);
|
|
||||||
$pos++;
|
|
||||||
} else {
|
|
||||||
print "Warning: found unbalanced parenthesis:\n";
|
|
||||||
print "$$file:$.:\n$$line\n";
|
|
||||||
$ret = 1;
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Push the item for open-paren on @paren_stack
|
|
||||||
# @item = [ position of the open-paren, linenum, code-line ]
|
|
||||||
while (($pos = index($temp, "\(", $pos)) >= 0) {
|
|
||||||
push @$paren_stack, [$pos, $., $$line];
|
|
||||||
$pos++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $ret = 0;
|
|
||||||
|
|
||||||
foreach my $file (@ARGV) {
|
|
||||||
# Per-file variables for multiline Curly Bracket (cb_) check
|
|
||||||
my $cb_linenum = 0;
|
|
||||||
my $cb_code = "";
|
|
||||||
my $cb_scolon = 0;
|
|
||||||
my $fn_linenum = 0;
|
|
||||||
my $incomment = 0;
|
|
||||||
my @paren_stack;
|
|
||||||
|
|
||||||
open FILE, $file;
|
|
||||||
|
|
||||||
while (defined (my $line = <FILE>)) {
|
|
||||||
my $has_define = 0;
|
|
||||||
my $data = $line;
|
|
||||||
my $location = "$file:$.:\n$line";
|
|
||||||
|
|
||||||
# Kill any quoted , ; = or "
|
|
||||||
$data =~ s/'[";,=]'/'X'/g;
|
|
||||||
|
|
||||||
# Kill any quoted strings. Replace with equal-length "XXXX..."
|
|
||||||
$data =~ s,"(([^\\\"]|\\.)*)","\"".'X'x(length $1)."\"",ge;
|
|
||||||
$data =~ s,'(([^\\\']|\\.)*)',"\'".'X'x(length $1)."\'",ge;
|
|
||||||
|
|
||||||
# Kill any C++ style comments
|
|
||||||
$data =~ s,//.*$,//,;
|
|
||||||
|
|
||||||
$has_define = 1 if $data =~ /(?:^#\s*define\b)/;
|
|
||||||
if (not $has_define) {
|
|
||||||
# Ignore all macros except for #define
|
|
||||||
next if $data =~ /^#/;
|
|
||||||
|
|
||||||
$ret = 1 if CheckFunctionBody(\$data, \$location, \$fn_linenum);
|
|
||||||
|
|
||||||
KillComments(\$data, \$incomment);
|
|
||||||
|
|
||||||
$ret = 1 if CheckWhiteSpaces(\$data, \$location);
|
|
||||||
|
|
||||||
$ret = 1 if CheckCurlyBrackets(\$data, \$file, \$line,
|
|
||||||
\$cb_linenum, \$cb_code, \$cb_scolon);
|
|
||||||
}
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
# Temporary Filter for CheckMisalignment:
|
|
||||||
# Here we introduce a white-list of path, since there're
|
|
||||||
# too much misalignment.
|
|
||||||
# We _need_ fix these misalignment in batches.
|
|
||||||
# We _should_ remove it as soon as fixing all.
|
|
||||||
#####################################################################
|
|
||||||
next unless $file =~ /^src\/util\//;
|
|
||||||
|
|
||||||
$ret = 1 if CheckMisalignment(\$data, \$file, \$line, \@paren_stack);
|
|
||||||
}
|
|
||||||
close FILE;
|
|
||||||
}
|
|
||||||
|
|
||||||
exit $ret;
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
#!/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;
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
#!/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
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#!/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;
|
|
||||||
@@ -20,74 +20,26 @@
|
|||||||
* Since virt-login-shell will be setuid, we must do everything
|
* Since virt-login-shell will be setuid, we must do everything
|
||||||
* we can to avoid linking to other libraries. Many of them do
|
* we can to avoid linking to other libraries. Many of them do
|
||||||
* unsafe things in functions marked __atttribute__((constructor)).
|
* unsafe things in functions marked __atttribute__((constructor)).
|
||||||
* The only way to avoid such deps is to re-compile the
|
* The only way avoid to avoid such deps is to re-compile the
|
||||||
* functions with the code in question disabled, and for that we
|
* functions with the code in question disabled, and for that we
|
||||||
* must override the main config.h rules. Hence this file :-(
|
* must override the main config.h rules. Hence this file :-(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef LIBVIRT_SETUID_RPC_CLIENT
|
#ifdef LIBVIRT_SETUID_RPC_CLIENT
|
||||||
|
# undef HAVE_LIBDEVMAPPER_H
|
||||||
# undef HAVE_LIBNL
|
# undef HAVE_LIBNL
|
||||||
# undef HAVE_LIBNL3
|
# undef HAVE_LIBNL3
|
||||||
# undef HAVE_LIBSASL2
|
# undef HAVE_LIBSASL2
|
||||||
# undef HAVE_SYS_ACL_H
|
|
||||||
# undef WITH_CAPNG
|
# undef WITH_CAPNG
|
||||||
# undef WITH_CURL
|
# undef WITH_CURL
|
||||||
# undef WITH_DBUS
|
|
||||||
# undef WITH_DEVMAPPER
|
|
||||||
# undef WITH_DTRACE_PROBES
|
# undef WITH_DTRACE_PROBES
|
||||||
# undef WITH_GNUTLS
|
# undef WITH_GNUTLS
|
||||||
# undef WITH_LIBSSH
|
# undef WITH_GNUTLS_GCRYPT
|
||||||
# undef WITH_MACVTAP
|
# undef WITH_MACVTAP
|
||||||
# undef WITH_NUMACTL
|
# undef WITH_NUMACTL
|
||||||
# undef WITH_SASL
|
# undef WITH_SASL
|
||||||
# undef WITH_SSH2
|
# undef WITH_SSH2
|
||||||
# undef WITH_SYSTEMD_DAEMON
|
|
||||||
# undef WITH_VIRTUALPORT
|
# undef WITH_VIRTUALPORT
|
||||||
# undef WITH_YAJL
|
# undef WITH_YAJL
|
||||||
# undef WITH_YAJL2
|
# undef WITH_YAJL2
|
||||||
#endif
|
#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.4, or CLang"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Define __GNUC_PREREQ to a sane default if it isn't yet defined.
|
|
||||||
* This is done here so that it's included as early as possible; gnulib relies
|
|
||||||
* on this to be defined in features.h, which should be included from ctype.h.
|
|
||||||
* This doesn't happen on many non-glibc systems.
|
|
||||||
* When __GNUC_PREREQ is not defined, gnulib defines it to 0, which breaks things.
|
|
||||||
*/
|
|
||||||
#ifndef __GNUC_PREREQ
|
|
||||||
# define __GNUC_PREREQ(maj, min) \
|
|
||||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !(__GNUC_PREREQ(4, 4) || defined(__clang__))
|
|
||||||
# error "Libvirt requires GCC >= 4.4, or CLang"
|
|
||||||
#endif
|
|
||||||
|
|||||||
2759
configure.ac
2759
configure.ac
File diff suppressed because it is too large
Load Diff
538
daemon/Makefile.am
Normal file
538
daemon/Makefile.am
Normal file
@@ -0,0 +1,538 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
|
## Copyright (C) 2005-2015 Red Hat, Inc.
|
||||||
|
##
|
||||||
|
## This library is free software; you can redistribute it and/or
|
||||||
|
## modify it under the terms of the GNU Lesser General Public
|
||||||
|
## License as published by the Free Software Foundation; either
|
||||||
|
## version 2.1 of the License, or (at your option) any later version.
|
||||||
|
##
|
||||||
|
## This library is distributed in the hope that it will be useful,
|
||||||
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
## Lesser General Public License for more details.
|
||||||
|
##
|
||||||
|
## You should have received a copy of the GNU Lesser General Public
|
||||||
|
## License along with this library. If not, see
|
||||||
|
## <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
INCLUDES = \
|
||||||
|
-I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib \
|
||||||
|
-I$(top_srcdir) \
|
||||||
|
-I$(top_builddir)/include -I$(top_srcdir)/include \
|
||||||
|
-I$(top_builddir)/src -I$(top_srcdir)/src \
|
||||||
|
-I$(top_srcdir)/src/util \
|
||||||
|
-I$(top_srcdir)/src/conf \
|
||||||
|
-I$(top_srcdir)/src/rpc \
|
||||||
|
-I$(top_srcdir)/src/remote \
|
||||||
|
-I$(top_srcdir)/src/admin \
|
||||||
|
-I$(top_srcdir)/src/access \
|
||||||
|
$(GETTEXT_CPPFLAGS)
|
||||||
|
|
||||||
|
CLEANFILES =
|
||||||
|
|
||||||
|
DAEMON_GENERATED = \
|
||||||
|
remote_dispatch.h \
|
||||||
|
lxc_dispatch.h \
|
||||||
|
qemu_dispatch.h \
|
||||||
|
admin_dispatch.h \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
DAEMON_SOURCES = \
|
||||||
|
libvirtd.c libvirtd.h \
|
||||||
|
remote.c remote.h \
|
||||||
|
stream.c stream.h \
|
||||||
|
$(DAEMON_GENERATED)
|
||||||
|
|
||||||
|
LIBVIRTD_CONF_SOURCES = libvirtd-config.c libvirtd-config.h
|
||||||
|
|
||||||
|
DISTCLEANFILES =
|
||||||
|
EXTRA_DIST = \
|
||||||
|
remote_dispatch.h \
|
||||||
|
lxc_dispatch.h \
|
||||||
|
qemu_dispatch.h \
|
||||||
|
admin_dispatch.h \
|
||||||
|
libvirtd.conf \
|
||||||
|
libvirtd.init.in \
|
||||||
|
libvirtd.upstart \
|
||||||
|
libvirtd.policy.in \
|
||||||
|
libvirt.rules \
|
||||||
|
libvirtd.sasl \
|
||||||
|
libvirtd.service.in \
|
||||||
|
libvirtd.socket.in \
|
||||||
|
libvirtd.sysconf \
|
||||||
|
libvirtd.sysctl \
|
||||||
|
libvirtd.aug \
|
||||||
|
libvirtd.logrotate.in \
|
||||||
|
libvirtd.qemu.logrotate.in \
|
||||||
|
libvirtd.lxc.logrotate.in \
|
||||||
|
libvirtd.libxl.logrotate.in \
|
||||||
|
libvirtd.uml.logrotate.in \
|
||||||
|
test_libvirtd.aug.in \
|
||||||
|
THREADS.txt \
|
||||||
|
libvirtd.pod.in \
|
||||||
|
libvirtd.8.in \
|
||||||
|
$(DAEMON_SOURCES) \
|
||||||
|
$(LIBVIRTD_CONF_SOURCES) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
BUILT_SOURCES =
|
||||||
|
|
||||||
|
REMOTE_PROTOCOL = $(top_srcdir)/src/remote/remote_protocol.x
|
||||||
|
LXC_PROTOCOL = $(top_srcdir)/src/remote/lxc_protocol.x
|
||||||
|
QEMU_PROTOCOL = $(top_srcdir)/src/remote/qemu_protocol.x
|
||||||
|
ADMIN_PROTOCOL = $(top_srcdir)/src/admin/admin_protocol.x
|
||||||
|
|
||||||
|
remote_dispatch.h: $(top_srcdir)/src/rpc/gendispatch.pl \
|
||||||
|
$(REMOTE_PROTOCOL)
|
||||||
|
$(AM_V_GEN)$(PERL) -w $(top_srcdir)/src/rpc/gendispatch.pl \
|
||||||
|
--mode=server remote REMOTE $(REMOTE_PROTOCOL) \
|
||||||
|
> $(srcdir)/remote_dispatch.h
|
||||||
|
|
||||||
|
lxc_dispatch.h: $(top_srcdir)/src/rpc/gendispatch.pl \
|
||||||
|
$(LXC_PROTOCOL)
|
||||||
|
$(AM_V_GEN)$(PERL) -w $(top_srcdir)/src/rpc/gendispatch.pl \
|
||||||
|
--mode=server lxc LXC $(LXC_PROTOCOL) \
|
||||||
|
> $(srcdir)/lxc_dispatch.h
|
||||||
|
|
||||||
|
qemu_dispatch.h: $(top_srcdir)/src/rpc/gendispatch.pl \
|
||||||
|
$(QEMU_PROTOCOL)
|
||||||
|
$(AM_V_GEN)$(PERL) -w $(top_srcdir)/src/rpc/gendispatch.pl \
|
||||||
|
--mode=server qemu QEMU $(QEMU_PROTOCOL) \
|
||||||
|
> $(srcdir)/qemu_dispatch.h
|
||||||
|
|
||||||
|
admin_dispatch.h: $(top_srcdir)/src/rpc/gendispatch.pl \
|
||||||
|
$(ADMIN_PROTOCOL)
|
||||||
|
$(AM_V_GEN)$(PERL) -w $(top_srcdir)/src/rpc/gendispatch.pl \
|
||||||
|
--mode=server admin ADMIN $(ADMIN_PROTOCOL) \
|
||||||
|
> $(srcdir)/admin_dispatch.h
|
||||||
|
|
||||||
|
if WITH_LIBVIRTD
|
||||||
|
|
||||||
|
# Build a convenience library, for reuse in tests/libvirtdconftest
|
||||||
|
noinst_LTLIBRARIES = libvirtd_conf.la
|
||||||
|
libvirtd_conf_la_SOURCES = $(LIBVIRTD_CONF_SOURCES)
|
||||||
|
libvirtd_conf_la_CFLAGS = \
|
||||||
|
$(LIBXML_CFLAGS) \
|
||||||
|
$(XDR_CFLAGS) \
|
||||||
|
$(WARN_CFLAGS) $(PIE_CFLAGS) \
|
||||||
|
$(COVERAGE_CFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
libvirtd_conf_la_LDFLAGS = \
|
||||||
|
$(RELRO_LDFLAGS) \
|
||||||
|
$(PIE_LDFLAGS) \
|
||||||
|
$(COVERAGE_LDFLAGS) \
|
||||||
|
$(NO_INDIRECT_LDFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
libvirtd_conf_la_LIBADD = $(LIBXML_LIBS)
|
||||||
|
|
||||||
|
noinst_LTLIBRARIES += libvirtd_admin.la
|
||||||
|
libvirtd_admin_la_SOURCES = \
|
||||||
|
admin_server.c admin_server.h
|
||||||
|
|
||||||
|
libvirtd_admin_la_CFLAGS = \
|
||||||
|
$(AM_CFLAGS) \
|
||||||
|
$(XDR_CFLAGS) \
|
||||||
|
$(PIE_CFLAGS) \
|
||||||
|
$(WARN_CFLAGS) \
|
||||||
|
$(LIBXML_CFLAGS) \
|
||||||
|
$(COVERAGE_CFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
libvirtd_admin_la_LDFLAGS = \
|
||||||
|
$(PIE_LDFLAGS) \
|
||||||
|
$(RELRO_LDFLAGS) \
|
||||||
|
$(COVERAGE_LDFLAGS) \
|
||||||
|
$(NO_INDIRECT_LDFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
libvirtd_admin_la_LIBADD = \
|
||||||
|
../src/libvirt-admin.la
|
||||||
|
|
||||||
|
man8_MANS = libvirtd.8
|
||||||
|
|
||||||
|
sbin_PROGRAMS = libvirtd
|
||||||
|
|
||||||
|
confdir = $(sysconfdir)/libvirt/
|
||||||
|
conf_DATA = libvirtd.conf
|
||||||
|
|
||||||
|
augeasdir = $(datadir)/augeas/lenses
|
||||||
|
augeas_DATA = libvirtd.aug
|
||||||
|
|
||||||
|
augeastestsdir = $(datadir)/augeas/lenses/tests
|
||||||
|
augeastests_DATA = test_libvirtd.aug
|
||||||
|
|
||||||
|
CLEANFILES += test_libvirtd.aug
|
||||||
|
|
||||||
|
libvirtd.8: $(srcdir)/libvirtd.8.in
|
||||||
|
$(AM_V_GEN)sed \
|
||||||
|
-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
|
||||||
|
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||||
|
< $< > $@-t && \
|
||||||
|
mv $@-t $@
|
||||||
|
|
||||||
|
libvirtd_SOURCES = $(DAEMON_SOURCES)
|
||||||
|
|
||||||
|
#-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
|
||||||
|
libvirtd_CFLAGS = \
|
||||||
|
$(LIBXML_CFLAGS) $(GNUTLS_CFLAGS) $(SASL_CFLAGS) \
|
||||||
|
$(XDR_CFLAGS) $(DBUS_CFLAGS) $(LIBNL_CFLAGS) \
|
||||||
|
$(WARN_CFLAGS) $(PIE_CFLAGS) \
|
||||||
|
$(COVERAGE_CFLAGS) \
|
||||||
|
-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\""
|
||||||
|
|
||||||
|
libvirtd_LDFLAGS = \
|
||||||
|
$(RELRO_LDFLAGS) \
|
||||||
|
$(PIE_LDFLAGS) \
|
||||||
|
$(COVERAGE_LDFLAGS) \
|
||||||
|
$(NO_INDIRECT_LDFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
libvirtd_LDADD = \
|
||||||
|
$(LIBXML_LIBS) \
|
||||||
|
$(GNUTLS_LIBS) \
|
||||||
|
$(SASL_LIBS) \
|
||||||
|
$(DBUS_LIBS) \
|
||||||
|
$(LIBNL_LIBS)
|
||||||
|
|
||||||
|
if WITH_DTRACE_PROBES
|
||||||
|
libvirtd_LDADD += ../src/libvirt_probes.lo
|
||||||
|
endif WITH_DTRACE_PROBES
|
||||||
|
|
||||||
|
libvirtd_LDADD += \
|
||||||
|
libvirtd_conf.la \
|
||||||
|
libvirtd_admin.la \
|
||||||
|
../src/libvirt-lxc.la \
|
||||||
|
../src/libvirt-qemu.la \
|
||||||
|
../src/libvirt_driver_remote.la \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
if ! WITH_DRIVER_MODULES
|
||||||
|
if WITH_QEMU
|
||||||
|
libvirtd_LDADD += ../src/libvirt_driver_qemu.la
|
||||||
|
if WITH_DTRACE_PROBES
|
||||||
|
libvirtd_LDADD += ../src/libvirt_qemu_probes.lo
|
||||||
|
endif WITH_DTRACE_PROBES
|
||||||
|
endif WITH_QEMU
|
||||||
|
|
||||||
|
if WITH_LXC
|
||||||
|
libvirtd_LDADD += ../src/libvirt_driver_lxc.la
|
||||||
|
endif WITH_LXC
|
||||||
|
|
||||||
|
if WITH_XEN
|
||||||
|
libvirtd_LDADD += ../src/libvirt_driver_xen.la
|
||||||
|
endif WITH_XEN
|
||||||
|
|
||||||
|
if WITH_LIBXL
|
||||||
|
libvirtd_LDADD += ../src/libvirt_driver_libxl.la
|
||||||
|
endif WITH_LIBXL
|
||||||
|
|
||||||
|
if WITH_UML
|
||||||
|
libvirtd_LDADD += ../src/libvirt_driver_uml.la
|
||||||
|
endif WITH_UML
|
||||||
|
|
||||||
|
if WITH_VBOX
|
||||||
|
libvirtd_LDADD += ../src/libvirt_driver_vbox.la
|
||||||
|
endif WITH_VBOX
|
||||||
|
|
||||||
|
if WITH_STORAGE
|
||||||
|
libvirtd_LDADD += ../src/libvirt_driver_storage.la
|
||||||
|
endif WITH_STORAGE
|
||||||
|
|
||||||
|
if WITH_NETWORK
|
||||||
|
libvirtd_LDADD += ../src/libvirt_driver_network.la
|
||||||
|
endif WITH_NETWORK
|
||||||
|
|
||||||
|
if WITH_INTERFACE
|
||||||
|
libvirtd_LDADD += ../src/libvirt_driver_interface.la
|
||||||
|
endif WITH_INTERFACE
|
||||||
|
|
||||||
|
if WITH_NODE_DEVICES
|
||||||
|
libvirtd_LDADD += ../src/libvirt_driver_nodedev.la
|
||||||
|
endif WITH_NODE_DEVICES
|
||||||
|
|
||||||
|
if WITH_SECRETS
|
||||||
|
libvirtd_LDADD += ../src/libvirt_driver_secret.la
|
||||||
|
endif WITH_SECRETS
|
||||||
|
|
||||||
|
if WITH_NWFILTER
|
||||||
|
libvirtd_LDADD += ../src/libvirt_driver_nwfilter.la
|
||||||
|
endif WITH_NWFILTER
|
||||||
|
endif ! WITH_DRIVER_MODULES
|
||||||
|
|
||||||
|
libvirtd_LDADD += ../src/libvirt.la
|
||||||
|
|
||||||
|
if WITH_POLKIT
|
||||||
|
if WITH_POLKIT0
|
||||||
|
policydir = $(datadir)/PolicyKit/policy
|
||||||
|
policyauth = auth_admin_keep_session
|
||||||
|
else ! WITH_POLKIT0
|
||||||
|
policydir = $(datadir)/polkit-1/actions
|
||||||
|
policyauth = auth_admin_keep
|
||||||
|
rulesdir = $(datadir)/polkit-1/rules.d
|
||||||
|
rulesfile = libvirt.rules
|
||||||
|
endif ! WITH_POLKIT0
|
||||||
|
endif WITH_POLKIT
|
||||||
|
|
||||||
|
libvirtd.policy: libvirtd.policy.in $(top_builddir)/config.status
|
||||||
|
$(AM_V_GEN) sed \
|
||||||
|
-e 's|[@]authaction[@]|$(policyauth)|g' \
|
||||||
|
< $< > $@-t && \
|
||||||
|
mv $@-t $@
|
||||||
|
BUILT_SOURCES += libvirtd.policy
|
||||||
|
|
||||||
|
install-data-local: install-init-redhat install-init-systemd \
|
||||||
|
install-init-upstart \
|
||||||
|
install-data-sasl install-data-polkit \
|
||||||
|
install-logrotate install-sysctl
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt \
|
||||||
|
$(DESTDIR)$(localstatedir)/run/libvirt \
|
||||||
|
$(DESTDIR)$(localstatedir)/lib/libvirt
|
||||||
|
|
||||||
|
uninstall-local:: uninstall-init-redhat uninstall-init-systemd \
|
||||||
|
uninstall-init-upstart \
|
||||||
|
uninstall-data-sasl uninstall-data-polkit \
|
||||||
|
uninstall-logrotate uninstall-sysctl
|
||||||
|
rmdir $(DESTDIR)$(localstatedir)/log/libvirt || :
|
||||||
|
rmdir $(DESTDIR)$(localstatedir)/run/libvirt || :
|
||||||
|
rmdir $(DESTDIR)$(localstatedir)/lib/libvirt || :
|
||||||
|
|
||||||
|
if WITH_POLKIT
|
||||||
|
install-data-polkit::
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(policydir)
|
||||||
|
$(INSTALL_DATA) libvirtd.policy $(DESTDIR)$(policydir)/org.libvirt.unix.policy
|
||||||
|
if ! WITH_POLKIT0
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(rulesdir)
|
||||||
|
$(INSTALL_DATA) $(srcdir)/$(rulesfile) $(DESTDIR)$(rulesdir)/50-libvirt.rules
|
||||||
|
endif ! WITH_POLKIT0
|
||||||
|
|
||||||
|
uninstall-data-polkit::
|
||||||
|
rm -f $(DESTDIR)$(policydir)/org.libvirt.unix.policy
|
||||||
|
rmdir $(DESTDIR)$(policydir) || :
|
||||||
|
if ! WITH_POLKIT0
|
||||||
|
rm -f $(DESTDIR)$(rulesdir)/50-libvirt.rules
|
||||||
|
rmdir $(DESTDIR)$(rulesdir) || :
|
||||||
|
endif ! WITH_POLKIT0
|
||||||
|
|
||||||
|
else ! WITH_POLKIT
|
||||||
|
install-data-polkit::
|
||||||
|
uninstall-data-polkit::
|
||||||
|
endif ! WITH_POLKIT
|
||||||
|
|
||||||
|
remote.c: $(DAEMON_GENERATED)
|
||||||
|
remote.h: $(DAEMON_GENERATED)
|
||||||
|
admin_server.c: $(DAEMON_GENERATED)
|
||||||
|
|
||||||
|
LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
|
||||||
|
libvirtd.libxl.logrotate libvirtd.uml.logrotate \
|
||||||
|
libvirtd.logrotate
|
||||||
|
|
||||||
|
BUILT_SOURCES += $(LOGROTATE_CONFS)
|
||||||
|
|
||||||
|
libvirtd.logrotate: libvirtd.logrotate.in
|
||||||
|
$(AM_V_GEN)sed \
|
||||||
|
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||||
|
< $< > $@-t && \
|
||||||
|
mv $@-t $@
|
||||||
|
|
||||||
|
libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in
|
||||||
|
$(AM_V_GEN)sed \
|
||||||
|
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||||
|
< $< > $@-t && \
|
||||||
|
mv $@-t $@
|
||||||
|
|
||||||
|
libvirtd.lxc.logrotate: libvirtd.lxc.logrotate.in
|
||||||
|
$(AM_V_GEN)sed \
|
||||||
|
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||||
|
< $< > $@-t && \
|
||||||
|
mv $@-t $@
|
||||||
|
|
||||||
|
libvirtd.libxl.logrotate: libvirtd.libxl.logrotate.in
|
||||||
|
$(AM_V_GEN)sed \
|
||||||
|
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||||
|
< $< > $@-t && \
|
||||||
|
mv $@-t $@
|
||||||
|
|
||||||
|
libvirtd.uml.logrotate: libvirtd.uml.logrotate.in
|
||||||
|
$(AM_V_GEN)sed \
|
||||||
|
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||||
|
< $< > $@-t && \
|
||||||
|
mv $@-t $@
|
||||||
|
|
||||||
|
install-logrotate: $(LOGROTATE_CONFS)
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(localstatedir)/log/libvirt/qemu/ \
|
||||||
|
$(DESTDIR)$(localstatedir)/log/libvirt/lxc/ \
|
||||||
|
$(DESTDIR)$(localstatedir)/log/libvirt/uml/ \
|
||||||
|
$(DESTDIR)$(sysconfdir)/logrotate.d/
|
||||||
|
$(INSTALL_DATA) libvirtd.logrotate \
|
||||||
|
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd
|
||||||
|
$(INSTALL_DATA) libvirtd.qemu.logrotate \
|
||||||
|
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu
|
||||||
|
$(INSTALL_DATA) libvirtd.lxc.logrotate \
|
||||||
|
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc
|
||||||
|
$(INSTALL_DATA) libvirtd.libxl.logrotate \
|
||||||
|
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.libxl
|
||||||
|
$(INSTALL_DATA) libvirtd.uml.logrotate \
|
||||||
|
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
|
||||||
|
|
||||||
|
uninstall-logrotate:
|
||||||
|
rm -f $(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd \
|
||||||
|
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.qemu \
|
||||||
|
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.lxc \
|
||||||
|
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.libxl \
|
||||||
|
$(DESTDIR)$(sysconfdir)/logrotate.d/libvirtd.uml
|
||||||
|
rmdir $(DESTDIR)$(localstatedir)/log/libvirt/qemu || :
|
||||||
|
rmdir $(DESTDIR)$(localstatedir)/log/libvirt/lxc || :
|
||||||
|
rmdir $(DESTDIR)$(localstatedir)/log/libvirt/uml || :
|
||||||
|
rmdir $(DESTDIR)$(sysconfdir)/logrotate.d || :
|
||||||
|
|
||||||
|
install-sysconfig:
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
|
||||||
|
$(INSTALL_DATA) $(srcdir)/libvirtd.sysconf \
|
||||||
|
$(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
|
||||||
|
uninstall-sysconfig:
|
||||||
|
rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
|
||||||
|
rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
|
||||||
|
|
||||||
|
if WITH_SYSCTL
|
||||||
|
# Use $(prefix)/lib rather than $(libdir), since man sysctl.d insists on
|
||||||
|
# /usr/lib/sysctl.d/ even when libdir is /usr/lib64
|
||||||
|
install-sysctl:
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(prefix)/lib/sysctl.d
|
||||||
|
$(INSTALL_DATA) $(srcdir)/libvirtd.sysctl \
|
||||||
|
$(DESTDIR)$(prefix)/lib/sysctl.d/60-libvirtd.conf
|
||||||
|
|
||||||
|
uninstall-sysctl:
|
||||||
|
rm -f $(DESTDIR)$(prefix)/lib/sysctl.d/60-libvirtd.conf
|
||||||
|
rmdir $(DESTDIR)$(prefix)/lib/sysctl.d || :
|
||||||
|
else ! WITH_SYSCTL
|
||||||
|
install-sysctl:
|
||||||
|
uninstall-sysctl:
|
||||||
|
endif ! WITH_SYSCTL
|
||||||
|
|
||||||
|
if LIBVIRT_INIT_SCRIPT_RED_HAT
|
||||||
|
|
||||||
|
BUILT_SOURCES += libvirtd.init
|
||||||
|
|
||||||
|
install-init-redhat: install-sysconfig libvirtd.init
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
|
||||||
|
$(INSTALL_SCRIPT) libvirtd.init \
|
||||||
|
$(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd
|
||||||
|
|
||||||
|
uninstall-init-redhat: uninstall-sysconfig
|
||||||
|
rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd
|
||||||
|
rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d || :
|
||||||
|
else ! LIBVIRT_INIT_SCRIPT_RED_HAT
|
||||||
|
install-init-redhat:
|
||||||
|
uninstall-init-redhat:
|
||||||
|
endif ! LIBVIRT_INIT_SCRIPT_RED_HAT
|
||||||
|
|
||||||
|
|
||||||
|
if LIBVIRT_INIT_SCRIPT_UPSTART
|
||||||
|
|
||||||
|
install-init-upstart: install-sysconfig
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/event.d
|
||||||
|
$(INSTALL_SCRIPT) libvirtd.upstart \
|
||||||
|
$(DESTDIR)$(sysconfdir)/event.d/libvirtd
|
||||||
|
|
||||||
|
uninstall-init-upstart: uninstall-sysconfig
|
||||||
|
rm -f $(DESTDIR)$(sysconfdir)/event.d/libvirtd
|
||||||
|
rmdir $(DESTDIR)$(sysconfdir)/event.d || :
|
||||||
|
else ! LIBVIRT_INIT_SCRIPT_UPSTART
|
||||||
|
install-init-upstart:
|
||||||
|
uninstall-init-upstart:
|
||||||
|
endif ! LIBVIRT_INIT_SCRIPT_UPSTART
|
||||||
|
|
||||||
|
|
||||||
|
if LIBVIRT_INIT_SCRIPT_SYSTEMD
|
||||||
|
|
||||||
|
SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
|
||||||
|
BUILT_SOURCES += libvirtd.service libvirtd.socket
|
||||||
|
|
||||||
|
install-init-systemd: install-sysconfig libvirtd.service libvirtd.socket
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
|
||||||
|
$(INSTALL_DATA) libvirtd.service \
|
||||||
|
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service
|
||||||
|
$(INSTALL_DATA) libvirtd.socket \
|
||||||
|
$(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.socket
|
||||||
|
|
||||||
|
uninstall-init-systemd: uninstall-sysconfig
|
||||||
|
rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.service
|
||||||
|
rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirtd.socket
|
||||||
|
rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
|
||||||
|
else ! LIBVIRT_INIT_SCRIPT_SYSTEMD
|
||||||
|
install-init-systemd:
|
||||||
|
uninstall-init-systemd:
|
||||||
|
endif ! LIBVIRT_INIT_SCRIPT_SYSTEMD
|
||||||
|
|
||||||
|
libvirtd.init: libvirtd.init.in $(top_builddir)/config.status
|
||||||
|
$(AM_V_GEN)sed \
|
||||||
|
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||||
|
-e 's|[@]sbindir[@]|$(sbindir)|g' \
|
||||||
|
-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
|
||||||
|
< $< > $@-t && \
|
||||||
|
chmod a+x $@-t && \
|
||||||
|
mv $@-t $@
|
||||||
|
|
||||||
|
libvirtd.service: libvirtd.service.in $(top_builddir)/config.status
|
||||||
|
$(AM_V_GEN)sed \
|
||||||
|
-e 's|[@]localstatedir[@]|$(localstatedir)|g' \
|
||||||
|
-e 's|[@]sbindir[@]|$(sbindir)|g' \
|
||||||
|
-e 's|[@]sysconfdir[@]|$(sysconfdir)|g' \
|
||||||
|
< $< > $@-t && \
|
||||||
|
mv $@-t $@
|
||||||
|
|
||||||
|
libvirtd.socket: libvirtd.socket.in $(top_builddir)/config.status
|
||||||
|
$(AM_V_GEN)sed \
|
||||||
|
-e 's|[@]runstatedir[@]|$(runstatedir)|g' \
|
||||||
|
< $< > $@-t && \
|
||||||
|
mv $@-t $@
|
||||||
|
|
||||||
|
|
||||||
|
check-local: check-augeas
|
||||||
|
|
||||||
|
AUG_GENTEST = $(PERL) $(top_srcdir)/build-aux/augeas-gentest.pl
|
||||||
|
|
||||||
|
test_libvirtd.aug: test_libvirtd.aug.in $(srcdir)/libvirtd.conf
|
||||||
|
$(AM_V_GEN)$(AUG_GENTEST) $(srcdir)/libvirtd.conf $< $@
|
||||||
|
|
||||||
|
check-augeas: test_libvirtd.aug
|
||||||
|
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
|
||||||
|
'$(AUGPARSE)' -I $(srcdir) test_libvirtd.aug; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# This must be added last, since functions it provides/replaces
|
||||||
|
# are used by nearly every other library.
|
||||||
|
libvirtd_LDADD += ../gnulib/lib/libgnu.la $(LIBSOCKET)
|
||||||
|
|
||||||
|
else ! WITH_LIBVIRTD
|
||||||
|
install-data-local: install-data-sasl
|
||||||
|
uninstall-local:: uninstall-data-sasl
|
||||||
|
endif ! WITH_LIBVIRTD
|
||||||
|
|
||||||
|
POD2MAN = pod2man -c "Virtualization Support" \
|
||||||
|
-r "$(PACKAGE)-$(VERSION)" -s 8
|
||||||
|
|
||||||
|
$(srcdir)/libvirtd.8.in: libvirtd.pod.in $(top_srcdir)/configure.ac
|
||||||
|
$(AM_V_GEN)$(POD2MAN) --name LIBVIRTD $< $@ \
|
||||||
|
&& if grep 'POD ERROR' $@ ; then rm $@; exit 1; fi
|
||||||
|
|
||||||
|
# This is needed for clients too, so can't wrap in
|
||||||
|
# the WITH_LIBVIRTD conditional
|
||||||
|
if WITH_SASL
|
||||||
|
install-data-sasl:
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sasl2/
|
||||||
|
$(INSTALL_DATA) $(srcdir)/libvirtd.sasl \
|
||||||
|
$(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
|
||||||
|
|
||||||
|
uninstall-data-sasl:
|
||||||
|
rm -f $(DESTDIR)$(sysconfdir)/sasl2/libvirt.conf
|
||||||
|
rmdir $(DESTDIR)$(sysconfdir)/sasl2/ || :
|
||||||
|
else ! WITH_SASL
|
||||||
|
install-data-sasl:
|
||||||
|
uninstall-data-sasl:
|
||||||
|
endif ! WITH_SASL
|
||||||
|
|
||||||
|
|
||||||
|
CLEANFILES += $(BUILT_SOURCES) $(man8_MANS)
|
||||||
|
CLEANFILES += *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
|
||||||
|
MAINTAINERCLEANFILES = $(srcdir)/libvirtd.8.in $(DAEMON_GENERATED)
|
||||||
52
daemon/THREADS.txt
Normal file
52
daemon/THREADS.txt
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
|
||||||
|
Threading in the libvirtd daemon
|
||||||
|
================================
|
||||||
|
|
||||||
|
To allow efficient processing of RPC requests, the libvirtd daemon
|
||||||
|
makes use of threads.
|
||||||
|
|
||||||
|
- The process leader. This is the initial thread of control
|
||||||
|
when the daemon starts running. It is responsible for
|
||||||
|
initializing all the state, and starting the event loop.
|
||||||
|
Once that's all done, this thread does nothing except
|
||||||
|
wait for the event loop to quit, thus indicating an orderly
|
||||||
|
shutdown is required.
|
||||||
|
|
||||||
|
- The event loop. This thread runs the event loop, sitting
|
||||||
|
in poll() on all monitored file handles, and calculating
|
||||||
|
and dispatching any timers that may be registered. When
|
||||||
|
this thread quits, the entire daemon will shutdown.
|
||||||
|
|
||||||
|
- The workers. These 'n' threads all sit around waiting to
|
||||||
|
process incoming RPC requests. Since RPC requests may take
|
||||||
|
a long time to complete, with long idle periods, there will
|
||||||
|
be quite a few workers running.
|
||||||
|
|
||||||
|
The use of threads obviously requires locking to ensure safety when
|
||||||
|
accessing/changing data structures.
|
||||||
|
|
||||||
|
- the top level lock is on 'struct qemud_server'. This must be
|
||||||
|
held before acquiring any other lock
|
||||||
|
|
||||||
|
- Each 'struct qemud_client' object has a lock. The server lock
|
||||||
|
must be held before acquiring it. Once the client lock is acquired
|
||||||
|
the server lock can (optionally) be dropped.
|
||||||
|
|
||||||
|
- The event loop has its own self-contained lock. You can ignore
|
||||||
|
this as a caller of virEvent APIs.
|
||||||
|
|
||||||
|
|
||||||
|
The server lock is used in conjunction with a condition variable
|
||||||
|
to pass jobs from the event loop thread to the workers. The main
|
||||||
|
event loop thread handles I/O from the client socket, and once a
|
||||||
|
complete RPC message has been read off the wire (and optionally
|
||||||
|
decrypted), it will be placed on the 'dx' job queue for the
|
||||||
|
associated client object. The job condition will be signalled and
|
||||||
|
a worker will wakup and process it.
|
||||||
|
|
||||||
|
The worker thread must quickly drop its locks on the server and
|
||||||
|
client to allow the main event loop thread to continue running
|
||||||
|
with its other work. Critically important, is that now libvirt
|
||||||
|
API call will ever be made with the server or client locks held.
|
||||||
|
|
||||||
|
-- End
|
||||||
117
daemon/admin_server.c
Normal file
117
daemon/admin_server.c
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
* admin_server.c:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014-2015 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Author: Martin Kletzander <mkletzan@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "internal.h"
|
||||||
|
#include "libvirtd.h"
|
||||||
|
#include "libvirt_internal.h"
|
||||||
|
|
||||||
|
#include "admin_protocol.h"
|
||||||
|
#include "admin_server.h"
|
||||||
|
#include "datatypes.h"
|
||||||
|
#include "viralloc.h"
|
||||||
|
#include "virerror.h"
|
||||||
|
#include "virlog.h"
|
||||||
|
#include "virnetdaemon.h"
|
||||||
|
#include "virnetserver.h"
|
||||||
|
#include "virstring.h"
|
||||||
|
#include "virthreadjob.h"
|
||||||
|
|
||||||
|
#define VIR_FROM_THIS VIR_FROM_ADMIN
|
||||||
|
|
||||||
|
VIR_LOG_INIT("daemon.admin");
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
remoteAdmClientFreeFunc(void *data)
|
||||||
|
{
|
||||||
|
struct daemonAdmClientPrivate *priv = data;
|
||||||
|
|
||||||
|
virMutexDestroy(&priv->lock);
|
||||||
|
virObjectUnref(priv->dmn);
|
||||||
|
VIR_FREE(priv);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
remoteAdmClientInitHook(virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
||||||
|
void *opaque)
|
||||||
|
{
|
||||||
|
struct daemonAdmClientPrivate *priv;
|
||||||
|
|
||||||
|
if (VIR_ALLOC(priv) < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (virMutexInit(&priv->lock) < 0) {
|
||||||
|
VIR_FREE(priv);
|
||||||
|
virReportSystemError(errno, "%s", _("unable to init mutex"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We don't necessarily need to ref this object right now as there
|
||||||
|
* must be one ref being held throughout the life of the daemon,
|
||||||
|
* but let's just be safe for future.
|
||||||
|
*/
|
||||||
|
priv->dmn = virObjectRef(opaque);
|
||||||
|
|
||||||
|
return priv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Functions */
|
||||||
|
static int
|
||||||
|
adminDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||||
|
virNetServerClientPtr client,
|
||||||
|
virNetMessagePtr msg ATTRIBUTE_UNUSED,
|
||||||
|
virNetMessageErrorPtr rerr,
|
||||||
|
struct admin_connect_open_args *args)
|
||||||
|
{
|
||||||
|
unsigned int flags;
|
||||||
|
struct daemonAdmClientPrivate *priv =
|
||||||
|
virNetServerClientGetPrivateData(client);
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
VIR_DEBUG("priv=%p dmn=%p", priv, priv->dmn);
|
||||||
|
virMutexLock(&priv->lock);
|
||||||
|
|
||||||
|
flags = args->flags;
|
||||||
|
virCheckFlagsGoto(0, cleanup);
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
cleanup:
|
||||||
|
if (ret < 0)
|
||||||
|
virNetMessageSaveError(rerr);
|
||||||
|
virMutexUnlock(&priv->lock);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
adminDispatchConnectClose(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||||
|
virNetServerClientPtr client,
|
||||||
|
virNetMessagePtr msg ATTRIBUTE_UNUSED,
|
||||||
|
virNetMessageErrorPtr rerr ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
virNetServerClientDelayedClose(client);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "admin_dispatch.h"
|
||||||
36
daemon/admin_server.h
Normal file
36
daemon/admin_server.h
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* admin_server.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Author: Martin Kletzander <mkletzan@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBVIRTD_ADMIN_H__
|
||||||
|
# define __LIBVIRTD_ADMIN_H__
|
||||||
|
|
||||||
|
# include "rpc/virnetserverprogram.h"
|
||||||
|
# include "rpc/virnetserverclient.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern virNetServerProgramProc adminProcs[];
|
||||||
|
extern size_t adminNProcs;
|
||||||
|
|
||||||
|
void remoteAdmClientFreeFunc(void *data);
|
||||||
|
void *remoteAdmClientInitHook(virNetServerClientPtr client, void *opaque);
|
||||||
|
|
||||||
|
#endif /* __ADMIN_REMOTE_H__ */
|
||||||
526
daemon/libvirtd-config.c
Normal file
526
daemon/libvirtd-config.c
Normal file
@@ -0,0 +1,526 @@
|
|||||||
|
/*
|
||||||
|
* libvirtd-config.c: daemon start of day, guest process & i/o management
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2012, 2014, 2015 Red Hat, Inc.
|
||||||
|
* Copyright (C) 2006 Daniel P. Berrange
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "libvirtd-config.h"
|
||||||
|
#include "virconf.h"
|
||||||
|
#include "viralloc.h"
|
||||||
|
#include "virerror.h"
|
||||||
|
#include "virlog.h"
|
||||||
|
#include "rpc/virnetserver.h"
|
||||||
|
#include "configmake.h"
|
||||||
|
#include "remote/remote_protocol.h"
|
||||||
|
#include "remote/remote_driver.h"
|
||||||
|
#include "virstring.h"
|
||||||
|
#include "virutil.h"
|
||||||
|
|
||||||
|
#define VIR_FROM_THIS VIR_FROM_CONF
|
||||||
|
|
||||||
|
VIR_LOG_INIT("daemon.libvirtd-config");
|
||||||
|
|
||||||
|
/* Allocate an array of malloc'd strings from the config file, filename
|
||||||
|
* (used only in diagnostics), using handle "conf". Upon error, return -1
|
||||||
|
* and free any allocated memory. Otherwise, save the array in *list_arg
|
||||||
|
* and return 0.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
|
||||||
|
const char *filename)
|
||||||
|
{
|
||||||
|
char **list;
|
||||||
|
virConfValuePtr p = virConfGetValue(conf, key);
|
||||||
|
if (!p)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
switch (p->type) {
|
||||||
|
case VIR_CONF_STRING:
|
||||||
|
if (VIR_ALLOC_N(list, 2) < 0) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("failed to allocate memory for %s config list"),
|
||||||
|
key);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (VIR_STRDUP(list[0], p->str) < 0) {
|
||||||
|
VIR_FREE(list);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
list[1] = NULL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_CONF_LIST: {
|
||||||
|
int len = 0;
|
||||||
|
size_t i;
|
||||||
|
virConfValuePtr pp;
|
||||||
|
for (pp = p->list; pp; pp = pp->next)
|
||||||
|
len++;
|
||||||
|
if (VIR_ALLOC_N(list, 1+len) < 0) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("failed to allocate memory for %s config list"),
|
||||||
|
key);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
|
||||||
|
if (pp->type != VIR_CONF_STRING) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("remoteReadConfigFile: %s: %s:"
|
||||||
|
" must be a string or list of strings"),
|
||||||
|
filename, key);
|
||||||
|
VIR_FREE(list);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (VIR_STRDUP(list[i], pp->str) < 0) {
|
||||||
|
size_t j;
|
||||||
|
for (j = 0; j < i; j++)
|
||||||
|
VIR_FREE(list[j]);
|
||||||
|
VIR_FREE(list);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
list[i] = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("remoteReadConfigFile: %s: %s:"
|
||||||
|
" must be a string or list of strings"),
|
||||||
|
filename, key);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*list_arg = list;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* A helper function used by each of the following macros. */
|
||||||
|
static int
|
||||||
|
checkType(virConfValuePtr p, const char *filename,
|
||||||
|
const char *key, virConfType required_type)
|
||||||
|
{
|
||||||
|
if (p->type != required_type) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("remoteReadConfigFile: %s: %s: invalid type:"
|
||||||
|
" got %s; expected %s"), filename, key,
|
||||||
|
virConfTypeToString(p->type),
|
||||||
|
virConfTypeToString(required_type));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If there is no config data for the key, #var_name, then do nothing.
|
||||||
|
If there is valid data of type VIR_CONF_STRING, and VIR_STRDUP succeeds,
|
||||||
|
store the result in var_name. Otherwise, (i.e. invalid type, or VIR_STRDUP
|
||||||
|
failure), give a diagnostic and "goto" the cleanup-and-fail label. */
|
||||||
|
#define GET_CONF_STR(conf, filename, var_name) \
|
||||||
|
do { \
|
||||||
|
virConfValuePtr p = virConfGetValue(conf, #var_name); \
|
||||||
|
if (p) { \
|
||||||
|
if (checkType(p, filename, #var_name, VIR_CONF_STRING) < 0) \
|
||||||
|
goto error; \
|
||||||
|
VIR_FREE(data->var_name); \
|
||||||
|
if (VIR_STRDUP(data->var_name, p->str) < 0) \
|
||||||
|
goto error; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/* Like GET_CONF_STR, but for signed integral values. */
|
||||||
|
#define GET_CONF_INT(conf, filename, var_name) \
|
||||||
|
do { \
|
||||||
|
virConfValuePtr p = virConfGetValue(conf, #var_name); \
|
||||||
|
if (p) { \
|
||||||
|
if (p->type != VIR_CONF_ULONG && \
|
||||||
|
checkType(p, filename, #var_name, VIR_CONF_LONG) < 0) \
|
||||||
|
goto error; \
|
||||||
|
data->var_name = p->l; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/* Like GET_CONF_STR, but for unsigned integral values. */
|
||||||
|
#define GET_CONF_UINT(conf, filename, var_name) \
|
||||||
|
do { \
|
||||||
|
virConfValuePtr p = virConfGetValue(conf, #var_name); \
|
||||||
|
if (p) { \
|
||||||
|
if (checkType(p, filename, #var_name, VIR_CONF_ULONG) < 0) \
|
||||||
|
goto error; \
|
||||||
|
data->var_name = p->l; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteConfigGetAuth(virConfPtr conf,
|
||||||
|
const char *key,
|
||||||
|
int *auth,
|
||||||
|
const char *filename)
|
||||||
|
{
|
||||||
|
virConfValuePtr p;
|
||||||
|
|
||||||
|
p = virConfGetValue(conf, key);
|
||||||
|
if (!p)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (checkType(p, filename, key, VIR_CONF_STRING) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (!p->str)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (STREQ(p->str, "none")) {
|
||||||
|
*auth = VIR_NET_SERVER_SERVICE_AUTH_NONE;
|
||||||
|
#if WITH_SASL
|
||||||
|
} else if (STREQ(p->str, "sasl")) {
|
||||||
|
*auth = VIR_NET_SERVER_SERVICE_AUTH_SASL;
|
||||||
|
#endif
|
||||||
|
} else if (STREQ(p->str, "polkit")) {
|
||||||
|
*auth = VIR_NET_SERVER_SERVICE_AUTH_POLKIT;
|
||||||
|
} else {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("remoteReadConfigFile: %s: %s: unsupported auth %s"),
|
||||||
|
filename, key, p->str);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
daemonConfigFilePath(bool privileged, char **configfile)
|
||||||
|
{
|
||||||
|
if (privileged) {
|
||||||
|
if (VIR_STRDUP(*configfile, SYSCONFDIR "/libvirt/libvirtd.conf") < 0)
|
||||||
|
goto error;
|
||||||
|
} else {
|
||||||
|
char *configdir = NULL;
|
||||||
|
|
||||||
|
if (!(configdir = virGetUserConfigDirectory()))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
if (virAsprintf(configfile, "%s/libvirtd.conf", configdir) < 0) {
|
||||||
|
VIR_FREE(configdir);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
VIR_FREE(configdir);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct daemonConfig*
|
||||||
|
daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
struct daemonConfig *data;
|
||||||
|
char *localhost;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (VIR_ALLOC(data) < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
data->listen_tls = 1;
|
||||||
|
data->listen_tcp = 0;
|
||||||
|
|
||||||
|
if (VIR_STRDUP(data->tls_port, LIBVIRTD_TLS_PORT) < 0 ||
|
||||||
|
VIR_STRDUP(data->tcp_port, LIBVIRTD_TCP_PORT) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
/* Only default to PolicyKit if running as root */
|
||||||
|
#if WITH_POLKIT
|
||||||
|
if (privileged) {
|
||||||
|
data->auth_unix_rw = REMOTE_AUTH_POLKIT;
|
||||||
|
data->auth_unix_ro = REMOTE_AUTH_POLKIT;
|
||||||
|
} else {
|
||||||
|
#endif
|
||||||
|
data->auth_unix_rw = REMOTE_AUTH_NONE;
|
||||||
|
data->auth_unix_ro = REMOTE_AUTH_NONE;
|
||||||
|
#if WITH_POLKIT
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (VIR_STRDUP(data->unix_sock_rw_perms,
|
||||||
|
data->auth_unix_rw == REMOTE_AUTH_POLKIT ? "0777" : "0700") < 0 ||
|
||||||
|
VIR_STRDUP(data->unix_sock_ro_perms, "0777") < 0 ||
|
||||||
|
VIR_STRDUP(data->unix_sock_admin_perms, "0700") < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
#if WITH_SASL
|
||||||
|
data->auth_tcp = REMOTE_AUTH_SASL;
|
||||||
|
#else
|
||||||
|
data->auth_tcp = REMOTE_AUTH_NONE;
|
||||||
|
#endif
|
||||||
|
data->auth_tls = REMOTE_AUTH_NONE;
|
||||||
|
|
||||||
|
data->mdns_adv = 0;
|
||||||
|
|
||||||
|
data->min_workers = 5;
|
||||||
|
data->max_workers = 20;
|
||||||
|
data->max_clients = 5000;
|
||||||
|
data->max_anonymous_clients = 20;
|
||||||
|
|
||||||
|
data->prio_workers = 5;
|
||||||
|
|
||||||
|
data->max_requests = 20;
|
||||||
|
data->max_client_requests = 5;
|
||||||
|
|
||||||
|
data->audit_level = 1;
|
||||||
|
data->audit_logging = 0;
|
||||||
|
|
||||||
|
data->keepalive_interval = 5;
|
||||||
|
data->keepalive_count = 5;
|
||||||
|
data->keepalive_required = 0;
|
||||||
|
|
||||||
|
data->admin_min_workers = 5;
|
||||||
|
data->admin_max_workers = 20;
|
||||||
|
data->admin_max_clients = 5000;
|
||||||
|
data->admin_max_queued_clients = 20;
|
||||||
|
data->admin_max_client_requests = 5;
|
||||||
|
|
||||||
|
data->admin_keepalive_interval = 5;
|
||||||
|
data->admin_keepalive_count = 5;
|
||||||
|
data->admin_keepalive_required = 0;
|
||||||
|
|
||||||
|
localhost = virGetHostname();
|
||||||
|
if (localhost == NULL) {
|
||||||
|
/* we couldn't resolve the hostname; assume that we are
|
||||||
|
* running in disconnected operation, and report a less
|
||||||
|
* useful Avahi string
|
||||||
|
*/
|
||||||
|
ret = VIR_STRDUP(data->mdns_name, "Virtualization Host");
|
||||||
|
} else {
|
||||||
|
char *tmp;
|
||||||
|
/* Extract the host part of the potentially FQDN */
|
||||||
|
if ((tmp = strchr(localhost, '.')))
|
||||||
|
*tmp = '\0';
|
||||||
|
ret = virAsprintf(&data->mdns_name, "Virtualization Host %s",
|
||||||
|
localhost);
|
||||||
|
}
|
||||||
|
VIR_FREE(localhost);
|
||||||
|
if (ret < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
|
||||||
|
error:
|
||||||
|
daemonConfigFree(data);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
daemonConfigFree(struct daemonConfig *data)
|
||||||
|
{
|
||||||
|
char **tmp;
|
||||||
|
|
||||||
|
if (!data)
|
||||||
|
return;
|
||||||
|
|
||||||
|
VIR_FREE(data->listen_addr);
|
||||||
|
VIR_FREE(data->tls_port);
|
||||||
|
VIR_FREE(data->tcp_port);
|
||||||
|
tmp = data->access_drivers;
|
||||||
|
while (tmp && *tmp) {
|
||||||
|
VIR_FREE(*tmp);
|
||||||
|
tmp++;
|
||||||
|
}
|
||||||
|
VIR_FREE(data->access_drivers);
|
||||||
|
|
||||||
|
VIR_FREE(data->unix_sock_admin_perms);
|
||||||
|
VIR_FREE(data->unix_sock_ro_perms);
|
||||||
|
VIR_FREE(data->unix_sock_rw_perms);
|
||||||
|
VIR_FREE(data->unix_sock_group);
|
||||||
|
VIR_FREE(data->unix_sock_dir);
|
||||||
|
VIR_FREE(data->mdns_name);
|
||||||
|
|
||||||
|
tmp = data->tls_allowed_dn_list;
|
||||||
|
while (tmp && *tmp) {
|
||||||
|
VIR_FREE(*tmp);
|
||||||
|
tmp++;
|
||||||
|
}
|
||||||
|
VIR_FREE(data->tls_allowed_dn_list);
|
||||||
|
|
||||||
|
tmp = data->sasl_allowed_username_list;
|
||||||
|
while (tmp && *tmp) {
|
||||||
|
VIR_FREE(*tmp);
|
||||||
|
tmp++;
|
||||||
|
}
|
||||||
|
VIR_FREE(data->sasl_allowed_username_list);
|
||||||
|
|
||||||
|
VIR_FREE(data->key_file);
|
||||||
|
VIR_FREE(data->ca_file);
|
||||||
|
VIR_FREE(data->cert_file);
|
||||||
|
VIR_FREE(data->crl_file);
|
||||||
|
|
||||||
|
VIR_FREE(data->host_uuid);
|
||||||
|
VIR_FREE(data->log_filters);
|
||||||
|
VIR_FREE(data->log_outputs);
|
||||||
|
|
||||||
|
VIR_FREE(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
daemonConfigLoadOptions(struct daemonConfig *data,
|
||||||
|
const char *filename,
|
||||||
|
virConfPtr conf)
|
||||||
|
{
|
||||||
|
GET_CONF_UINT(conf, filename, listen_tcp);
|
||||||
|
GET_CONF_UINT(conf, filename, listen_tls);
|
||||||
|
GET_CONF_STR(conf, filename, tls_port);
|
||||||
|
GET_CONF_STR(conf, filename, tcp_port);
|
||||||
|
GET_CONF_STR(conf, filename, listen_addr);
|
||||||
|
|
||||||
|
if (remoteConfigGetAuth(conf, "auth_unix_rw", &data->auth_unix_rw, filename) < 0)
|
||||||
|
goto error;
|
||||||
|
#if WITH_POLKIT
|
||||||
|
/* Change default perms to be wide-open if PolicyKit is enabled.
|
||||||
|
* Admin can always override in config file
|
||||||
|
*/
|
||||||
|
if (data->auth_unix_rw == REMOTE_AUTH_POLKIT) {
|
||||||
|
VIR_FREE(data->unix_sock_rw_perms);
|
||||||
|
if (VIR_STRDUP(data->unix_sock_rw_perms, "0777") < 0)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (remoteConfigGetAuth(conf, "auth_unix_ro", &data->auth_unix_ro, filename) < 0)
|
||||||
|
goto error;
|
||||||
|
if (remoteConfigGetAuth(conf, "auth_tcp", &data->auth_tcp, filename) < 0)
|
||||||
|
goto error;
|
||||||
|
if (remoteConfigGetAuth(conf, "auth_tls", &data->auth_tls, filename) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
if (remoteConfigGetStringList(conf, "access_drivers",
|
||||||
|
&data->access_drivers, filename) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
GET_CONF_STR(conf, filename, unix_sock_group);
|
||||||
|
GET_CONF_STR(conf, filename, unix_sock_admin_perms);
|
||||||
|
GET_CONF_STR(conf, filename, unix_sock_ro_perms);
|
||||||
|
GET_CONF_STR(conf, filename, unix_sock_rw_perms);
|
||||||
|
|
||||||
|
GET_CONF_STR(conf, filename, unix_sock_dir);
|
||||||
|
|
||||||
|
GET_CONF_UINT(conf, filename, mdns_adv);
|
||||||
|
GET_CONF_STR(conf, filename, mdns_name);
|
||||||
|
|
||||||
|
GET_CONF_UINT(conf, filename, tls_no_sanity_certificate);
|
||||||
|
GET_CONF_UINT(conf, filename, tls_no_verify_certificate);
|
||||||
|
|
||||||
|
GET_CONF_STR(conf, filename, key_file);
|
||||||
|
GET_CONF_STR(conf, filename, cert_file);
|
||||||
|
GET_CONF_STR(conf, filename, ca_file);
|
||||||
|
GET_CONF_STR(conf, filename, crl_file);
|
||||||
|
|
||||||
|
if (remoteConfigGetStringList(conf, "tls_allowed_dn_list",
|
||||||
|
&data->tls_allowed_dn_list, filename) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
|
||||||
|
if (remoteConfigGetStringList(conf, "sasl_allowed_username_list",
|
||||||
|
&data->sasl_allowed_username_list, filename) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
|
||||||
|
GET_CONF_UINT(conf, filename, min_workers);
|
||||||
|
GET_CONF_UINT(conf, filename, max_workers);
|
||||||
|
GET_CONF_UINT(conf, filename, max_clients);
|
||||||
|
GET_CONF_UINT(conf, filename, max_queued_clients);
|
||||||
|
GET_CONF_UINT(conf, filename, max_anonymous_clients);
|
||||||
|
|
||||||
|
GET_CONF_UINT(conf, filename, prio_workers);
|
||||||
|
|
||||||
|
GET_CONF_INT(conf, filename, max_requests);
|
||||||
|
GET_CONF_UINT(conf, filename, max_client_requests);
|
||||||
|
|
||||||
|
GET_CONF_UINT(conf, filename, admin_min_workers);
|
||||||
|
GET_CONF_UINT(conf, filename, admin_max_workers);
|
||||||
|
GET_CONF_UINT(conf, filename, admin_max_clients);
|
||||||
|
GET_CONF_UINT(conf, filename, admin_max_queued_clients);
|
||||||
|
GET_CONF_UINT(conf, filename, admin_max_client_requests);
|
||||||
|
|
||||||
|
GET_CONF_UINT(conf, filename, audit_level);
|
||||||
|
GET_CONF_UINT(conf, filename, audit_logging);
|
||||||
|
|
||||||
|
GET_CONF_STR(conf, filename, host_uuid);
|
||||||
|
|
||||||
|
GET_CONF_UINT(conf, filename, log_level);
|
||||||
|
GET_CONF_STR(conf, filename, log_filters);
|
||||||
|
GET_CONF_STR(conf, filename, log_outputs);
|
||||||
|
|
||||||
|
GET_CONF_INT(conf, filename, keepalive_interval);
|
||||||
|
GET_CONF_UINT(conf, filename, keepalive_count);
|
||||||
|
GET_CONF_UINT(conf, filename, keepalive_required);
|
||||||
|
|
||||||
|
GET_CONF_INT(conf, filename, admin_keepalive_interval);
|
||||||
|
GET_CONF_UINT(conf, filename, admin_keepalive_count);
|
||||||
|
GET_CONF_UINT(conf, filename, admin_keepalive_required);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Read the config file if it exists.
|
||||||
|
* Only used in the remote case, hence the name.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
daemonConfigLoadFile(struct daemonConfig *data,
|
||||||
|
const char *filename,
|
||||||
|
bool allow_missing)
|
||||||
|
{
|
||||||
|
virConfPtr conf;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (allow_missing &&
|
||||||
|
access(filename, R_OK) == -1 &&
|
||||||
|
errno == ENOENT)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
conf = virConfReadFile(filename, 0);
|
||||||
|
if (!conf)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
ret = daemonConfigLoadOptions(data, filename, conf);
|
||||||
|
virConfFree(conf);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int daemonConfigLoadData(struct daemonConfig *data,
|
||||||
|
const char *filename,
|
||||||
|
const char *filedata)
|
||||||
|
{
|
||||||
|
virConfPtr conf;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
conf = virConfReadMem(filedata, strlen(filedata), 0);
|
||||||
|
if (!conf)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
ret = daemonConfigLoadOptions(data, filename, conf);
|
||||||
|
virConfFree(conf);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
108
daemon/libvirtd-config.h
Normal file
108
daemon/libvirtd-config.h
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
* libvirtd-config.h: daemon start of day, guest process & i/o management
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2012, 2015 Red Hat, Inc.
|
||||||
|
* Copyright (C) 2006 Daniel P. Berrange
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBVIRTD_CONFIG_H__
|
||||||
|
# define __LIBVIRTD_CONFIG_H__
|
||||||
|
|
||||||
|
# include "internal.h"
|
||||||
|
|
||||||
|
struct daemonConfig {
|
||||||
|
char *host_uuid;
|
||||||
|
|
||||||
|
int listen_tls;
|
||||||
|
int listen_tcp;
|
||||||
|
char *listen_addr;
|
||||||
|
char *tls_port;
|
||||||
|
char *tcp_port;
|
||||||
|
|
||||||
|
char *unix_sock_admin_perms;
|
||||||
|
char *unix_sock_ro_perms;
|
||||||
|
char *unix_sock_rw_perms;
|
||||||
|
char *unix_sock_group;
|
||||||
|
char *unix_sock_dir;
|
||||||
|
|
||||||
|
int auth_unix_rw;
|
||||||
|
int auth_unix_ro;
|
||||||
|
int auth_tcp;
|
||||||
|
int auth_tls;
|
||||||
|
|
||||||
|
char **access_drivers;
|
||||||
|
|
||||||
|
int mdns_adv;
|
||||||
|
char *mdns_name;
|
||||||
|
|
||||||
|
int tls_no_verify_certificate;
|
||||||
|
int tls_no_sanity_certificate;
|
||||||
|
char **tls_allowed_dn_list;
|
||||||
|
char **sasl_allowed_username_list;
|
||||||
|
|
||||||
|
char *key_file;
|
||||||
|
char *cert_file;
|
||||||
|
char *ca_file;
|
||||||
|
char *crl_file;
|
||||||
|
|
||||||
|
int min_workers;
|
||||||
|
int max_workers;
|
||||||
|
int max_clients;
|
||||||
|
int max_queued_clients;
|
||||||
|
int max_anonymous_clients;
|
||||||
|
|
||||||
|
int prio_workers;
|
||||||
|
|
||||||
|
int max_requests;
|
||||||
|
int max_client_requests;
|
||||||
|
|
||||||
|
int log_level;
|
||||||
|
char *log_filters;
|
||||||
|
char *log_outputs;
|
||||||
|
|
||||||
|
int audit_level;
|
||||||
|
int audit_logging;
|
||||||
|
|
||||||
|
int keepalive_interval;
|
||||||
|
unsigned int keepalive_count;
|
||||||
|
int keepalive_required;
|
||||||
|
|
||||||
|
int admin_min_workers;
|
||||||
|
int admin_max_workers;
|
||||||
|
int admin_max_clients;
|
||||||
|
int admin_max_queued_clients;
|
||||||
|
int admin_max_client_requests;
|
||||||
|
|
||||||
|
int admin_keepalive_interval;
|
||||||
|
unsigned int admin_keepalive_count;
|
||||||
|
int admin_keepalive_required;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int daemonConfigFilePath(bool privileged, char **configfile);
|
||||||
|
struct daemonConfig* daemonConfigNew(bool privileged);
|
||||||
|
void daemonConfigFree(struct daemonConfig *data);
|
||||||
|
int daemonConfigLoadFile(struct daemonConfig *data,
|
||||||
|
const char *filename,
|
||||||
|
bool allow_missing);
|
||||||
|
int daemonConfigLoadData(struct daemonConfig *data,
|
||||||
|
const char *filename,
|
||||||
|
const char *filedata);
|
||||||
|
|
||||||
|
#endif /* __LIBVIRTD_CONFIG_H__ */
|
||||||
@@ -13,7 +13,7 @@ module Libvirtd =
|
|||||||
|
|
||||||
let str_val = del /\"/ "\"" . store /[^\"]*/ . del /\"/ "\""
|
let str_val = del /\"/ "\"" . store /[^\"]*/ . del /\"/ "\""
|
||||||
let bool_val = store /0|1/
|
let bool_val = store /0|1/
|
||||||
let int_val = store /-?[0-9]+/
|
let int_val = store /[0-9]+/
|
||||||
let str_array_element = [ seq "el" . str_val ] . del /[ \t\n]*/ ""
|
let str_array_element = [ seq "el" . str_val ] . del /[ \t\n]*/ ""
|
||||||
let str_array_val = counter "el" . array_start . ( str_array_element . ( array_sep . str_array_element ) * ) ? . array_end
|
let str_array_val = counter "el" . array_start . ( str_array_element . ( array_sep . str_array_element ) * ) ? . array_end
|
||||||
|
|
||||||
@@ -53,13 +53,13 @@ module Libvirtd =
|
|||||||
| str_array_entry "tls_allowed_dn_list"
|
| str_array_entry "tls_allowed_dn_list"
|
||||||
| str_array_entry "sasl_allowed_username_list"
|
| str_array_entry "sasl_allowed_username_list"
|
||||||
| str_array_entry "access_drivers"
|
| str_array_entry "access_drivers"
|
||||||
| str_entry "tls_priority"
|
|
||||||
|
|
||||||
let processing_entry = int_entry "min_workers"
|
let processing_entry = int_entry "min_workers"
|
||||||
| int_entry "max_workers"
|
| int_entry "max_workers"
|
||||||
| int_entry "max_clients"
|
| int_entry "max_clients"
|
||||||
| int_entry "max_queued_clients"
|
| int_entry "max_queued_clients"
|
||||||
| int_entry "max_anonymous_clients"
|
| int_entry "max_anonymous_clients"
|
||||||
|
| int_entry "max_requests"
|
||||||
| int_entry "max_client_requests"
|
| int_entry "max_client_requests"
|
||||||
| int_entry "prio_workers"
|
| int_entry "prio_workers"
|
||||||
|
|
||||||
@@ -72,6 +72,7 @@ module Libvirtd =
|
|||||||
let logging_entry = int_entry "log_level"
|
let logging_entry = int_entry "log_level"
|
||||||
| str_entry "log_filters"
|
| str_entry "log_filters"
|
||||||
| str_entry "log_outputs"
|
| str_entry "log_outputs"
|
||||||
|
| int_entry "log_buffer_size"
|
||||||
|
|
||||||
let auditing_entry = int_entry "audit_level"
|
let auditing_entry = int_entry "audit_level"
|
||||||
| bool_entry "audit_logging"
|
| bool_entry "audit_logging"
|
||||||
@@ -85,8 +86,6 @@ module Libvirtd =
|
|||||||
| bool_entry "admin_keepalive_required"
|
| bool_entry "admin_keepalive_required"
|
||||||
|
|
||||||
let misc_entry = str_entry "host_uuid"
|
let misc_entry = str_entry "host_uuid"
|
||||||
| str_entry "host_uuid_source"
|
|
||||||
| int_entry "ovs_timeout"
|
|
||||||
|
|
||||||
(* Each enty in the config is one of the following three ... *)
|
(* Each enty in the config is one of the following three ... *)
|
||||||
let entry = network_entry
|
let entry = network_entry
|
||||||
1625
daemon/libvirtd.c
Normal file
1625
daemon/libvirtd.c
Normal file
File diff suppressed because it is too large
Load Diff
453
daemon/libvirtd.conf
Normal file
453
daemon/libvirtd.conf
Normal file
@@ -0,0 +1,453 @@
|
|||||||
|
# Master libvirt daemon configuration file
|
||||||
|
#
|
||||||
|
# For further information consult http://libvirt.org/format.html
|
||||||
|
#
|
||||||
|
# NOTE: the tests/daemon-conf regression test script requires
|
||||||
|
# that each "PARAMETER = VALUE" line in this file have the parameter
|
||||||
|
# name just after a leading "#".
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
#
|
||||||
|
# Network connectivity controls
|
||||||
|
#
|
||||||
|
|
||||||
|
# Flag listening for secure TLS connections on the public TCP/IP port.
|
||||||
|
# NB, must pass the --listen flag to the libvirtd process for this to
|
||||||
|
# have any effect.
|
||||||
|
#
|
||||||
|
# It is necessary to setup a CA and issue server certificates before
|
||||||
|
# using this capability.
|
||||||
|
#
|
||||||
|
# This is enabled by default, uncomment this to disable it
|
||||||
|
#listen_tls = 0
|
||||||
|
|
||||||
|
# Listen for unencrypted TCP connections on the public TCP/IP port.
|
||||||
|
# NB, must pass the --listen flag to the libvirtd process for this to
|
||||||
|
# have any effect.
|
||||||
|
#
|
||||||
|
# Using the TCP socket requires SASL authentication by default. Only
|
||||||
|
# SASL mechanisms which support data encryption are allowed. This is
|
||||||
|
# DIGEST_MD5 and GSSAPI (Kerberos5)
|
||||||
|
#
|
||||||
|
# This is disabled by default, uncomment this to enable it.
|
||||||
|
#listen_tcp = 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Override the port for accepting secure TLS connections
|
||||||
|
# This can be a port number, or service name
|
||||||
|
#
|
||||||
|
#tls_port = "16514"
|
||||||
|
|
||||||
|
# Override the port for accepting insecure TCP connections
|
||||||
|
# This can be a port number, or service name
|
||||||
|
#
|
||||||
|
#tcp_port = "16509"
|
||||||
|
|
||||||
|
|
||||||
|
# Override the default configuration which binds to all network
|
||||||
|
# interfaces. This can be a numeric IPv4/6 address, or hostname
|
||||||
|
#
|
||||||
|
# If the libvirtd service is started in parallel with network
|
||||||
|
# startup (e.g. with systemd), binding to addresses other than
|
||||||
|
# the wildcards (0.0.0.0/::) might not be available yet.
|
||||||
|
#
|
||||||
|
#listen_addr = "192.168.0.1"
|
||||||
|
|
||||||
|
|
||||||
|
# Flag toggling mDNS advertizement of the libvirt service.
|
||||||
|
#
|
||||||
|
# Alternatively can disable for all services on a host by
|
||||||
|
# stopping the Avahi daemon
|
||||||
|
#
|
||||||
|
# This is disabled by default, uncomment this to enable it
|
||||||
|
#mdns_adv = 1
|
||||||
|
|
||||||
|
# Override the default mDNS advertizement name. This must be
|
||||||
|
# unique on the immediate broadcast network.
|
||||||
|
#
|
||||||
|
# The default is "Virtualization Host HOSTNAME", where HOSTNAME
|
||||||
|
# is substituted for the short hostname of the machine (without domain)
|
||||||
|
#
|
||||||
|
#mdns_name = "Virtualization Host Joe Demo"
|
||||||
|
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
#
|
||||||
|
# UNIX socket access controls
|
||||||
|
#
|
||||||
|
|
||||||
|
# Beware that if you are changing *any* of these options, and you use
|
||||||
|
# socket activation with systemd, you need to adjust the settings in
|
||||||
|
# the libvirtd.socket file as well since it could impose a security
|
||||||
|
# risk if you rely on file permission checking only.
|
||||||
|
|
||||||
|
# Set the UNIX domain socket group ownership. This can be used to
|
||||||
|
# allow a 'trusted' set of users access to management capabilities
|
||||||
|
# without becoming root.
|
||||||
|
#
|
||||||
|
# This is restricted to 'root' by default.
|
||||||
|
#unix_sock_group = "libvirt"
|
||||||
|
|
||||||
|
# Set the UNIX socket permissions for the R/O socket. This is used
|
||||||
|
# for monitoring VM status only
|
||||||
|
#
|
||||||
|
# Default allows any user. If setting group ownership, you may want to
|
||||||
|
# restrict this too.
|
||||||
|
#unix_sock_ro_perms = "0777"
|
||||||
|
|
||||||
|
# Set the UNIX socket permissions for the R/W socket. This is used
|
||||||
|
# for full management of VMs
|
||||||
|
#
|
||||||
|
# Default allows only root. If PolicyKit is enabled on the socket,
|
||||||
|
# the default will change to allow everyone (eg, 0777)
|
||||||
|
#
|
||||||
|
# If not using PolicyKit and setting group ownership for access
|
||||||
|
# control, then you may want to relax this too.
|
||||||
|
#unix_sock_rw_perms = "0770"
|
||||||
|
|
||||||
|
# Set the UNIX socket permissions for the admin interface socket.
|
||||||
|
#
|
||||||
|
# Default allows only owner (root), do not change it unless you are
|
||||||
|
# sure to whom you are exposing the access to.
|
||||||
|
#unix_sock_admin_perms = "0700"
|
||||||
|
|
||||||
|
# Set the name of the directory in which sockets will be found/created.
|
||||||
|
#unix_sock_dir = "/var/run/libvirt"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
#
|
||||||
|
# Authentication.
|
||||||
|
#
|
||||||
|
# - none: do not perform auth checks. If you can connect to the
|
||||||
|
# socket you are allowed. This is suitable if there are
|
||||||
|
# restrictions on connecting to the socket (eg, UNIX
|
||||||
|
# socket permissions), or if there is a lower layer in
|
||||||
|
# the network providing auth (eg, TLS/x509 certificates)
|
||||||
|
#
|
||||||
|
# - sasl: use SASL infrastructure. The actual auth scheme is then
|
||||||
|
# controlled from /etc/sasl2/libvirt.conf. For the TCP
|
||||||
|
# socket only GSSAPI & DIGEST-MD5 mechanisms will be used.
|
||||||
|
# For non-TCP or TLS sockets, any scheme is allowed.
|
||||||
|
#
|
||||||
|
# - polkit: use PolicyKit to authenticate. This is only suitable
|
||||||
|
# for use on the UNIX sockets. The default policy will
|
||||||
|
# require a user to supply their own password to gain
|
||||||
|
# full read/write access (aka sudo like), while anyone
|
||||||
|
# is allowed read/only access.
|
||||||
|
#
|
||||||
|
# Set an authentication scheme for UNIX read-only sockets
|
||||||
|
# By default socket permissions allow anyone to connect
|
||||||
|
#
|
||||||
|
# To restrict monitoring of domains you may wish to enable
|
||||||
|
# an authentication mechanism here
|
||||||
|
#auth_unix_ro = "none"
|
||||||
|
|
||||||
|
# Set an authentication scheme for UNIX read-write sockets
|
||||||
|
# By default socket permissions only allow root. If PolicyKit
|
||||||
|
# support was compiled into libvirt, the default will be to
|
||||||
|
# use 'polkit' auth.
|
||||||
|
#
|
||||||
|
# If the unix_sock_rw_perms are changed you may wish to enable
|
||||||
|
# an authentication mechanism here
|
||||||
|
#auth_unix_rw = "none"
|
||||||
|
|
||||||
|
# Change the authentication scheme for TCP sockets.
|
||||||
|
#
|
||||||
|
# If you don't enable SASL, then all TCP traffic is cleartext.
|
||||||
|
# Don't do this outside of a dev/test scenario. For real world
|
||||||
|
# use, always enable SASL and use the GSSAPI or DIGEST-MD5
|
||||||
|
# mechanism in /etc/sasl2/libvirt.conf
|
||||||
|
#auth_tcp = "sasl"
|
||||||
|
|
||||||
|
# Change the authentication scheme for TLS sockets.
|
||||||
|
#
|
||||||
|
# TLS sockets already have encryption provided by the TLS
|
||||||
|
# layer, and limited authentication is done by certificates
|
||||||
|
#
|
||||||
|
# It is possible to make use of any SASL authentication
|
||||||
|
# mechanism as well, by using 'sasl' for this option
|
||||||
|
#auth_tls = "none"
|
||||||
|
|
||||||
|
|
||||||
|
# Change the API access control scheme
|
||||||
|
#
|
||||||
|
# By default an authenticated user is allowed access
|
||||||
|
# to all APIs. Access drivers can place restrictions
|
||||||
|
# on this. By default the 'nop' driver is enabled,
|
||||||
|
# meaning no access control checks are done once a
|
||||||
|
# client has authenticated with libvirtd
|
||||||
|
#
|
||||||
|
#access_drivers = [ "polkit" ]
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
#
|
||||||
|
# TLS x509 certificate configuration
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# Override the default server key file path
|
||||||
|
#
|
||||||
|
#key_file = "/etc/pki/libvirt/private/serverkey.pem"
|
||||||
|
|
||||||
|
# Override the default server certificate file path
|
||||||
|
#
|
||||||
|
#cert_file = "/etc/pki/libvirt/servercert.pem"
|
||||||
|
|
||||||
|
# Override the default CA certificate path
|
||||||
|
#
|
||||||
|
#ca_file = "/etc/pki/CA/cacert.pem"
|
||||||
|
|
||||||
|
# Specify a certificate revocation list.
|
||||||
|
#
|
||||||
|
# Defaults to not using a CRL, uncomment to enable it
|
||||||
|
#crl_file = "/etc/pki/CA/crl.pem"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
#
|
||||||
|
# Authorization controls
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# Flag to disable verification of our own server certificates
|
||||||
|
#
|
||||||
|
# When libvirtd starts it performs some sanity checks against
|
||||||
|
# its own certificates.
|
||||||
|
#
|
||||||
|
# Default is to always run sanity checks. Uncommenting this
|
||||||
|
# will disable sanity checks which is not a good idea
|
||||||
|
#tls_no_sanity_certificate = 1
|
||||||
|
|
||||||
|
# Flag to disable verification of client certificates
|
||||||
|
#
|
||||||
|
# Client certificate verification is the primary authentication mechanism.
|
||||||
|
# Any client which does not present a certificate signed by the CA
|
||||||
|
# will be rejected.
|
||||||
|
#
|
||||||
|
# Default is to always verify. Uncommenting this will disable
|
||||||
|
# verification - make sure an IP whitelist is set
|
||||||
|
#tls_no_verify_certificate = 1
|
||||||
|
|
||||||
|
|
||||||
|
# A whitelist of allowed x509 Distinguished Names
|
||||||
|
# This list may contain wildcards such as
|
||||||
|
#
|
||||||
|
# "C=GB,ST=London,L=London,O=Red Hat,CN=*"
|
||||||
|
#
|
||||||
|
# See the POSIX fnmatch function for the format of the wildcards.
|
||||||
|
#
|
||||||
|
# NB If this is an empty list, no client can connect, so comment out
|
||||||
|
# entirely rather than using empty list to disable these checks
|
||||||
|
#
|
||||||
|
# By default, no DN's are checked
|
||||||
|
#tls_allowed_dn_list = ["DN1", "DN2"]
|
||||||
|
|
||||||
|
|
||||||
|
# A whitelist of allowed SASL usernames. The format for usernames
|
||||||
|
# depends on the SASL authentication mechanism. Kerberos usernames
|
||||||
|
# look like username@REALM
|
||||||
|
#
|
||||||
|
# This list may contain wildcards such as
|
||||||
|
#
|
||||||
|
# "*@EXAMPLE.COM"
|
||||||
|
#
|
||||||
|
# See the POSIX fnmatch function for the format of the wildcards.
|
||||||
|
#
|
||||||
|
# NB If this is an empty list, no client can connect, so comment out
|
||||||
|
# entirely rather than using empty list to disable these checks
|
||||||
|
#
|
||||||
|
# By default, no Username's are checked
|
||||||
|
#sasl_allowed_username_list = ["joe@EXAMPLE.COM", "fred@EXAMPLE.COM" ]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
#
|
||||||
|
# Processing controls
|
||||||
|
#
|
||||||
|
|
||||||
|
# The maximum number of concurrent client connections to allow
|
||||||
|
# over all sockets combined.
|
||||||
|
#max_clients = 5000
|
||||||
|
|
||||||
|
# The maximum length of queue of connections waiting to be
|
||||||
|
# accepted by the daemon. Note, that some protocols supporting
|
||||||
|
# retransmission may obey this so that a later reattempt at
|
||||||
|
# connection succeeds.
|
||||||
|
#max_queued_clients = 1000
|
||||||
|
|
||||||
|
# The maximum length of queue of accepted but not yet
|
||||||
|
# authenticated clients. The default value is zero, meaning
|
||||||
|
# the feature is disabled.
|
||||||
|
#max_anonymous_clients = 20
|
||||||
|
|
||||||
|
# The minimum limit sets the number of workers to start up
|
||||||
|
# initially. If the number of active clients exceeds this,
|
||||||
|
# then more threads are spawned, up to max_workers limit.
|
||||||
|
# Typically you'd want max_workers to equal maximum number
|
||||||
|
# of clients allowed
|
||||||
|
#min_workers = 5
|
||||||
|
#max_workers = 20
|
||||||
|
|
||||||
|
|
||||||
|
# The number of priority workers. If all workers from above
|
||||||
|
# pool are stuck, some calls marked as high priority
|
||||||
|
# (notably domainDestroy) can be executed in this pool.
|
||||||
|
#prio_workers = 5
|
||||||
|
|
||||||
|
# Total global limit on concurrent RPC calls. Should be
|
||||||
|
# at least as large as max_workers. Beyond this, RPC requests
|
||||||
|
# will be read into memory and queued. This directly impacts
|
||||||
|
# memory usage, currently each request requires 256 KB of
|
||||||
|
# memory. So by default up to 5 MB of memory is used
|
||||||
|
#
|
||||||
|
# XXX this isn't actually enforced yet, only the per-client
|
||||||
|
# limit is used so far
|
||||||
|
#max_requests = 20
|
||||||
|
|
||||||
|
# Limit on concurrent requests from a single client
|
||||||
|
# connection. To avoid one client monopolizing the server
|
||||||
|
# this should be a small fraction of the global max_requests
|
||||||
|
# and max_workers parameter
|
||||||
|
#max_client_requests = 5
|
||||||
|
|
||||||
|
# Same processing controls, but this time for the admin interface.
|
||||||
|
# For description of each option, be so kind to scroll few lines
|
||||||
|
# upwards.
|
||||||
|
|
||||||
|
#admin_min_workers = 1
|
||||||
|
#admin_max_workers = 5
|
||||||
|
#admin_max_clients = 5
|
||||||
|
#admin_max_queued_clients = 5
|
||||||
|
#admin_max_client_requests = 5
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
#
|
||||||
|
# Logging controls
|
||||||
|
#
|
||||||
|
|
||||||
|
# Logging level: 4 errors, 3 warnings, 2 information, 1 debug
|
||||||
|
# basically 1 will log everything possible
|
||||||
|
# Note: Journald may employ rate limiting of the messages logged
|
||||||
|
# and thus lock up the libvirt daemon. To use the debug level with
|
||||||
|
# journald you have to specify it explicitly in 'log_outputs', otherwise
|
||||||
|
# only information level messages will be logged.
|
||||||
|
#log_level = 3
|
||||||
|
|
||||||
|
# Logging filters:
|
||||||
|
# A filter allows to select a different logging level for a given category
|
||||||
|
# of logs
|
||||||
|
# The format for a filter is one of:
|
||||||
|
# x:name
|
||||||
|
# x:+name
|
||||||
|
# where name is a string which is matched against source file name,
|
||||||
|
# e.g., "remote", "qemu", or "util/json", the optional "+" prefix
|
||||||
|
# tells libvirt to log stack trace for each message matching name,
|
||||||
|
# and x is the minimal level where matching messages should be logged:
|
||||||
|
# 1: DEBUG
|
||||||
|
# 2: INFO
|
||||||
|
# 3: WARNING
|
||||||
|
# 4: ERROR
|
||||||
|
#
|
||||||
|
# Multiple filters can be defined in a single @filters, they just need to be
|
||||||
|
# separated by spaces.
|
||||||
|
#
|
||||||
|
# e.g. to only get warning or errors from the remote layer and only errors
|
||||||
|
# from the event layer:
|
||||||
|
#log_filters="3:remote 4:event"
|
||||||
|
|
||||||
|
# Logging outputs:
|
||||||
|
# An output is one of the places to save logging information
|
||||||
|
# The format for an output can be:
|
||||||
|
# x:stderr
|
||||||
|
# output goes to stderr
|
||||||
|
# x:syslog:name
|
||||||
|
# use syslog for the output and use the given name as the ident
|
||||||
|
# x:file:file_path
|
||||||
|
# output to a file, with the given filepath
|
||||||
|
# x:journald
|
||||||
|
# output to journald logging system
|
||||||
|
# In all case the x prefix is the minimal level, acting as a filter
|
||||||
|
# 1: DEBUG
|
||||||
|
# 2: INFO
|
||||||
|
# 3: WARNING
|
||||||
|
# 4: ERROR
|
||||||
|
#
|
||||||
|
# Multiple outputs can be defined, they just need to be separated by spaces.
|
||||||
|
# e.g. to log all warnings and errors to syslog under the libvirtd ident:
|
||||||
|
#log_outputs="3:syslog:libvirtd"
|
||||||
|
#
|
||||||
|
|
||||||
|
# Log debug buffer size:
|
||||||
|
#
|
||||||
|
# This configuration option is no longer used, since the global
|
||||||
|
# log buffer functionality has been removed. Please configure
|
||||||
|
# suitable log_outputs/log_filters settings to obtain logs.
|
||||||
|
#log_buffer_size = 64
|
||||||
|
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
#
|
||||||
|
# Auditing
|
||||||
|
#
|
||||||
|
# This setting allows usage of the auditing subsystem to be altered:
|
||||||
|
#
|
||||||
|
# audit_level == 0 -> disable all auditing
|
||||||
|
# audit_level == 1 -> enable auditing, only if enabled on host (default)
|
||||||
|
# audit_level == 2 -> enable auditing, and exit if disabled on host
|
||||||
|
#
|
||||||
|
#audit_level = 2
|
||||||
|
#
|
||||||
|
# If set to 1, then audit messages will also be sent
|
||||||
|
# via libvirt logging infrastructure. Defaults to 0
|
||||||
|
#
|
||||||
|
#audit_logging = 1
|
||||||
|
|
||||||
|
###################################################################
|
||||||
|
# UUID of the host:
|
||||||
|
# Provide the UUID of the host here in case the command
|
||||||
|
# 'dmidecode -s system-uuid' does not provide a valid uuid. In case
|
||||||
|
# 'dmidecode' does not provide a valid UUID and none is provided here, a
|
||||||
|
# temporary UUID will be generated.
|
||||||
|
# Keep the format of the example UUID below. UUID must not have all digits
|
||||||
|
# be the same.
|
||||||
|
|
||||||
|
# NB This default all-zeros UUID will not work. Replace
|
||||||
|
# it with the output of the 'uuidgen' command and then
|
||||||
|
# uncomment this entry
|
||||||
|
#host_uuid = "00000000-0000-0000-0000-000000000000"
|
||||||
|
|
||||||
|
###################################################################
|
||||||
|
# Keepalive protocol:
|
||||||
|
# This allows libvirtd to detect broken client connections or even
|
||||||
|
# dead clients. A keepalive message is sent to a client after
|
||||||
|
# keepalive_interval seconds of inactivity to check if the client is
|
||||||
|
# still responding; keepalive_count is a maximum number of keepalive
|
||||||
|
# messages that are allowed to be sent to the client without getting
|
||||||
|
# any response before the connection is considered broken. In other
|
||||||
|
# words, the connection is automatically closed approximately after
|
||||||
|
# keepalive_interval * (keepalive_count + 1) seconds since the last
|
||||||
|
# message received from the client. If keepalive_interval is set to
|
||||||
|
# -1, libvirtd will never send keepalive requests; however clients
|
||||||
|
# can still send them and the daemon will send responses. When
|
||||||
|
# keepalive_count is set to 0, connections will be automatically
|
||||||
|
# closed after keepalive_interval seconds of inactivity without
|
||||||
|
# sending any keepalive messages.
|
||||||
|
#
|
||||||
|
#keepalive_interval = 5
|
||||||
|
#keepalive_count = 5
|
||||||
|
#
|
||||||
|
# If set to 1, libvirtd will refuse to talk to clients that do not
|
||||||
|
# support keepalive protocol. Defaults to 0.
|
||||||
|
#
|
||||||
|
#keepalive_required = 1
|
||||||
|
|
||||||
|
# Keepalive settings for the admin interface
|
||||||
|
#admin_keepalive_interval = 5
|
||||||
|
#admin_keepalive_count = 5
|
||||||
|
#
|
||||||
|
#admin_keepalive_required = 1
|
||||||
92
daemon/libvirtd.h
Normal file
92
daemon/libvirtd.h
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* libvirtd.h: daemon data structure definitions
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2015 Red Hat, Inc.
|
||||||
|
* Copyright (C) 2006 Daniel P. Berrange
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef LIBVIRTD_H__
|
||||||
|
# define LIBVIRTD_H__
|
||||||
|
|
||||||
|
# define VIR_ENUM_SENTINELS
|
||||||
|
|
||||||
|
# include <rpc/types.h>
|
||||||
|
# include <rpc/xdr.h>
|
||||||
|
# include "remote_protocol.h"
|
||||||
|
# include "admin_protocol.h"
|
||||||
|
# include "lxc_protocol.h"
|
||||||
|
# include "qemu_protocol.h"
|
||||||
|
# include "virthread.h"
|
||||||
|
|
||||||
|
# if WITH_SASL
|
||||||
|
# include "virnetsaslcontext.h"
|
||||||
|
# endif
|
||||||
|
# include "virnetserverprogram.h"
|
||||||
|
|
||||||
|
typedef struct daemonClientStream daemonClientStream;
|
||||||
|
typedef daemonClientStream *daemonClientStreamPtr;
|
||||||
|
typedef struct daemonClientPrivate daemonClientPrivate;
|
||||||
|
typedef daemonClientPrivate *daemonClientPrivatePtr;
|
||||||
|
typedef struct daemonAdmClientPrivate daemonAdmClientPrivate;
|
||||||
|
typedef daemonAdmClientPrivate *daemonAdmClientPrivatePtr;
|
||||||
|
typedef struct daemonClientEventCallback daemonClientEventCallback;
|
||||||
|
typedef daemonClientEventCallback *daemonClientEventCallbackPtr;
|
||||||
|
|
||||||
|
/* Stores the per-client connection state */
|
||||||
|
struct daemonClientPrivate {
|
||||||
|
/* Hold while accessing any data except conn */
|
||||||
|
virMutex lock;
|
||||||
|
|
||||||
|
daemonClientEventCallbackPtr *domainEventCallbacks;
|
||||||
|
size_t ndomainEventCallbacks;
|
||||||
|
daemonClientEventCallbackPtr *networkEventCallbacks;
|
||||||
|
size_t nnetworkEventCallbacks;
|
||||||
|
daemonClientEventCallbackPtr *qemuEventCallbacks;
|
||||||
|
size_t nqemuEventCallbacks;
|
||||||
|
|
||||||
|
# if WITH_SASL
|
||||||
|
virNetSASLSessionPtr sasl;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* This is only valid if a remote open call has been made on this
|
||||||
|
* connection, otherwise it will be NULL. Also if remote close is
|
||||||
|
* called, it will be set back to NULL if that succeeds.
|
||||||
|
*/
|
||||||
|
virConnectPtr conn;
|
||||||
|
|
||||||
|
daemonClientStreamPtr streams;
|
||||||
|
bool keepalive_supported;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Separate private data for admin connection */
|
||||||
|
struct daemonAdmClientPrivate {
|
||||||
|
/* Just a placeholder, not that there is anything to be locked */
|
||||||
|
virMutex lock;
|
||||||
|
|
||||||
|
virNetDaemonPtr dmn;
|
||||||
|
};
|
||||||
|
|
||||||
|
# if WITH_SASL
|
||||||
|
extern virNetSASLContextPtr saslCtxt;
|
||||||
|
# endif
|
||||||
|
extern virNetServerProgramPtr remoteProgram;
|
||||||
|
extern virNetServerProgramPtr qemuProgram;
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,20 +1,23 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# the following is the LSB init header see
|
# the following is the LSB init header see
|
||||||
# http://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html
|
# http://www.linux-foundation.org/spec//booksets/LSB-Core-generic/LSB-Core-generic.html#INITSCRCOMCONV
|
||||||
#
|
#
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: libvirtd
|
# Provides: libvirtd
|
||||||
|
# Required-Start: $network messagebus
|
||||||
|
# Should-Start: $named
|
||||||
|
# Should-Start: xend
|
||||||
|
# Should-Start: avahi-daemon
|
||||||
|
# Should-Start: virtlockd
|
||||||
|
# Required-Stop: $network messagebus
|
||||||
|
# Should-Stop: $named
|
||||||
# Default-Start: 3 4 5
|
# Default-Start: 3 4 5
|
||||||
# Default-Stop: 0 1 2 6
|
# Default-Stop: 0 1 2 6
|
||||||
# Required-Start: $network messagebus virtlogd
|
|
||||||
# Required-Stop: $network messagebus
|
|
||||||
# Should-Start: $named xend avahi-daemon virtlockd
|
|
||||||
# Should-Stop: $named
|
|
||||||
# Short-Description: daemon for libvirt virtualization API
|
# Short-Description: daemon for libvirt virtualization API
|
||||||
# Description: This is a daemon for managing guest instances
|
# Description: This is a daemon for managing guest instances
|
||||||
# and libvirt virtual networks
|
# and libvirt virtual networks
|
||||||
# See https://libvirt.org
|
# See http://libvirt.org
|
||||||
### END INIT INFO
|
### END INIT INFO
|
||||||
|
|
||||||
# the following is chkconfig init header
|
# the following is chkconfig init header
|
||||||
@@ -24,7 +27,7 @@
|
|||||||
# chkconfig: 345 97 03
|
# chkconfig: 345 97 03
|
||||||
# description: This is a daemon for managing guest instances \
|
# description: This is a daemon for managing guest instances \
|
||||||
# and libvirt virtual networks \
|
# and libvirt virtual networks \
|
||||||
# See https://libvirt.org
|
# See http://libvirt.org
|
||||||
#
|
#
|
||||||
# processname: libvirtd
|
# processname: libvirtd
|
||||||
# pidfile: @localstatedir@/run/libvirtd.pid
|
# pidfile: @localstatedir@/run/libvirtd.pid
|
||||||
@@ -5,4 +5,5 @@
|
|||||||
compress
|
compress
|
||||||
delaycompress
|
delaycompress
|
||||||
copytruncate
|
copytruncate
|
||||||
|
minsize 100k
|
||||||
}
|
}
|
||||||
@@ -5,4 +5,5 @@
|
|||||||
compress
|
compress
|
||||||
delaycompress
|
delaycompress
|
||||||
copytruncate
|
copytruncate
|
||||||
|
minsize 100k
|
||||||
}
|
}
|
||||||
208
daemon/libvirtd.pod.in
Normal file
208
daemon/libvirtd.pod.in
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
libvirtd - libvirtd management daemon
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
B<libvirtd> [ -dlv ] [ -f config_file ] [ -p pid_file ] [ -t timeout_seconds ]
|
||||||
|
|
||||||
|
B<libvirtd> --version
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
The B<libvirtd> program is the server side daemon component of the libvirt
|
||||||
|
virtualization management system.
|
||||||
|
|
||||||
|
This daemon runs on host servers and performs required management tasks for
|
||||||
|
virtualized guests. This includes activities such as starting, stopping
|
||||||
|
and migrating guests between host servers, configuring and manipulating
|
||||||
|
networking, and managing storage for use by guests.
|
||||||
|
|
||||||
|
The libvirt client libraries and utilities connect to this daemon to issue
|
||||||
|
tasks and collect information about the configuration and resources of the host
|
||||||
|
system and guests.
|
||||||
|
|
||||||
|
By default, the libvirtd daemon listens for requests on a local Unix domain
|
||||||
|
socket. Using the B<-l>|B<--listen> command line option, the libvirtd daemon
|
||||||
|
can be instructed to additionally listen on a TCP/IP socket. The TCP/IP socket
|
||||||
|
to use is defined in the libvirtd configuration file.
|
||||||
|
|
||||||
|
Restarting libvirtd does not impact running guests. Guests continue to operate
|
||||||
|
and will be picked up automatically if their XML configuration has been
|
||||||
|
defined. Any guests whose XML configuration has not been defined will be lost
|
||||||
|
from the configuration.
|
||||||
|
|
||||||
|
=head1 OPTIONS
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item B<-h, --help>
|
||||||
|
|
||||||
|
Display command line help usage then exit.
|
||||||
|
|
||||||
|
=item B<-d, --daemon>
|
||||||
|
|
||||||
|
Run as a daemon & write PID file.
|
||||||
|
|
||||||
|
=item B<-f, --config> I<FILE>
|
||||||
|
|
||||||
|
Use this configuration file, overriding the default value.
|
||||||
|
|
||||||
|
=item B<-l, --listen>
|
||||||
|
|
||||||
|
Listen for TCP/IP connections.
|
||||||
|
|
||||||
|
=item B<-p, --pid-file> I<FILE>
|
||||||
|
|
||||||
|
Use this name for the PID file, overriding the default value.
|
||||||
|
|
||||||
|
=item B<-t, --timeout> I<SECONDS>
|
||||||
|
|
||||||
|
Exit after timeout period (in seconds) elapse with no client connections
|
||||||
|
or registered resources. Be aware that resources such as autostart
|
||||||
|
networks will result in never reaching the timeout, even when there are
|
||||||
|
no client connections.
|
||||||
|
|
||||||
|
=item B<-v, --verbose>
|
||||||
|
|
||||||
|
Enable output of verbose messages.
|
||||||
|
|
||||||
|
=item B< --version>
|
||||||
|
|
||||||
|
Display version information then exit.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 SIGNALS
|
||||||
|
|
||||||
|
On receipt of B<SIGHUP> libvirtd will reload its configuration.
|
||||||
|
|
||||||
|
=head1 FILES
|
||||||
|
|
||||||
|
=head2 When run as B<root>.
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item F<SYSCONFDIR/libvirtd.conf>
|
||||||
|
|
||||||
|
The default configuration file used by libvirtd, unless overridden on the
|
||||||
|
command line using the B<-f>|B<--config> option.
|
||||||
|
|
||||||
|
=item F<LOCALSTATEDIR/run/libvirt/libvirt-sock>
|
||||||
|
|
||||||
|
=item F<LOCALSTATEDIR/run/libvirt/libvirt-sock-ro>
|
||||||
|
|
||||||
|
The sockets libvirtd will use.
|
||||||
|
|
||||||
|
=item F<SYSCONFDIR/pki/CA/cacert.pem>
|
||||||
|
|
||||||
|
The TLS B<Certificate Authority> certificate libvirtd will use.
|
||||||
|
|
||||||
|
=item F<SYSCONFDIR/pki/libvirt/servercert.pem>
|
||||||
|
|
||||||
|
The TLS B<Server> certificate libvirtd will use.
|
||||||
|
|
||||||
|
=item F<SYSCONFDIR/pki/libvirt/private/serverkey.pem>
|
||||||
|
|
||||||
|
The TLS B<Server> private key libvirtd will use.
|
||||||
|
|
||||||
|
=item F<LOCALSTATEDIR/run/libvirtd.pid>
|
||||||
|
|
||||||
|
The PID file to use, unless overridden by the B<-p>|B<--pid-file> option.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head2 When run as B<non-root>.
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item F<$XDG_CONFIG_HOME/libvirtd.conf>
|
||||||
|
|
||||||
|
The default configuration file used by libvirtd, unless overridden on the
|
||||||
|
command line using the B<-f>|B<--config> option.
|
||||||
|
|
||||||
|
=item F<$XDG_RUNTIME_DIR/libvirt/libvirt-sock>
|
||||||
|
|
||||||
|
The socket libvirtd will use.
|
||||||
|
|
||||||
|
=item F<$HOME/.pki/libvirt/cacert.pem>
|
||||||
|
|
||||||
|
The TLS B<Certificate Authority> certificate libvirtd will use.
|
||||||
|
|
||||||
|
=item F<$HOME/.pki/libvirt/servercert.pem>
|
||||||
|
|
||||||
|
The TLS B<Server> certificate libvirtd will use.
|
||||||
|
|
||||||
|
=item F<$HOME/.pki/libvirt/serverkey.pem>
|
||||||
|
|
||||||
|
The TLS B<Server> private key libvirtd will use.
|
||||||
|
|
||||||
|
=item F<$XDG_RUNTIME_DIR/libvirt/libvirtd.pid>
|
||||||
|
|
||||||
|
The PID file to use, unless overridden by the B<-p>|B<--pid-file> option.
|
||||||
|
|
||||||
|
=item If $XDG_CONFIG_HOME is not set in your environment, libvirtd will use F<$HOME/.config>
|
||||||
|
|
||||||
|
=item If $XDG_RUNTIME_DIR is not set in your environment, libvirtd will use F<$HOME/.cache>
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 EXAMPLES
|
||||||
|
|
||||||
|
To retrieve the version of libvirtd:
|
||||||
|
|
||||||
|
# libvirtd --version
|
||||||
|
libvirtd (libvirt) 0.8.2
|
||||||
|
#
|
||||||
|
|
||||||
|
To start libvirtd, instructing it to daemonize and create a PID file:
|
||||||
|
|
||||||
|
# libvirtd -d
|
||||||
|
# ls -la LOCALSTATEDIR/run/libvirtd.pid
|
||||||
|
-rw-r--r-- 1 root root 6 Jul 9 02:40 LOCALSTATEDIR/run/libvirtd.pid
|
||||||
|
#
|
||||||
|
|
||||||
|
=head1 BUGS
|
||||||
|
|
||||||
|
Please report all bugs you discover. This should be done via either:
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item a) the mailing list
|
||||||
|
|
||||||
|
L<http://libvirt.org/contact.html>
|
||||||
|
|
||||||
|
=item or,
|
||||||
|
|
||||||
|
B<>
|
||||||
|
|
||||||
|
=item b) the bug tracker
|
||||||
|
|
||||||
|
L<http://libvirt.org/bugs.html>
|
||||||
|
|
||||||
|
=item Alternatively, you may report bugs to your software distributor / vendor.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=head1 AUTHORS
|
||||||
|
|
||||||
|
Please refer to the AUTHORS file distributed with libvirt.
|
||||||
|
|
||||||
|
=head1 COPYRIGHT
|
||||||
|
|
||||||
|
Copyright (C) 2006-2012 Red Hat, Inc., and the authors listed in the
|
||||||
|
libvirt AUTHORS file.
|
||||||
|
|
||||||
|
=head1 LICENSE
|
||||||
|
|
||||||
|
libvirtd is distributed under the terms of the GNU LGPL v2.1+.
|
||||||
|
This is free software; see the source for copying conditions. There
|
||||||
|
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE
|
||||||
|
|
||||||
|
=head1 SEE ALSO
|
||||||
|
|
||||||
|
L<virsh(1)>, L<virt-install(1)>, L<virt-xml-validate(1)>, L<virt-top(1)>,
|
||||||
|
L<virt-df(1)>, L<http://www.libvirt.org/>
|
||||||
|
|
||||||
|
=cut
|
||||||
51
daemon/libvirtd.policy.in
Normal file
51
daemon/libvirtd.policy.in
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE policyconfig PUBLIC
|
||||||
|
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
||||||
|
"http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Policy definitions for libvirt daemon
|
||||||
|
|
||||||
|
Copyright (C) 2012 Red Hat, Inc.
|
||||||
|
Copyright (C) 2007 Daniel P. Berrange <berrange redhat com>
|
||||||
|
|
||||||
|
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/>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<policyconfig>
|
||||||
|
<action id="org.libvirt.unix.monitor">
|
||||||
|
<description>Monitor local virtualized systems</description>
|
||||||
|
<message>System policy prevents monitoring of local virtualized systems</message>
|
||||||
|
<defaults>
|
||||||
|
<!-- Any program can use libvirt in read-only mode for monitoring,
|
||||||
|
even if not part of a session -->
|
||||||
|
<allow_any>yes</allow_any>
|
||||||
|
<allow_inactive>yes</allow_inactive>
|
||||||
|
<allow_active>yes</allow_active>
|
||||||
|
</defaults>
|
||||||
|
</action>
|
||||||
|
|
||||||
|
<action id="org.libvirt.unix.manage">
|
||||||
|
<description>Manage local virtualized systems</description>
|
||||||
|
<message>System policy prevents management of local virtualized systems</message>
|
||||||
|
<defaults>
|
||||||
|
<!-- Any program can use libvirt in read/write mode if they
|
||||||
|
provide the root password -->
|
||||||
|
<allow_any>@authaction@</allow_any>
|
||||||
|
<allow_inactive>@authaction@</allow_inactive>
|
||||||
|
<allow_active>@authaction@</allow_active>
|
||||||
|
</defaults>
|
||||||
|
</action>
|
||||||
|
</policyconfig>
|
||||||
@@ -5,4 +5,5 @@
|
|||||||
compress
|
compress
|
||||||
delaycompress
|
delaycompress
|
||||||
copytruncate
|
copytruncate
|
||||||
|
minsize 100k
|
||||||
}
|
}
|
||||||
31
daemon/libvirtd.sasl
Normal file
31
daemon/libvirtd.sasl
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# If you want to use the non-TLS socket, then you *must* include
|
||||||
|
# the GSSAPI or DIGEST-MD5 mechanisms, because they are the only
|
||||||
|
# ones that can offer session encryption as well as authentication.
|
||||||
|
#
|
||||||
|
# If you're only using TLS, then you can turn on any mechanisms
|
||||||
|
# you like for authentication, because TLS provides the encryption
|
||||||
|
#
|
||||||
|
# Default to a simple username+password mechanism
|
||||||
|
mech_list: digest-md5
|
||||||
|
|
||||||
|
# Before you can use GSSAPI, you need a service principle on the
|
||||||
|
# KDC server for libvirt, and that to be exported to the keytab
|
||||||
|
# file listed below
|
||||||
|
#mech_list: gssapi
|
||||||
|
#
|
||||||
|
# You can also list many mechanisms at once, then the user can choose
|
||||||
|
# by adding '?auth=sasl.gssapi' to their libvirt URI, eg
|
||||||
|
# qemu+tcp://hostname/system?auth=sasl.gssapi
|
||||||
|
#mech_list: digest-md5 gssapi
|
||||||
|
|
||||||
|
# Some older builds of MIT kerberos on Linux ignore this option &
|
||||||
|
# instead need KRB5_KTNAME env var.
|
||||||
|
# For modern Linux, and other OS, this should be sufficient
|
||||||
|
#
|
||||||
|
# There is no default value here, uncomment if you need this
|
||||||
|
#keytab: /etc/libvirt/krb5.tab
|
||||||
|
|
||||||
|
# If using digest-md5 for username/passwds, then this is the file
|
||||||
|
# containing the passwds. Use 'saslpasswd2 -a libvirt [username]'
|
||||||
|
# to add entries, and 'sasldblistusers2 -f [sasldb_path]' to browse it
|
||||||
|
sasldb_path: /etc/libvirt/passwd.db
|
||||||
24
daemon/libvirtd.service.in
Normal file
24
daemon/libvirtd.service.in
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Virtualization daemon
|
||||||
|
Before=libvirt-guests.service
|
||||||
|
After=network.target
|
||||||
|
After=dbus.service
|
||||||
|
After=iscsid.service
|
||||||
|
After=apparmor.service
|
||||||
|
After=local-fs.target
|
||||||
|
After=remote-fs.target
|
||||||
|
Documentation=man:libvirtd(8)
|
||||||
|
Documentation=http://libvirt.org
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=notify
|
||||||
|
EnvironmentFile=-/etc/sysconfig/libvirtd
|
||||||
|
ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
KillMode=process
|
||||||
|
Restart=on-failure
|
||||||
|
# Override the maximum number of opened files
|
||||||
|
#LimitNOFILE=2048
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
11
daemon/libvirtd.socket.in
Normal file
11
daemon/libvirtd.socket.in
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[Socket]
|
||||||
|
ListenStream=@runstatedir@/libvirt/libvirt-sock
|
||||||
|
ListenStream=@runstatedir@/libvirt/libvirt-sock-ro
|
||||||
|
|
||||||
|
; The following settings must match libvirtd.conf file in order to
|
||||||
|
; work as expected because libvirtd can't change them later.
|
||||||
|
; SocketMode=0777 is safe only if authentication on the socket is set
|
||||||
|
; up. For further information, please see the libvirtd.conf file.
|
||||||
|
SocketMode=0777
|
||||||
|
SocketUser=root
|
||||||
|
SocketGroup=root
|
||||||
@@ -5,4 +5,5 @@
|
|||||||
compress
|
compress
|
||||||
delaycompress
|
delaycompress
|
||||||
copytruncate
|
copytruncate
|
||||||
|
minsize 100k
|
||||||
}
|
}
|
||||||
6834
daemon/remote.c
Normal file
6834
daemon/remote.c
Normal file
File diff suppressed because it is too large
Load Diff
45
daemon/remote.h
Normal file
45
daemon/remote.h
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* remote.h: handlers for RPC method calls
|
||||||
|
*
|
||||||
|
* Copyright (C) 2007, 2008, 2009 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Author: Richard W.M. Jones <rjones@redhat.com>
|
||||||
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __LIBVIRTD_REMOTE_H__
|
||||||
|
# define __LIBVIRTD_REMOTE_H__
|
||||||
|
|
||||||
|
# include "remote_protocol.h"
|
||||||
|
# include "rpc/virnetserverprogram.h"
|
||||||
|
# include "rpc/virnetserverclient.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern virNetServerProgramProc remoteProcs[];
|
||||||
|
extern size_t remoteNProcs;
|
||||||
|
|
||||||
|
extern virNetServerProgramProc lxcProcs[];
|
||||||
|
extern size_t lxcNProcs;
|
||||||
|
|
||||||
|
extern virNetServerProgramProc qemuProcs[];
|
||||||
|
extern size_t qemuNProcs;
|
||||||
|
|
||||||
|
void remoteClientFreeFunc(void *data);
|
||||||
|
void *remoteClientInitHook(virNetServerClientPtr client,
|
||||||
|
void *opaque);
|
||||||
|
|
||||||
|
#endif /* __LIBVIRTD_REMOTE_H__ */
|
||||||
777
daemon/stream.c
Normal file
777
daemon/stream.c
Normal file
@@ -0,0 +1,777 @@
|
|||||||
|
/*
|
||||||
|
* stream.c: APIs for managing client streams
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009-2014 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "stream.h"
|
||||||
|
#include "remote.h"
|
||||||
|
#include "viralloc.h"
|
||||||
|
#include "virlog.h"
|
||||||
|
#include "virnetserverclient.h"
|
||||||
|
#include "virerror.h"
|
||||||
|
|
||||||
|
#define VIR_FROM_THIS VIR_FROM_STREAMS
|
||||||
|
|
||||||
|
VIR_LOG_INIT("daemon.stream");
|
||||||
|
|
||||||
|
struct daemonClientStream {
|
||||||
|
daemonClientPrivatePtr priv;
|
||||||
|
int refs;
|
||||||
|
|
||||||
|
virNetServerProgramPtr prog;
|
||||||
|
|
||||||
|
virStreamPtr st;
|
||||||
|
int procedure;
|
||||||
|
int serial;
|
||||||
|
|
||||||
|
unsigned int recvEOF : 1;
|
||||||
|
unsigned int closed : 1;
|
||||||
|
|
||||||
|
int filterID;
|
||||||
|
|
||||||
|
virNetMessagePtr rx;
|
||||||
|
int tx;
|
||||||
|
|
||||||
|
daemonClientStreamPtr next;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
daemonStreamHandleWrite(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream);
|
||||||
|
static int
|
||||||
|
daemonStreamHandleRead(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream);
|
||||||
|
static int
|
||||||
|
daemonStreamHandleFinish(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream,
|
||||||
|
virNetMessagePtr msg);
|
||||||
|
static int
|
||||||
|
daemonStreamHandleAbort(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream,
|
||||||
|
virNetMessagePtr msg);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
daemonStreamUpdateEvents(daemonClientStream *stream)
|
||||||
|
{
|
||||||
|
int newEvents = 0;
|
||||||
|
if (stream->rx)
|
||||||
|
newEvents |= VIR_STREAM_EVENT_WRITABLE;
|
||||||
|
if (stream->tx && !stream->recvEOF)
|
||||||
|
newEvents |= VIR_STREAM_EVENT_READABLE;
|
||||||
|
|
||||||
|
virStreamEventUpdateCallback(stream->st, newEvents);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Invoked when an outgoing data packet message has been fully sent.
|
||||||
|
* This simply re-enables TX of further data.
|
||||||
|
*
|
||||||
|
* The idea is to stop the daemon growing without bound due to
|
||||||
|
* fast stream, but slow client
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
daemonStreamMessageFinished(virNetMessagePtr msg ATTRIBUTE_UNUSED,
|
||||||
|
void *opaque)
|
||||||
|
{
|
||||||
|
daemonClientStream *stream = opaque;
|
||||||
|
VIR_DEBUG("stream=%p proc=%d serial=%d",
|
||||||
|
stream, msg->header.proc, msg->header.serial);
|
||||||
|
|
||||||
|
stream->tx = 1;
|
||||||
|
daemonStreamUpdateEvents(stream);
|
||||||
|
|
||||||
|
daemonFreeClientStream(NULL, stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Callback that gets invoked when a stream becomes writable/readable
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
daemonStreamEvent(virStreamPtr st, int events, void *opaque)
|
||||||
|
{
|
||||||
|
virNetServerClientPtr client = opaque;
|
||||||
|
daemonClientStream *stream;
|
||||||
|
daemonClientPrivatePtr priv = virNetServerClientGetPrivateData(client);
|
||||||
|
|
||||||
|
virMutexLock(&priv->lock);
|
||||||
|
|
||||||
|
stream = priv->streams;
|
||||||
|
while (stream) {
|
||||||
|
if (stream->st == st)
|
||||||
|
break;
|
||||||
|
stream = stream->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stream) {
|
||||||
|
VIR_WARN("event for client=%p stream st=%p, but missing stream state", client, st);
|
||||||
|
virStreamEventRemoveCallback(st);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
VIR_DEBUG("st=%p events=%d EOF=%d closed=%d", st, events, stream->recvEOF, stream->closed);
|
||||||
|
|
||||||
|
if (!stream->closed &&
|
||||||
|
(events & VIR_STREAM_EVENT_WRITABLE)) {
|
||||||
|
if (daemonStreamHandleWrite(client, stream) < 0) {
|
||||||
|
daemonRemoveClientStream(client, stream);
|
||||||
|
virNetServerClientClose(client);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stream->closed && !stream->recvEOF &&
|
||||||
|
(events & (VIR_STREAM_EVENT_READABLE))) {
|
||||||
|
events = events & ~(VIR_STREAM_EVENT_READABLE);
|
||||||
|
if (daemonStreamHandleRead(client, stream) < 0) {
|
||||||
|
daemonRemoveClientStream(client, stream);
|
||||||
|
virNetServerClientClose(client);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
/* If we detected EOF during read processing,
|
||||||
|
* then clear hangup/error conditions, since
|
||||||
|
* we want the client to see the EOF message
|
||||||
|
* we just sent them
|
||||||
|
*/
|
||||||
|
if (stream->recvEOF)
|
||||||
|
events = events & ~(VIR_STREAM_EVENT_HANGUP |
|
||||||
|
VIR_STREAM_EVENT_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we have a completion/abort message, always process it */
|
||||||
|
if (stream->rx) {
|
||||||
|
virNetMessagePtr msg = stream->rx;
|
||||||
|
switch (msg->header.status) {
|
||||||
|
case VIR_NET_CONTINUE:
|
||||||
|
/* nada */
|
||||||
|
break;
|
||||||
|
case VIR_NET_OK:
|
||||||
|
virNetMessageQueueServe(&stream->rx);
|
||||||
|
if (daemonStreamHandleFinish(client, stream, msg) < 0) {
|
||||||
|
virNetMessageFree(msg);
|
||||||
|
daemonRemoveClientStream(client, stream);
|
||||||
|
virNetServerClientClose(client);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case VIR_NET_ERROR:
|
||||||
|
default:
|
||||||
|
virNetMessageQueueServe(&stream->rx);
|
||||||
|
if (daemonStreamHandleAbort(client, stream, msg) < 0) {
|
||||||
|
virNetMessageFree(msg);
|
||||||
|
daemonRemoveClientStream(client, stream);
|
||||||
|
virNetServerClientClose(client);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* If we got HANGUP, we need to only send an empty
|
||||||
|
* packet so the client sees an EOF and cleans up
|
||||||
|
*/
|
||||||
|
if (!stream->closed && !stream->recvEOF &&
|
||||||
|
(events & VIR_STREAM_EVENT_HANGUP)) {
|
||||||
|
virNetMessagePtr msg;
|
||||||
|
events &= ~(VIR_STREAM_EVENT_HANGUP);
|
||||||
|
stream->tx = 0;
|
||||||
|
stream->recvEOF = 1;
|
||||||
|
if (!(msg = virNetMessageNew(false))) {
|
||||||
|
daemonRemoveClientStream(client, stream);
|
||||||
|
virNetServerClientClose(client);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
msg->cb = daemonStreamMessageFinished;
|
||||||
|
msg->opaque = stream;
|
||||||
|
stream->refs++;
|
||||||
|
if (virNetServerProgramSendStreamData(remoteProgram,
|
||||||
|
client,
|
||||||
|
msg,
|
||||||
|
stream->procedure,
|
||||||
|
stream->serial,
|
||||||
|
"", 0) < 0) {
|
||||||
|
virNetMessageFree(msg);
|
||||||
|
daemonRemoveClientStream(client, stream);
|
||||||
|
virNetServerClientClose(client);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stream->closed &&
|
||||||
|
(events & (VIR_STREAM_EVENT_ERROR | VIR_STREAM_EVENT_HANGUP))) {
|
||||||
|
int ret;
|
||||||
|
virNetMessagePtr msg;
|
||||||
|
virNetMessageError rerr;
|
||||||
|
|
||||||
|
memset(&rerr, 0, sizeof(rerr));
|
||||||
|
stream->closed = 1;
|
||||||
|
virStreamEventRemoveCallback(stream->st);
|
||||||
|
virStreamAbort(stream->st);
|
||||||
|
if (events & VIR_STREAM_EVENT_HANGUP)
|
||||||
|
virReportError(VIR_ERR_RPC,
|
||||||
|
"%s", _("stream had unexpected termination"));
|
||||||
|
else
|
||||||
|
virReportError(VIR_ERR_RPC,
|
||||||
|
"%s", _("stream had I/O failure"));
|
||||||
|
|
||||||
|
msg = virNetMessageNew(false);
|
||||||
|
if (!msg) {
|
||||||
|
ret = -1;
|
||||||
|
} else {
|
||||||
|
ret = virNetServerProgramSendStreamError(remoteProgram,
|
||||||
|
client,
|
||||||
|
msg,
|
||||||
|
&rerr,
|
||||||
|
stream->procedure,
|
||||||
|
stream->serial);
|
||||||
|
}
|
||||||
|
daemonRemoveClientStream(client, stream);
|
||||||
|
if (ret < 0)
|
||||||
|
virNetServerClientClose(client);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stream->closed) {
|
||||||
|
daemonRemoveClientStream(client, stream);
|
||||||
|
} else {
|
||||||
|
daemonStreamUpdateEvents(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
virMutexUnlock(&priv->lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @client: a locked client object
|
||||||
|
*
|
||||||
|
* Invoked by the main loop when filtering incoming messages.
|
||||||
|
*
|
||||||
|
* Returns 1 if the message was processed, 0 if skipped,
|
||||||
|
* -1 on fatal client error
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
daemonStreamFilter(virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
||||||
|
virNetMessagePtr msg,
|
||||||
|
void *opaque)
|
||||||
|
{
|
||||||
|
daemonClientStream *stream = opaque;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
virMutexLock(&stream->priv->lock);
|
||||||
|
|
||||||
|
if (msg->header.type != VIR_NET_STREAM)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!virNetServerProgramMatches(stream->prog, msg))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (msg->header.proc != stream->procedure ||
|
||||||
|
msg->header.serial != stream->serial)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
VIR_DEBUG("Incoming client=%p, rx=%p, serial=%d, proc=%d, status=%d",
|
||||||
|
client, stream->rx, msg->header.proc,
|
||||||
|
msg->header.serial, msg->header.status);
|
||||||
|
|
||||||
|
virNetMessageQueuePush(&stream->rx, msg);
|
||||||
|
daemonStreamUpdateEvents(stream);
|
||||||
|
ret = 1;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
virMutexUnlock(&stream->priv->lock);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @conn: a connection object to associate the stream with
|
||||||
|
* @header: the method call to associate with the stream
|
||||||
|
*
|
||||||
|
* Creates a new stream for this conn
|
||||||
|
*
|
||||||
|
* Returns a new stream object, or NULL upon OOM
|
||||||
|
*/
|
||||||
|
daemonClientStream *
|
||||||
|
daemonCreateClientStream(virNetServerClientPtr client,
|
||||||
|
virStreamPtr st,
|
||||||
|
virNetServerProgramPtr prog,
|
||||||
|
virNetMessageHeaderPtr header)
|
||||||
|
{
|
||||||
|
daemonClientStream *stream;
|
||||||
|
daemonClientPrivatePtr priv = virNetServerClientGetPrivateData(client);
|
||||||
|
|
||||||
|
VIR_DEBUG("client=%p, proc=%d, serial=%d, st=%p",
|
||||||
|
client, header->proc, header->serial, st);
|
||||||
|
|
||||||
|
if (VIR_ALLOC(stream) < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
stream->refs = 1;
|
||||||
|
stream->priv = priv;
|
||||||
|
stream->prog = virObjectRef(prog);
|
||||||
|
stream->procedure = header->proc;
|
||||||
|
stream->serial = header->serial;
|
||||||
|
stream->filterID = -1;
|
||||||
|
stream->st = st;
|
||||||
|
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @stream: an unused client stream
|
||||||
|
*
|
||||||
|
* Frees the memory associated with this inactive client
|
||||||
|
* stream
|
||||||
|
*/
|
||||||
|
int daemonFreeClientStream(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream)
|
||||||
|
{
|
||||||
|
virNetMessagePtr msg;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if (!stream)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
stream->refs--;
|
||||||
|
if (stream->refs)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
VIR_DEBUG("client=%p, proc=%d, serial=%d",
|
||||||
|
client, stream->procedure, stream->serial);
|
||||||
|
|
||||||
|
virObjectUnref(stream->prog);
|
||||||
|
|
||||||
|
msg = stream->rx;
|
||||||
|
while (msg) {
|
||||||
|
virNetMessagePtr tmp = msg->next;
|
||||||
|
if (client) {
|
||||||
|
/* Send a dummy reply to free up 'msg' & unblock client rx */
|
||||||
|
virNetMessageClear(msg);
|
||||||
|
msg->header.type = VIR_NET_REPLY;
|
||||||
|
if (virNetServerClientSendMessage(client, msg) < 0) {
|
||||||
|
virNetServerClientImmediateClose(client);
|
||||||
|
virNetMessageFree(msg);
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
virNetMessageFree(msg);
|
||||||
|
}
|
||||||
|
msg = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
virObjectUnref(stream->st);
|
||||||
|
VIR_FREE(stream);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @client: a locked client to add the stream to
|
||||||
|
* @stream: a stream to add
|
||||||
|
*/
|
||||||
|
int daemonAddClientStream(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream,
|
||||||
|
bool transmit)
|
||||||
|
{
|
||||||
|
VIR_DEBUG("client=%p, proc=%d, serial=%d, st=%p, transmit=%d",
|
||||||
|
client, stream->procedure, stream->serial, stream->st, transmit);
|
||||||
|
daemonClientPrivatePtr priv = virNetServerClientGetPrivateData(client);
|
||||||
|
|
||||||
|
if (stream->filterID != -1) {
|
||||||
|
VIR_WARN("Filter already added to client %p", client);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (virStreamEventAddCallback(stream->st, 0,
|
||||||
|
daemonStreamEvent, client,
|
||||||
|
virObjectFreeCallback) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
virObjectRef(client);
|
||||||
|
|
||||||
|
if ((stream->filterID = virNetServerClientAddFilter(client,
|
||||||
|
daemonStreamFilter,
|
||||||
|
stream)) < 0) {
|
||||||
|
virStreamEventRemoveCallback(stream->st);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transmit)
|
||||||
|
stream->tx = 1;
|
||||||
|
|
||||||
|
virMutexLock(&priv->lock);
|
||||||
|
stream->next = priv->streams;
|
||||||
|
priv->streams = stream;
|
||||||
|
|
||||||
|
daemonStreamUpdateEvents(stream);
|
||||||
|
|
||||||
|
virMutexUnlock(&priv->lock);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @client: a locked client object
|
||||||
|
* @stream: an inactive, closed stream object
|
||||||
|
*
|
||||||
|
* Removes a stream from the list of active streams for the client
|
||||||
|
*
|
||||||
|
* Returns 0 if the stream was removd, -1 if it doesn't exist
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
daemonRemoveClientStream(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream)
|
||||||
|
{
|
||||||
|
VIR_DEBUG("client=%p, proc=%d, serial=%d, st=%p",
|
||||||
|
client, stream->procedure, stream->serial, stream->st);
|
||||||
|
daemonClientPrivatePtr priv = virNetServerClientGetPrivateData(client);
|
||||||
|
daemonClientStream *curr = priv->streams;
|
||||||
|
daemonClientStream *prev = NULL;
|
||||||
|
|
||||||
|
if (stream->filterID != -1) {
|
||||||
|
virNetServerClientRemoveFilter(client,
|
||||||
|
stream->filterID);
|
||||||
|
stream->filterID = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stream->closed) {
|
||||||
|
virStreamEventRemoveCallback(stream->st);
|
||||||
|
virStreamAbort(stream->st);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (curr) {
|
||||||
|
if (curr == stream) {
|
||||||
|
if (prev)
|
||||||
|
prev->next = curr->next;
|
||||||
|
else
|
||||||
|
priv->streams = curr->next;
|
||||||
|
return daemonFreeClientStream(client, stream);
|
||||||
|
}
|
||||||
|
prev = curr;
|
||||||
|
curr = curr->next;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
daemonRemoveAllClientStreams(daemonClientStream *stream)
|
||||||
|
{
|
||||||
|
daemonClientStream *tmp;
|
||||||
|
|
||||||
|
VIR_DEBUG("stream=%p", stream);
|
||||||
|
|
||||||
|
while (stream) {
|
||||||
|
tmp = stream->next;
|
||||||
|
|
||||||
|
if (!stream->closed) {
|
||||||
|
virStreamEventRemoveCallback(stream->st);
|
||||||
|
virStreamAbort(stream->st);
|
||||||
|
}
|
||||||
|
|
||||||
|
daemonFreeClientStream(NULL, stream);
|
||||||
|
|
||||||
|
VIR_DEBUG("next stream=%p", tmp);
|
||||||
|
stream = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns:
|
||||||
|
* -1 if fatal error occurred
|
||||||
|
* 0 if message was fully processed
|
||||||
|
* 1 if message is still being processed
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
daemonStreamHandleWriteData(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream,
|
||||||
|
virNetMessagePtr msg)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
VIR_DEBUG("client=%p, stream=%p, proc=%d, serial=%d, len=%zu, offset=%zu",
|
||||||
|
client, stream, msg->header.proc, msg->header.serial,
|
||||||
|
msg->bufferLength, msg->bufferOffset);
|
||||||
|
|
||||||
|
ret = virStreamSend(stream->st,
|
||||||
|
msg->buffer + msg->bufferOffset,
|
||||||
|
msg->bufferLength - msg->bufferOffset);
|
||||||
|
|
||||||
|
if (ret > 0) {
|
||||||
|
msg->bufferOffset += ret;
|
||||||
|
|
||||||
|
/* Partial write, so indicate we have more todo later */
|
||||||
|
if (msg->bufferOffset < msg->bufferLength)
|
||||||
|
return 1;
|
||||||
|
} else if (ret == -2) {
|
||||||
|
/* Blocking, so indicate we have more todo later */
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
virNetMessageError rerr;
|
||||||
|
|
||||||
|
memset(&rerr, 0, sizeof(rerr));
|
||||||
|
|
||||||
|
VIR_INFO("Stream send failed");
|
||||||
|
stream->closed = 1;
|
||||||
|
return virNetServerProgramSendReplyError(stream->prog,
|
||||||
|
client,
|
||||||
|
msg,
|
||||||
|
&rerr,
|
||||||
|
&msg->header);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Process a finish handshake from the client.
|
||||||
|
*
|
||||||
|
* Returns a VIR_NET_OK confirmation if successful, or a VIR_NET_ERROR
|
||||||
|
* if there was a stream error
|
||||||
|
*
|
||||||
|
* Returns 0 if successfully sent RPC reply, -1 upon fatal error
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
daemonStreamHandleFinish(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream,
|
||||||
|
virNetMessagePtr msg)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
VIR_DEBUG("client=%p, stream=%p, proc=%d, serial=%d",
|
||||||
|
client, stream, msg->header.proc, msg->header.serial);
|
||||||
|
|
||||||
|
stream->closed = 1;
|
||||||
|
virStreamEventRemoveCallback(stream->st);
|
||||||
|
ret = virStreamFinish(stream->st);
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
virNetMessageError rerr;
|
||||||
|
memset(&rerr, 0, sizeof(rerr));
|
||||||
|
return virNetServerProgramSendReplyError(stream->prog,
|
||||||
|
client,
|
||||||
|
msg,
|
||||||
|
&rerr,
|
||||||
|
&msg->header);
|
||||||
|
} else {
|
||||||
|
/* Send zero-length confirm */
|
||||||
|
return virNetServerProgramSendStreamData(stream->prog,
|
||||||
|
client,
|
||||||
|
msg,
|
||||||
|
stream->procedure,
|
||||||
|
stream->serial,
|
||||||
|
NULL, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Process an abort request from the client.
|
||||||
|
*
|
||||||
|
* Returns 0 if successfully aborted, -1 upon error
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
daemonStreamHandleAbort(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream,
|
||||||
|
virNetMessagePtr msg)
|
||||||
|
{
|
||||||
|
VIR_DEBUG("client=%p, stream=%p, proc=%d, serial=%d",
|
||||||
|
client, stream, msg->header.proc, msg->header.serial);
|
||||||
|
virNetMessageError rerr;
|
||||||
|
|
||||||
|
memset(&rerr, 0, sizeof(rerr));
|
||||||
|
|
||||||
|
stream->closed = 1;
|
||||||
|
virStreamEventRemoveCallback(stream->st);
|
||||||
|
virStreamAbort(stream->st);
|
||||||
|
|
||||||
|
if (msg->header.status == VIR_NET_ERROR) {
|
||||||
|
virReportError(VIR_ERR_RPC,
|
||||||
|
"%s", _("stream aborted at client request"));
|
||||||
|
} else {
|
||||||
|
VIR_WARN("unexpected stream status %d", msg->header.status);
|
||||||
|
virReportError(VIR_ERR_RPC,
|
||||||
|
_("stream aborted with unexpected status %d"),
|
||||||
|
msg->header.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
return virNetServerProgramSendReplyError(remoteProgram,
|
||||||
|
client,
|
||||||
|
msg,
|
||||||
|
&rerr,
|
||||||
|
&msg->header);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called when the stream is signalled has being able to accept
|
||||||
|
* data writes. Will process all pending incoming messages
|
||||||
|
* until they're all gone, or I/O blocks
|
||||||
|
*
|
||||||
|
* Returns 0 on success, or -1 upon fatal error
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
daemonStreamHandleWrite(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream)
|
||||||
|
{
|
||||||
|
VIR_DEBUG("client=%p, stream=%p", client, stream);
|
||||||
|
|
||||||
|
while (stream->rx && !stream->closed) {
|
||||||
|
virNetMessagePtr msg = stream->rx;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
switch (msg->header.status) {
|
||||||
|
case VIR_NET_OK:
|
||||||
|
ret = daemonStreamHandleFinish(client, stream, msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NET_CONTINUE:
|
||||||
|
ret = daemonStreamHandleWriteData(client, stream, msg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_NET_ERROR:
|
||||||
|
default:
|
||||||
|
ret = daemonStreamHandleAbort(client, stream, msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret > 0)
|
||||||
|
break; /* still processing data from msg */
|
||||||
|
|
||||||
|
virNetMessageQueueServe(&stream->rx);
|
||||||
|
if (ret < 0) {
|
||||||
|
virNetMessageFree(msg);
|
||||||
|
virNetServerClientImmediateClose(client);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 'CONTINUE' messages don't send a reply (unless error
|
||||||
|
* occurred), so to release the 'msg' object we need to
|
||||||
|
* send a fake zero-length reply. Nothing actually gets
|
||||||
|
* onto the wire, but this causes the client to reset
|
||||||
|
* its active request count / throttling
|
||||||
|
*/
|
||||||
|
if (msg->header.status == VIR_NET_CONTINUE) {
|
||||||
|
virNetMessageClear(msg);
|
||||||
|
msg->header.type = VIR_NET_REPLY;
|
||||||
|
if (virNetServerClientSendMessage(client, msg) < 0) {
|
||||||
|
virNetMessageFree(msg);
|
||||||
|
virNetServerClientImmediateClose(client);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Invoked when a stream is signalled as having data
|
||||||
|
* available to read. This reads up to one message
|
||||||
|
* worth of data, and then queues that for transmission
|
||||||
|
* to the client.
|
||||||
|
*
|
||||||
|
* Returns 0 if data was queued for TX, or a error RPC
|
||||||
|
* was sent, or -1 on fatal error, indicating client should
|
||||||
|
* be killed
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
daemonStreamHandleRead(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream)
|
||||||
|
{
|
||||||
|
char *buffer;
|
||||||
|
size_t bufferLen = VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
VIR_DEBUG("client=%p, stream=%p tx=%d closed=%d",
|
||||||
|
client, stream, stream->tx, stream->closed);
|
||||||
|
|
||||||
|
/* We might have had an event pending before we shut
|
||||||
|
* down the stream, so if we're marked as closed,
|
||||||
|
* then do nothing
|
||||||
|
*/
|
||||||
|
if (stream->closed)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Shouldn't ever be called unless we're marked able to
|
||||||
|
* transmit, but doesn't hurt to check */
|
||||||
|
if (!stream->tx)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (VIR_ALLOC_N(buffer, bufferLen) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
ret = virStreamRecv(stream->st, buffer, bufferLen);
|
||||||
|
if (ret == -2) {
|
||||||
|
/* Should never get this, since we're only called when we know
|
||||||
|
* we're readable, but hey things change... */
|
||||||
|
ret = 0;
|
||||||
|
} else if (ret < 0) {
|
||||||
|
virNetMessagePtr msg;
|
||||||
|
virNetMessageError rerr;
|
||||||
|
|
||||||
|
memset(&rerr, 0, sizeof(rerr));
|
||||||
|
|
||||||
|
if (!(msg = virNetMessageNew(false)))
|
||||||
|
ret = -1;
|
||||||
|
else
|
||||||
|
ret = virNetServerProgramSendStreamError(remoteProgram,
|
||||||
|
client,
|
||||||
|
msg,
|
||||||
|
&rerr,
|
||||||
|
stream->procedure,
|
||||||
|
stream->serial);
|
||||||
|
} else {
|
||||||
|
virNetMessagePtr msg;
|
||||||
|
stream->tx = 0;
|
||||||
|
if (ret == 0)
|
||||||
|
stream->recvEOF = 1;
|
||||||
|
if (!(msg = virNetMessageNew(false)))
|
||||||
|
ret = -1;
|
||||||
|
|
||||||
|
if (msg) {
|
||||||
|
msg->cb = daemonStreamMessageFinished;
|
||||||
|
msg->opaque = stream;
|
||||||
|
stream->refs++;
|
||||||
|
ret = virNetServerProgramSendStreamData(remoteProgram,
|
||||||
|
client,
|
||||||
|
msg,
|
||||||
|
stream->procedure,
|
||||||
|
stream->serial,
|
||||||
|
buffer, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VIR_FREE(buffer);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
51
daemon/stream.h
Normal file
51
daemon/stream.h
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* stream.h: APIs for managing client streams
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __LIBVIRTD_STREAM_H__
|
||||||
|
# define __LIBVIRTD_STREAM_H__
|
||||||
|
|
||||||
|
# include "libvirtd.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
daemonClientStream *
|
||||||
|
daemonCreateClientStream(virNetServerClientPtr client,
|
||||||
|
virStreamPtr st,
|
||||||
|
virNetServerProgramPtr prog,
|
||||||
|
virNetMessageHeaderPtr hdr);
|
||||||
|
|
||||||
|
int daemonFreeClientStream(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream);
|
||||||
|
|
||||||
|
int daemonAddClientStream(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream,
|
||||||
|
bool transmit);
|
||||||
|
|
||||||
|
int
|
||||||
|
daemonRemoveClientStream(virNetServerClientPtr client,
|
||||||
|
daemonClientStream *stream);
|
||||||
|
|
||||||
|
void
|
||||||
|
daemonRemoveAllClientStreams(daemonClientStream *stream);
|
||||||
|
|
||||||
|
#endif /* __LIBVIRTD_STREAM_H__ */
|
||||||
@@ -35,13 +35,13 @@ module Test_libvirtd =
|
|||||||
{ "1" = "joe@EXAMPLE.COM" }
|
{ "1" = "joe@EXAMPLE.COM" }
|
||||||
{ "2" = "fred@EXAMPLE.COM" }
|
{ "2" = "fred@EXAMPLE.COM" }
|
||||||
}
|
}
|
||||||
{ "tls_priority" = "NORMAL" }
|
|
||||||
{ "max_clients" = "5000" }
|
{ "max_clients" = "5000" }
|
||||||
{ "max_queued_clients" = "1000" }
|
{ "max_queued_clients" = "1000" }
|
||||||
{ "max_anonymous_clients" = "20" }
|
{ "max_anonymous_clients" = "20" }
|
||||||
{ "min_workers" = "5" }
|
{ "min_workers" = "5" }
|
||||||
{ "max_workers" = "20" }
|
{ "max_workers" = "20" }
|
||||||
{ "prio_workers" = "5" }
|
{ "prio_workers" = "5" }
|
||||||
|
{ "max_requests" = "20" }
|
||||||
{ "max_client_requests" = "5" }
|
{ "max_client_requests" = "5" }
|
||||||
{ "admin_min_workers" = "1" }
|
{ "admin_min_workers" = "1" }
|
||||||
{ "admin_max_workers" = "5" }
|
{ "admin_max_workers" = "5" }
|
||||||
@@ -49,16 +49,15 @@ module Test_libvirtd =
|
|||||||
{ "admin_max_queued_clients" = "5" }
|
{ "admin_max_queued_clients" = "5" }
|
||||||
{ "admin_max_client_requests" = "5" }
|
{ "admin_max_client_requests" = "5" }
|
||||||
{ "log_level" = "3" }
|
{ "log_level" = "3" }
|
||||||
{ "log_filters" = "1:qemu 1:libvirt 4:object 4:json 4:event 1:util" }
|
{ "log_filters" = "3:remote 4:event" }
|
||||||
{ "log_outputs" = "3:syslog:libvirtd" }
|
{ "log_outputs" = "3:syslog:libvirtd" }
|
||||||
|
{ "log_buffer_size" = "64" }
|
||||||
{ "audit_level" = "2" }
|
{ "audit_level" = "2" }
|
||||||
{ "audit_logging" = "1" }
|
{ "audit_logging" = "1" }
|
||||||
{ "host_uuid" = "00000000-0000-0000-0000-000000000000" }
|
{ "host_uuid" = "00000000-0000-0000-0000-000000000000" }
|
||||||
{ "host_uuid_source" = "smbios" }
|
|
||||||
{ "keepalive_interval" = "5" }
|
{ "keepalive_interval" = "5" }
|
||||||
{ "keepalive_count" = "5" }
|
{ "keepalive_count" = "5" }
|
||||||
{ "keepalive_required" = "1" }
|
{ "keepalive_required" = "1" }
|
||||||
{ "admin_keepalive_required" = "1" }
|
|
||||||
{ "admin_keepalive_interval" = "5" }
|
{ "admin_keepalive_interval" = "5" }
|
||||||
{ "admin_keepalive_count" = "5" }
|
{ "admin_keepalive_count" = "5" }
|
||||||
{ "ovs_timeout" = "5" }
|
{ "admin_keepalive_required" = "1" }
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<body>
|
<body>
|
||||||
<h1>404 page not found</h1>
|
<h1>404 page not found</h1>
|
||||||
@@ -9,11 +9,16 @@
|
|||||||
page you were looking for. You might want to try
|
page you were looking for. You might want to try
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>going back to the <a href="https://libvirt.org/">home page</a> to find
|
<li>going back to the <a href="http://libvirt.org/">home page</a> to find
|
||||||
a collection of links to interesting pages on this site</li>
|
a collection of links to interesting pages on this site</li>
|
||||||
<li>using the search box at the top right corner of the screen to
|
<li>using the search box at the top right corner of the screen to
|
||||||
locate the content on this site or mailing list archives</li>
|
locate the content on this site or mailing list archives</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<p class="image">
|
||||||
|
<img src="/libvirtLogo404.png" alt="libvirt Logo"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
318
docs/Makefile.am
318
docs/Makefile.am
@@ -1,6 +1,6 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
## Copyright (C) 2005-2016 Red Hat, Inc.
|
## Copyright (C) 2005-2015 Red Hat, Inc.
|
||||||
##
|
##
|
||||||
## This library is free software; you can redistribute it and/or
|
## This library is free software; you can redistribute it and/or
|
||||||
## modify it under the terms of the GNU Lesser General Public
|
## modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -16,93 +16,74 @@
|
|||||||
## License along with this library. If not, see
|
## License along with this library. If not, see
|
||||||
## <http://www.gnu.org/licenses/>.
|
## <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
SUBDIRS= schemas
|
||||||
|
|
||||||
|
PERL = perl
|
||||||
|
|
||||||
|
# The directory containing the source code (if it contains documentation).
|
||||||
|
DOC_SOURCE_DIR=../src
|
||||||
|
|
||||||
DEVHELP_DIR=$(datadir)/gtk-doc/html/libvirt
|
DEVHELP_DIR=$(datadir)/gtk-doc/html/libvirt
|
||||||
|
|
||||||
apihtml = \
|
apihtml = \
|
||||||
html/index.html \
|
html/index.html \
|
||||||
$(apihtml_generated)
|
$(apihtml_generated)
|
||||||
|
|
||||||
apihtml_generated = \
|
apihtml_generated = \
|
||||||
html/libvirt-libvirt-common.html \
|
html/libvirt-libvirt-domain.html \
|
||||||
html/libvirt-libvirt-domain.html \
|
html/libvirt-libvirt-domain-snapshot.html \
|
||||||
html/libvirt-libvirt-domain-snapshot.html \
|
html/libvirt-libvirt-event.html \
|
||||||
html/libvirt-libvirt-event.html \
|
html/libvirt-libvirt-host.html \
|
||||||
html/libvirt-libvirt-host.html \
|
html/libvirt-libvirt-interface.html \
|
||||||
html/libvirt-libvirt-interface.html \
|
html/libvirt-libvirt-network.html \
|
||||||
html/libvirt-libvirt-network.html \
|
html/libvirt-libvirt-nodedev.html \
|
||||||
html/libvirt-libvirt-nodedev.html \
|
html/libvirt-libvirt-nwfilter.html \
|
||||||
html/libvirt-libvirt-nwfilter.html \
|
html/libvirt-libvirt-secret.html \
|
||||||
html/libvirt-libvirt-secret.html \
|
html/libvirt-libvirt-storage.html \
|
||||||
html/libvirt-libvirt-storage.html \
|
html/libvirt-libvirt-stream.html \
|
||||||
html/libvirt-libvirt-stream.html \
|
|
||||||
html/libvirt-virterror.html
|
html/libvirt-virterror.html
|
||||||
|
|
||||||
apipng = \
|
apipng = \
|
||||||
html/left.png \
|
html/left.png \
|
||||||
html/up.png \
|
html/up.png \
|
||||||
html/home.png \
|
html/home.png \
|
||||||
html/right.png
|
html/right.png
|
||||||
|
|
||||||
devhelphtml = \
|
devhelphtml = \
|
||||||
devhelp/libvirt.devhelp \
|
devhelp/libvirt.devhelp \
|
||||||
devhelp/index.html \
|
devhelp/index.html \
|
||||||
devhelp/general.html \
|
devhelp/general.html \
|
||||||
devhelp/libvirt-virterror.html
|
devhelp/libvirt-virterror.html
|
||||||
|
|
||||||
css = \
|
css = \
|
||||||
generic.css \
|
generic.css \
|
||||||
libvirt.css \
|
libvirt.css \
|
||||||
mobile.css \
|
|
||||||
main.css
|
main.css
|
||||||
|
|
||||||
fonts = \
|
devhelppng = \
|
||||||
fonts/LICENSE.md \
|
devhelp/home.png \
|
||||||
fonts/stylesheet.css \
|
devhelp/left.png \
|
||||||
fonts/overpass-bold-italic.woff \
|
devhelp/right.png \
|
||||||
fonts/overpass-bold.woff \
|
|
||||||
fonts/overpass-italic.woff \
|
|
||||||
fonts/overpass-light-italic.woff \
|
|
||||||
fonts/overpass-light.woff \
|
|
||||||
fonts/overpass-mono-bold.woff \
|
|
||||||
fonts/overpass-mono-light.woff \
|
|
||||||
fonts/overpass-mono-regular.woff \
|
|
||||||
fonts/overpass-mono-semibold.woff \
|
|
||||||
fonts/overpass-regular.woff
|
|
||||||
|
|
||||||
devhelppng = \
|
|
||||||
devhelp/home.png \
|
|
||||||
devhelp/left.png \
|
|
||||||
devhelp/right.png \
|
|
||||||
devhelp/up.png
|
devhelp/up.png
|
||||||
|
|
||||||
devhelpcss = devhelp/style.css
|
devhelpcss = devhelp/style.css
|
||||||
|
|
||||||
devhelpxsl = devhelp/devhelp.xsl devhelp/html.xsl
|
devhelpxsl = devhelp/devhelp.xsl devhelp/html.xsl
|
||||||
|
|
||||||
logofiles = \
|
|
||||||
logos/logo-base.svg \
|
|
||||||
logos/logo-square.svg \
|
|
||||||
logos/logo-square-powered.svg \
|
|
||||||
logos/logo-banner-dark.svg \
|
|
||||||
logos/logo-banner-light.svg \
|
|
||||||
logos/logo-square-96.png \
|
|
||||||
logos/logo-square-128.png \
|
|
||||||
logos/logo-square-192.png \
|
|
||||||
logos/logo-square-256.png \
|
|
||||||
logos/logo-square-powered-96.png \
|
|
||||||
logos/logo-square-powered-128.png \
|
|
||||||
logos/logo-square-powered-192.png \
|
|
||||||
logos/logo-square-powered-256.png \
|
|
||||||
logos/logo-banner-dark-256.png \
|
|
||||||
logos/logo-banner-dark-800.png \
|
|
||||||
logos/logo-banner-light-256.png \
|
|
||||||
logos/logo-banner-light-800.png
|
|
||||||
|
|
||||||
png = \
|
png = \
|
||||||
32favicon.png \
|
32favicon.png \
|
||||||
|
footer_corner.png \
|
||||||
|
footer_pattern.png \
|
||||||
|
libvirt-header-bg.png \
|
||||||
|
libvirt-header-logo.png \
|
||||||
|
libvirtLogo.png \
|
||||||
|
libvirt-net-logical.png \
|
||||||
|
libvirt-net-physical.png \
|
||||||
libvirt-daemon-arch.png \
|
libvirt-daemon-arch.png \
|
||||||
libvirt-driver-arch.png \
|
libvirt-driver-arch.png \
|
||||||
libvirt-object-model.png \
|
libvirt-object-model.png \
|
||||||
|
madeWith.png \
|
||||||
|
et.png \
|
||||||
migration-managed-direct.png \
|
migration-managed-direct.png \
|
||||||
migration-managed-p2p.png \
|
migration-managed-p2p.png \
|
||||||
migration-native.png \
|
migration-native.png \
|
||||||
@@ -118,20 +99,23 @@ internals_html_in = \
|
|||||||
$(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/internals/*.html.in))
|
$(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/internals/*.html.in))
|
||||||
internals_html = $(internals_html_in:%.html.in=%.html)
|
internals_html = $(internals_html_in:%.html.in=%.html)
|
||||||
|
|
||||||
# Since we ship pre-built html in the tarball, we must also
|
# todo.html is special - it is shipped in the tarball, but we
|
||||||
# ship the sources, even when those sources are themselves
|
# have a dedicated 'todo' target to rebuild it from a proper
|
||||||
# generated.
|
# config file, all other users are able to build it locally.
|
||||||
# Generate hvsupport.html and news.html first, since they take one extra step.
|
# For all other files, since we ship pre-built html in the
|
||||||
dot_html_in = \
|
# tarball, we must also ship the sources, even when those
|
||||||
hvsupport.html.in \
|
# sources are themselves generated.
|
||||||
news.html.in \
|
dot_html_in = $(notdir $(wildcard $(srcdir)/*.html.in)) \
|
||||||
$(notdir $(wildcard $(srcdir)/*.html.in))
|
todo.html.in \
|
||||||
|
hvsupport.html.in
|
||||||
dot_html = $(dot_html_in:%.html.in=%.html)
|
dot_html = $(dot_html_in:%.html.in=%.html)
|
||||||
|
|
||||||
dot_php_in = $(notdir $(wildcard $(srcdir)/*.php.in))
|
dot_php_in = $(notdir $(wildcard $(srcdir)/*.php.in))
|
||||||
dot_php_code_in = $(dot_php_in:%.php.in=%.php.code.in)
|
dot_php_code_in = $(dot_php_in:%.php.in=%.php.code.in)
|
||||||
dot_php = $(dot_php_in:%.php.in=%.php)
|
dot_php = $(dot_php_in:%.php.in=%.php)
|
||||||
|
|
||||||
|
patches = $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/api_extension/*.patch))
|
||||||
|
|
||||||
xml = \
|
xml = \
|
||||||
libvirt-api.xml \
|
libvirt-api.xml \
|
||||||
libvirt-refs.xml
|
libvirt-refs.xml
|
||||||
@@ -152,10 +136,11 @@ apidir = $(pkgdatadir)/api
|
|||||||
api_DATA = \
|
api_DATA = \
|
||||||
libvirt-api.xml \
|
libvirt-api.xml \
|
||||||
libvirt-qemu-api.xml \
|
libvirt-qemu-api.xml \
|
||||||
libvirt-lxc-api.xml \
|
libvirt-lxc-api.xml
|
||||||
libvirt-admin-api.xml
|
|
||||||
|
|
||||||
fig = \
|
fig = \
|
||||||
|
libvirt-net-logical.fig \
|
||||||
|
libvirt-net-physical.fig \
|
||||||
libvirt-daemon-arch.fig \
|
libvirt-daemon-arch.fig \
|
||||||
libvirt-driver-arch.fig \
|
libvirt-driver-arch.fig \
|
||||||
libvirt-object-model.fig \
|
libvirt-object-model.fig \
|
||||||
@@ -165,21 +150,17 @@ fig = \
|
|||||||
migration-tunnel.fig \
|
migration-tunnel.fig \
|
||||||
migration-unmanaged-direct.fig
|
migration-unmanaged-direct.fig
|
||||||
|
|
||||||
schemadir = $(pkgdatadir)/schemas
|
EXTRA_DIST= \
|
||||||
schema_DATA = $(wildcard $(srcdir)/schemas/*.rng)
|
|
||||||
|
|
||||||
EXTRA_DIST= \
|
|
||||||
apibuild.py genaclperms.pl \
|
apibuild.py genaclperms.pl \
|
||||||
site.xsl subsite.xsl newapi.xsl page.xsl \
|
site.xsl newapi.xsl news.xsl page.xsl \
|
||||||
wrapstring.xsl \
|
hacking1.xsl hacking2.xsl wrapstring.xsl \
|
||||||
$(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \
|
$(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \
|
||||||
$(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \
|
$(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \
|
||||||
$(xml) $(qemu_xml) $(lxc_xml) $(admin_xml) $(fig) $(png) $(css) \
|
$(xml) $(qemu_xml) $(lxc_xml) $(fig) $(png) $(css) \
|
||||||
$(logofiles) $(dot_php_in) $(dot_php_code_in) $(dot_php)\
|
$(patches) $(dot_php_in) $(dot_php_code_in) $(dot_php)\
|
||||||
$(internals_html_in) $(internals_html) $(fonts) \
|
$(internals_html_in) $(internals_html) \
|
||||||
aclperms.htmlinc \
|
sitemap.html.in aclperms.htmlinc \
|
||||||
hvsupport.pl \
|
todo.pl hvsupport.pl todo.cfg-example
|
||||||
$(schema_DATA)
|
|
||||||
|
|
||||||
acl_generated = aclperms.htmlinc
|
acl_generated = aclperms.htmlinc
|
||||||
|
|
||||||
@@ -195,13 +176,6 @@ MAINTAINERCLEANFILES = \
|
|||||||
$(addprefix $(srcdir)/,$(dot_php)) \
|
$(addprefix $(srcdir)/,$(dot_php)) \
|
||||||
$(srcdir)/hvsupport.html.in $(srcdir)/aclperms.htmlinc
|
$(srcdir)/hvsupport.html.in $(srcdir)/aclperms.htmlinc
|
||||||
|
|
||||||
timestamp="$(shell if test -n "$$SOURCE_DATE_EPOCH"; \
|
|
||||||
then \
|
|
||||||
date -u --date="@$$SOURCE_DATE_EPOCH"; \
|
|
||||||
else \
|
|
||||||
date -u; \
|
|
||||||
fi)"
|
|
||||||
|
|
||||||
all-am: web
|
all-am: web
|
||||||
|
|
||||||
api: $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml
|
api: $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml
|
||||||
@@ -212,7 +186,25 @@ admin_api: $(srcdir)/libvirt-admin-api.xml $(srcdir)/libvirt-admin-refs.xml
|
|||||||
web: $(dot_html) $(internals_html) html/index.html devhelp/index.html \
|
web: $(dot_html) $(internals_html) html/index.html devhelp/index.html \
|
||||||
$(dot_php)
|
$(dot_php)
|
||||||
|
|
||||||
hvsupport.html: $(srcdir)/hvsupport.html.in
|
todo.html.in: todo.pl
|
||||||
|
if [ -f todo.cfg ]; then \
|
||||||
|
echo "Generating $@"; \
|
||||||
|
$(PERL) $< > $@ \
|
||||||
|
|| { rm $@ && exit 1; }; \
|
||||||
|
else \
|
||||||
|
echo "Stubbing $@"; \
|
||||||
|
printf "%s\n" \
|
||||||
|
"<html xmlns=\"http://www.w3.org/1999/xhtml\">" \
|
||||||
|
"<body>" \
|
||||||
|
"<h1>Todo list unavailable: no config file</h1>" \
|
||||||
|
"</body></html>" > $@ ; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
todo:
|
||||||
|
rm -f todo.html.in
|
||||||
|
$(MAKE) todo.html
|
||||||
|
|
||||||
|
hvsupport.html:: $(srcdir)/hvsupport.html.in
|
||||||
|
|
||||||
$(srcdir)/hvsupport.html.in: $(srcdir)/hvsupport.pl $(api_DATA) \
|
$(srcdir)/hvsupport.html.in: $(srcdir)/hvsupport.pl $(api_DATA) \
|
||||||
$(top_srcdir)/src/libvirt_public.syms \
|
$(top_srcdir)/src/libvirt_public.syms \
|
||||||
@@ -221,75 +213,70 @@ $(srcdir)/hvsupport.html.in: $(srcdir)/hvsupport.pl $(api_DATA) \
|
|||||||
$(AM_V_GEN)$(PERL) $(srcdir)/hvsupport.pl $(top_srcdir)/src > $@ \
|
$(AM_V_GEN)$(PERL) $(srcdir)/hvsupport.pl $(top_srcdir)/src > $@ \
|
||||||
|| { rm $@ && exit 1; }
|
|| { rm $@ && exit 1; }
|
||||||
|
|
||||||
# xsltproc seems to add the xmlns="" attribute to random output elements:
|
.PHONY: todo
|
||||||
# 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 \
|
|
||||||
>$@-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
|
%.png: %.fig
|
||||||
convert -rotate 90 $< $@
|
convert -rotate 90 $< $@
|
||||||
|
|
||||||
%.html.tmp: %.html.in site.xsl subsite.xsl page.xsl \
|
internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
|
||||||
$(acl_generated)
|
@if [ -x $(XSLTPROC) ] ; then \
|
||||||
$(AM_V_GEN)name=`echo $@ | sed -e 's/.tmp//'`; \
|
echo "Generating $@"; \
|
||||||
dir=`dirname $@` ; \
|
$(MKDIR_P) internals; \
|
||||||
if test "$$dir" = "."; \
|
name=`echo $@ | sed -e 's/.tmp//'`; \
|
||||||
then \
|
$(XSLTPROC) --stringparam pagename $$name --nonet \
|
||||||
style=site.xsl; \
|
$(top_srcdir)/docs/subsite.xsl $< > $@ \
|
||||||
else \
|
|| { rm $@ && exit 1; }; fi
|
||||||
$(MKDIR_P) $$dir; \
|
|
||||||
style=subsite.xsl; \
|
%.html.tmp: %.html.in site.xsl page.xsl sitemap.html.in $(acl_generated)
|
||||||
fi; \
|
@if [ -x $(XSLTPROC) ] ; then \
|
||||||
$(XSLTPROC) --stringparam pagename $$name \
|
echo "Generating $@"; \
|
||||||
--stringparam timestamp $(timestamp) --nonet \
|
name=`echo $@ | sed -e 's/.tmp//'`; \
|
||||||
$(top_srcdir)/docs/$$style $< > $@ \
|
$(XSLTPROC) --stringparam pagename $$name --nonet \
|
||||||
|| { rm $@ && exit 1; }
|
$(top_srcdir)/docs/site.xsl $< > $@ \
|
||||||
|
|| { rm $@ && exit 1; }; fi
|
||||||
|
|
||||||
%.html: %.html.tmp
|
%.html: %.html.tmp
|
||||||
$(AM_V_GEN)$(XMLLINT) --nonet --format $< > $(srcdir)/$@ \
|
@if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \
|
||||||
|| { rm $(srcdir)/$@ && exit 1; }
|
if $(XMLCATALOG) '$(XML_CATALOG_FILE)' \
|
||||||
|
"-//W3C//DTD XHTML 1.0 Strict//EN" > /dev/null ; then \
|
||||||
|
echo "Validating $@" ; \
|
||||||
|
SGML_CATALOG_FILES='$(XML_CATALOG_FILE)' \
|
||||||
|
$(XMLLINT) --catalogs --nonet --format --valid $< > $(srcdir)/$@ \
|
||||||
|
|| { rm $(srcdir)/$@ && exit 1; }; \
|
||||||
|
else echo "missing XHTML1 DTD"; cat $< > $(srcdir)/$@ ; fi ; fi
|
||||||
|
|
||||||
%.php.tmp: %.php.in site.xsl page.xsl
|
%.php.tmp: %.php.in site.xsl page.xsl sitemap.html.in
|
||||||
$(AM_V_GEN)$(XSLTPROC) --stringparam pagename $(@:.tmp=) \
|
@if [ -x $(XSLTPROC) ] ; then \
|
||||||
--stringparam timestamp $(timestamp) --nonet \
|
echo "Generating $@"; \
|
||||||
|
$(XSLTPROC) --stringparam pagename $(@:.tmp=) --nonet \
|
||||||
$(top_srcdir)/docs/site.xsl $< > $@ \
|
$(top_srcdir)/docs/site.xsl $< > $@ \
|
||||||
|| { rm $@ && exit 1; }
|
|| { rm $@ && exit 1; }; fi
|
||||||
|
|
||||||
%.php: %.php.tmp %.php.code.in
|
%.php: %.php.tmp %.php.code.in
|
||||||
$(AM_V_GEN)sed \
|
@if [ -x $(XSLTPROC) ] ; then \
|
||||||
-e '/<span id="php_placeholder"><\/span>/r '"$(srcdir)/$@.code.in" \
|
echo "Scripting $@"; \
|
||||||
|
sed -e '/<span id="php_placeholder"><\/span>/r '"$(srcdir)/$@.code.in" \
|
||||||
-e /php_placeholder/d < $@.tmp > $(srcdir)/$@ \
|
-e /php_placeholder/d < $@.tmp > $(srcdir)/$@ \
|
||||||
|| { rm $(srcdir)/$@ && exit 1; }
|
|| { rm $(srcdir)/$@ && exit 1; }; fi
|
||||||
|
|
||||||
$(apihtml_generated): html/index.html
|
$(apihtml_generated): html/index.html
|
||||||
|
|
||||||
html/index.html: libvirt-api.xml newapi.xsl page.xsl $(APIBUILD_STAMP)
|
html/index.html: libvirt-api.xml newapi.xsl page.xsl sitemap.html.in
|
||||||
$(AM_V_GEN)$(XSLTPROC) --nonet -o $(srcdir)/ \
|
$(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \
|
||||||
|
$(XSLTPROC) --nonet -o $(srcdir)/ \
|
||||||
--stringparam builddir '$(abs_top_builddir)' \
|
--stringparam builddir '$(abs_top_builddir)' \
|
||||||
--stringparam timestamp $(timestamp) \
|
$(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml ; fi && \
|
||||||
$(srcdir)/newapi.xsl $(srcdir)/libvirt-api.xml && \
|
if test -x $(XMLLINT) && test -x $(XMLCATALOG) ; then \
|
||||||
$(XMLLINT) --nonet --noout $(srcdir)/html/*.html
|
if $(XMLCATALOG) '$(XML_CATALOG_FILE)' "-//W3C//DTD XHTML 1.0 Strict//EN" \
|
||||||
|
> /dev/null ; then \
|
||||||
|
SGML_CATALOG_FILES='$(XML_CATALOG_FILE)' \
|
||||||
|
$(XMLLINT) --catalogs --nonet --valid --noout $(srcdir)/html/*.html ; \
|
||||||
|
else echo "missing XHTML1 DTD"; cat $< > $(srcdir)/$@ ; fi ; fi
|
||||||
|
|
||||||
$(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl)
|
$(addprefix $(srcdir)/,$(devhelphtml)): $(srcdir)/libvirt-api.xml $(devhelpxsl)
|
||||||
$(AM_V_GEN)$(XSLTPROC) --stringparam timestamp $(timestamp) \
|
$(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \
|
||||||
--nonet -o $(srcdir)/devhelp/ \
|
$(XSLTPROC) --nonet -o $(srcdir)/devhelp/ \
|
||||||
$(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml
|
$(top_srcdir)/docs/devhelp/devhelp.xsl $(srcdir)/libvirt-api.xml ; fi
|
||||||
|
|
||||||
|
|
||||||
python_generated_files = \
|
python_generated_files = \
|
||||||
@@ -314,8 +301,7 @@ EXTRA_DIST += $(APIBUILD_STAMP)
|
|||||||
$(python_generated_files): $(APIBUILD_STAMP)
|
$(python_generated_files): $(APIBUILD_STAMP)
|
||||||
|
|
||||||
$(APIBUILD_STAMP): $(srcdir)/apibuild.py \
|
$(APIBUILD_STAMP): $(srcdir)/apibuild.py \
|
||||||
$(top_srcdir)/include/libvirt/libvirt.h \
|
$(top_srcdir)/include/libvirt/libvirt.h.in \
|
||||||
$(top_srcdir)/include/libvirt/libvirt-common.h.in \
|
|
||||||
$(top_srcdir)/include/libvirt/libvirt-domain-snapshot.h \
|
$(top_srcdir)/include/libvirt/libvirt-domain-snapshot.h \
|
||||||
$(top_srcdir)/include/libvirt/libvirt-domain.h \
|
$(top_srcdir)/include/libvirt/libvirt-domain.h \
|
||||||
$(top_srcdir)/include/libvirt/libvirt-event.h \
|
$(top_srcdir)/include/libvirt/libvirt-event.h \
|
||||||
@@ -332,23 +318,13 @@ $(APIBUILD_STAMP): $(srcdir)/apibuild.py \
|
|||||||
$(top_srcdir)/include/libvirt/libvirt-admin.h \
|
$(top_srcdir)/include/libvirt/libvirt-admin.h \
|
||||||
$(top_srcdir)/include/libvirt/virterror.h \
|
$(top_srcdir)/include/libvirt/virterror.h \
|
||||||
$(top_srcdir)/src/libvirt.c \
|
$(top_srcdir)/src/libvirt.c \
|
||||||
$(top_srcdir)/src/libvirt-domain-snapshot.c \
|
|
||||||
$(top_srcdir)/src/libvirt-domain.c \
|
|
||||||
$(top_srcdir)/src/libvirt-host.c \
|
|
||||||
$(top_srcdir)/src/libvirt-interface.c \
|
|
||||||
$(top_srcdir)/src/libvirt-network.c \
|
|
||||||
$(top_srcdir)/src/libvirt-nodedev.c \
|
|
||||||
$(top_srcdir)/src/libvirt-nwfilter.c \
|
|
||||||
$(top_srcdir)/src/libvirt-secret.c \
|
|
||||||
$(top_srcdir)/src/libvirt-storage.c \
|
|
||||||
$(top_srcdir)/src/libvirt-stream.c \
|
|
||||||
$(top_srcdir)/src/libvirt-lxc.c \
|
$(top_srcdir)/src/libvirt-lxc.c \
|
||||||
$(top_srcdir)/src/libvirt-qemu.c \
|
$(top_srcdir)/src/libvirt-qemu.c \
|
||||||
$(top_srcdir)/src/libvirt-admin.c \
|
$(top_srcdir)/src/libvirt-admin.c \
|
||||||
$(top_srcdir)/src/util/virerror.c \
|
$(top_srcdir)/src/util/virerror.c \
|
||||||
$(top_srcdir)/src/util/virevent.c \
|
$(top_srcdir)/src/util/virevent.c \
|
||||||
$(top_srcdir)/src/util/virtypedparam.c
|
$(top_srcdir)/src/util/virtypedparam.c
|
||||||
$(AM_V_GEN)srcdir=$(srcdir) builddir=$(builddir) $(PYTHON) $(APIBUILD)
|
$(AM_V_GEN)srcdir=$(srcdir) $(PYTHON) $(APIBUILD)
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
|
|
||||||
@@ -356,10 +332,11 @@ check-local: all
|
|||||||
dist-local: all
|
dist-local: all
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -f *~ *.bak *.hierarchy *.signals *-unused.txt *.html html/*.html
|
rm -f *~ *.bak *.hierarchy *.signals *-unused.txt *.html
|
||||||
|
|
||||||
maintainer-clean-local: clean-local
|
maintainer-clean-local: clean-local
|
||||||
rm -rf $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml
|
rm -rf $(srcdir)/libvirt-api.xml $(srcdir)/libvirt-refs.xml \
|
||||||
|
todo.html.in
|
||||||
rm -rf $(srcdir)/libvirt-qemu-api.xml $(srcdir)/libvirt-qemu-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-lxc-api.xml $(srcdir)/libvirt-lxc-refs.xml
|
||||||
rm -rf $(srcdir)/libvirt-admin-api.xml $(srcdir)/libvirt-admin-refs.xml
|
rm -rf $(srcdir)/libvirt-admin-api.xml $(srcdir)/libvirt-admin-refs.xml
|
||||||
@@ -371,9 +348,6 @@ install-data-local:
|
|||||||
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
|
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
|
||||||
for f in $(css) $(dot_html) $(gif) $(png); do \
|
for f in $(css) $(dot_html) $(gif) $(png); do \
|
||||||
$(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR); done
|
$(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
|
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/html
|
||||||
for h in $(apihtml); do \
|
for h in $(apihtml); do \
|
||||||
$(INSTALL) -m 0644 $(srcdir)/$$h $(DESTDIR)$(HTML_DIR)/html; done
|
$(INSTALL) -m 0644 $(srcdir)/$$h $(DESTDIR)$(HTML_DIR)/html; done
|
||||||
@@ -386,23 +360,11 @@ install-data-local:
|
|||||||
for file in $(devhelphtml) $(devhelppng) $(devhelpcss); do \
|
for file in $(devhelphtml) $(devhelppng) $(devhelpcss); do \
|
||||||
$(INSTALL) -m 0644 $(srcdir)/$${file} $(DESTDIR)$(DEVHELP_DIR) ; \
|
$(INSTALL) -m 0644 $(srcdir)/$${file} $(DESTDIR)$(DEVHELP_DIR) ; \
|
||||||
done
|
done
|
||||||
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/fonts
|
$(INSTALL_DATA) $(srcdir)/libvirtLogo.png $(DESTDIR)$(pkgdatadir)
|
||||||
for f in $(fonts); do \
|
|
||||||
$(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR)/fonts; \
|
|
||||||
done
|
|
||||||
|
|
||||||
uninstall-local:
|
uninstall-local:
|
||||||
for f in $(css) $(dot_html) $(gif) $(png) $(fonts); do \
|
for h in $(apihtml); do rm $(DESTDIR)$(HTML_DIR)/$$h; done
|
||||||
rm -f $(DESTDIR)$(HTML_DIR)/$$f; \
|
for p in $(apipng); do rm $(DESTDIR)$(HTML_DIR)/$$p; done
|
||||||
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 \
|
for f in $(devhelphtml) $(devhelppng) $(devhelpcss); do \
|
||||||
rm -f $(DESTDIR)$(DEVHELP_DIR)/$$(basename $$f); \
|
rm $(DESTDIR)$(DEVHELP_DIR)/$$(basename $$f); \
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<body>
|
<body>
|
||||||
<h1>Client access control</h1>
|
<h1>Client access control</h1>
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<ul id="toc"></ul>
|
<ul id="toc"></ul>
|
||||||
|
|
||||||
<h2><a id="intro">Access control introduction</a></h2>
|
<h2><a name="intro">Access control introduction</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
In a default configuration, the libvirtd daemon has three levels
|
In a default configuration, the libvirtd daemon has three levels
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
<code>getattr</code> permission.
|
<code>getattr</code> permission.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="drivers">Access control drivers</a></h2>
|
<h2><a name="drivers">Access control drivers</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The access control framework is designed as a pluggable
|
The access control framework is designed as a pluggable
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
the libvirtd daemon be restarted.
|
the libvirtd daemon be restarted.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="perms">Objects and permissions</a></h2>
|
<h2><a name="perms">Objects and permissions</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Libvirt applies access control to all the main object
|
Libvirt applies access control to all the main object
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<body>
|
<body>
|
||||||
<h1>Polkit access control</h1>
|
<h1>Polkit access control</h1>
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<ul id="toc"></ul>
|
<ul id="toc"></ul>
|
||||||
|
|
||||||
<h2><a id="intro">Introduction</a></h2>
|
<h2><a name="intro">Introduction</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
A default install of libvirt will typically use
|
A default install of libvirt will typically use
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
object.
|
object.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="perms">Permission names</a></h2>
|
<h2><a name="perms">Permission names</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The libvirt <a href="acl.html#perms">object names and permission names</a>
|
The libvirt <a href="acl.html#perms">object names and permission names</a>
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
permissions default to deny access.
|
permissions default to deny access.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="attrs">Object identity attributes</a></h2>
|
<h2><a name="attrs">Object identity attributes</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
To allow polkit authorization rules to be written to match
|
To allow polkit authorization rules to be written to match
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
of object being checked
|
of object being checked
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3><a id="object_connect">virConnectPtr</a></h3>
|
<h3><a name="object_connect">virConnectPtr</a></h3>
|
||||||
<table class="acl">
|
<table class="acl">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3><a id="object_domain">virDomainPtr</a></h3>
|
<h3><a name="object_domain">virDomainPtr</a></h3>
|
||||||
<table class="acl">
|
<table class="acl">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3><a id="object_interface">virInterfacePtr</a></h3>
|
<h3><a name="object_interface">virInterfacePtr</a></h3>
|
||||||
<table class="acl">
|
<table class="acl">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3><a id="object_network">virNetworkPtr</a></h3>
|
<h3><a name="object_network">virNetworkPtr</a></h3>
|
||||||
<table class="acl">
|
<table class="acl">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -151,7 +151,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3><a id="object_node_device">virNodeDevicePtr</a></h3>
|
<h3><a name="object_node_device">virNodeDevicePtr</a></h3>
|
||||||
<table class="acl">
|
<table class="acl">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -171,7 +171,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3><a id="object_nwfilter">virNWFilterPtr</a></h3>
|
<h3><a name="object_nwfilter">virNWFilterPtr</a></h3>
|
||||||
<table class="acl">
|
<table class="acl">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -195,7 +195,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3><a id="object_secret">virSecretPtr</a></h3>
|
<h3><a name="object_secret">virSecretPtr</a></h3>
|
||||||
<table class="acl">
|
<table class="acl">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -224,14 +224,10 @@
|
|||||||
<td>secret_usage_target</td>
|
<td>secret_usage_target</td>
|
||||||
<td>Name of the associated iSCSI target, if any</td>
|
<td>Name of the associated iSCSI target, if any</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>secret_usage_name</td>
|
|
||||||
<td>Name of the associated TLS secret, if any</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3><a id="object_storage_pool">virStoragePoolPtr</a></h3>
|
<h3><a name="object_storage_pool">virStoragePoolPtr</a></h3>
|
||||||
<table class="acl">
|
<table class="acl">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -255,7 +251,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3><a id="object_storage_vol">virStorageVolPtr</a></h3>
|
<h3><a name="object_storage_vol">virStorageVolPtr</a></h3>
|
||||||
<table class="acl">
|
<table class="acl">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -288,7 +284,7 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
<h2><a id="user">User identity attributes</a></h2>
|
<h2><a name="user">User identity attributes</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
At this point in time, the only attribute provided by
|
At this point in time, the only attribute provided by
|
||||||
@@ -307,7 +303,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<h2><a id="checks">Writing access control policies</a></h2>
|
<h2><a name="checks">Writing access control policies</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If using versions of polkit prior to 0.106 then it is only
|
If using versions of polkit prior to 0.106 then it is only
|
||||||
@@ -334,9 +330,9 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
polkit.addRule(function(action, subject) {
|
polkit.addRule(function(action, subject) {
|
||||||
....logic to check 'action' and 'subject'...
|
....logic to check 'action' and 'subject'...
|
||||||
});
|
});
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -352,13 +348,7 @@ polkit.addRule(function(action, subject) {
|
|||||||
<code>lookup</code> method.
|
<code>lookup</code> method.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<h3><a name="exconnect">Example: restricting ability to connect to drivers</a></h3>
|
||||||
See
|
|
||||||
<a href="https://libvirt.org/git/?p=libvirt.git;a=tree;f=examples/polkit;hb=HEAD">source code</a>
|
|
||||||
for a more complex example.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h3><a id="exconnect">Example: restricting ability to connect to drivers</a></h3>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Consider a local user <code>berrange</code>
|
Consider a local user <code>berrange</code>
|
||||||
@@ -386,7 +376,7 @@ polkit.addRule(function(action, subject) {
|
|||||||
});
|
});
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3><a id="exdomain">Example: restricting access to a single domain</a></h3>
|
<h3><a name="exdomain">Example: restricting access to a single domain</a></h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Consider a local user <code>berrange</code>
|
Consider a local user <code>berrange</code>
|
||||||
@@ -396,7 +386,7 @@ polkit.addRule(function(action, subject) {
|
|||||||
To achieve this we need to write a rule which checks
|
To achieve this we need to write a rule which checks
|
||||||
whether the <code>connect_driver</code> attribute
|
whether the <code>connect_driver</code> attribute
|
||||||
is <code>LXC</code> and the <code>domain_name</code>
|
is <code>LXC</code> and the <code>domain_name</code>
|
||||||
attribute is <code>demo</code>, and match on an action
|
attribute is <code>demo</code>, and match on a action
|
||||||
name of <code>org.libvirt.api.domain.getattr</code>. Using
|
name of <code>org.libvirt.api.domain.getattr</code>. Using
|
||||||
the javascript rules format, this ends up written as
|
the javascript rules format, this ends up written as
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB |
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<body>
|
<body>
|
||||||
<h1>The libvirt API concepts</h1>
|
<h1>The libvirt API concepts</h1>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<ul id="toc"></ul>
|
<ul id="toc"></ul>
|
||||||
|
|
||||||
<h2><a id="Objects">Objects Exposed</a></h2>
|
<h2><a name="Objects">Objects Exposed</a></h2>
|
||||||
<p> As defined in the <a href="goals.html">goals section</a>, the libvirt
|
<p> As defined in the <a href="goals.html">goals section</a>, the libvirt
|
||||||
API is designed to expose all the resources needed to manage the
|
API is designed to expose all the resources needed to manage the
|
||||||
virtualization support of recent operating systems. The first object
|
virtualization support of recent operating systems. The first object
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
set of nodes.</p></li>
|
set of nodes.</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2><a id="Functions">Functions and Naming Conventions</a></h2>
|
<h2><a name="Functions">Functions and Naming Conventions</a></h2>
|
||||||
<p> The naming of the functions present in the library is usually
|
<p> The naming of the functions present in the library is usually
|
||||||
composed by a prefix describing the object associated to the function
|
composed by a prefix describing the object associated to the function
|
||||||
and a verb describing the action on that object.</p>
|
and a verb describing the action on that object.</p>
|
||||||
@@ -155,7 +155,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><b>Enumeration</b> [virConnectList..., virConnectNumOf...]
|
<li><b>Enumeration</b> [virConnectList..., virConnectNumOf...]
|
||||||
<p>Used to enumerate a set of object available to a given
|
<p>Used to enumerate a set of object available to an given
|
||||||
hypervisor connection such as:</p>
|
hypervisor connection such as:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
@@ -297,7 +297,7 @@
|
|||||||
<p> For more in-depth details of the storage related APIs see
|
<p> For more in-depth details of the storage related APIs see
|
||||||
<a href="storage.html">the storage management page</a>.
|
<a href="storage.html">the storage management page</a>.
|
||||||
</p>
|
</p>
|
||||||
<h2><a id="Drivers">The libvirt Drivers</a></h2>
|
<h2><a name="Drivers">The libvirt Drivers</a></h2>
|
||||||
<p>Drivers are the basic building block for libvirt functionality
|
<p>Drivers are the basic building block for libvirt functionality
|
||||||
to support the capability to handle specific hypervisor driver calls.
|
to support the capability to handle specific hypervisor driver calls.
|
||||||
Drivers are discovered and registered during connection processing as
|
Drivers are discovered and registered during connection processing as
|
||||||
@@ -325,12 +325,12 @@
|
|||||||
the various functions and support found in each driver by the version
|
the various functions and support found in each driver by the version
|
||||||
support was added into libvirt.
|
support was added into libvirt.
|
||||||
</p>
|
</p>
|
||||||
<h2><a id="Remote">Daemon and Remote Access</a></h2>
|
<h2><a name="Remote">Daemon and Remote Access</a></h2>
|
||||||
<p>Access to libvirt drivers is primarily handled by the libvirtd
|
<p>Access to libvirt drivers is primarily handled by the libvirtd
|
||||||
daemon through the <a href="remote.html">remote</a> driver via an
|
daemon through the <a href="remote.html">remote</a> driver via an
|
||||||
<a href="internals/rpc.html">RPC</a>. Some hypervisors do support
|
<a href="internals/rpc.html">RPC</a>. Some hypervisors do support
|
||||||
client-side connections and responses, such as Test, OpenVZ, VMware,
|
client-side connections and responses, such as Test, OpenVZ, VMware,
|
||||||
Power VM (phyp), VirtualBox (vbox), ESX, Hyper-V, Xen, and Virtuozzo.
|
Power VM (phyp), VirtualBox (vbox), ESX, Hyper-V, Xen, and Parallels.
|
||||||
The libvirtd daemon service is started on the host at system boot
|
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
|
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
|
user, such as root. The libvirtd daemon uses the same libvirt API
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<body>
|
<body>
|
||||||
<h1>Implementing a new API in Libvirt</h1>
|
<h1>Implementing a new API in Libvirt</h1>
|
||||||
@@ -8,9 +8,14 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
This document walks you through the process of implementing a new
|
This document walks you through the process of implementing a new
|
||||||
API in libvirt. Remember that new API consists of any new public
|
API in libvirt. It uses as an example the addition of an API for
|
||||||
functions, as well as the addition of flags or extensions of XML used by
|
separating maximum from current vcpu usage of a domain, over
|
||||||
existing functions.
|
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>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -22,7 +27,12 @@
|
|||||||
added to libvirt. Someone may already be working on the feature you
|
added to libvirt. Someone may already be working on the feature you
|
||||||
want. Also, recognize that everything you write is likely to undergo
|
want. Also, recognize that everything you write is likely to undergo
|
||||||
significant rework as you discuss it with the other developers, so
|
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>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -34,7 +44,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="https://libvirt.org/downloads.html">https://libvirt.org/downloads.html</a>
|
<a href="http://libvirt.org/downloads.html">http://libvirt.org/downloads.html</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -71,12 +81,14 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Submit new code in the form of one patch per step. That's not to say
|
Submit new code in the form shown in the example code: one patch
|
||||||
submit patches before you have working functionality--get the whole thing
|
per step. That's not to say submit patches before you have working
|
||||||
working and make sure you're happy with it. Then use git to break the
|
functionality--get the whole thing working and make sure you're happy
|
||||||
changes into pieces so you don't drop a big blob of code on the
|
with it. Then use git or some other version control system that lets
|
||||||
mailing list in one go. Also, you should follow the upstream tree, and
|
you rewrite your commit history and break patches into pieces so you
|
||||||
rebase your series to adapt your patches to work with any other changes
|
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.
|
that were accepted upstream during your development.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@@ -89,6 +101,8 @@
|
|||||||
separately.
|
separately.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>With that said, let's begin.</p>
|
||||||
|
|
||||||
<h2><a name='publicapi'>Defining the public API</a></h2>
|
<h2><a name='publicapi'>Defining the public API</a></h2>
|
||||||
|
|
||||||
<p>The first task is to define the public API. If the new API
|
<p>The first task is to define the public API. If the new API
|
||||||
@@ -96,7 +110,7 @@
|
|||||||
schema and document the new elements or attributes:</p>
|
schema and document the new elements or attributes:</p>
|
||||||
|
|
||||||
<p><code>
|
<p><code>
|
||||||
docs/schemas/domaincommon.rng<br/>
|
docs/schemas/domain.rng<br/>
|
||||||
docs/formatdomain.html.in
|
docs/formatdomain.html.in
|
||||||
</code></p>
|
</code></p>
|
||||||
|
|
||||||
@@ -106,7 +120,7 @@
|
|||||||
libvirt library and call the new function:</p>
|
libvirt library and call the new function:</p>
|
||||||
|
|
||||||
<p><code>
|
<p><code>
|
||||||
include/libvirt/libvirt-$MODULE.h.in
|
include/libvirt/libvirt.h.in
|
||||||
src/libvirt_public.syms
|
src/libvirt_public.syms
|
||||||
</code></p>
|
</code></p>
|
||||||
|
|
||||||
@@ -119,6 +133,10 @@
|
|||||||
rework it as you go through the process of implementing it.
|
rework it as you go through the process of implementing it.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<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>
|
<h2><a name='internalapi'>Defining the internal API</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -137,7 +155,7 @@
|
|||||||
|
|
||||||
<p>The driver structs are defined in:</p>
|
<p>The driver structs are defined in:</p>
|
||||||
|
|
||||||
<p><code>src/driver-$MODULE.h</code></p>
|
<p><code>src/driver.h</code></p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
To define the internal API, first typedef the driver function
|
To define the internal API, first typedef the driver function
|
||||||
@@ -146,6 +164,8 @@
|
|||||||
provide a <code>NULL</code> stub for the new function.
|
provide a <code>NULL</code> stub for the new function.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<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>
|
<h2><a name='implpublic'>Implementing the public API</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -177,16 +197,22 @@
|
|||||||
|
|
||||||
<p>The public API calls are implemented in:</p>
|
<p>The public API calls are implemented in:</p>
|
||||||
|
|
||||||
<p><code>src/libvirt-$MODULE.c</code></p>
|
<p><code>src/libvirt.c</code></p>
|
||||||
|
|
||||||
|
<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>
|
<h2><a name='remoteproto'>Implementing the remote protocol</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Implementing the remote protocol is essentially a
|
Implementing the remote protocol is essentially a
|
||||||
straightforward exercise which is probably most easily
|
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>
|
</p>
|
||||||
|
|
||||||
|
<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>
|
<h3><a name='wireproto'>Defining the wire protocol format</a></h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -219,9 +245,9 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p><code>
|
<p><code>
|
||||||
src/remote/remote_daemon_dispatch_stubs.h
|
daemon/remote_dispatch_args.h
|
||||||
src/remote/remote_daemon_dispatch.h
|
daemon/remote_dispatch_prototypes.h
|
||||||
src/remote/remote_daemon_dispatch.c
|
daemon/remote_dispatch_table.h
|
||||||
src/remote/remote_protocol.c
|
src/remote/remote_protocol.c
|
||||||
src/remote/remote_protocol.h
|
src/remote/remote_protocol.h
|
||||||
</code></p>
|
</code></p>
|
||||||
@@ -233,7 +259,7 @@
|
|||||||
method calls go in:
|
method calls go in:
|
||||||
</p>
|
</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>
|
<p>Each remote method invocation does the following:</p>
|
||||||
|
|
||||||
@@ -247,7 +273,7 @@
|
|||||||
<li>unlocks the remote driver.</li>
|
<li>unlocks the remote driver.</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<h3><a id="serverdispatch">Implement the server side dispatcher</a></h3>
|
<h3><a name="serverdispatch">Implement the server side dispatcher</a></h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Implementing the server side of the remote function call is simply a
|
Implementing the server side of the remote function call is simply a
|
||||||
@@ -256,7 +282,7 @@
|
|||||||
The server side dispatchers are implemented in:
|
The server side dispatchers are implemented in:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p><code>src/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>
|
<p>Again, this step uses the .h files generated by make rpcgen.</p>
|
||||||
|
|
||||||
@@ -272,7 +298,9 @@
|
|||||||
existing lines probably imply a backwards-incompatible API change.
|
existing lines probably imply a backwards-incompatible API change.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="internaluseapi">Use the new API internally</a></h2>
|
<p class="example">See <a href="api_extension/0005-implement-the-remote-protocol.patch">0005-implement-the-remote-protocol.patch</a></p>
|
||||||
|
|
||||||
|
<h2><a name="internaluseapi">Use the new API internally</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Sometimes, a new API serves as a superset of existing API, by
|
Sometimes, a new API serves as a superset of existing API, by
|
||||||
@@ -284,7 +312,9 @@
|
|||||||
not necessary if the new API has no relation to existing API.
|
not necessary if the new API has no relation to existing API.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="virshuseapi">Expose the new API in virsh</a></h2>
|
<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 name="virshuseapi">Expose the new API in virsh</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
All new API should be manageable from the virsh command line
|
All new API should be manageable from the virsh command line
|
||||||
@@ -309,11 +339,13 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p><code>
|
<p><code>
|
||||||
tools/virsh-$MODULE.c<br/>
|
tools/virsh.c<br/>
|
||||||
tools/virsh.pod
|
tools/virsh.pod
|
||||||
</code></p>
|
</code></p>
|
||||||
|
|
||||||
<h2><a id="driverimpl">Implement the driver methods</a></h2>
|
<p class="example">See <a href="api_extension/0007-add-virsh-support.patch">0007-add-virsh-support.patch</a></p>
|
||||||
|
|
||||||
|
<h2><a name="driverimpl">Implement the driver methods</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
So, after all that, we get to the fun part. All functionality in
|
So, after all that, we get to the fun part. All functionality in
|
||||||
@@ -324,7 +356,7 @@
|
|||||||
adding.
|
adding.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3><a id="commonimpl">Implement common handling</a></h3>
|
<h3><a name="commonimpl">Implement common handling</a></h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If the new API is applicable to more than one driver, it may
|
If the new API is applicable to more than one driver, it may
|
||||||
@@ -339,7 +371,9 @@
|
|||||||
the same way as the older API wrappers.
|
the same way as the older API wrappers.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3><a id="drivercode">Implement driver handling</a></h3>
|
<p class="example">See <a href="api_extension/0008-support-new-xml.patch">0008-support-new-xml.patch</a></p>
|
||||||
|
|
||||||
|
<h3><a name="drivercode">Implement driver handling</a></h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The remaining patches should only touch one driver at a time.
|
The remaining patches should only touch one driver at a time.
|
||||||
@@ -350,14 +384,41 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
It is always a good idea to patch the test driver in addition to the
|
In the example patches, three separate drivers are supported:
|
||||||
target driver, to prove that the API can be used for more than one
|
test, qemu, and xen. It is always a good idea to patch the test
|
||||||
driver.
|
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>
|
||||||
|
|
||||||
|
<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>
|
<p>
|
||||||
Any cleanups resulting from the changes should be added as separate
|
The qemu changes were easier to split into two phases, one for
|
||||||
patches at the end of the series.
|
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>
|
||||||
|
|
||||||
<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
|
||||||
|
|
||||||
1181
docs/apibuild.py
1181
docs/apibuild.py
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 10 KiB |
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<body>
|
<body>
|
||||||
<h1>Applications using libvirt</h1>
|
<h1>Applications using <strong>libvirt</strong></h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
This page provides an illustration of the wide variety of
|
This page provides an illustration of the wide variety of
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<ul id="toc"></ul>
|
<ul id="toc"></ul>
|
||||||
|
|
||||||
<h2><a id="add">Add an application</a></h2>
|
<h2><a name="add">Add an application</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
To add an application not listed on this page, send a message
|
To add an application not listed on this page, send a message
|
||||||
@@ -19,18 +19,15 @@
|
|||||||
be added here, or simply send a patch against the documentation
|
be added here, or simply send a patch against the documentation
|
||||||
in the libvirt.git docs subdirectory.
|
in the libvirt.git docs subdirectory.
|
||||||
If your application uses libvirt as its API,
|
If your application uses libvirt as its API,
|
||||||
the following graphics are available for your website to advertise
|
the following graphic is available for your website to advertise
|
||||||
support for libvirt:
|
support for libvirt:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="image">
|
<p class="image">
|
||||||
<img src="logos/logo-square-powered-96.png" alt="libvirt powered"/>
|
<img src="madeWith.png" alt="Made with libvirt"/>
|
||||||
<img src="logos/logo-square-powered-128.png" alt="libvirt powered"/>
|
|
||||||
<img src="logos/logo-square-powered-192.png" alt="libvirt powered"/>
|
|
||||||
<img src="logos/logo-square-powered-256.png" alt="libvirt powered"/>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="clientserver">Client/Server applications</a></h2>
|
<h2><a name="clientserver">Client/Server applications</a></h2>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="http://archipelproject.org">Archipel</a></dt>
|
<dt><a href="http://archipelproject.org">Archipel</a></dt>
|
||||||
@@ -50,7 +47,7 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2><a id="command">Command line tools</a></h2>
|
<h2><a name="command">Command line tools</a></h2>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="http://libguestfs.org">guestfish</a></dt>
|
<dt><a href="http://libguestfs.org">guestfish</a></dt>
|
||||||
@@ -65,21 +62,21 @@
|
|||||||
management tasks on all libvirt managed domains, networks and
|
management tasks on all libvirt managed domains, networks and
|
||||||
storage. This is part of the libvirt core distribution.
|
storage. This is part of the libvirt core distribution.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="https://virt-manager.org/">virt-clone</a></dt>
|
<dt><a href="http://virt-manager.org/">virt-clone</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Allows the disk image(s) and configuration for an existing
|
Allows the disk image(s) and configuration for an existing
|
||||||
virtual machine to be cloned to form a new virtual machine.
|
virtual machine to be cloned to form a new virtual machine.
|
||||||
It automates copying of data across to new disk images, and
|
It automates copying of data across to new disk images, and
|
||||||
updates the UUID, MAC address, and name in the configuration.
|
updates the UUID, MAC address, and name in the configuration.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="https://people.redhat.com/rjones/virt-df/">virt-df</a></dt>
|
<dt><a href="http://et.redhat.com/~rjones/virt-df/">virt-df</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Examine the utilization of each filesystem in a virtual machine
|
Examine the utilization of each filesystem in a virtual machine
|
||||||
from the comfort of the host machine. This tool peeks into the
|
from the comfort of the host machine. This tool peeks into the
|
||||||
guest disks and determines how much space is used. It can cope
|
guest disks and determines how much space is used. It can cope
|
||||||
with common Linux filesystems and LVM volumes.
|
with common Linux filesystems and LVM volumes.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="https://virt-manager.org/">virt-image</a></dt>
|
<dt><a href="http://virt-manager.org/">virt-image</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Provides a way to deploy virtual appliances. It defines a
|
Provides a way to deploy virtual appliances. It defines a
|
||||||
simplified portable XML format describing the pre-requisites
|
simplified portable XML format describing the pre-requisites
|
||||||
@@ -87,26 +84,26 @@
|
|||||||
into the domain XML format for execution under any libvirt
|
into the domain XML format for execution under any libvirt
|
||||||
hypervisor meeting the pre-requisites.
|
hypervisor meeting the pre-requisites.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="https://virt-manager.org/">virt-install</a></dt>
|
<dt><a href="http://virt-manager.org/">virt-install</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Provides a way to provision new virtual machines from a
|
Provides a way to provision new virtual machines from a
|
||||||
OS distribution install tree. It supports provisioning from
|
OS distribution install tree. It supports provisioning from
|
||||||
local CD images, and the network over NFS, HTTP and FTP.
|
local CD images, and the network over NFS, HTTP and FTP.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="https://people.redhat.com/rjones/virt-top/">virt-top</a></dt>
|
<dt><a href="http://et.redhat.com/~rjones/virt-top/">virt-top</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Watch the CPU, memory, network and disk utilization of all
|
Watch the CPU, memory, network and disk utilization of all
|
||||||
virtual machines running on a host.
|
virtual machines running on a host.
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a href="https://people.redhat.com/~rjones/virt-what/">virt-what</a>
|
<a href="http://people.redhat.com/~rjones/virt-what/">virt-what</a>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
virt-what is a shell script for detecting if the program is running
|
virt-what is a shell script for detecting if the program is running
|
||||||
in a virtual machine. It prints out a list of facts about the
|
in a virtual machine. It prints out a list of facts about the
|
||||||
virtual machine, derived from heuristics.
|
virtual machine, derived from heuristics.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="https://sourceware.org/systemtap/">stap</a></dt>
|
<dt><a href="http://sourceware.org/systemtap/">stap</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
SystemTap is a tool used to gather rich information about a running
|
SystemTap is a tool used to gather rich information about a running
|
||||||
system through the use of scripts. Starting from v2.4, the front-end
|
system through the use of scripts. Starting from v2.4, the front-end
|
||||||
@@ -121,7 +118,7 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2><a id="configmgmt">Configuration Management</a></h2>
|
<h2><a name="configmgmt">Configuration Management</a></h2>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="https://wiki.lcfg.org/bin/view/LCFG/LcfgLibvirt">LCFG</a></dt>
|
<dt><a href="https://wiki.lcfg.org/bin/view/LCFG/LcfgLibvirt">LCFG</a></dt>
|
||||||
@@ -139,10 +136,10 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2><a id="continuousintegration">Continuous Integration</a></h2>
|
<h2><a name="continuousintegration">Continuous Integration</a></h2>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="https://buildbot.net/buildbot/docs/current/Libvirt.html">BuildBot</a></dt>
|
<dt><a href="http://buildbot.net/buildbot/docs/current/Libvirt.html">BuildBot</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
BuildBot is a system to automate the compile/test cycle required
|
BuildBot is a system to automate the compile/test cycle required
|
||||||
by most software projects. CVS commits trigger new builds, run on
|
by most software projects. CVS commits trigger new builds, run on
|
||||||
@@ -152,7 +149,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="https://wiki.jenkins-ci.org/display/JENKINS/Libvirt+Slaves+Plugin">Jenkins</a></dt>
|
<dt><a href="http://wiki.jenkins-ci.org/display/JENKINS/Libvirt+Slaves+Plugin">Jenkins</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
This plugin for Jenkins adds a way to control guest domains hosted
|
This plugin for Jenkins adds a way to control guest domains hosted
|
||||||
on Xen or QEMU/KVM. You configure a Jenkins Slave,
|
on Xen or QEMU/KVM. You configure a Jenkins Slave,
|
||||||
@@ -163,7 +160,7 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2><a id="conversion">Conversion</a></h2>
|
<h2><a name="conversion">Conversion</a></h2>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="http://libguestfs.org/virt-p2v.1.html">virt-p2v</a></dt>
|
<dt><a href="http://libguestfs.org/virt-p2v.1.html">virt-p2v</a></dt>
|
||||||
@@ -194,37 +191,26 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2><a id="desktop">Desktop applications</a></h2>
|
<h2><a name="desktop">Desktop applications</a></h2>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="https://virt-manager.org/">virt-manager</a></dt>
|
<dt><a href="http://virt-manager.org/">virt-manager</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
A general purpose desktop management tool, able to manage
|
A general purpose desktop management tool, able to manage
|
||||||
virtual machines across both local and remotely accessed
|
virtual machines across both local and remotely accessed
|
||||||
hypervisors. It is targeted at home and small office usage
|
hypervisors. It is targeted at home and small office usage
|
||||||
up to managing 10-20 hosts and their VMs.
|
up to managing 10-20 hosts and their VMs.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="https://virt-manager.org/">virt-viewer</a></dt>
|
<dt><a href="http://virt-manager.org/">virt-viewer</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
A lightweight tool for accessing the graphical console
|
A lightweight tool for accessing the graphical console
|
||||||
associated with a virtual machine. It can securely connect
|
associated with a virtual machine. It can securely connect
|
||||||
to remote consoles supporting the VNC protocol. Also provides
|
to remote consoles supporting the VNC protocol. Also provides
|
||||||
an optional mozilla browser plugin.
|
an optional mozilla browser plugin.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="https://f1ash.github.io/qt-virt-manager">qt-virt-manager</a></dt>
|
|
||||||
<dd>
|
|
||||||
The Qt GUI for create and control VMs and another virtual entities
|
|
||||||
(aka networks, storages, interfaces, secrets, network filters).
|
|
||||||
Contains integrated LXC/SPICE/VNC viewer for accessing the graphical or
|
|
||||||
text console associated with a virtual machine or container.
|
|
||||||
</dd>
|
|
||||||
<dt><a href="https://f1ash.github.io/qt-virt-manager/#virtual-machines-viewer">qt-remote-viewer</a></dt>
|
|
||||||
<dd>
|
|
||||||
The Qt VNC/SPICE viewer for access to remote desktops or VMs.
|
|
||||||
</dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2><a id="iaas">Infrastructure as a Service (IaaS)</a></h2>
|
<h2><a name="iaas">Infrastructure as a Service (IaaS)</a></h2>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="http://cc1.ifj.edu.pl">Cracow Cloud One</a></dt>
|
<dt><a href="http://cc1.ifj.edu.pl">Cracow Cloud One</a></dt>
|
||||||
@@ -234,7 +220,17 @@
|
|||||||
it easy to benefit from private Cloud Computing technology.
|
it easy to benefit from private Cloud Computing technology.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt><a href="https://github.com/eucalyptus/eucalyptus">Eucalyptus</a></dt>
|
<dt><a href="http://www.emotivecloud.net">EMOTIVE Cloud</a></dt>
|
||||||
|
<dd>The EMOTIVE (Elastic Management Of Tasks In Virtualized
|
||||||
|
Environments) middleware allows executing tasks and providing
|
||||||
|
virtualized environments to the users with Xen, KVM or
|
||||||
|
VirtualBox hypervisor. EMOTIVE's main feature is VM management
|
||||||
|
with different scheduling policies. It can be also used as a
|
||||||
|
cloud provider and is very easy to extend thanks to its
|
||||||
|
modular Web Services architecture.
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<dt><a href="http://www.eucalyptus.com">Eucalyptus</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Eucalyptus is an on-premise Infrastructure as a Service cloud
|
Eucalyptus is an on-premise Infrastructure as a Service cloud
|
||||||
software platform that is open source and
|
software platform that is open source and
|
||||||
@@ -258,7 +254,7 @@
|
|||||||
management.
|
management.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt><a href="https://www.openstack.org">OpenStack</a></dt>
|
<dt><a href="http://www.openstack.org">OpenStack</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
OpenStack is a "cloud operating system" usable for both public
|
OpenStack is a "cloud operating system" usable for both public
|
||||||
and private clouds. Its various parts take care of compute,
|
and private clouds. Its various parts take care of compute,
|
||||||
@@ -266,29 +262,9 @@
|
|||||||
using a dashboard. Compute part uses libvirt to manage VM
|
using a dashboard. Compute part uses libvirt to manage VM
|
||||||
life-cycle, monitoring and so on.
|
life-cycle, monitoring and so on.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt><a href="https://github.com/gustavfranssonnyvell/cherrypop">Cherrypop</a></dt>
|
|
||||||
<dd>
|
|
||||||
A cloud software with no masters or central points. Nodes
|
|
||||||
autodetect other nodes and autodistribute virtual
|
|
||||||
machines and autodivide up the workload. Also there is no
|
|
||||||
minimum limit for hosts, well, one might be nice. It's
|
|
||||||
perfect for setting up low-end servers in a cloud or a
|
|
||||||
cloud where you want the most bang for the bucks.
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dt><a href="http://en.zstack.io/">ZStack</a></dt>
|
|
||||||
<dd>
|
|
||||||
ZStack is an open source IaaS software that aims to automate the
|
|
||||||
management of all resources (compute, storage, networking, etc.) in a
|
|
||||||
datacenter by using APIs, thus conforming to the principles of a
|
|
||||||
software-defined datacenter. The key strengths of ZStack in terms of
|
|
||||||
management are scalability, performance, and a fast, user-friendly
|
|
||||||
deployment.
|
|
||||||
</dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2><a id="libraries">Libraries</a></h2>
|
<h2><a name="libraries">Libraries</a></h2>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="http://libguestfs.org">libguestfs</a></dt>
|
<dt><a href="http://libguestfs.org">libguestfs</a></dt>
|
||||||
@@ -304,7 +280,7 @@
|
|||||||
Windows Registry in Windows guests.
|
Windows Registry in Windows guests.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dt><a href="https://sandbox.libvirt.org">libvirt-sandbox</a></dt>
|
<dt><a href="http://sandbox.libvirt.org">libvirt-sandbox</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
A library and command line tools for simplifying the creation of
|
A library and command line tools for simplifying the creation of
|
||||||
application sandboxes using virtualization technology. It currently
|
application sandboxes using virtualization technology. It currently
|
||||||
@@ -317,14 +293,14 @@
|
|||||||
Allows using simple ruby objects to manipulate
|
Allows using simple ruby objects to manipulate
|
||||||
hypervisors, guests, storage, network etc. It is
|
hypervisors, guests, storage, network etc. It is
|
||||||
based on top of
|
based on top of
|
||||||
the <a href="https://libvirt.org/ruby">native ruby bindings</a>.
|
the <a href="http://libvirt.org/ruby">native ruby bindings</a>.
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2><a id="livecd">LiveCD / Appliances</a></h2>
|
<h2><a name="livecd">LiveCD / Appliances</a></h2>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="http://libguestfs.org/virt-v2v/">virt-p2v</a></dt>
|
<dt><a href="http://et.redhat.com/~rjones/virt-p2v/">virt-p2v</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
An older tool for converting a physical machine into a virtual
|
An older tool for converting a physical machine into a virtual
|
||||||
machine. It is a LiveCD which is booted on the machine to be
|
machine. It is a LiveCD which is booted on the machine to be
|
||||||
@@ -334,9 +310,9 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2><a id="monitoring">Monitoring</a></h2>
|
<h2><a name="monitoring">Monitoring</a></h2>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="https://collectd.org/plugins/libvirt.shtml">collectd</a></dt>
|
<dt><a href="http://collectd.org/plugins/libvirt.shtml">collectd</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
The libvirt-plugin is part of <a href="http://collectd.org/">collectd</a>
|
The libvirt-plugin is part of <a href="http://collectd.org/">collectd</a>
|
||||||
and gathers statistics about virtualized guests on a system. This
|
and gathers statistics about virtualized guests on a system. This
|
||||||
@@ -345,19 +321,19 @@
|
|||||||
For a full description, please refer to the libvirt section in the
|
For a full description, please refer to the libvirt section in the
|
||||||
collectd.conf(5) manual page.
|
collectd.conf(5) manual page.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="http://www.sflow.net/">Host sFlow</a></dt>
|
<dt><a href="http://host-sflow.sourceforge.net/">Host sFlow</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Host sFlow is a lightweight agent running on KVM hypervisors that
|
Host sFlow is a lightweight agent running on KVM hypervisors that
|
||||||
links to libvirt library and exports standardized cpu, memory, network
|
links to libvirt library and exports standardized cpu, memory, network
|
||||||
and disk metrics for all virtual machines.
|
and disk metrics for all virtual machines.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="https://honk.sigxcpu.org/projects/libvirt/#munin">Munin</a></dt>
|
<dt><a href="http://honk.sigxcpu.org/projects/libvirt/#munin">Munin</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
The plugins provided by Guido Günther allow to monitor various things
|
The plugins provided by Guido Günther allow to monitor various things
|
||||||
like network and block I/O with
|
like network and block I/O with
|
||||||
<a href="http://munin.projects.linpro.no/">Munin</a>.
|
<a href="http://munin.projects.linpro.no/">Munin</a>.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="http://people.redhat.com/rjones/nagios-virt/">Nagios-virt</a></dt>
|
<dt><a href="http://et.redhat.com/~rjones/nagios-virt/">Nagios-virt</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Nagios-virt is a configuration tool to add monitoring of your
|
Nagios-virt is a configuration tool to add monitoring of your
|
||||||
virtualised domains to <a href="http://www.nagios.org/">Nagios</a>.
|
virtualised domains to <a href="http://www.nagios.org/">Nagios</a>.
|
||||||
@@ -365,15 +341,7 @@
|
|||||||
your Xen or QEMU/KVM guests, or to integrate with your existing Nagios
|
your Xen or QEMU/KVM guests, or to integrate with your existing Nagios
|
||||||
installation.
|
installation.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="http://www.pcp.io/man/man1/pmdalibvirt.1.html">PCP</a></dt>
|
<dt><a href="http://community.zenoss.org/docs/DOC-4687">Zenoss</a></dt>
|
||||||
<dd>
|
|
||||||
The PCP libvirt PMDA (plugin) is part of the
|
|
||||||
<a href="http://pcp.io/">PCP</a> toolkit and provides
|
|
||||||
hypervisor and guest information and complete set of guest performance
|
|
||||||
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>
|
<dd>
|
||||||
The Zenoss libvirt Zenpack adds support for monitoring virtualization
|
The Zenoss libvirt Zenpack adds support for monitoring virtualization
|
||||||
servers. It has been tested with KVM, QEMU, VMware ESX, and VMware
|
servers. It has been tested with KVM, QEMU, VMware ESX, and VMware
|
||||||
@@ -381,10 +349,10 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2><a id="provisioning">Provisioning</a></h2>
|
<h2><a name="provisioning">Provisioning</a></h2>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Tivoli+Provisioning+Manager">Tivoli Provisioning Manager</a></dt>
|
<dt><a href="http://www.ibm.com/software/tivoli/products/prov-mgr/">Tivoli Provisioning Manager</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Part of the IBM Tivoli family, Tivoli Provisioning Manager (TPM) is
|
Part of the IBM Tivoli family, Tivoli Provisioning Manager (TPM) is
|
||||||
an IT lifecycle automation product. It
|
an IT lifecycle automation product. It
|
||||||
@@ -394,7 +362,7 @@
|
|||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="https://theforeman.org">Foreman</a></dt>
|
<dt><a href="http://theforeman.org">Foreman</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Foreman is an open source web based application aimed to be a
|
Foreman is an open source web based application aimed to be a
|
||||||
Single Address For All Machines Life Cycle Management. Foreman:
|
Single Address For All Machines Life Cycle Management. Foreman:
|
||||||
@@ -415,10 +383,10 @@
|
|||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
<h2><a id="web">Web applications</a></h2>
|
<h2><a name="web">Web applications</a></h2>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="http://www.abiquo.com/">AbiCloud</a></dt>
|
<dt><a href="http://community.abiquo.com/display/AbiCloud">AbiCloud</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
AbiCloud is an open source cloud platform manager which allows to
|
AbiCloud is an open source cloud platform manager which allows to
|
||||||
easily deploy a private cloud in your datacenter. One of the key
|
easily deploy a private cloud in your datacenter. One of the key
|
||||||
@@ -426,22 +394,14 @@
|
|||||||
infrastructure. You can deploy a new service just dragging and
|
infrastructure. You can deploy a new service just dragging and
|
||||||
dropping a VM.
|
dropping a VM.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="https://kimchi-project.github.io/kimchi/">Kimchi</a></dt>
|
<dt><a href="http://ovirt.org/">oVirt</a></dt>
|
||||||
<dd>
|
|
||||||
Kimchi is an HTML5 based management tool for KVM. It is designed to
|
|
||||||
make it as easy as possible to get started with KVM and create your first guest.
|
|
||||||
|
|
||||||
Kimchi manages KVM guests through libvirt. The management interface is accessed
|
|
||||||
over the web using a browser that supports HTML5.
|
|
||||||
</dd>
|
|
||||||
<dt><a href="https://ovirt.org/">oVirt</a></dt>
|
|
||||||
<dd>
|
<dd>
|
||||||
oVirt provides the ability to manage large numbers of virtual
|
oVirt provides the ability to manage large numbers of virtual
|
||||||
machines across an entire data center of hosts. It integrates
|
machines across an entire data center of hosts. It integrates
|
||||||
with FreeIPA for Kerberos authentication, and in the future,
|
with FreeIPA for Kerberos authentication, and in the future,
|
||||||
certificate management.
|
certificate management.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="https://ispsystem.com/en/software/vmmanager">VMmanager</a></dt>
|
<dt><a href="http://ispsystem.com/en/software/vmmanager">VMmanager</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
VMmanager is a software solution for virtualization management
|
VMmanager is a software solution for virtualization management
|
||||||
that can be used both for hosting virtual machines and
|
that can be used both for hosting virtual machines and
|
||||||
@@ -450,7 +410,7 @@
|
|||||||
functions, such as live migration that allows for load
|
functions, such as live migration that allows for load
|
||||||
balancing between cluster nodes, monitoring CPU, memory.
|
balancing between cluster nodes, monitoring CPU, memory.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="https://mist.io/">mist.io</a></dt>
|
<dt><a href="http://mist.io/">mist.io</a></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Mist.io is an open source project and a service that can assist you in
|
Mist.io is an open source project and a service that can assist you in
|
||||||
managing your virtual machines on a unified way, providing a simple
|
managing your virtual machines on a unified way, providing a simple
|
||||||
@@ -458,32 +418,9 @@
|
|||||||
providers, OpenStack based public/private clouds, Docker servers, bare
|
providers, OpenStack based public/private clouds, Docker servers, bare
|
||||||
metal servers and now KVM hypervisors).
|
metal servers and now KVM hypervisors).
|
||||||
</dd>
|
</dd>
|
||||||
<dt><a href="https://ravada.upc.edu/">Ravada</a></dt>
|
|
||||||
<dd>
|
|
||||||
Ravada is an open source tool for managing Virtual Desktop
|
|
||||||
Infrastructure (VDI). It is very easy to install and use. Following
|
|
||||||
the documentation, you'll be ready to deploy virtual machines in
|
|
||||||
minutes. The only requirements for the users are a Web browser and
|
|
||||||
a lightweight remote viewer.
|
|
||||||
</dd>
|
|
||||||
<dt><a href="https://github.com/cutelyst/Virtlyst">Virtlyst</a></dt>
|
|
||||||
<dd>
|
|
||||||
Virtlyst is an open source web application built with C++11, Cutelyst and Qt.
|
|
||||||
It features:
|
|
||||||
<ul>
|
|
||||||
<li>Low memory usage (around 5 MiB of RAM)</li>
|
|
||||||
<li>Look and feel easily customized with HTML templates that use the Django syntax</li>
|
|
||||||
<li>VNC/Spice console directly in the browser using websockets on the same HTTP port</li>
|
|
||||||
<li>Host and Domain statistics graphs (CPU, Memory, IO, Network)</li>
|
|
||||||
<li>Connect to multiple libvirtd instances (over local Unix domain socket, SSH, TCP and TLS)</li>
|
|
||||||
<li>Manage Storage Pools, Storage Volumes, Networks, Interfaces, and Secrets</li>
|
|
||||||
<li>Create and launch VMs</li>
|
|
||||||
<li>Configure VMs with easy panels or go pro and edit the VM's XML</li>
|
|
||||||
</ul>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2><a id="mobile">Mobile applications</a></h2>
|
<h2><a name="mobile">Mobile applications</a></h2>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><a href="https://market.android.com/details?id=vm.manager">VM Manager</a></dt>
|
<dt><a href="https://market.android.com/details?id=vm.manager">VM Manager</a></dt>
|
||||||
@@ -494,19 +431,5 @@
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2><a id="other">Other</a></h2>
|
|
||||||
|
|
||||||
<dl>
|
|
||||||
<dt><a href="https://cuckoosandbox.org/">Cuckoo Sandbox</a></dt>
|
|
||||||
<dd>
|
|
||||||
Cuckoo Sandbox is a malware analysis system. You can throw
|
|
||||||
any suspicious file at it and in a matter of seconds Cuckoo
|
|
||||||
will provide you back some detailed results outlining what
|
|
||||||
such file did when executed inside an isolated environment.
|
|
||||||
And libvirt is one of the backends that can be used for the
|
|
||||||
isolated environment.
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
7
docs/archdomain.html.in
Normal file
7
docs/archdomain.html.in
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<body>
|
||||||
|
<h1>Domain management architecture</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<body>
|
<body>
|
||||||
<h1 >libvirt architecture</h1>
|
<h1 >libvirt architecture</h1>
|
||||||
@@ -13,38 +13,54 @@
|
|||||||
|
|
||||||
<ul id="toc"></ul>
|
<ul id="toc"></ul>
|
||||||
|
|
||||||
<h2><a id="Xen">Xen support</a></h2>
|
<h2><a name="Xen">Xen support</a></h2>
|
||||||
|
|
||||||
<p>When running in a Xen environment, programs using libvirt have to execute
|
<p>When running in a Xen environment, programs using libvirt have to execute
|
||||||
in "Domain 0", which is the primary Linux OS loaded on the machine. That OS
|
in "Domain 0", which is the primary Linux OS loaded on the machine. That OS
|
||||||
kernel provides most if not all of the actual drivers used by the set of
|
kernel provides most if not all of the actual drivers used by the set of
|
||||||
domains. It also runs the Xen Store, a database of information shared by the
|
domains. It also runs the Xen Store, a database of information shared by the
|
||||||
hypervisor, the backend drivers, any running domains, and libxl (aka libxenlight).
|
hypervisor, the kernels, the drivers and the xen daemon. Xend. The xen daemon
|
||||||
libxl provides a set of APIs for creating and managing domains, which can be used
|
supervise the control and execution of the sets of domains. The hypervisor,
|
||||||
by applications such as the xl tool provided by Xen or libvirt. The hypervisor,
|
|
||||||
drivers, kernels and daemons communicate though a shared system bus
|
drivers, kernels and daemons communicate though a shared system bus
|
||||||
implemented in the hypervisor. The figure below tries to provide a view of
|
implemented in the hypervisor. The figure below tries to provide a view of
|
||||||
this environment:</p>
|
this environment:</p>
|
||||||
<img src="architecture.gif" alt="The Xen architecture" />
|
<img src="architecture.gif" alt="The Xen architecture" />
|
||||||
<p>The library will interact with libxl for all management operations
|
<p>The library can be initialized in 2 ways depending on the level of
|
||||||
on a Xen system.</p>
|
privilege of the embedding program. If it runs with root access,
|
||||||
<p>Note that the libvirt libxl driver only supports root access.</p>
|
virConnectOpen() can be used, it will use three different ways to connect to
|
||||||
|
the Xen infrastructure:</p>
|
||||||
|
<ul>
|
||||||
|
<li>a connection to the Xen Daemon though an HTTP RPC layer</li>
|
||||||
|
<li>a read/write connection to the Xen Store</li>
|
||||||
|
<li>use Xen Hypervisor calls</li>
|
||||||
|
<li>when used as non-root libvirt connect to a proxy daemon running
|
||||||
|
as root and providing read-only support</li>
|
||||||
|
</ul>
|
||||||
|
<p>The library will usually interact with the Xen daemon for any operation
|
||||||
|
changing the state of the system, but for performance and accuracy reasons
|
||||||
|
may talk directly to the hypervisor when gathering state information at
|
||||||
|
least when possible (i.e. when the running program using libvirt has root
|
||||||
|
privilege access).</p>
|
||||||
|
<p>If it runs without root access virConnectOpenReadOnly() should be used to
|
||||||
|
connect to initialize the library. It will then fork a libvirt_proxy
|
||||||
|
program running as root and providing read_only access to the API, this is
|
||||||
|
then only useful for reporting and monitoring.</p>
|
||||||
|
|
||||||
<h2><a id="QEMU">QEMU and KVM support</a></h2>
|
<h2><a name="QEmu">QEmu and KVM support</a></h2>
|
||||||
|
|
||||||
<p>The model for QEMU and KVM is completely similar, basically KVM is based
|
<p>The model for QEmu and KVM is completely similar, basically KVM is based
|
||||||
on QEMU for the process controlling a new domain, only small details differs
|
on QEmu for the process controlling a new domain, only small details differs
|
||||||
between the two. In both case the libvirt API is provided by a controlling
|
between the two. In both case the libvirt API is provided by a controlling
|
||||||
process forked by libvirt in the background and which launch and control the
|
process forked by libvirt in the background and which launch and control the
|
||||||
QEMU or KVM process. That program called libvirt_qemud talks though a specific
|
QEmu or KVM process. That program called libvirt_qemud talks though a specific
|
||||||
protocol to the library, and connects to the console of the QEMU process in
|
protocol to the library, and connects to the console of the QEmu process in
|
||||||
order to control and report on its status. Libvirt tries to expose all the
|
order to control and report on its status. Libvirt tries to expose all the
|
||||||
emulations models of QEMU, the selection is done when creating the new
|
emulations models of QEmu, the selection is done when creating the new
|
||||||
domain, by specifying the architecture and machine type targeted.</p>
|
domain, by specifying the architecture and machine type targeted.</p>
|
||||||
<p>The code controlling the QEMU process is available in the
|
<p>The code controlling the QEmu process is available in the
|
||||||
<code>qemud/</code> directory.</p>
|
<code>qemud/</code> directory.</p>
|
||||||
|
|
||||||
<h2><a id="drivers">Driver based architecture</a></h2>
|
<h2><a name="drivers">Driver based architecture</a></h2>
|
||||||
|
|
||||||
<p>As the previous section explains, libvirt can communicate using different
|
<p>As the previous section explains, libvirt can communicate using different
|
||||||
channels with the current hypervisor, and should also be able to use
|
channels with the current hypervisor, and should also be able to use
|
||||||
@@ -67,9 +83,9 @@ drivers present in driver.h:</p>
|
|||||||
is in the <code>proxy/</code> directory.</li>
|
is in the <code>proxy/</code> directory.</li>
|
||||||
<li>xm_internal: provide support for Xen defined but not running
|
<li>xm_internal: provide support for Xen defined but not running
|
||||||
domains.</li>
|
domains.</li>
|
||||||
<li>qemu_internal: implement the driver functions for QEMU and
|
<li>qemu_internal: implement the driver functions for QEmu and
|
||||||
KVM virtualization engines. It also uses a qemud/ specific daemon
|
KVM virtualization engines. It also uses a qemud/ specific daemon
|
||||||
which interacts with the QEMU process to implement libvirt API.</li>
|
which interacts with the QEmu process to implement libvirt API.</li>
|
||||||
<li>test: this is a test driver useful for regression tests of the
|
<li>test: this is a test driver useful for regression tests of the
|
||||||
front-end part of libvirt.</li>
|
front-end part of libvirt.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
54
docs/archnetwork.html.in
Normal file
54
docs/archnetwork.html.in
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<body>
|
||||||
|
<h1>Network management architecture</h1>
|
||||||
|
|
||||||
|
<ul id="toc"></ul>
|
||||||
|
|
||||||
|
<h2><a name="architecture">Architecture illustration</a></h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The diagrams below illustrate some of the network configurations
|
||||||
|
enabled by the libvirt networking APIs
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><strong>VLAN 1</strong>. This virtual network has connectivity
|
||||||
|
to <code>LAN 2</code> with traffic forwarded and NATed.
|
||||||
|
</li>
|
||||||
|
<li><strong>VLAN 2</strong>. This virtual network is completely
|
||||||
|
isolated from any physical LAN.
|
||||||
|
</li>
|
||||||
|
<li><strong>Guest A</strong>. The first network interface is bridged
|
||||||
|
to the physical <code>LAN 1</code>. The second interface is connected
|
||||||
|
to a virtual network <code>VLAN 1</code>.
|
||||||
|
</li>
|
||||||
|
<li><strong>Guest B</strong>. The first network interface is connected
|
||||||
|
to a virtual network <code>VLAN 1</code>, giving it limited NAT
|
||||||
|
based connectivity to LAN2. It has a second network interface
|
||||||
|
connected to <code>VLAN 2</code>. It acts a router allowing limited
|
||||||
|
traffic between the two VLANs, thus giving <code>Guest C</code>
|
||||||
|
connectivity to the physical <code>LAN 2</code>.
|
||||||
|
</li>
|
||||||
|
<li><strong>Guest C</strong>. The only network interface is connected
|
||||||
|
to a virtual network <code>VLAN 2</code>. It has no direct connectivity
|
||||||
|
to a physical LAN, relying on <code>Guest B</code> to route traffic
|
||||||
|
on its behalf.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3><a name="logical">Logical diagram</a></h3>
|
||||||
|
|
||||||
|
<p class="image">
|
||||||
|
<img src="libvirt-net-logical.png" alt="Logical network architecture"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3><a name="physical">Physical diagram</a></h3>
|
||||||
|
|
||||||
|
<p class="image">
|
||||||
|
<img src="libvirt-net-physical.png" alt="Physical network architecture"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
7
docs/archnode.html.in
Normal file
7
docs/archnode.html.in
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<body>
|
||||||
|
<h1>Node device management architecture</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
32
docs/archstorage.html.in
Normal file
32
docs/archstorage.html.in
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<body>
|
||||||
|
<h1>Storage management architecture</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The storage management APIs are based around 2 core concepts
|
||||||
|
</p>
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
<strong>Volume</strong> - a single storage volume which can
|
||||||
|
be assigned to a guest, or used for creating further pools. A
|
||||||
|
volume is either a block device, a raw file, or a special format
|
||||||
|
file.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<strong>Pool</strong> - provides a means for taking a chunk
|
||||||
|
of storage and carving it up into volumes. A pool can be used to
|
||||||
|
manage things such as a physical disk, a NFS server, a iSCSI target,
|
||||||
|
a host adapter, an LVM group.
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
These two concepts are mapped through to two libvirt objects, a
|
||||||
|
<code>virStorageVolPtr</code> and a <code>virStoragePoolPtr</code>,
|
||||||
|
each with a collection of APIs for their management.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<body>
|
<body>
|
||||||
<h1>Audit log</h1>
|
<h1>Audit log</h1>
|
||||||
|
|
||||||
<ul id="toc"></ul>
|
<ul id="toc"></ul>
|
||||||
|
|
||||||
<h2><a id="intro">Introduction</a></h2>
|
<h2><a name="intro">Introduction</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
A number of the libvirt virtualization drivers (QEMU/KVM and LXC) include
|
A number of the libvirt virtualization drivers (QEMU/KVM and LXC) include
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
the logs will usually end up in <code>/var/log/audit/audit.log</code>
|
the logs will usually end up in <code>/var/log/audit/audit.log</code>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="config">Configuration</a></h2>
|
<h2><a name="config">Configuration</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The libvirt audit integration is enabled by default on any host which has
|
The libvirt audit integration is enabled by default on any host which has
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
mentioned above.
|
mentioned above.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="types">Message types</a></h2>
|
<h2><a name="types">Message types</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Libvirt defines three core audit message types each of which will
|
Libvirt defines three core audit message types each of which will
|
||||||
@@ -57,13 +57,13 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>pid</code></dt>
|
<dt>pid</dt>
|
||||||
<dd>Process ID of the libvirtd daemon generating the audit record.</dd>
|
<dd>Process ID of the libvirtd daemon generating the audit record.</dd>
|
||||||
<dt><code>uid</code></dt>
|
<dt>uid</dt>
|
||||||
<dd>User ID of the libvirtd daemon process generating the audit record.</dd>
|
<dd>User ID of the libvirtd daemon process generating the audit record.</dd>
|
||||||
<dt><code>subj</code></dt>
|
<dt>subj</dt>
|
||||||
<dd>Security context of the libvirtd daemon process generating the audit record.</dd>
|
<dd>Security context of the libvirtd daemon process generating the audit record.</dd>
|
||||||
<dt><code>msg</code></dt>
|
<dt>msg</dt>
|
||||||
<dd>String containing a list of key=value pairs specific to the type of audit record being reported.</dd>
|
<dd>String containing a list of key=value pairs specific to the type of audit record being reported.</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
@@ -72,25 +72,25 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>virt</code></dt>
|
<dt>virt</dt>
|
||||||
<dd>Type of virtualization driver used. One of <code>qemu</code> or <code>lxc</code></dd>
|
<dd>Type of virtualization driver used. One of <code>qemu</code> or <code>lxc</code></dd>
|
||||||
<dt><code>vm</code></dt>
|
<dt>vm</dt>
|
||||||
<dd>Host driver unique name of the guest</dd>
|
<dd>Host driver unique name of the guest</dd>
|
||||||
<dt><code>uuid</code></dt>
|
<dt>uuid</dt>
|
||||||
<dd>Globally unique identifier for the guest</dd>
|
<dd>Globally unique identifier for the guest</dd>
|
||||||
<dt><code>exe</code></dt>
|
<dt>exe</dt>
|
||||||
<dd>Path of the libvirtd daemon</dd>
|
<dd>Path of the libvirtd daemon</dd>
|
||||||
<dt><code>hostname</code></dt>
|
<dt>hostname</dt>
|
||||||
<dd>Currently unused</dd>
|
<dd>Currently unused</dd>
|
||||||
<dt><code>addr</code></dt>
|
<dt>addr</dt>
|
||||||
<dd>Currently unused</dd>
|
<dd>Currently unused</dd>
|
||||||
<dt><code>terminal</code></dt>
|
<dt>terminal</dt>
|
||||||
<dd>Currently unused</dd>
|
<dd>Currently unused</dd>
|
||||||
<dt><code>res</code></dt>
|
<dt>res</dt>
|
||||||
<dd>Result of the action, either <code>success</code> or <code>failed</code></dd>
|
<dd>Result of the action, either <code>success</code> or <code>failed</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h3><a id="typecontrol">VIRT_CONTROL</a></h3>
|
<h3><a name="typecontrol">VIRT_CONTROL</a></h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Reports change in the lifecycle state of a virtual machine. The <code>msg</code>
|
Reports change in the lifecycle state of a virtual machine. The <code>msg</code>
|
||||||
@@ -98,19 +98,19 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>op</code></dt>
|
<dt>op</dt>
|
||||||
<dd>Type of operation performed. One of <code>start</code>, <code>stop</code> or <code>init</code></dd>
|
<dd>Type of operation performed. One of <code>start</code>, <code>stop</code> or <code>init</code></dd>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the operation to happen</dd>
|
<dd>The reason which caused the operation to happen</dd>
|
||||||
<dt><code>vm-pid</code></dt>
|
<dt>vm-pid</dt>
|
||||||
<dd>ID of the primary/leading process associated with the guest</dd>
|
<dd>ID of the primary/leading process associated with the guest</dd>
|
||||||
<dt><code>init-pid</code></dt>
|
<dt>init-pid</dt>
|
||||||
<dd>ID of the <code>init</code> process in a container. Only if <code>op=init</code> and <code>virt=lxc</code></dd>
|
<dd>ID of the <code>init</code> process in a container. Only if <code>op=init</code> and <code>virt=lxc</code></dd>
|
||||||
<dt><code>pid-ns</code></dt>
|
<dt>pid-ns</dt>
|
||||||
<dd>Namespace ID of the <code>init</code> process in a container. Only if <code>op=init</code> and <code>virt=lxc</code></dd>
|
<dd>Namespace ID of the <code>init</code> process in a container. Only if <code>op=init</code> and <code>virt=lxc</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h3><a id="typemachine">VIRT_MACHINE_ID</a></h3>
|
<h3><a name="typemachine">VIRT_MACHINE_ID</a></h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Reports the association of a security context with a guest. The <code>msg</code>
|
Reports the association of a security context with a guest. The <code>msg</code>
|
||||||
@@ -118,15 +118,15 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>model</code></dt>
|
<dt>model</dt>
|
||||||
<dd>The security driver type. One of <code>selinux</code> or <code>apparmor</code></dd>
|
<dd>The security driver type. One of <code>selinux</code> or <code>apparmor</code></dd>
|
||||||
<dt><code>vm-ctx</code></dt>
|
<dt>vm-ctx</dt>
|
||||||
<dd>Security context for the guest process</dd>
|
<dd>Security context for the guest process</dd>
|
||||||
<dt><code>img-ctx</code></dt>
|
<dt>img-ctx</dt>
|
||||||
<dd>Security context for the guest disk images and other assigned host resources</dd>
|
<dd>Security context for the guest disk images and other assigned host resources</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h3><a id="typeresource">VIRT_RESOURCE</a></h3>
|
<h3><a name="typeresource">VIRT_RESOURCE</a></h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Reports the usage of a host resource by a guest. The fields include will
|
Reports the usage of a host resource by a guest. The fields include will
|
||||||
@@ -137,71 +137,71 @@
|
|||||||
be generated.
|
be generated.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h4><a id="typeresourcevcpu">Virtual CPU</a></h4>
|
<h4><a name="typeresourcevcpu">Virtual CPU</a></h4>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The <code>msg</code> field will include the following sub-fields
|
The <code>msg</code> field will include the following sub-fields
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||||
<dt><code>resrc</code></dt>
|
<dt>resrc</dt>
|
||||||
<dd>The type of resource assigned. Set to <code>vcpu</code></dd>
|
<dd>The type of resource assigned. Set to <code>vcpu</code></dd>
|
||||||
<dt><code>old-vcpu</code></dt>
|
<dt>old-vcpu</dt>
|
||||||
<dd>Original vCPU count, or 0</dd>
|
<dd>Original vCPU count, or 0</dd>
|
||||||
<dt><code>new-vcpu</code></dt>
|
<dt>new-vcpu</dt>
|
||||||
<dd>Updated vCPU count</dd>
|
<dd>Updated vCPU count</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
<h4><a id="typeresourcemem">Memory</a></h4>
|
<h4><a name="typeresourcemem">Memory</a></h4>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The <code>msg</code> field will include the following sub-fields
|
The <code>msg</code> field will include the following sub-fields
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||||
<dt><code>resrc</code></dt>
|
<dt>resrc</dt>
|
||||||
<dd>The type of resource assigned. Set to <code>mem</code></dd>
|
<dd>The type of resource assigned. Set to <code>mem</code></dd>
|
||||||
<dt><code>old-mem</code></dt>
|
<dt>old-mem</dt>
|
||||||
<dd>Original memory size in bytes, or 0</dd>
|
<dd>Original memory size in bytes, or 0</dd>
|
||||||
<dt><code>new-mem</code></dt>
|
<dt>new-mem</dt>
|
||||||
<dd>Updated memory size in bytes</dd>
|
<dd>Updated memory size in bytes</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h4><a id="typeresourcedisk">Disk</a></h4>
|
<h4><a name="typeresourcedisk">Disk</a></h4>
|
||||||
<p>
|
<p>
|
||||||
The <code>msg</code> field will include the following sub-fields
|
The <code>msg</code> field will include the following sub-fields
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||||
<dt><code>resrc</code></dt>
|
<dt>resrc</dt>
|
||||||
<dd>The type of resource assigned. Set to <code>disk</code></dd>
|
<dd>The type of resource assigned. Set to <code>disk</code></dd>
|
||||||
<dt><code>old-disk</code></dt>
|
<dt>old-disk</dt>
|
||||||
<dd>Original host file or device path acting as the disk backing file</dd>
|
<dd>Original host file or device path acting as the disk backing file</dd>
|
||||||
<dt><code>new-disk</code></dt>
|
<dt>new-disk</dt>
|
||||||
<dd>Updated host file or device path acting as the disk backing file</dd>
|
<dd>Updated host file or device path acting as the disk backing file</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h4><a id="typeresourcenic">Network interface</a></h4>
|
<h4><a name="typeresourcenic">Network interface</a></h4>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The <code>msg</code> field will include the following sub-fields
|
The <code>msg</code> field will include the following sub-fields
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||||
<dt><code>resrc</code></dt>
|
<dt>resrc</dt>
|
||||||
<dd>The type of resource assigned. Set to <code>net</code></dd>
|
<dd>The type of resource assigned. Set to <code>net</code></dd>
|
||||||
<dt><code>old-net</code></dt>
|
<dt>old-net</dt>
|
||||||
<dd>Original MAC address of the guest network interface</dd>
|
<dd>Original MAC address of the guest network interface</dd>
|
||||||
<dt><code>new-net</code></dt>
|
<dt>new-net</dt>
|
||||||
<dd>Updated MAC address of the guest network interface</dd>
|
<dd>Updated MAC address of the guest network interface</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
@@ -211,165 +211,146 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||||
<dt><code>resrc</code></dt>
|
<dt>resrc</dt>
|
||||||
<dd>The type of resource assigned. Set to <code>net</code></dd>
|
<dd>The type of resource assigned. Set to <code>net</code></dd>
|
||||||
<dt><code>net</code></dt>
|
<dt>net</dt>
|
||||||
<dd>MAC address of the host network interface</dd>
|
<dd>MAC address of the host network interface</dd>
|
||||||
<dt><code>rdev</code></dt>
|
<dt>rdev</dt>
|
||||||
<dd>Name of the host network interface</dd>
|
<dd>Name of the host network interface</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h4><a id="typeresourcefs">Filesystem</a></h4>
|
<h4><a name="typeresourcefs">Filesystem</a></h4>
|
||||||
<p>
|
<p>
|
||||||
The <code>msg</code> field will include the following sub-fields
|
The <code>msg</code> field will include the following sub-fields
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||||
<dt><code>resrc</code></dt>
|
<dt>resrc</dt>
|
||||||
<dd>The type of resource assigned. Set to <code>fs</code></dd>
|
<dd>The type of resource assigned. Set to <code>fs</code></dd>
|
||||||
<dt><code>old-fs</code></dt>
|
<dt>old-fs</dt>
|
||||||
<dd>Original host directory, file or device path backing the filesystem </dd>
|
<dd>Original host directory, file or device path backing the filesystem </dd>
|
||||||
<dt><code>new-fs</code></dt>
|
<dt>new-fs</dt>
|
||||||
<dd>Updated host directory, file or device path backing the filesystem</dd>
|
<dd>Updated host directory, file or device path backing the filesystem</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h4><a id="typeresourcehost">Host device</a></h4>
|
<h4><a name="typeresourcehost">Host device</a></h4>
|
||||||
<p>
|
<p>
|
||||||
The <code>msg</code> field will include the following sub-fields
|
The <code>msg</code> field will include the following sub-fields
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||||
<dt><code>resrc</code></dt>
|
<dt>resrc</dt>
|
||||||
<dd>The type of resource assigned. Set to <code>hostdev</code> or <code>dev</code></dd>
|
<dd>The type of resource assigned. Set to <code>hostdev</code> or <code>dev</code></dd>
|
||||||
<dt><code>dev</code></dt>
|
<dt>dev</dt>
|
||||||
<dd>The unique bus identifier of the USB, PCI or SCSI device, if <code>resrc=dev</code></dd>
|
<dd>The unique bus identifier of the USB, PCI or SCSI device, if <code>resrc=dev</code></dd>
|
||||||
<dt><code>disk</code></dt>
|
<dt>disk</dt>
|
||||||
<dd>The path of the block device assigned to the guest, if <code>resrc=hostdev</code></dd>
|
<dd>The path of the block device assigned to the guest, if <code>resrc=hostdev</code></dd>
|
||||||
<dt><code>chardev</code></dt>
|
<dt>chardev</dt>
|
||||||
<dd>The path of the character device assigned to the guest, if <code>resrc=hostdev</code></dd>
|
<dd>The path of the character device assigned to the guest, if <code>resrc=hostdev</code></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h4><a id="typeresourcetpm">TPM</a></h4>
|
<h4><a name="typeresourcetpm">TPM</a></h4>
|
||||||
<p>
|
<p>
|
||||||
The <code>msg</code> field will include the following sub-fields
|
The <code>msg</code> field will include the following sub-fields
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||||
<dt><code>resrc</code></dt>
|
<dt>resrc</dt>
|
||||||
<dd>The type of resource assigned. Set to <code>tpm</code> or <code>tpm-emulator</code></dd>
|
<dd>The type of resource assigned. Set to <code>tpm</code></dd>
|
||||||
<dt><code>device</code></dt>
|
<dt>device</dt>
|
||||||
<dd>The path of the host TPM device assigned to the guest</dd>
|
<dd>The path of the host TPM device assigned to the guest</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h4><a id="typeresourcerng">RNG</a></h4>
|
<h4><a name="typeresourcerng">RNG</a></h4>
|
||||||
<p>
|
<p>
|
||||||
The <code>msg</code> field will include the following sub-fields
|
The <code>msg</code> field will include the following sub-fields
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||||
<dt><code>resrc</code></dt>
|
<dt>resrc</dt>
|
||||||
<dd>The type of resource assigned. Set to <code>rng</code></dd>
|
<dd>The type of resource assigned. Set to <code>rng</code></dd>
|
||||||
<dt><code>old-rng</code></dt>
|
<dt>old-rng</dt>
|
||||||
<dd>Original path of the host entropy source for the RNG</dd>
|
<dd>Original path of the host entropy source for the RNG</dd>
|
||||||
<dt><code>new-rng</code></dt>
|
<dt>new-rng</dt>
|
||||||
<dd>Updated path of the host entropy source for the RNG</dd>
|
<dd>Updated path of the host entropy source for the RNG</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h4><a id="typeresourcechardev">console/serial/parallel/channel</a></h4>
|
<h4><a name="typeresourcechardev">console/serial/parallel/channel</a></h4>
|
||||||
<p>
|
<p>
|
||||||
The <code>msg</code> field will include the following sub-fields
|
The <code>msg</code> field will include the following sub-fields
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||||
<dt><code>resrc</code></dt>
|
<dt>resrc</dt>
|
||||||
<dd>The type of resource assigned. Set to <code>chardev</code></dd>
|
<dd>The type of resource assigned. Set to <code>chardev</code></dd>
|
||||||
<dt><code>old-chardev</code></dt>
|
<dt>old-chardev</dt>
|
||||||
<dd>Original path of the backing character device for given emulated device</dd>
|
<dd>Original path of the backing character device for given emulated device</dd>
|
||||||
<dt><code>new-chardev</code></dt>
|
<dt>new-chardev</dt>
|
||||||
<dd>Updated path of the backing character device for given emulated device</dd>
|
<dd>Updated path of the backing character device for given emulated device</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h4><a id="typeresourcesmartcard">smartcard</a></h4>
|
<h4><a name="typeresourcesmartcard">smartcard</a></h4>
|
||||||
<p>
|
<p>
|
||||||
The <code>msg</code> field will include the following sub-fields
|
The <code>msg</code> field will include the following sub-fields
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||||
<dt><code>resrc</code></dt>
|
<dt>resrc</dt>
|
||||||
<dd>The type of resource assigned. Set to <code>smartcard</code></dd>
|
<dd>The type of resource assigned. Set to <code>smartcard</code></dd>
|
||||||
<dt><code>old-smartcard</code></dt>
|
<dt>old-smartcard</dt>
|
||||||
<dd>Original path of the backing character device, certificate store or
|
<dd>Original path of the backing character device, certificate store or
|
||||||
"nss-smartcard-device" for host smartcard passthrough.
|
"nss-smartcard-device" for host smartcard passthrough.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><code>new-smartcard</code></dt>
|
<dt>new-smartcard</dt>
|
||||||
<dd>Updated path of the backing character device, certificate store or
|
<dd>Updated path of the backing character device, certificate store or
|
||||||
"nss-smartcard-device" for host smartcard passthrough.
|
"nss-smartcard-device" for host smartcard passthrough.
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h4><a id="typeresourceredir">Redirected device</a></h4>
|
<h4><a name="typeresourceredir">Redirected device</a></h4>
|
||||||
<p>
|
<p>
|
||||||
The <code>msg</code> field will include the following sub-fields
|
The <code>msg</code> field will include the following sub-fields
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||||
<dt><code>resrc</code></dt>
|
<dt>resrc</dt>
|
||||||
<dd>The type of resource assigned. Set to <code>redir</code></dd>
|
<dd>The type of resource assigned. Set to <code>redir</code></dd>
|
||||||
<dt><code>bus</code></dt>
|
<dt>bus</dt>
|
||||||
<dd>The bus type, only <code>usb</code> allowed</dd>
|
<dd>The bus type, only <code>usb</code> allowed</dd>
|
||||||
<dt><code>device</code></dt>
|
<dt>device</dt>
|
||||||
<dd>The device type, only <code>USB redir</code> allowed</dd>
|
<dd>The device type, only <code>USB redir</code> allowed</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h4><a id="typeresourcecgroup">Control group</a></h4>
|
<h4><a name="typeresourcecgroup">Control group</a></h4>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The <code>msg</code> field will include the following sub-fields
|
The <code>msg</code> field will include the following sub-fields
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><code>reason</code></dt>
|
<dt>reason</dt>
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
<dd>The reason which caused the resource to be assigned to happen</dd>
|
||||||
<dt><code>resrc</code></dt>
|
<dt>resrc</dt>
|
||||||
<dd>The type of resource assigned. Set to <code>cgroup</code></dd>
|
<dd>The type of resource assigned. Set to <code>cgroup</code></dd>
|
||||||
<dt><code>cgroup</code></dt>
|
<dt>cgroup</dt>
|
||||||
<dd>The name of the cgroup controller</dd>
|
<dd>The name of the cgroup controller</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
|
||||||
<h4><a id="typeresourceshmem">Shared memory</a></h4>
|
|
||||||
<p>
|
|
||||||
The <code>msg</code> field will include the following sub-fields
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<dl>
|
|
||||||
<dt><code>resrc</code></dt>
|
|
||||||
<dd>The type of resource assigned. Set to <code>shmem</code></dd>
|
|
||||||
<dt><code>reason</code></dt>
|
|
||||||
<dd>The reason which caused the resource to be assigned to happen</dd>
|
|
||||||
<dt><code>size</code></dt>
|
|
||||||
<dd>The size of the shared memory region</dd>
|
|
||||||
<dt><code>shmem</code></dt>
|
|
||||||
<dd>Name of the shared memory region</dd>
|
|
||||||
<dt><code>source</code></dt>
|
|
||||||
<dd>Path of the backing character device for given emulated device</dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<body>
|
<body>
|
||||||
<h1>Connection authentication</h1>
|
<h1>Connection authentication</h1>
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
<ul id="toc"></ul>
|
<ul id="toc"></ul>
|
||||||
|
|
||||||
<h2><a id="Auth_client_config">Client configuration</a></h2>
|
<h2><a name="Auth_client_config">Client configuration</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
When connecting to a remote hypervisor which requires authentication,
|
When connecting to a remote hypervisor which requires authentication,
|
||||||
@@ -76,11 +76,7 @@ password=letmein
|
|||||||
|
|
||||||
[credentials-dev]
|
[credentials-dev]
|
||||||
username=joe
|
username=joe
|
||||||
password=hello
|
password=hello</pre>
|
||||||
|
|
||||||
[credentials-defgrp]
|
|
||||||
username=defuser
|
|
||||||
password=defpw</pre>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The second set of groups provide mappings of credentials to
|
The second set of groups provide mappings of credentials to
|
||||||
@@ -94,8 +90,7 @@ credentials=$CREDENTIALS</pre>
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
For example, following the previous example, here is how to
|
For example, following the previous example, here is how to
|
||||||
map some machines. For convenience libvirt supports a default
|
list some machines
|
||||||
mapping of credentials to machines:
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
@@ -111,15 +106,8 @@ credentials=test
|
|||||||
[auth-libvirt-prod1.example.com]
|
[auth-libvirt-prod1.example.com]
|
||||||
credentials=prod
|
credentials=prod
|
||||||
|
|
||||||
[auth-libvirt-default]
|
|
||||||
credentials=defgrp
|
|
||||||
|
|
||||||
[auth-esx-dev1.example.com]
|
[auth-esx-dev1.example.com]
|
||||||
credentials=dev
|
credentials=dev</pre>
|
||||||
|
|
||||||
[auth-esx-default]
|
|
||||||
credentials=defgrp</pre>
|
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The following service types are known to libvirt
|
The following service types are known to libvirt
|
||||||
@@ -142,7 +130,7 @@ credentials=defgrp</pre>
|
|||||||
to storage VNC or SPICE login credentials
|
to storage VNC or SPICE login credentials
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="ACL_server_config">Server configuration</a></h2>
|
<h2><a name="ACL_server_config">Server configuration</a></h2>
|
||||||
<p>
|
<p>
|
||||||
The libvirt daemon allows the administrator to choose the authentication
|
The libvirt daemon allows the administrator to choose the authentication
|
||||||
mechanisms used for client connections on each network socket independently.
|
mechanisms used for client connections on each network socket independently.
|
||||||
@@ -153,7 +141,7 @@ currently a choice of <code>none</code>, <code>polkit</code>, and <code>sasl</co
|
|||||||
The SASL scheme can be further configured to choose between a large
|
The SASL scheme can be further configured to choose between a large
|
||||||
number of different mechanisms.
|
number of different mechanisms.
|
||||||
</p>
|
</p>
|
||||||
<h2><a id="ACL_server_unix_perms">UNIX socket permissions/group</a></h2>
|
<h2><a name="ACL_server_unix_perms">UNIX socket permissions/group</a></h2>
|
||||||
<p>
|
<p>
|
||||||
If libvirt does not contain support for PolicyKit, then access control for
|
If libvirt does not contain support for PolicyKit, then access control for
|
||||||
the UNIX domain socket is done using traditional file user/group ownership
|
the UNIX domain socket is done using traditional file user/group ownership
|
||||||
@@ -170,10 +158,10 @@ parameter. For example, setting the former to mode <code>0770</code> and the
|
|||||||
latter <code>wheel</code> would let any user in the wheel group connect to
|
latter <code>wheel</code> would let any user in the wheel group connect to
|
||||||
the libvirt daemon.
|
the libvirt daemon.
|
||||||
</p>
|
</p>
|
||||||
<h2><a id="ACL_server_polkit">UNIX socket PolicyKit auth</a></h2>
|
<h2><a name="ACL_server_polkit">UNIX socket PolicyKit auth</a></h2>
|
||||||
<p>
|
<p>
|
||||||
If libvirt contains support for PolicyKit, then access control options are
|
If libvirt contains support for PolicyKit, then access control options are
|
||||||
more advanced. The <code>auth_unix_rw</code> parameter will default to
|
more advanced. The <code>unix_sock_auth</code> parameter will default to
|
||||||
<code>polkit</code>, and the file permissions will default to <code>0777</code>
|
<code>polkit</code>, and the file permissions will default to <code>0777</code>
|
||||||
even on the RW socket. Upon connecting to the socket, the client application
|
even on the RW socket. Upon connecting to the socket, the client application
|
||||||
will be required to identify itself with PolicyKit. The default policy for the
|
will be required to identify itself with PolicyKit. The default policy for the
|
||||||
@@ -204,72 +192,16 @@ ResultActive=yes</pre>
|
|||||||
Further examples of PolicyKit setup can be found on the
|
Further examples of PolicyKit setup can be found on the
|
||||||
<a href="http://wiki.libvirt.org/page/SSHPolicyKitSetup">wiki page</a>.
|
<a href="http://wiki.libvirt.org/page/SSHPolicyKitSetup">wiki page</a>.
|
||||||
</p>
|
</p>
|
||||||
<h2><a id="ACL_server_sasl">SASL pluggable authentication</a></h2>
|
<h2><a name="ACL_server_username">Username/password auth</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Libvirt integrates with the cyrus-sasl library to provide a pluggable authentication
|
The plain TCP socket of the libvirt daemon defaults to using SASL for authentication.
|
||||||
system using the SASL protocol. SASL can be used in combination with libvirtd's TLS
|
The SASL mechanism configured by default is DIGEST-MD5, which provides a basic
|
||||||
or TCP socket listeners. When used with the TCP listener, the SASL mechanism is
|
username+password style authentication. It also provides for encryption of the data
|
||||||
rqeuired to provide session encryption in addition to authentication. Only a very
|
stream, so the security of the plain TCP socket is on a par with that of the TLS
|
||||||
few SASL mechanisms are able to do this, and of those that can do it, only the
|
socket. If desired the UNIX socket and TLS socket can also have SASL enabled by
|
||||||
GSSAPI plugin is considered acceptably secure by modern standards:
|
setting the <code>auth_unix_ro</code>, <code>auth_unix_rw</code>, <code>auth_tls</code>
|
||||||
</p>
|
config params in <code>libvirt.conf</code>.
|
||||||
|
</p>
|
||||||
<dl>
|
|
||||||
<dt>GSSAPI</dt>
|
|
||||||
<dd><strong>This is the current default mechanism to use with libvirtd</strong>.
|
|
||||||
It uses the Kerberos v5 authentication protocol underneath, and assuming
|
|
||||||
the Kerberos client/server are configured with modern ciphers (AES),
|
|
||||||
it provides strong session encryption capabilities.</dd>
|
|
||||||
|
|
||||||
<dt>DIGEST-MD5</dt>
|
|
||||||
<dd>This was previously set as the default mechanism to use with libvirtd.
|
|
||||||
It provides a simple username/password based authentication mechanism
|
|
||||||
that includes session encryption.
|
|
||||||
<a href="https://tools.ietf.org/html/rfc6331">RFC 6331</a>, however,
|
|
||||||
documents a number of serious security flaws with DIGEST-MD5 and as a
|
|
||||||
result marks it as <code>OBSOLETE</code>. Specific concerns are that
|
|
||||||
it is vulnerable to MITM attacks and the MD5 hash can be brute-forced
|
|
||||||
to reveal the password. A replacement is provided via the SCRAM mechanism,
|
|
||||||
however, note that this does not provide encryption, so the SCRAM
|
|
||||||
mechanism can only be used on the libvirtd TLS listener.
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dt>PASSDSS-3DES-1</dt>
|
|
||||||
<dd>This provides a simple username/password based authentication
|
|
||||||
mechanism that includes session encryption. The current cyrus-sasl
|
|
||||||
implementation does not provide a way to validate the server's
|
|
||||||
public key identity, thus it is susceptible to a MITM attacker
|
|
||||||
impersonating the server. It is also not enabled in many OS
|
|
||||||
distros when building SASL libraries.</dd>
|
|
||||||
|
|
||||||
<dt>KERBEROS_V4</dt>
|
|
||||||
<dd>This uses the obsolete Kerberos v4 protocol to provide both authentication
|
|
||||||
and session encryption. Kerberos v4 protocol has been obsolete since the
|
|
||||||
early 1990's and has known security vulnerabilities so this will never be
|
|
||||||
used in practice.</dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Other SASL mechanisms, not listed above, can only be used when the libvirtd
|
|
||||||
TLS or UNIX socket listeners.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h3><a id="ACL_server_username">Username/password auth</a></h3>
|
|
||||||
<p>
|
|
||||||
As noted above, the DIGEST-MD5 mechanism is considered obsolete and should
|
|
||||||
not be used anymore. To provide a simple username/password auth scheme on
|
|
||||||
the libvirt UNIX socket or TLS listeners, however, it is possible to use
|
|
||||||
the SCRAM mechanism. The <code>auth_unix_ro</code>, <code>auth_unix_rw</code>,
|
|
||||||
<code>auth_tls</code> config params in <code>libvirt.conf</code> can be used
|
|
||||||
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 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>
|
|
||||||
<p>
|
<p>
|
||||||
Out of the box, no user accounts are defined, so no clients will be able to authenticate
|
Out of the box, no user accounts are defined, so no clients will be able to authenticate
|
||||||
on the TCP socket. Adding users and setting their passwords is done with the <code>saslpasswd2</code>
|
on the TCP socket. Adding users and setting their passwords is done with the <code>saslpasswd2</code>
|
||||||
@@ -297,13 +229,17 @@ again:
|
|||||||
<pre>
|
<pre>
|
||||||
# saslpasswd2 -a libvirt -d fred
|
# saslpasswd2 -a libvirt -d fred
|
||||||
</pre>
|
</pre>
|
||||||
<h3><a id="ACL_server_kerberos">GSSAPI/Kerberos auth</a></h3>
|
<h2><a name="ACL_server_kerberos">Kerberos auth</a></h2>
|
||||||
<p>
|
<p>
|
||||||
The plain TCP listener of the libvirt daemon defaults to using SASL for authentication.
|
The plain TCP socket of the libvirt daemon defaults to using SASL for authentication.
|
||||||
The libvirt SASL config also defaults to GSSAPI, so there is no need to edit the
|
The SASL mechanism configured by default is DIGEST-MD5, which provides a basic
|
||||||
SASL config when using GSSAPI. If the libvirtd TLS or UNIX listeners are used,
|
username+password style authentication. To enable Kerberos single-sign-on instead,
|
||||||
then the Kerberos session encryption will be disabled since it is not required
|
the libvirt SASL configuration file must be changed. This is <code>/etc/sasl2/libvirt.conf</code>.
|
||||||
in these scenarios - only the plain TCP listener needs encryption
|
The <code>mech_list</code> parameter must first be changed to <code>gssapi</code>
|
||||||
|
instead of the default <code>digest-md5</code>, and keytab should be set to
|
||||||
|
<code>/etc/libvirt/krb5.tab</code> . If SASL is enabled on the UNIX
|
||||||
|
and/or TLS sockets, Kerberos will also be used for them. Like DIGEST-MD5, the Kerberos
|
||||||
|
mechanism provides data encryption of the session.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Some operating systems do not install the SASL kerberos plugin by default. It
|
Some operating systems do not install the SASL kerberos plugin by default. It
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<body>
|
<body>
|
||||||
<h1 >Bindings for other languages and integration API modules</h1>
|
<h1 >Bindings for other languages</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Libvirt supports C and C++ directly, and has bindings available
|
Libvirt supports C and C++ directly, and has bindings available
|
||||||
@@ -14,17 +14,13 @@
|
|||||||
<strong>C#</strong>: Arnaud Champion develops
|
<strong>C#</strong>: Arnaud Champion develops
|
||||||
<a href="csharp.html">C# bindings</a>.
|
<a href="csharp.html">C# bindings</a>.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<strong>Go</strong>: Daniel Berrange develops
|
|
||||||
<a href="https://godoc.org/github.com/libvirt/libvirt-go">Go bindings</a>.
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<strong>Java</strong>: Daniel Veillard develops
|
<strong>Java</strong>: Daniel Veillard develops
|
||||||
<a href="java.html">Java bindings</a>.
|
<a href="java.html">Java bindings</a>.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<strong>OCaml</strong>: Richard Jones develops
|
<strong>OCaml</strong>: Richard Jones develops
|
||||||
<a href="https://libvirt.org/ocaml/">OCaml bindings</a>.
|
<a href="http://libvirt.org/ocaml/">OCaml bindings</a>.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<strong>Perl</strong>: Daniel Berrange develops
|
<strong>Perl</strong>: Daniel Berrange develops
|
||||||
@@ -33,7 +29,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
<strong>PHP</strong>: Radek Hladik started developing
|
<strong>PHP</strong>: Radek Hladik started developing
|
||||||
<a href="https://libvirt.org/php">PHP bindings</a> in 2010.
|
<a href="http://libvirt.org/php">PHP bindings</a> in 2010.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
In February 2011 the binding development has been moved to the libvirt.org website as
|
In February 2011 the binding development has been moved to the libvirt.org website as
|
||||||
@@ -43,13 +39,13 @@
|
|||||||
The project is now maintained by Michal Novotny and it's heavily based
|
The project is now maintained by Michal Novotny and it's heavily based
|
||||||
on Radek's version. For more information, including
|
on Radek's version. For more information, including
|
||||||
information on posting patches to libvirt-php, please refer
|
information on posting patches to libvirt-php, please refer
|
||||||
to the <a href="https://libvirt.org/php">PHP bindings</a> site.
|
to the <a href="http://libvirt.org/php">PHP bindings</a> site.
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p>
|
<p>
|
||||||
<strong>Python</strong>: Libvirt's python bindings are split to a
|
<strong>Python</strong>: Libvirt's python bindings are split to a
|
||||||
separate <a href="https://libvirt.org/git/?p=libvirt-python.git">package</a>
|
separate <a href="http://libvirt.org/git/?p=libvirt-python.git">package</a>
|
||||||
since version 1.2.0, older versions came with direct support for the
|
since version 1.2.0, older versions came with direct support for the
|
||||||
Python language.
|
Python language.
|
||||||
</p>
|
</p>
|
||||||
@@ -70,18 +66,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<strong>Ruby</strong>: Chris Lalancette develops
|
<strong>Ruby</strong>: Chris Lalancette develops
|
||||||
<a href="https://libvirt.org/ruby/">Ruby bindings</a>.
|
<a href="http://libvirt.org/ruby/">Ruby bindings</a>.
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Integration API modules:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<strong>D-Bus</strong>: Pavel Hrdina develops
|
|
||||||
<a href="dbus.html">D-Bus API</a>.
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<browserconfig>
|
|
||||||
<msapplication>
|
|
||||||
<tile>
|
|
||||||
<square150x150logo src="/mstile-150x150.png"/>
|
|
||||||
<TileColor>#b91d47</TileColor>
|
|
||||||
</tile>
|
|
||||||
</msapplication>
|
|
||||||
</browserconfig>
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<ul id="toc"></ul>
|
<ul id="toc"></ul>
|
||||||
|
|
||||||
<h2><a id="security">Security Issues</a></h2>
|
<h2><a name="security">Security Issues</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If you think that an issue with libvirt may have security
|
If you think that an issue with libvirt may have security
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<a href="securityprocess.html">security process</a> instead.
|
<a href="securityprocess.html">security process</a> instead.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="bugzilla">Bug Tracking</a></h2>
|
<h2><a name="bugzilla">Bug Tracking</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If you are using libvirt binaries from a Linux distribution
|
If you are using libvirt binaries from a Linux distribution
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
first.
|
first.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="general">General libvirt bug reports</a></h2>
|
<h2><a name="general">General libvirt bug reports</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The <a href="http://bugzilla.redhat.com">Red Hat Bugzilla Server</a>
|
The <a href="http://bugzilla.redhat.com">Red Hat Bugzilla Server</a>
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
<li><a href="http://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Virtualization%20Tools&component=libvirt">New libvirt ticket</a></li>
|
<li><a href="http://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Virtualization%20Tools&component=libvirt">New libvirt ticket</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2><a id="distribution">Linux Distribution specific bug reports</a></h2>
|
<h2><a name="distribution">Linux Distribution specific bug reports</a></h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
If you are using binaries from <strong>Fedora</strong>, enter
|
If you are using binaries from <strong>Fedora</strong>, enter
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
<h2><a id="quality">How to file high quality bug reports</a></h2>
|
<h2><a name="quality">How to file high quality bug reports</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
To increase the likelihood of your bug report being addressed it is
|
To increase the likelihood of your bug report being addressed it is
|
||||||
@@ -122,8 +122,7 @@
|
|||||||
<li>The hardware architecture being used</li>
|
<li>The hardware architecture being used</li>
|
||||||
<li>The name of the hypervisor (Xen, QEMU, KVM)</li>
|
<li>The name of the hypervisor (Xen, QEMU, KVM)</li>
|
||||||
<li>The XML config of the guest domain if relevant</li>
|
<li>The XML config of the guest domain if relevant</li>
|
||||||
<li>For Xen hypervisor, the domain logfiles from /var/log/xen and
|
<li>For Xen hypervisor, the XenD logfile from /var/log/xen</li>
|
||||||
/var/log/libvirt/libxl</li>
|
|
||||||
<li>For QEMU/KVM, the domain logfile from /var/log/libvirt/qemu</li>
|
<li>For QEMU/KVM, the domain logfile from /var/log/libvirt/qemu</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<body>
|
<body>
|
||||||
<h1>Control Groups Resource Management</h1>
|
<h1>Control Groups Resource Management</h1>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
for applying resource management to their virtual machines and containers.
|
for applying resource management to their virtual machines and containers.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="requiredControllers">Required controllers</a></h2>
|
<h2><a name="requiredControllers">Required controllers</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The control groups filesystem supports multiple "controllers". By default
|
The control groups filesystem supports multiple "controllers". By default
|
||||||
@@ -23,13 +23,12 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
The QEMU driver is capable of using the <code>cpuset</code>,
|
The QEMU driver is capable of using the <code>cpuset</code>,
|
||||||
<code>cpu</code>, <code>cpuacct</code>, <code>memory</code>,
|
<code>cpu</code>, <code>memory</code>, <code>blkio</code> and
|
||||||
<code>blkio</code> and <code>devices</code> controllers.
|
<code>devices</code> controllers. None of them are compulsory.
|
||||||
None of them are compulsory. If any controller is not mounted,
|
If any controller is not mounted, the resource management APIs
|
||||||
the resource management APIs which use it will cease to operate.
|
which use it will cease to operate. It is possible to explicitly
|
||||||
It is possible to explicitly turn off use of a controller,
|
turn off use of a controller, even when mounted, via the
|
||||||
even when mounted, via the <code>/etc/libvirt/qemu.conf</code>
|
<code>/etc/libvirt/qemu.conf</code> configuration file.
|
||||||
configuration file.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -43,7 +42,7 @@
|
|||||||
which use them will cease to operate.
|
which use them will cease to operate.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="currentLayout">Current cgroups layout</a></h2>
|
<h2><a name="currentLayout">Current cgroups layout</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
As of libvirt 1.0.5 or later, the cgroups layout created by libvirt has been
|
As of libvirt 1.0.5 or later, the cgroups layout created by libvirt has been
|
||||||
@@ -64,29 +63,27 @@
|
|||||||
in two, one describing systemd hosts and the other non-systemd hosts.
|
in two, one describing systemd hosts and the other non-systemd hosts.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3><a id="currentLayoutSystemd">Systemd cgroups integration</a></h3>
|
<h3><a name="currentLayoutSystemd">Systemd cgroups integration</a></h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
On hosts which use systemd, each consumer maps to a systemd scope unit,
|
On hosts which use systemd, each consumer maps to a systemd scope unit,
|
||||||
while partitions map to a system slice unit.
|
while partitions map to a system slice unit.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h4><a id="systemdScope">Systemd scope naming</a></h4>
|
<h4><a name="systemdScope">Systemd scope naming</a></h4>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The systemd convention is for the scope name of virtual machines / containers
|
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
|
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
|
<code>$NAME</code> part of this by concatenating the driver type with the name
|
||||||
and truncated name of the guest, and then escaping any systemd reserved
|
of the guest, and then escaping any systemd reserved characters.
|
||||||
characters.
|
|
||||||
So for a guest <code>demo</code> running under the <code>lxc</code> driver,
|
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
|
we get a <code>$NAME</code> of <code>lxc-demo</code> which when escaped is
|
||||||
is <code>lxc\x2d12345\x2ddemo</code>. So the complete scope name is
|
<code>lxc\x2ddemo</code>. So the complete scope name is <code>machine-lxc\x2ddemo.scope</code>.
|
||||||
<code>machine-lxc\x2d12345\x2ddemo.scope</code>.
|
|
||||||
The scope names map directly to the cgroup directory names.
|
The scope names map directly to the cgroup directory names.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h4><a id="systemdSlice">Systemd slice naming</a></h4>
|
<h4><a name="systemdSlice">Systemd slice naming</a></h4>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The systemd convention for slice naming is that a slice should include the
|
The systemd convention for slice naming is that a slice should include the
|
||||||
@@ -99,7 +96,7 @@
|
|||||||
by libvirt will be associated with <code>machine.slice</code> by default.
|
by libvirt will be associated with <code>machine.slice</code> by default.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h4><a id="systemdLayout">Systemd cgroup layout</a></h4>
|
<h4><a name="systemdLayout">Systemd cgroup layout</a></h4>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Given this, a possible systemd cgroups layout involving 3 qemu guests,
|
Given this, a possible systemd cgroups layout involving 3 qemu guests,
|
||||||
@@ -115,19 +112,19 @@ $ROOT
|
|||||||
|
|
|
|
||||||
+- machine.slice
|
+- machine.slice
|
||||||
|
|
|
|
||||||
+- machine-qemu\x2d1\x2dvm1.scope
|
+- machine-qemu\x2dvm1.scope
|
||||||
| |
|
| |
|
||||||
| +- emulator
|
| +- emulator
|
||||||
| +- vcpu0
|
| +- vcpu0
|
||||||
| +- vcpu1
|
| +- vcpu1
|
||||||
|
|
|
|
||||||
+- machine-qemu\x2d2\x2dvm2.scope
|
+- machine-qemu\x2dvm2.scope
|
||||||
| |
|
| |
|
||||||
| +- emulator
|
| +- emulator
|
||||||
| +- vcpu0
|
| +- vcpu0
|
||||||
| +- vcpu1
|
| +- vcpu1
|
||||||
|
|
|
|
||||||
+- machine-qemu\x2d3\x2dvm3.scope
|
+- machine-qemu\x2dvm3.scope
|
||||||
| |
|
| |
|
||||||
| +- emulator
|
| +- emulator
|
||||||
| +- vcpu0
|
| +- vcpu0
|
||||||
@@ -137,18 +134,18 @@ $ROOT
|
|||||||
| |
|
| |
|
||||||
| +- machine-engineering-testing.slice
|
| +- machine-engineering-testing.slice
|
||||||
| | |
|
| | |
|
||||||
| | +- machine-lxc\x2d11111\x2dcontainer1.scope
|
| | +- machine-lxc\x2dcontainer1.scope
|
||||||
| |
|
| |
|
||||||
| +- machine-engineering-production.slice
|
| +- machine-engineering-production.slice
|
||||||
| |
|
| |
|
||||||
| +- machine-lxc\x2d22222\x2dcontainer2.scope
|
| +- machine-lxc\x2dcontainer2.scope
|
||||||
|
|
|
|
||||||
+- machine-marketing.slice
|
+- machine-marketing.slice
|
||||||
|
|
|
|
||||||
+- machine-lxc\x2d33333\x2dcontainer3.scope
|
+- machine-lxc\x2dcontainer3.scope
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3><a id="currentLayoutGeneric">Non-systemd cgroups layout</a></h3>
|
<h3><a name="currentLayoutGeneric">Non-systemd cgroups layout</a></h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
On hosts which do not use systemd, each consumer has a corresponding cgroup
|
On hosts which do not use systemd, each consumer has a corresponding cgroup
|
||||||
@@ -176,19 +173,19 @@ $ROOT
|
|||||||
|
|
|
|
||||||
+- machine
|
+- machine
|
||||||
|
|
|
|
||||||
+- qemu-1-vm1.libvirt-qemu
|
+- vm1.libvirt-qemu
|
||||||
| |
|
| |
|
||||||
| +- emulator
|
| +- emulator
|
||||||
| +- vcpu0
|
| +- vcpu0
|
||||||
| +- vcpu1
|
| +- vcpu1
|
||||||
|
|
|
|
||||||
+- qeme-2-vm2.libvirt-qemu
|
+- vm2.libvirt-qemu
|
||||||
| |
|
| |
|
||||||
| +- emulator
|
| +- emulator
|
||||||
| +- vcpu0
|
| +- vcpu0
|
||||||
| +- vcpu1
|
| +- vcpu1
|
||||||
|
|
|
|
||||||
+- qemu-3-vm3.libvirt-qemu
|
+- vm3.libvirt-qemu
|
||||||
| |
|
| |
|
||||||
| +- emulator
|
| +- emulator
|
||||||
| +- vcpu0
|
| +- vcpu0
|
||||||
@@ -198,18 +195,18 @@ $ROOT
|
|||||||
| |
|
| |
|
||||||
| +- testing.partition
|
| +- testing.partition
|
||||||
| | |
|
| | |
|
||||||
| | +- lxc-11111-container1.libvirt-lxc
|
| | +- container1.libvirt-lxc
|
||||||
| |
|
| |
|
||||||
| +- production.partition
|
| +- production.partition
|
||||||
| |
|
| |
|
||||||
| +- lxc-22222-container2.libvirt-lxc
|
| +- container2.libvirt-lxc
|
||||||
|
|
|
|
||||||
+- marketing.partition
|
+- marketing.partition
|
||||||
|
|
|
|
||||||
+- lxc-33333-container3.libvirt-lxc
|
+- container3.libvirt-lxc
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h2><a id="customPartiton">Using custom partitions</a></h2>
|
<h2><a name="customPartiton">Using custom partitions</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If there is a need to apply resource constraints to groups of
|
If there is a need to apply resource constraints to groups of
|
||||||
@@ -224,11 +221,11 @@ $ROOT
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
...
|
...
|
||||||
<resource>
|
<resource>
|
||||||
<partition>/machine/production</partition>
|
<partition>/machine/production</partition>
|
||||||
</resource>
|
</resource>
|
||||||
...
|
...
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -258,7 +255,7 @@ $ROOT
|
|||||||
later in this document did not support customization per guest.
|
later in this document did not support customization per guest.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3><a id="createSystemd">Creating custom partitions (systemd)</a></h3>
|
<h3><a name="createSystemd">Creating custom partitions (systemd)</a></h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Given the XML config above, the admin on a systemd based host would
|
Given the XML config above, the admin on a systemd based host would
|
||||||
@@ -275,7 +272,7 @@ EOF
|
|||||||
# systemctl start machine-testing.slice
|
# systemctl start machine-testing.slice
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3><a id="createNonSystemd">Creating custom partitions (non-systemd)</a></h3>
|
<h3><a name="createNonSystemd">Creating custom partitions (non-systemd)</a></h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Given the XML config above, the admin on a non-systemd based host
|
Given the XML config above, the admin on a non-systemd based host
|
||||||
@@ -294,7 +291,7 @@ EOF
|
|||||||
done
|
done
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h2><a id="resourceAPIs">Resource management APIs/commands</a></h2>
|
<h2><a name="resourceAPIs">Resource management APIs/commands</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Since libvirt aims to provide an API which is portable across
|
Since libvirt aims to provide an API which is portable across
|
||||||
@@ -357,7 +354,7 @@ swap_hard_limit: unlimited
|
|||||||
network interfaces.
|
network interfaces.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2><a id="legacyLayout">Legacy cgroups layout</a></h2>
|
<h2><a name="legacyLayout">Legacy cgroups layout</a></h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Prior to libvirt 1.0.5, the cgroups layout created by libvirt was different
|
Prior to libvirt 1.0.5, the cgroups layout created by libvirt was different
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user