Gentoo Archives: gentoo-commits

From: Samuel Bernardo <samuelbernardo.mail@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/user/ssnb:master commit in: app-emulation/libvirt/files/, app-emulation/libvirt/
Date: Sun, 10 Dec 2017 22:14:58
Message-Id: 1512944073.a1218e8a96c9126126e4517b42fc0123fe4888d5.samuelbernardo@gentoo
1 commit: a1218e8a96c9126126e4517b42fc0123fe4888d5
2 Author: Samuel Bernardo <samuelbernardo.mail <AT> gmail <DOT> com>
3 AuthorDate: Sun Dec 10 22:14:33 2017 +0000
4 Commit: Samuel Bernardo <samuelbernardo.mail <AT> gmail <DOT> com>
5 CommitDate: Sun Dec 10 22:14:33 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/user/ssnb.git/commit/?id=a1218e8a
7
8 libvirt version working with glibc-2.26
9
10 app-emulation/libvirt/Manifest | 18 +
11 app-emulation/libvirt/files/README.gentoo-r2 | 58 ++++
12 ...irt-1.2.16-fix_paths_in_libvirt-guests_sh.patch | 19 +
13 .../files/libvirt-1.3.0-do_not_use_sysconf.patch | 114 ++++++
14 .../libvirt/files/libvirt-1.3.4-glibc-2.23.patch | 86 +++++
15 .../files/libvirt-3.1.0-musl-fix-includes.patch | 10 +
16 .../libvirt-3.10.0-fix_paths_for_apparmor.patch | 118 +++++++
17 app-emulation/libvirt/files/libvirt-guests.confd | 68 ++++
18 app-emulation/libvirt/files/libvirt-guests.init-r2 | 235 +++++++++++++
19 app-emulation/libvirt/files/libvirtd.confd-r5 | 18 +
20 app-emulation/libvirt/files/libvirtd.init-r16 | 34 ++
21 app-emulation/libvirt/files/libvirtd.service.conf | 10 +
22 app-emulation/libvirt/files/libvirtd.tmpfiles.conf | 1 +
23 app-emulation/libvirt/files/virtlockd.init-r1 | 23 ++
24 app-emulation/libvirt/files/virtlogd.init-r1 | 23 ++
25 app-emulation/libvirt/libvirt-3.10.0-r1.ebuild | 382 +++++++++++++++++++++
26 app-emulation/libvirt/libvirt-9999.ebuild | 379 ++++++++++++++++++++
27 app-emulation/libvirt/metadata.xml | 102 ++++++
28 18 files changed, 1698 insertions(+)
29
30 diff --git a/app-emulation/libvirt/Manifest b/app-emulation/libvirt/Manifest
31 new file mode 100644
32 index 0000000..d339c39
33 --- /dev/null
34 +++ b/app-emulation/libvirt/Manifest
35 @@ -0,0 +1,18 @@
36 +AUX README.gentoo-r2 2094 SHA256 e4360cd1a0ab23180fcc4dc97958f043aedb0b7564f2b7172dbe5e8240c3c247 SHA512 595ede7bb574c7f244a15e430b70f828bc4574b409d4cc37261bf38bfb30cdb31edb6091ff63f6517b281cc11a34eee960ea0330a6ea285dd48fe2288dd67196 WHIRLPOOL 820501bc603a28041eab27221024957a428a59c3edc8eebe4209d984b7f81f1c67da1186f7d402c237dc0a8b4c633266edb2d46255e1305fa4708da8a7be2f96
37 +AUX libvirt-1.2.16-fix_paths_in_libvirt-guests_sh.patch 641 SHA256 a8417304d8dfd4d042956d33bfb373d61c7c2c0e8ead8c384300bf32f8acee8e SHA512 df9960b80c7dda852e38d992ab31181d79091bd6e1ba88c0b0c1af8a2f2d1445ee95c957df38ab27b452cd2de01d36b88164e665a867ad69c15ca15c18b1d588 WHIRLPOOL 892bc9d14257929718e29671bea2eb44ed25a8ed5f7f4d8ee72c9d82a4e6a96b5da67f43279de29c06d6abe41ab2792b48515c2dea46aa4a452d76e85ebda973
38 +AUX libvirt-1.3.0-do_not_use_sysconf.patch 4072 SHA256 896d482d3aa9281977e6900e6103848e34a7e4c0479395016fd1d2ff254eb476 SHA512 44428e16cf1998db0bcae1b54d3ba32363a71db3f45f493bd675f6ad7d6bf131667749f33226ab5f40be52e833ec0899bb9202a8f0e150d007c3f7c71a9cf314 WHIRLPOOL 4978b13925c4836d1601217aec9473a62797821275a1c2bab4a7acb80fa3a34a54ed01b3daf91cd78c20622f3be6f6f9214399fc7da63172a5f9e138727b4fcf
39 +AUX libvirt-1.3.4-glibc-2.23.patch 2049 SHA256 8fa125da2a8e6dabf17fc47863597b2b3929d4d4b1e01ace1433a75ac4bc0ba2 SHA512 022b610c2e343c9cb595babcc8b2e5e0e0db1a19d6bfc9babdc817bc1e093ff12ee1c26304c188151fecc32481ffd225d7a3d36324613dd5b4ea7139280629c4 WHIRLPOOL 3cc039820865eafd1ea23eec81c3b4f842fe359e49a85d09925dddd5f8b0228adf62fa908cb345b9df0526ed9eb388f965d70ef99d73edcfaf20c5539fcb4559
40 +AUX libvirt-3.1.0-musl-fix-includes.patch 221 SHA256 40b1814d2a1d05a987242af46592a74feb612ccb3f064e93984bdad29d9c1fc7 SHA512 876c7dacedcce1d69938779b978b3a23b2f51128f121b4aa53f5f301d7740f90d77f335523210ed492b68b5f7a0b864b25a694ee562fb5e8ab1b6411d3da48e7 WHIRLPOOL d9d7f57cee28f1f6149f6de6f853f08679cbb9b3e82b019ff6046da525c1768ea3f7ef34cf3afa6033e87f80e8f5c74e5f2d129122d8df6edb371e743a3a3af5
41 +AUX libvirt-3.10.0-fix_paths_for_apparmor.patch 3504 SHA256 b09888e448ec3253ca63a7daae8b19ae1ad85eaa99cb28b1989bae3c7c999a08 SHA512 4fc444f73f69c03c46e21ba51a8ecb9d089fa944ddf22985ca1d595a40535bf2e93f8d76ae64e5abc3b51f5f9007f84dea5e29533629297623abd116b700f6e3 WHIRLPOOL 50664d86f0c6f3d282fc3b7d4c0706fa8e8afb02413b22d3265fb951802b1829f599099502db2487583968f348258c80ca249c9c8f68bcd7965240f5eb4c32d3
42 +AUX libvirt-guests.confd 2430 SHA256 d5f85bb8c1d2010347f23badc422e98046b97a0066254739b5829fce07837d63 SHA512 78f419a89de7aabaad860903c24f1c070786fc1296d987e61dd537705b0e7f71a46c315888028f3826c3417e42861ca8471788be4ec5695e98427c5f18ae63fc WHIRLPOOL 4f06b9319f52b872f14f86da9aeeafecf176c46755955c7773badd0df239fdd76efaff50921565154fa24896d0e4b07df788e785ed6ff5f2308c0ba0e79a9418
43 +AUX libvirt-guests.init-r2 5412 SHA256 f78ced5ebe644522c6ce102b3f6bcf932686243a50629559f988548c570cad3a SHA512 0f46ec5776c61d1776248779fa894b1a6d7b98d0eb8e8374b320c785c25d92468f087e350233b9152eb2cd0680f6b334c3a61684dabc7c5b559d3b55fdcb712d WHIRLPOOL 77ce5c6e615c94b437f13f8bfb2689cea7b8231a4aa227e83944fd66793a3daf0ada8c041c358f38c2f676dfc7fb071880df682dcc759f63e8e20f033e141d39
44 +AUX libvirtd.confd-r5 740 SHA256 4f7fba7e64533868119c0f3355aa22932e163b208397323dc2cd96daadcc4079 SHA512 98f935589dbc5f2a99329f77fdf84c563fa0dc99404b7476603679478d68ce8dbea2c88645251d3c28f59e7bcae124ae632972146e8a8c3e0e9fcbfb27296f91 WHIRLPOOL cc40f10c1ab440efff318f4cac95c0923dfb3309e727d3de4a5dd5cd95181da76a6f1de4ad6740b99d0b65b6bbf5a5128ce24288f77a91268e74d2e8d8e95e49
45 +AUX libvirtd.init-r16 1093 SHA256 1f875e12cc6ecb1b434bfea774893b84f6602072da0218b654d2ecf79cf2d36d SHA512 5ea4c2f9e48faf2aa8fe7077d075841d610da17e28bcc85c79c55565f286e345339f042090b453e25accf5c405e322e76b6cf846fdfb3e90db3e2d0c2fff4c48 WHIRLPOOL 1de3b7c8fab0ec92d1138f6de9f7ba38087de7094908fc9205d91bfa0bc667d11dff2e113cf393f5508b23badf3a2e524c6f81d5a3b817a7b9d198f0b504332a
46 +AUX libvirtd.service.conf 401 SHA256 1cfb6f7dec5746364d9a4cccddb4b63f8ccd0ebf8bfaa000b13a09962ca24fac SHA512 27adbd104ea87e51d423b057392a0c6726692ad8ee9723f73dc4bfe8eb54069725d64883434424ba810d36992d404d1ba4afe6bcefb866d3d3d92dfd161c2b32 WHIRLPOOL d6b960b7d18bdbaf0ff6dc5ecf29e7d10e22fa7d16933a149d6287c007d864a0e0dd67048c25a038dd5f73c9ea911d2cd49bf21c072b0c7eab1e92be35d8b545
47 +AUX libvirtd.tmpfiles.conf 36 SHA256 0102a9bbbb6fc9764c2d49933a89d1661b3999aec53c6a66302cb0f21ce9c9fc SHA512 2b1c3c64dd6fa03d8c2ae24e7ce4aa7d754913214542a68a4e99f10fbc251fd23ee26e297a957d7b4b70eec8ef028c41fc915da3a85fbbd16143bb92d1de3aed WHIRLPOOL c51b2059f4eef0ceaf69e11018a6e51299be5aa21a56741366db4fe43a7998388fa6e5bf15d79c52ab66dd69d64c679003a0904c54033c8bdfc04c16bb5b8e4f
48 +AUX virtlockd.init-r1 570 SHA256 23ddea66fb2d85c17c382daa07abfabe7fa57d62406d2ca5df0c755f5dcc3834 SHA512 65a05d406200da9a534df5caa1b9cb2af97f0b03f64e6b4157322975fa754f59ae74fff9ec8301a6c0510e4b75e2b72a78cddf004a76109e18c375e83527cee5 WHIRLPOOL 7959e426986747165ef074ca52b8049aa4120b0206b7532330346552fe5811a46fa71b58e02fcd37e55b872e099ccc8688fcc3f30b2e2316e01a4220806d49b4
49 +AUX virtlogd.init-r1 569 SHA256 1647c11779fd874bdc115234bae0f0f65278084541473d2825aa9864ad49f939 SHA512 0a3e083e742f9e0d8206ab9a48c63bbd395bdc24e5551e2cbeddffa3fb576a817b73dbafe646c392a35c354d6b65426a9b6f3ce3dcafc30077715e90684968c1 WHIRLPOOL e0fa334c60dac4aa1ff721c3c4e957a688e0a58297cb06249de50dd838c55eee3c1c00fcb4b1c06b74c1fb61c52354889a09bd2793c8623faa120489cac95c3a
50 +DIST libvirt-3.10.0.tar.xz 14952220 SHA256 dff109cae2cc915b3ed5ba7e460502b85eb9a5058cda4f356d7bb7b1e3196b0e SHA512 c2dfe0629bd90e8d7ae85f2a31dc027475c9614d497063fec6905aa2da4db68ce96e8f20d3290b0c0542b6ea31c85700b2727008bac65997ff0901b45f1b7260 WHIRLPOOL b2eeee1a75fbd8d3878fb646ebc432abdb53568741cf0efbdd9a7b78035e5d8a50720890861c7e8b11e1ec92a9e00b3142f52d7799118255dffedba90245a0c6
51 +EBUILD libvirt-3.10.0-r1.ebuild 9635 SHA256 785314548039f033b8c1d76c25059e8e5c449e623415618eacd021b616b30b99 SHA512 ac6dd002208619d19d058249df5c4d0f1197c4d4f925b19bd0fcdf4fcde9111f46d51ca71999b55b1249cd3f6307a73f1af119aadfa0243823519eb114dc19f5 WHIRLPOOL e8c1e60a0f205b1f2ec21a99fb8c2df60809b92a80ea741126ba57f37c7c2b1303b44be26d97c5e6c0fb084c8073a496eb8474fa06f0a0b9ddfff3ba30f78261
52 +EBUILD libvirt-9999.ebuild 9506 SHA256 d5af8cfea0f8f40cb4c1e474a64709440cd5fc31672af9be7bc607fcec880f04 SHA512 669472ae963372efc043f20dcf3a38d06fcdf45eb80ca13c7b76e6fed35590255206731ebd4a42b95017399bba309d49e734c14c07c9b5dc22cc7ae7819dbac2 WHIRLPOOL 1158f1338973b99a1dc518aae73e50015fff4cc2a7d8afee086784525571b2668b76dd5f6eaf5391d8a80d6817f4d8c5caf363d93e758b89202ee73e4c047f43
53 +MISC metadata.xml 3779 SHA256 4e9be58ed2f7a2426e897aa3530aaeadff88477cabf988545e90d947cccfb859 SHA512 071cc7193ce6b2d6e1a1557f0977697bf7edc07b947fe51cc126975b2bbe7e64079db154112b99bbe88c0c237f2252f4608a7d31c9140b7afd27b00f5dce5a02 WHIRLPOOL 72523ef832a3edb2bcc69154680ea085c5c6f77a12b33be42d558490c499cbbb6edf8161b8b399d3f72b700a165e78669034ad2fd04e237ffae845f7a29396ba
54
55 diff --git a/app-emulation/libvirt/files/README.gentoo-r2 b/app-emulation/libvirt/files/README.gentoo-r2
56 new file mode 100644
57 index 0000000..1c086c1
58 --- /dev/null
59 +++ b/app-emulation/libvirt/files/README.gentoo-r2
60 @@ -0,0 +1,58 @@
61 +Important: The openrc libvirtd init script is now broken up into two
62 +separate services: libvirtd, that solely handles the daemon, and
63 +libvirt-guests, that takes care of clients during shutdown/restart of the
64 +host. In order to reenable client handling, edit /etc/conf.d/libvirt-guests
65 +and enable the service and start it:
66 +
67 + $ rc-update add libvirt-guests
68 + $ service libvirt-guests start
69 +
70 +
71 +For the basic networking support (bridged and routed networks) you don't
72 +need any extra software. For more complex network modes including but not
73 +limited to NATed network, you can enable the 'virt-network' USE flag. It
74 +will pull in required runtime dependencies
75 +
76 +
77 +If you are using dnsmasq on your system, you will have to configure
78 +/etc/dnsmasq.conf to enable the following settings:
79 +
80 + bind-interfaces
81 + interface or except-interface
82 +
83 +Otherwise you might have issues with your existing DNS server.
84 +
85 +
86 +For openrc users:
87 +
88 + Please use /etc/conf.d/libvirtd to control the '--listen' parameter for
89 + libvirtd.
90 +
91 + Use /etc/init.d/libvirt-guests to manage clients on restart/shutdown of
92 + the host. The default configuration will suspend and resume running kvm
93 + guests with 'managedsave'. This behavior can be changed under
94 + /etc/conf.d/libvirt-guests
95 +
96 +
97 +For systemd users:
98 +
99 + Please use /etc/systemd/system/libvirtd.service.d/00gentoo.conf
100 + to control the '--listen' parameter for libvirtd.
101 +
102 + The configuration for the 'libvirt-guests.service' is found under
103 + /etc/libvirt/libvirt-guests.conf"
104 +
105 +
106 +If you have built libvirt with policykit support, a new group "libvirt" has
107 +been created. Simply add a user to the libvirt group in order to grant
108 +administrative access to libvirtd. Alternatively, drop a custom policykit
109 +rule into /etc/polkit-1/rules.d.
110 +
111 +If you have built libvirt without policykit support (USE=-policykit), you
112 +must change the unix sock group and/or perms in /etc/libvirt/libvirtd.conf
113 +in order to allow normal users to connect to libvirtd.
114 +
115 +
116 +If libvirtd is built with USE=caps, libvirt will now start qemu/kvm VMs
117 +with non-root privileges. Ensure any resources your VMs use are accessible
118 +by qemu:qemu.
119
120 diff --git a/app-emulation/libvirt/files/libvirt-1.2.16-fix_paths_in_libvirt-guests_sh.patch b/app-emulation/libvirt/files/libvirt-1.2.16-fix_paths_in_libvirt-guests_sh.patch
121 new file mode 100644
122 index 0000000..ddedb1f
123 --- /dev/null
124 +++ b/app-emulation/libvirt/files/libvirt-1.2.16-fix_paths_in_libvirt-guests_sh.patch
125 @@ -0,0 +1,19 @@
126 +diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in
127 +index 7f74b85..ea58119 100644
128 +--- a/tools/libvirt-guests.sh.in
129 ++++ b/tools/libvirt-guests.sh.in
130 +@@ -41,11 +41,11 @@ CONNECT_RETRIES=10
131 + RETRIES_SLEEP=1
132 + SYNC_TIME=0
133 +
134 +-test -f "$sysconfdir"/sysconfig/libvirt-guests &&
135 +- . "$sysconfdir"/sysconfig/libvirt-guests
136 ++test -f "$sysconfdir"/libvirt/libvirt-guests.conf &&
137 ++ . "$sysconfdir"/libvirt/libvirt-guests.conf
138 +
139 + LISTFILE="$localstatedir"/lib/libvirt/libvirt-guests
140 +-VAR_SUBSYS_LIBVIRT_GUESTS="$localstatedir"/lock/subsys/libvirt-guests
141 ++VAR_SUBSYS_LIBVIRT_GUESTS="$localstatedir"/lock/libvirt-guests
142 +
143 + RETVAL=0
144 +
145
146 diff --git a/app-emulation/libvirt/files/libvirt-1.3.0-do_not_use_sysconf.patch b/app-emulation/libvirt/files/libvirt-1.3.0-do_not_use_sysconf.patch
147 new file mode 100644
148 index 0000000..47010c4
149 --- /dev/null
150 +++ b/app-emulation/libvirt/files/libvirt-1.3.0-do_not_use_sysconf.patch
151 @@ -0,0 +1,114 @@
152 +diff --git a/daemon/Makefile.am b/daemon/Makefile.am
153 +index be1b5a9..5ce0e1e 100644
154 +--- a/daemon/Makefile.am
155 ++++ b/daemon/Makefile.am
156 +@@ -385,9 +385,7 @@ uninstall-logrotate:
157 + rmdir $(DESTDIR)$(sysconfdir)/logrotate.d || :
158 +
159 + install-sysconfig:
160 +- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
161 +- $(INSTALL_DATA) $(srcdir)/libvirtd.sysconf \
162 +- $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
163 ++
164 + uninstall-sysconfig:
165 + rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
166 + rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
167 +diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
168 +index 608221c..63708f4 100644
169 +--- a/daemon/libvirtd.service.in
170 ++++ b/daemon/libvirtd.service.in
171 +@@ -12,8 +12,7 @@ Documentation=http://libvirt.org
172 +
173 + [Service]
174 + Type=notify
175 +-EnvironmentFile=-/etc/sysconfig/libvirtd
176 +-ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
177 ++ExecStart=@sbindir@/libvirtd
178 + ExecReload=/bin/kill -HUP $MAINPID
179 + KillMode=process
180 + Restart=on-failure
181 +diff --git a/src/Makefile.am b/src/Makefile.am
182 +index 7219f7c..c474a23 100644
183 +--- a/src/Makefile.am
184 ++++ b/src/Makefile.am
185 +@@ -2473,11 +2473,6 @@ EXTRA_DIST += \
186 + logging/virtlogd.sysconf
187 +
188 + install-sysconfig:
189 +- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
190 +- $(INSTALL_DATA) $(srcdir)/locking/virtlockd.sysconf \
191 +- $(DESTDIR)$(sysconfdir)/sysconfig/virtlockd
192 +- $(INSTALL_DATA) $(srcdir)/logging/virtlogd.sysconf \
193 +- $(DESTDIR)$(sysconfdir)/sysconfig/virtlogd
194 +
195 + uninstall-sysconfig:
196 + rm -f $(DESTDIR)$(sysconfdir)/sysconfig/virtlogd
197 +diff --git a/src/locking/virtlockd.service.in b/src/locking/virtlockd.service.in
198 +index 57089b0..ace0c83 100644
199 +--- a/src/locking/virtlockd.service.in
200 ++++ b/src/locking/virtlockd.service.in
201 +@@ -5,8 +5,7 @@ Documentation=man:virtlockd(8)
202 + Documentation=http://libvirt.org
203 +
204 + [Service]
205 +-EnvironmentFile=-/etc/sysconfig/virtlockd
206 +-ExecStart=@sbindir@/virtlockd $VIRTLOCKD_ARGS
207 ++ExecStart=@sbindir@/virtlockd
208 + ExecReload=/bin/kill -USR1 $MAINPID
209 + # Loosing the locks is a really bad thing that will
210 + # cause the machine to be fenced (rebooted), so make
211 +diff --git a/src/logging/virtlogd.service.in b/src/logging/virtlogd.service.in
212 +index a264d3a..b467884 100644
213 +--- a/src/logging/virtlogd.service.in
214 ++++ b/src/logging/virtlogd.service.in
215 +@@ -5,8 +5,7 @@ Documentation=man:virtlogd(8)
216 + Documentation=http://libvirt.org
217 +
218 + [Service]
219 +-EnvironmentFile=-/etc/sysconfig/virtlogd
220 +-ExecStart=@sbindir@/virtlogd $VIRTLOGD_ARGS
221 ++ExecStart=@sbindir@/virtlogd
222 + ExecReload=/bin/kill -USR1 $MAINPID
223 + # Loosing the logs is a really bad thing that will
224 + # cause the machine to be fenced (rebooted), so make
225 +diff --git a/tools/Makefile.am b/tools/Makefile.am
226 +index 9180564..e72d5f4 100644
227 +--- a/tools/Makefile.am
228 ++++ b/tools/Makefile.am
229 +@@ -293,7 +293,7 @@ uninstall-local: uninstall-init uninstall-systemd
230 + install-sysconfig:
231 + $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
232 + $(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \
233 +- $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
234 ++ $(DESTDIR)$(sysconfdir)/libvirt/libvirt-guests.conf
235 +
236 + uninstall-sysconfig:
237 + rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
238 +diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
239 +index c31f663..71cb79d 100644
240 +--- a/tools/libvirt-guests.service.in
241 ++++ b/tools/libvirt-guests.service.in
242 +@@ -5,7 +5,7 @@ Documentation=man:libvirtd(8)
243 + Documentation=http://libvirt.org
244 +
245 + [Service]
246 +-EnvironmentFile=-/etc/sysconfig/libvirt-guests
247 ++EnvironmentFile=-/etc/libvirt/libvirt-guests.conf
248 + # Hack just call traditional service until we factor
249 + # out the code
250 + ExecStart=@libexecdir@/libvirt-guests.sh start
251 +diff --git a/tools/libvirt-guests.sysconf b/tools/libvirt-guests.sysconf
252 +index 2770056..accd4f5 100644
253 +--- a/tools/libvirt-guests.sysconf
254 ++++ b/tools/libvirt-guests.sysconf
255 +@@ -1,3 +1,10 @@
256 ++#
257 ++# Warning: This configuration file is only sourced by the systemd
258 ++# libvirt-guests.service unit. The coresponding openrc facility is in
259 ++# /etc/init.d/libvirtd and /etc/conf.d/libvirtd
260 ++#
261 ++
262 ++
263 + # URIs to check for running guests
264 + # example: URIS='default xen:/// vbox+tcp://host/system lxc:///'
265 + #URIS=default
266
267 diff --git a/app-emulation/libvirt/files/libvirt-1.3.4-glibc-2.23.patch b/app-emulation/libvirt/files/libvirt-1.3.4-glibc-2.23.patch
268 new file mode 100644
269 index 0000000..adeff5c
270 --- /dev/null
271 +++ b/app-emulation/libvirt/files/libvirt-1.3.4-glibc-2.23.patch
272 @@ -0,0 +1,86 @@
273 +get major/minor macros by using AC_HEADER_MAJOR
274 +
275 +https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Headers.html#AC_HEADER_MAJOR
276 +
277 +https://bugs.gentoo.org/579960
278 +diff --git a/configure.ac b/configure.ac
279 +index 93d347c..1e7ee51 100644
280 +--- a/configure.ac
281 ++++ b/configure.ac
282 +@@ -282,2 +282,5 @@ AC_CHECK_SIZEOF([long])
283 +
284 ++dnl detect system-specific headers for major()/minor()
285 ++AC_HEADER_MAJOR
286 ++
287 + dnl Availability of various common functions (non-fatal if missing),
288 +diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
289 +index bd2eeb6..74b2487 100644
290 +--- a/src/conf/domain_audit.c
291 ++++ b/src/conf/domain_audit.c
292 +@@ -28,2 +28,9 @@
293 +
294 ++#ifdef MAJOR_IN_MKDEV
295 ++# include <sys/mkdev.h>
296 ++#endif
297 ++#ifdef MAJOR_IN_SYSMACROS
298 ++# include <sys/sysmacros.h>
299 ++#endif
300 ++
301 + #include "domain_audit.h"
302 +diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
303 +index 76bef82..49c0648 100644
304 +--- a/src/lxc/lxc_controller.c
305 ++++ b/src/lxc/lxc_controller.c
306 +@@ -48,2 +48,9 @@
307 +
308 ++#ifdef MAJOR_IN_MKDEV
309 ++# include <sys/mkdev.h>
310 ++#endif
311 ++#ifdef MAJOR_IN_SYSMACROS
312 ++# include <sys/sysmacros.h>
313 ++#endif
314 ++
315 + #include "virerror.h"
316 +diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
317 +index 3c6c839..983cd21 100644
318 +--- a/src/lxc/lxc_driver.c
319 ++++ b/src/lxc/lxc_driver.c
320 +@@ -38,2 +38,9 @@
321 +
322 ++#ifdef MAJOR_IN_MKDEV
323 ++# include <sys/mkdev.h>
324 ++#endif
325 ++#ifdef MAJOR_IN_SYSMACROS
326 ++# include <sys/sysmacros.h>
327 ++#endif
328 ++
329 + #include "virerror.h"
330 +diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
331 +index 38398fd..4b45458 100644
332 +--- a/src/util/vircgroup.c
333 ++++ b/src/util/vircgroup.c
334 +@@ -31,2 +31,10 @@
335 + #endif
336 ++
337 ++#ifdef MAJOR_IN_MKDEV
338 ++# include <sys/mkdev.h>
339 ++#endif
340 ++#ifdef MAJOR_IN_SYSMACROS
341 ++# include <sys/sysmacros.h>
342 ++#endif
343 ++
344 + #include <fcntl.h>
345 +diff --git a/src/util/virutil.c b/src/util/virutil.c
346 +index bb9604a..9840a9e 100644
347 +--- a/src/util/virutil.c
348 ++++ b/src/util/virutil.c
349 +@@ -68,2 +68,9 @@
350 +
351 ++#ifdef MAJOR_IN_MKDEV
352 ++# include <sys/mkdev.h>
353 ++#endif
354 ++#ifdef MAJOR_IN_SYSMACROS
355 ++# include <sys/sysmacros.h>
356 ++#endif
357 ++
358 + #include "c-ctype.h"
359
360 diff --git a/app-emulation/libvirt/files/libvirt-3.1.0-musl-fix-includes.patch b/app-emulation/libvirt/files/libvirt-3.1.0-musl-fix-includes.patch
361 new file mode 100644
362 index 0000000..70fb168
363 --- /dev/null
364 +++ b/app-emulation/libvirt/files/libvirt-3.1.0-musl-fix-includes.patch
365 @@ -0,0 +1,10 @@
366 +--- a/src/storage/storage_backend_fs.c
367 ++++ b/src/storage/storage_backend_fs.c
368 +@@ -30,6 +30,7 @@
369 + #include <dirent.h>
370 + #include <errno.h>
371 + #include <fcntl.h>
372 ++#include <paths.h>
373 + #include <unistd.h>
374 + #include <string.h>
375 +
376
377 diff --git a/app-emulation/libvirt/files/libvirt-3.10.0-fix_paths_for_apparmor.patch b/app-emulation/libvirt/files/libvirt-3.10.0-fix_paths_for_apparmor.patch
378 new file mode 100644
379 index 0000000..0e386c1
380 --- /dev/null
381 +++ b/app-emulation/libvirt/files/libvirt-3.10.0-fix_paths_for_apparmor.patch
382 @@ -0,0 +1,118 @@
383 +diff --git a/examples/Makefile.am b/examples/Makefile.am
384 +index ef2f79d..d8cdb9b 100644
385 +--- a/examples/Makefile.am
386 ++++ b/examples/Makefile.am
387 +@@ -23,7 +23,7 @@ EXTRA_DIST = \
388 + apparmor/TEMPLATE.lxc \
389 + apparmor/libvirt-qemu \
390 + apparmor/libvirt-lxc \
391 +- apparmor/usr.lib.libvirt.virt-aa-helper \
392 ++ apparmor/usr.libexec.virt-aa-helper \
393 + apparmor/usr.sbin.libvirtd \
394 + lxcconvert/virt-lxc-convert \
395 + polkit/libvirt-acl.rules \
396 +@@ -70,7 +70,7 @@ admin_logging_SOURCES = admin/logging.c
397 + if WITH_APPARMOR_PROFILES
398 + apparmordir = $(sysconfdir)/apparmor.d/
399 + apparmor_DATA = \
400 +- apparmor/usr.lib.libvirt.virt-aa-helper \
401 ++ apparmor/usr.libexec.virt-aa-helper \
402 + apparmor/usr.sbin.libvirtd \
403 + $(NULL)
404 +
405 +diff --git a/examples/apparmor/libvirt-qemu b/examples/apparmor/libvirt-qemu
406 +index d4fad85..0b22009 100644
407 +--- a/examples/apparmor/libvirt-qemu
408 ++++ b/examples/apparmor/libvirt-qemu
409 +@@ -86,6 +86,8 @@
410 + /usr/share/AAVMF/** r,
411 + /usr/share/qemu-efi/** r,
412 + /usr/share/slof/** r,
413 ++ /usr/share/seavgabios/** r,
414 ++ /usr/share/edk2-ovmf/** r,
415 +
416 + # access PKI infrastructure
417 + /etc/pki/libvirt-vnc/** r,
418 +diff --git a/examples/apparmor/usr.lib.libvirt.virt-aa-helper b/examples/apparmor/usr.lib.libvirt.virt-aa-helper
419 +deleted file mode 100644
420 +index bd6181d..0000000
421 +--- a/examples/apparmor/usr.lib.libvirt.virt-aa-helper
422 ++++ /dev/null
423 +@@ -1,60 +0,0 @@
424 +-# Last Modified: Mon Apr 5 15:10:27 2010
425 +-#include <tunables/global>
426 +-
427 +-profile virt-aa-helper /usr/{lib,lib64}/libvirt/virt-aa-helper {
428 +- #include <abstractions/base>
429 +-
430 +- # needed for searching directories
431 +- capability dac_override,
432 +- capability dac_read_search,
433 +-
434 +- # needed for when disk is on a network filesystem
435 +- network inet,
436 +- network inet6,
437 +-
438 +- deny @{PROC}/[0-9]*/mounts r,
439 +- @{PROC}/[0-9]*/net/psched r,
440 +- owner @{PROC}/[0-9]*/status r,
441 +- @{PROC}/filesystems r,
442 +-
443 +- /etc/libnl-3/classid r,
444 +-
445 +- # for hostdev
446 +- /sys/devices/ r,
447 +- /sys/devices/** r,
448 +- deny /dev/sd* r,
449 +- deny /dev/vd* r,
450 +- deny /dev/dm-* r,
451 +- deny /dev/drbd[0-9]* r,
452 +- deny /dev/dasd* r,
453 +- deny /dev/nvme* r,
454 +- deny /dev/zd[0-9]* r,
455 +- deny /dev/mapper/ r,
456 +- deny /dev/mapper/* r,
457 +-
458 +- /usr/{lib,lib64}/libvirt/virt-aa-helper mr,
459 +- /{usr/,}sbin/apparmor_parser Ux,
460 +-
461 +- /etc/apparmor.d/libvirt/* r,
462 +- /etc/apparmor.d/libvirt/libvirt-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]* rw,
463 +-
464 +- # for backingstore -- allow access to non-hidden files in @{HOME} as well
465 +- # as storage pools
466 +- audit deny @{HOME}/.* mrwkl,
467 +- audit deny @{HOME}/.*/ rw,
468 +- audit deny @{HOME}/.*/** mrwkl,
469 +- audit deny @{HOME}/bin/ rw,
470 +- audit deny @{HOME}/bin/** mrwkl,
471 +- @{HOME}/ r,
472 +- @{HOME}/** r,
473 +- /var/lib/libvirt/images/ r,
474 +- /var/lib/libvirt/images/** r,
475 +- /{media,mnt,opt,srv}/** r,
476 +-
477 +- /**.img r,
478 +- /**.qcow{,2} r,
479 +- /**.qed r,
480 +- /**.vmdk r,
481 +- /**.[iI][sS][oO] r,
482 +- /**/disk{,.*} r,
483 +-}
484 +diff --git a/examples/apparmor/usr.sbin.libvirtd b/examples/apparmor/usr.sbin.libvirtd
485 +index 8d61d15..656a559 100644
486 +--- a/examples/apparmor/usr.sbin.libvirtd
487 ++++ b/examples/apparmor/usr.sbin.libvirtd
488 +@@ -84,8 +84,10 @@
489 + audit deny /sys/kernel/security/apparmor/.* rwxl,
490 + /sys/kernel/security/apparmor/profiles r,
491 + /usr/{lib,lib64}/libvirt/* PUxr,
492 +- /usr/{lib,lib64}/libvirt/libvirt_parthelper ix,
493 +- /usr/{lib,lib64}/libvirt/libvirt_iohelper ix,
494 ++ /usr/libexec/virt-aa-helper PUxr,
495 ++ /usr/libexec/libvirt_lxc PUxr,
496 ++ /usr/libexec/libvirt_parthelper ix,
497 ++ /usr/libexec/libvirt_iohelper ix,
498 + /etc/libvirt/hooks/** rmix,
499 + /etc/xen/scripts/** rmix,
500 +
501
502 diff --git a/app-emulation/libvirt/files/libvirt-guests.confd b/app-emulation/libvirt/files/libvirt-guests.confd
503 new file mode 100644
504 index 0000000..ed2ce58
505 --- /dev/null
506 +++ b/app-emulation/libvirt/files/libvirt-guests.confd
507 @@ -0,0 +1,68 @@
508 +# /etc/conf.d/libvirtd
509 +
510 +# LIBVIRT_URIS
511 +# space separated list of libvirt URIs to communicate with to start/stop guests
512 +# Valid values are anything that can be passed to 'virsh connect'
513 +
514 +#LIBVIRT_URIS="qemu:///system"
515 +
516 +
517 +# LIBVIRT_SHUTDOWN
518 +# Valid options:
519 +# * managedsave - Performs a state save external to the VM (for hypervisors
520 +# supporting this operation). qemu-kvm will stop the CPU
521 +# and save off all state to a separate file. When the
522 +# machine is started again, it will resume like nothing
523 +# ever happened. This is guarenteed to always successfully
524 +# stop your machine and restart it.
525 +#
526 +# * shutdown - Sends an ACPI shutdown (think of this as a request to
527 +# your guest to shutdown). There is no way to distinguish
528 +# between guests that are ignoring the shutdown request or
529 +# are stuck or are taking a long time to shutdown. We will
530 +# wait LIBVIRT_MAXWAIT seconds before yanking the power
531 +# out.
532 +#
533 +# * destroy - Immediately stop all running guests. Use with caution as
534 +# this can leave the guest in a corrupted state and might
535 +# lead to data loss.
536 +#
537 +
538 +#LIBVIRT_SHUTDOWN="managedsave"
539 +
540 +
541 +# LIBVIRT_MAXWAIT
542 +# Timeout in seconds until stopping a guest and "pulling the plug" on the
543 +# guest
544 +# Valid values are any integer over 0
545 +
546 +#LIBVIRT_MAXWAIT="500"
547 +
548 +
549 +# LIBVIRT_START
550 +# If this value is set to 'no', then guests and networks that were shutdown
551 +# by this script when it was stopped will not be started when it is started
552 +# back up.
553 +# Valid values are yes or no
554 +
555 +#LIBVIRT_START="yes"
556 +
557 +
558 +# LIBVIRT_IGNORE_AUTOSTART
559 +# If the VM is marked for autostart in its XML configuration then we won't
560 +# save its start when the init script is stopped. The result is that when
561 +# the init script starts back up, no attempt will be made to start the VM or
562 +# confirm it is started.
563 +# Valid values are yes or no
564 +
565 +#LIBVIRT_IGNORE_AUTOSTART="no"
566 +
567 +
568 +# LIBVIRT_NET_SHUTDOWN
569 +# If libvirtd created networks for you (e.g. NATed networks) then this init
570 +# script will shut them down for you if this is set to 'yes'. Otherwise,
571 +# the networks will be left running. For this option to be useful you must
572 +# have enabled the 'virt-network' USE flag and have had libvirt create a
573 +# NATed network for you. Valid values: 'yes' or 'no'
574 +
575 +#LIBVIRT_NET_SHUTDOWN="yes"
576
577 diff --git a/app-emulation/libvirt/files/libvirt-guests.init-r2 b/app-emulation/libvirt/files/libvirt-guests.init-r2
578 new file mode 100644
579 index 0000000..9db6d95
580 --- /dev/null
581 +++ b/app-emulation/libvirt/files/libvirt-guests.init-r2
582 @@ -0,0 +1,235 @@
583 +#!/sbin/openrc-run
584 +
585 +description="Virtual Machine Management (libvirt) Guests"
586 +
587 +depend() {
588 + use libvirtd
589 +}
590 +
591 +# set the default to QEMU
592 +[ -z "${LIBVIRT_URIS}" ] && LIBVIRT_URIS="qemu:///system"
593 +
594 +# default to suspending the VM via managedsave
595 +case "${LIBVIRT_SHUTDOWN}" in
596 + managedsave|shutdown|destroy) ;;
597 + *) LIBVIRT_SHUTDOWN="managedsave" ;;
598 +esac
599 +
600 +# default to 500 seconds
601 +[ -z ${LIBVIRT_MAXWAIT} ] && LIBVIRT_MAXWAIT=500
602 +
603 +gueststatefile="/var/lib/libvirt/libvirt-guests.state"
604 +netstatefile="/var/lib/libvirt/libvirt-net.state"
605 +
606 +do_virsh() {
607 + local hvuri=$1
608 + shift
609 +
610 + # if unset, default to qemu
611 + [ -z ${hvuri} ] && hvuri="qemu:///system"
612 + # if only qemu was supplied then correct the value
613 + [ "xqemu" = x${hvuri} ] && hvuri="qemu:///system"
614 +
615 + # Silence errors because virsh always throws an error about
616 + # not finding the hypervisor version when connecting to libvirtd
617 + # lastly strip the blank line at the end
618 + LC_ALL=C virsh -c ${hvuri} "$@" 2>/dev/null | head -n -1
619 +}
620 +
621 +libvirtd_dom_list() {
622 + # Only work with domains by their UUIDs
623 + local hvuri=$1
624 + shift
625 +
626 + do_virsh "${hvuri}" list --uuid $@
627 +}
628 +
629 +libvirtd_dom_count() {
630 + local hvuri=$1
631 + shift
632 +
633 + libvirtd_dom_list "${hvuri}" $@ | wc -l
634 +}
635 +
636 +libvirtd_net_list() {
637 + # Only work with networks by their UUIDs
638 + local hvuri=$1
639 + shift
640 +
641 + do_virsh "${hvuri}" net-list --uuid $@
642 +}
643 +
644 +libvirtd_net_count() {
645 + local hvuri=$1
646 + shift
647 +
648 + libvirtd_net_list "${hvuri}" $@ | wc -l
649 +}
650 +
651 +libvirtd_dom_stop() {
652 + # stops all persistent or transient domains for a given URI
653 + # $1 - uri
654 + # $2 - persisent/transient
655 +
656 + local uri=$1
657 + local persist=$2
658 + local shutdown_type=${LIBVIRT_SHUTDOWN}
659 + local counter=${LIBVIRT_MAXWAIT}
660 + local dom_name=
661 + local dom_as=
662 + local dom_ids=
663 + local uuid=
664 + local dom_count=
665 +
666 + [ "${persist}" = "--transient" ] && shutdown_type="shutdown"
667 + [ -n "${counter}" ] || counter=500
668 +
669 + einfo " Shutting down domain(s) ..."
670 +
671 + # grab all persistent or transient domains running
672 + dom_ids=$(libvirtd_dom_list ${uri} ${persist})
673 +
674 + for uuid in ${dom_ids}; do
675 + # Get the name
676 + dom_name=$(do_virsh ${uri} domname ${uuid})
677 + einfo " ${dom_name}"
678 + # Get autostart state
679 + dom_as=$(do_virsh ${uri} dominfo ${uuid} | \
680 + awk '$1 == "Autostart:" { print $2 }')
681 +
682 + if [ "${persist}" = "--persistent" ]; then
683 + # Save our running state only if LIBVIRT_IGNORE_AUTOSTART != yes
684 + if [ "x${LIBVIRT_IGNORE_AUTOSTART}" = "xyes" ] && \
685 + [ ${dom_as} = "enabled" ]; then
686 + :
687 + else
688 + echo "${uri} ${uuid}" >> ${gueststatefile}
689 + fi
690 +
691 + fi
692 +
693 + # Now let's stop it
694 + do_virsh "${uri}" ${shutdown_type} ${uuid} > /dev/null
695 +
696 + done
697 +
698 + dom_count="$(libvirtd_dom_count ${uri} ${persist})"
699 + while [ ${dom_count} -gt 0 ] && [ ${counter} -gt 0 ] ; do
700 + dom_count="$(libvirtd_dom_count ${uri} ${persist})"
701 + sleep 1
702 + if [ "${shutdown_type}" = "shutdown" ]; then
703 + counter=$((${counter} - 1))
704 + fi
705 + echo -n "."
706 + done
707 +
708 + if [ "${shutdown_type}" = "shutdown" ]; then
709 + # grab all domains still running
710 + dom_ids=$(libvirtd_dom_list ${uri} ${persist})
711 + for uuid in ${dom_ids}; do
712 + dom_name=$(do_virsh ${uri} domname ${uuid})
713 + eerror " ${dom_name} forcibly stopped"
714 + do_virsh "${uri}" destroy ${uuid} > /dev/null
715 + done
716 + fi
717 +}
718 +
719 +libvirtd_net_stop() {
720 + # stops all persistent or transient domains for a given URI
721 + # $1 - uri
722 + # $2 - persisent/transient
723 +
724 + local uri=$1
725 + local persist=$2
726 + local uuid=
727 + local net_name=
728 +
729 + if [ "${LIBVIRT_NET_SHUTDOWN}" != "no" ]; then
730 +
731 + einfo " Shutting down network(s):"
732 + for uuid in $(libvirtd_net_list ${uri} ${persist}); do
733 + net_name=$(do_virsh ${uri} net-name ${uuid})
734 + einfo " ${net_name}"
735 +
736 + if [ "${persist}" = "--persistent" ]; then
737 + # Save our running state
738 + echo "${uri} ${uuid}" >> ${netstatefile}
739 +
740 + fi
741 +
742 + # Actually stop the network
743 + do_virsh qemu net-destroy ${uuid} > /dev/null
744 + done
745 +
746 + fi
747 +}
748 +
749 +start() {
750 + local uri=
751 + local uuid=
752 + local name=
753 +
754 + for uri in ${LIBVIRT_URIS}; do
755 + do_virsh "${uri}" connect
756 + if [ $? -ne 0 ]; then
757 + eerror "Failed to connect to '${uri}'. Domains may not start."
758 + fi
759 + done
760 +
761 + [ ! -e "${netstatefile}" ] && touch "${netstatefile}"
762 + [ ! -e "${gueststatefile}" ] && touch "${gueststatefile}"
763 +
764 + # if the user didn't want to start any guests up then respect their wish
765 + [ "x${LIBVIRT_START}" = "xno" ] && return 0
766 +
767 + # start networks
768 + ebegin "Starting libvirt networks"
769 + while read -r uri uuid
770 + do
771 + # ignore trash
772 + [ -z "${uri}" ] || [ -z "${uuid}" ] && continue
773 +
774 + name=$(do_virsh "${uri}" net-name ${uuid})
775 + einfo " ${name}"
776 + do_virsh "${uri}" net-start ${uuid} > /dev/null
777 + done <"${netstatefile}"
778 + eend 0
779 +
780 + # start domains
781 + ebegin "Starting libvirt domains"
782 + while read -r uri uuid
783 + do
784 + # ignore trash
785 + [ -z "${uri}" ] || [ -z "${uuid}" ] && continue
786 +
787 + name=$(do_virsh "${uri}" domname ${uuid})
788 + einfo " ${name}"
789 + do_virsh "${uri}" start ${uuid} > /dev/null
790 + done <"${gueststatefile}"
791 + eend 0
792 +}
793 +
794 +stop() {
795 + local counter=
796 + local dom_name=
797 + local net_name=
798 + local dom_ids=
799 + local uuid=
800 + local dom_count=
801 +
802 + rm -f "${gueststatefile}"
803 + [ $? -ne 0 ] && eerror "Unable to save domain state"
804 + rm -f "${netstatefile}"
805 + [ $? -ne 0 ] && eerror "Unable to save net state"
806 +
807 + for uri in ${LIBVIRT_URIS}; do
808 + einfo "Stopping libvirt domains and networks for ${uri}"
809 +
810 + libvirtd_dom_stop "${uri}" "--persistent"
811 + libvirtd_dom_stop "${uri}" "--transient"
812 + libvirtd_net_stop "${uri}" "--persistent"
813 + libvirtd_net_stop "${uri}" "--transient"
814 +
815 + einfo "Done stopping domains and networks for ${uri}"
816 + done
817 +}
818
819 diff --git a/app-emulation/libvirt/files/libvirtd.confd-r5 b/app-emulation/libvirt/files/libvirtd.confd-r5
820 new file mode 100644
821 index 0000000..c326531
822 --- /dev/null
823 +++ b/app-emulation/libvirt/files/libvirtd.confd-r5
824 @@ -0,0 +1,18 @@
825 +# /etc/conf.d/libvirtd
826 +
827 +# Startup dependency
828 +# libvirtd typically requires all networks to be up and settled which
829 +# is what rc_need="net" provides. However if you only use specific networks
830 +# for libvirtd, you may override this. Or if you only use libvirtd locally.
831 +rc_need="net"
832 +
833 +# The termination timeout (start-stop-daemon parameter "retry") ensures
834 +# that the service will be terminated within a given time (25 + 5 seconds
835 +# per default) when you are stopping the service.
836 +#LIBVIRTD_TERMTIMEOUT="TERM/25/KILL/5"
837 +
838 +# LIBVIRTD_OPTS
839 +# You may want to add '--listen' to have libvirtd listen for tcp/ip connections
840 +# if you want to use libvirt for remote control
841 +# Please consult 'libvirtd --help' for more options
842 +#LIBVIRTD_OPTS="--listen"
843
844 diff --git a/app-emulation/libvirt/files/libvirtd.init-r16 b/app-emulation/libvirt/files/libvirtd.init-r16
845 new file mode 100644
846 index 0000000..be660e3
847 --- /dev/null
848 +++ b/app-emulation/libvirt/files/libvirtd.init-r16
849 @@ -0,0 +1,34 @@
850 +#!/sbin/openrc-run
851 +# Copyright 1999-2015 Gentoo Foundation
852 +# Distributed under the terms of the GNU General Public License v2
853 +
854 +description="Virtual Machine Management daemon (libvirt)"
855 +
856 +LIBVIRTD_OPTS=${LIBVIRTD_OPTS:-"${LIBVIRTD_OPTS}"}
857 +LIBVIRTD_TIMEOUT=${LIBVIRTD_TERMTIMEOUT:-"TERM/25/KILL/5"}
858 +
859 +command="/usr/sbin/libvirtd"
860 +command_args="-d ${LIBVIRTD_OPTS}"
861 +start_stop_daemon_args="--env KRB5_KTNAME=/etc/libvirt/krb5.tab"
862 +pidfile="/var/run/libvirtd.pid"
863 +retry="${LIBVIRTD_TERMTIMEOUT}"
864 +
865 +depend() {
866 + need virtlogd
867 + use dbus virtlockd
868 + after ntp-client ntpd nfs nfsmount portmap rpc.statd iptables ip6tables ebtables corosync sanlock cgconfig xenconsoled
869 + USE_FLAG_FIREWALLD
870 + USE_FLAG_AVAHI
871 + USE_FLAG_ISCSI
872 + USE_FLAG_RBD
873 +}
874 +
875 +start_pre() {
876 + # Test configuration directories in /etc/libvirt/ to be either not
877 + # present or a directory, i.e. not a regular file, bug #532892
878 +
879 + checkpath --directory /etc/libvirt/lxc || return 1
880 + checkpath --directory /etc/libvirt/nwfilter || return 1
881 + checkpath --directory /etc/libvirt/qemu || return 1
882 + checkpath --directory /etc/libvirt/storage || return 1
883 +}
884
885 diff --git a/app-emulation/libvirt/files/libvirtd.service.conf b/app-emulation/libvirt/files/libvirtd.service.conf
886 new file mode 100644
887 index 0000000..f087922
888 --- /dev/null
889 +++ b/app-emulation/libvirt/files/libvirtd.service.conf
890 @@ -0,0 +1,10 @@
891 +# Uncomment the following three lines to start libvirtd with the '--listen'
892 +# directive such that it listens for TCP/IP connections (honoring the
893 +# listen_tls and listen_tcp settings in /etc/libvirt/libvirtd.conf). If
894 +# libvirtd is started without the '--listen' parameter, network connection
895 +# (for the daemon) is globally disabled:
896 +
897 +# [Service]
898 +# ExecStart=
899 +# ExecStart=/usr/sbin/libvirtd --listen
900 +
901
902 diff --git a/app-emulation/libvirt/files/libvirtd.tmpfiles.conf b/app-emulation/libvirt/files/libvirtd.tmpfiles.conf
903 new file mode 100644
904 index 0000000..c22c23d
905 --- /dev/null
906 +++ b/app-emulation/libvirt/files/libvirtd.tmpfiles.conf
907 @@ -0,0 +1 @@
908 +d /run/libvirt/lxc 0755 root root -
909
910 diff --git a/app-emulation/libvirt/files/virtlockd.init-r1 b/app-emulation/libvirt/files/virtlockd.init-r1
911 new file mode 100644
912 index 0000000..e7c3db2
913 --- /dev/null
914 +++ b/app-emulation/libvirt/files/virtlockd.init-r1
915 @@ -0,0 +1,23 @@
916 +#!/sbin/openrc-run
917 +# Copyright 1999-2015 Gentoo Foundation
918 +# Distributed under the terms of the GNU General Public License v2
919 +
920 +description="libvirt virtual machine lock manager"
921 +command="/usr/sbin/virtlockd"
922 +command_args="-d"
923 +pidfile="/var/run/virtlockd.pid"
924 +
925 +extra_started_commands="reload"
926 +description_reload="re-exec the daemon, while maintaining locks and clients"
927 +
928 +
929 +depend() {
930 + after ntp-client ntpd nfs nfsmount corosync
931 +}
932 +
933 +reload() {
934 + ebegin "re-exec() virtlockd"
935 +
936 + start-stop-daemon --signal SIGUSR1 \
937 + --exec "${command}" --pidfile "${pidfile}"
938 +}
939
940 diff --git a/app-emulation/libvirt/files/virtlogd.init-r1 b/app-emulation/libvirt/files/virtlogd.init-r1
941 new file mode 100644
942 index 0000000..438070e
943 --- /dev/null
944 +++ b/app-emulation/libvirt/files/virtlogd.init-r1
945 @@ -0,0 +1,23 @@
946 +#!/sbin/openrc-run
947 +# Copyright 1999-2015 Gentoo Foundation
948 +# Distributed under the terms of the GNU General Public License v2
949 +
950 +description="libvirt virtual machine logging manager"
951 +command="/usr/sbin/virtlogd"
952 +command_args="-d"
953 +pidfile="/var/run/virtlogd.pid"
954 +
955 +extra_started_commands="reload"
956 +description_reload="re-exec the daemon, while maintaining open connections"
957 +
958 +
959 +depend() {
960 + after ntp-client ntpd nfs nfsmount corosync
961 +}
962 +
963 +reload() {
964 + ebegin "re-exec() virtlogd"
965 +
966 + start-stop-daemon --signal SIGUSR1 \
967 + --exec "${command}" --pidfile "${pidfile}"
968 +}
969
970 diff --git a/app-emulation/libvirt/libvirt-3.10.0-r1.ebuild b/app-emulation/libvirt/libvirt-3.10.0-r1.ebuild
971 new file mode 100644
972 index 0000000..aa6bd57
973 --- /dev/null
974 +++ b/app-emulation/libvirt/libvirt-3.10.0-r1.ebuild
975 @@ -0,0 +1,382 @@
976 +# Copyright 1999-2017 Gentoo Foundation
977 +# Distributed under the terms of the GNU General Public License v2
978 +
979 +EAPI=6
980 +
981 +inherit autotools eutils user linux-info systemd readme.gentoo-r1 versionator
982 +
983 +if [[ ${PV} = *9999* ]]; then
984 + inherit git-r3
985 + EGIT_REPO_URI="git://libvirt.org/libvirt.git"
986 + SRC_URI=""
987 + KEYWORDS=""
988 + SLOT="0"
989 +else
990 + # Versions with 4 numbers are stable updates:
991 + if [[ ${PV} =~ ^[0-9]+(\.[0-9]+){3} ]]; then
992 + SRC_URI="http://libvirt.org/sources/stable_updates/${P}.tar.xz"
993 + else
994 + SRC_URI="http://libvirt.org/sources/${P}.tar.xz"
995 + fi
996 + KEYWORDS="~amd64 ~arm64 ~x86"
997 + SLOT="0/${PV}"
998 +fi
999 +
1000 +DESCRIPTION="C toolkit to manipulate virtual machines"
1001 +HOMEPAGE="http://www.libvirt.org/"
1002 +LICENSE="LGPL-2.1"
1003 +IUSE="
1004 + apparmor audit +caps +dbus firewalld fuse glusterfs iscsi +libvirtd lvm
1005 + libssh lxc +macvtap nfs nls numa openvz parted pcap phyp policykit
1006 + +qemu rbd sasl selinux +udev uml +vepa virtualbox virt-network
1007 + wireshark-plugins xen zeroconf zfs
1008 +"
1009 +
1010 +REQUIRED_USE="
1011 + firewalld? ( virt-network )
1012 + libvirtd? ( || ( lxc openvz qemu uml virtualbox xen ) )
1013 + lxc? ( caps libvirtd )
1014 + openvz? ( libvirtd )
1015 + policykit? ( dbus )
1016 + qemu? ( libvirtd )
1017 + uml? ( libvirtd )
1018 + vepa? ( macvtap )
1019 + virt-network? ( libvirtd )
1020 + virtualbox? ( libvirtd )
1021 + xen? ( libvirtd )"
1022 +
1023 +# gettext.sh command is used by the libvirt command wrappers, and it's
1024 +# non-optional, so put it into RDEPEND.
1025 +# We can use both libnl:1.1 and libnl:3, but if you have both installed, the
1026 +# package will use 3 by default. Since we don't have slot pinning in an API,
1027 +# we must go with the most recent
1028 +RDEPEND="
1029 + app-misc/scrub
1030 + dev-libs/libgcrypt:0
1031 + dev-libs/libnl:3
1032 + >=dev-libs/libxml2-2.7.6
1033 + || ( >=net-analyzer/netcat6-1.0-r2 >=net-analyzer/openbsd-netcat-1.105-r1 )
1034 + >=net-libs/gnutls-1.0.25:0=
1035 + net-libs/libssh2
1036 + net-libs/libtirpc
1037 + net-libs/rpcsvc-proto
1038 + >=net-misc/curl-7.18.0
1039 + sys-apps/dmidecode
1040 + >=sys-apps/util-linux-2.17
1041 + sys-devel/gettext
1042 + sys-libs/ncurses:0=
1043 + sys-libs/readline:=
1044 + apparmor? ( sys-libs/libapparmor )
1045 + audit? ( sys-process/audit )
1046 + caps? ( sys-libs/libcap-ng )
1047 + dbus? ( sys-apps/dbus )
1048 + firewalld? ( net-firewall/firewalld )
1049 + fuse? ( >=sys-fs/fuse-2.8.6:= )
1050 + glusterfs? ( >=sys-cluster/glusterfs-3.4.1 )
1051 + iscsi? ( sys-block/open-iscsi )
1052 + libssh? ( net-libs/libssh )
1053 + lvm? ( >=sys-fs/lvm2-2.02.48-r2[-device-mapper-only(-)] )
1054 + nfs? ( net-fs/nfs-utils )
1055 + numa? (
1056 + >sys-process/numactl-2.0.2
1057 + sys-process/numad
1058 + )
1059 + parted? (
1060 + >=sys-block/parted-1.8[device-mapper]
1061 + sys-fs/lvm2[-device-mapper-only(-)]
1062 + )
1063 + pcap? ( >=net-libs/libpcap-1.0.0 )
1064 + policykit? ( >=sys-auth/polkit-0.9 )
1065 + qemu? (
1066 + >=app-emulation/qemu-0.13.0
1067 + dev-libs/yajl
1068 + )
1069 + rbd? ( sys-cluster/ceph )
1070 + sasl? ( dev-libs/cyrus-sasl )
1071 + selinux? ( >=sys-libs/libselinux-2.0.85 )
1072 + virt-network? (
1073 + net-dns/dnsmasq[script]
1074 + net-firewall/ebtables
1075 + >=net-firewall/iptables-1.4.10[ipv6]
1076 + net-misc/radvd
1077 + sys-apps/iproute2[-minimal]
1078 + )
1079 + virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) )
1080 + wireshark-plugins? ( net-analyzer/wireshark:= )
1081 + xen? (
1082 + app-emulation/xen
1083 + app-emulation/xen-tools:=
1084 + )
1085 + udev? (
1086 + virtual/udev
1087 + >=x11-libs/libpciaccess-0.10.9
1088 + )
1089 + zeroconf? ( >=net-dns/avahi-0.6[dbus] )
1090 + zfs? ( sys-fs/zfs )"
1091 +
1092 +DEPEND="${RDEPEND}
1093 + app-text/xhtml1
1094 + dev-lang/perl
1095 + dev-libs/libxslt
1096 + dev-perl/XML-XPath
1097 + virtual/pkgconfig"
1098 +
1099 +PATCHES=(
1100 + "${FILESDIR}"/${PN}-1.3.0-do_not_use_sysconf.patch
1101 + "${FILESDIR}"/${PN}-1.2.16-fix_paths_in_libvirt-guests_sh.patch
1102 + "${FILESDIR}"/${PN}-3.10.0-fix_paths_for_apparmor.patch
1103 + "${FILESDIR}"/${PN}-1.3.4-glibc-2.23.patch
1104 + "${FILESDIR}"/${PN}-3.1.0-musl-fix-includes.patch # bug #609488
1105 +)
1106 +
1107 +pkg_setup() {
1108 + if use qemu; then
1109 + enewgroup qemu 77
1110 + enewuser qemu 77 -1 -1 "qemu,kvm"
1111 + fi
1112 +
1113 + use policykit && enewgroup libvirt
1114 +
1115 + # Check kernel configuration:
1116 + CONFIG_CHECK=""
1117 + use fuse && CONFIG_CHECK+="
1118 + ~FUSE_FS"
1119 +
1120 + use lvm && CONFIG_CHECK+="
1121 + ~BLK_DEV_DM
1122 + ~DM_MULTIPATH
1123 + ~DM_SNAPSHOT"
1124 +
1125 + use lxc && CONFIG_CHECK+="
1126 + ~BLK_CGROUP
1127 + ~CGROUP_CPUACCT
1128 + ~CGROUP_DEVICE
1129 + ~CGROUP_FREEZER
1130 + ~CGROUP_NET_PRIO
1131 + ~CGROUP_PERF
1132 + ~CGROUPS
1133 + ~CGROUP_SCHED
1134 + ~CPUSETS
1135 + ~IPC_NS
1136 + ~MACVLAN
1137 + ~NAMESPACES
1138 + ~NET_CLS_CGROUP
1139 + ~NET_NS
1140 + ~PID_NS
1141 + ~POSIX_MQUEUE
1142 + ~SECURITYFS
1143 + ~USER_NS
1144 + ~UTS_NS
1145 + ~VETH
1146 + ~!GRKERNSEC_CHROOT_MOUNT
1147 + ~!GRKERNSEC_CHROOT_DOUBLE
1148 + ~!GRKERNSEC_CHROOT_PIVOT
1149 + ~!GRKERNSEC_CHROOT_CHMOD
1150 + ~!GRKERNSEC_CHROOT_CAPS"
1151 +
1152 + kernel_is lt 4 7 && use lxc && CONFIG_CHECK+="
1153 + ~DEVPTS_MULTIPLE_INSTANCES"
1154 +
1155 + use macvtap && CONFIG_CHECK+="
1156 + ~MACVTAP"
1157 +
1158 + use virt-network && CONFIG_CHECK+="
1159 + ~BRIDGE_EBT_MARK_T
1160 + ~BRIDGE_NF_EBTABLES
1161 + ~NETFILTER_ADVANCED
1162 + ~NETFILTER_XT_CONNMARK
1163 + ~NETFILTER_XT_MARK
1164 + ~NETFILTER_XT_TARGET_CHECKSUM"
1165 + # Bandwidth Limiting Support
1166 + use virt-network && CONFIG_CHECK+="
1167 + ~BRIDGE_EBT_T_NAT
1168 + ~NET_ACT_POLICE
1169 + ~NET_CLS_FW
1170 + ~NET_CLS_U32
1171 + ~NET_SCH_HTB
1172 + ~NET_SCH_INGRESS
1173 + ~NET_SCH_SFQ"
1174 +
1175 + # Handle specific kernel versions for different features
1176 + kernel_is lt 3 6 && CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR"
1177 + if kernel_is ge 3 6; then
1178 + CONFIG_CHECK+=" ~MEMCG ~MEMCG_SWAP "
1179 + kernel_is lt 4 5 && CONFIG_CHECK+=" ~MEMCG_KMEM "
1180 + fi
1181 +
1182 + ERROR_USER_NS="Optional depending on LXC configuration."
1183 +
1184 + if [[ -n ${CONFIG_CHECK} ]]; then
1185 + linux-info_pkg_setup
1186 + fi
1187 +}
1188 +
1189 +src_prepare() {
1190 + touch "${S}/.mailmap"
1191 +
1192 + default
1193 +
1194 + if [[ ${PV} = *9999* ]]; then
1195 + # git checkouts require bootstrapping to create the configure script.
1196 + # Additionally the submodules must be cloned to the right locations
1197 + # bug #377279
1198 + ./bootstrap || die "bootstrap failed"
1199 + (
1200 + git submodule status | sed 's/^[ +-]//;s/ .*//'
1201 + git hash-object bootstrap.conf
1202 + ) >.git-module-status
1203 + fi
1204 +
1205 + # Tweak the init script:
1206 + cp "${FILESDIR}/libvirtd.init-r16" "${S}/libvirtd.init" || die
1207 + sed -e "s/USE_FLAG_FIREWALLD/$(usex firewalld 'need firewalld' '')/" \
1208 + -e "s/USE_FLAG_AVAHI/$(usex zeroconf 'use avahi-daemon' '')/" \
1209 + -e "s/USE_FLAG_ISCSI/$(usex iscsi 'use iscsid' '')/" \
1210 + -e "s/USE_FLAG_RBD/$(usex rbd 'use ceph' '')/" \
1211 + -i "${S}/libvirtd.init" || die "sed failed"
1212 +
1213 + eautoreconf
1214 +}
1215 +
1216 +src_configure() {
1217 + local myeconfargs=(
1218 + $(use_with apparmor)
1219 + $(use_with apparmor apparmor-profiles)
1220 + $(use_with audit)
1221 + $(use_with caps capng)
1222 + $(use_with dbus)
1223 + $(use_with firewalld)
1224 + $(use_with fuse)
1225 + $(use_with glusterfs)
1226 + $(use_with glusterfs storage-gluster)
1227 + $(use_with iscsi storage-iscsi)
1228 + $(use_with libvirtd)
1229 + $(use_with libssh)
1230 + $(use_with lvm storage-lvm)
1231 + $(use_with lvm storage-mpath)
1232 + $(use_with lxc)
1233 + $(use_with macvtap)
1234 + $(use_enable nls)
1235 + $(use_with numa numactl)
1236 + $(use_with numa numad)
1237 + $(use_with openvz)
1238 + $(use_with parted storage-disk)
1239 + $(use_with pcap libpcap)
1240 + $(use_with phyp)
1241 + $(use_with policykit polkit)
1242 + $(use_with qemu)
1243 + $(use_with qemu yajl)
1244 + $(use_with rbd storage-rbd)
1245 + $(use_with sasl)
1246 + $(use_with selinux)
1247 + $(use_with udev)
1248 + $(use_with uml)
1249 + $(use_with vepa virtualport)
1250 + $(use_with virt-network network)
1251 + $(use_with wireshark-plugins wireshark-dissector)
1252 + $(use_with xen)
1253 + $(use_with xen xen-inotify)
1254 + $(use_with xen libxl)
1255 + $(use_with zeroconf avahi)
1256 + $(use_with zfs storage-zfs)
1257 +
1258 + --without-hal
1259 + --without-netcf
1260 + --without-sanlock
1261 + --without-xenapi
1262 +
1263 + --with-esx
1264 + --with-init-script=systemd
1265 + --with-qemu-group=$(usex caps qemu root)
1266 + --with-qemu-user=$(usex caps qemu root)
1267 + --with-remote
1268 + --with-storage-fs
1269 + --with-vmware
1270 +
1271 + --disable-static
1272 + --disable-werror
1273 +
1274 + --with-html-subdir=${PF}/html
1275 + --localstatedir=/var
1276 + )
1277 +
1278 + if use virtualbox && has_version app-emulation/virtualbox-ose; then
1279 + myeconfargs+=( --with-vbox=/usr/lib/virtualbox-ose/ )
1280 + else
1281 + myeconfargs+=( $(use_with virtualbox vbox) )
1282 + fi
1283 +
1284 + econf "${myeconfargs[@]}"
1285 +
1286 + if [[ ${PV} = *9999* ]]; then
1287 + # Restore gnulib's config.sub and config.guess
1288 + # bug #377279
1289 + (cd .gnulib && git reset --hard > /dev/null)
1290 + fi
1291 +}
1292 +
1293 +src_test() {
1294 + cd "${BUILD_DIR}"
1295 +
1296 + # remove problematic tests, bug #591416, bug #591418
1297 + sed -i -e 's#commandtest$(EXEEXT) # #' \
1298 + -e 's#virfirewalltest$(EXEEXT) # #' \
1299 + -e 's#nwfilterebiptablestest$(EXEEXT) # #' \
1300 + -e 's#nwfilterxml2firewalltest$(EXEEXT)$##' \
1301 + tests/Makefile
1302 +
1303 + export VIR_TEST_DEBUG=1
1304 + HOME="${T}" emake check || die "tests failed"
1305 +}
1306 +
1307 +src_install() {
1308 + emake DESTDIR="${D}" \
1309 + SYSTEMD_UNIT_DIR="$(systemd_get_systemunitdir)" install
1310 +
1311 + find "${D}" -name '*.la' -delete || die
1312 +
1313 + # Remove bogus, empty directories. They are either not used, or
1314 + # libvirtd is able to create them on demand
1315 + rm -rf "${D}"/etc/sysconfig
1316 + rm -rf "${D}"/var/cache
1317 + rm -rf "${D}"/var/run
1318 + rm -rf "${D}"/var/log
1319 +
1320 + use libvirtd || return 0
1321 + # From here, only libvirtd-related instructions, be warned!
1322 +
1323 + systemd_install_serviced \
1324 + "${FILESDIR}"/libvirtd.service.conf libvirtd.service
1325 +
1326 + systemd_newtmpfilesd "${FILESDIR}"/libvirtd.tmpfiles.conf libvirtd.conf
1327 +
1328 + newinitd "${S}/libvirtd.init" libvirtd || die
1329 + newinitd "${FILESDIR}/libvirt-guests.init-r2" libvirt-guests || die
1330 + newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd || die
1331 + newinitd "${FILESDIR}/virtlogd.init-r1" virtlogd || die
1332 +
1333 + newconfd "${FILESDIR}/libvirtd.confd-r5" libvirtd || die
1334 + newconfd "${FILESDIR}/libvirt-guests.confd" libvirt-guests || die
1335 +
1336 + DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r2")
1337 + DISABLE_AUTOFORMATTING=true
1338 + readme.gentoo_create_doc
1339 +}
1340 +
1341 +pkg_preinst() {
1342 + # we only ever want to generate this once
1343 + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
1344 + rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml
1345 + fi
1346 +}
1347 +
1348 +pkg_postinst() {
1349 + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
1350 + touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml
1351 + fi
1352 +
1353 + use libvirtd || return 0
1354 + # From here, only libvirtd-related instructions, be warned!
1355 +
1356 + readme.gentoo_print_elog
1357 +}
1358
1359 diff --git a/app-emulation/libvirt/libvirt-9999.ebuild b/app-emulation/libvirt/libvirt-9999.ebuild
1360 new file mode 100644
1361 index 0000000..3716e89
1362 --- /dev/null
1363 +++ b/app-emulation/libvirt/libvirt-9999.ebuild
1364 @@ -0,0 +1,379 @@
1365 +# Copyright 1999-2017 Gentoo Foundation
1366 +# Distributed under the terms of the GNU General Public License v2
1367 +
1368 +EAPI=6
1369 +
1370 +inherit autotools eutils user linux-info systemd readme.gentoo-r1
1371 +
1372 +if [[ ${PV} = *9999* ]]; then
1373 + inherit git-r3
1374 + EGIT_REPO_URI="git://libvirt.org/libvirt.git"
1375 + SRC_URI=""
1376 + KEYWORDS=""
1377 + SLOT="0"
1378 +else
1379 + # Versions with 4 numbers are stable updates:
1380 + if [[ ${PV} =~ ^[0-9]+(\.[0-9]+){3} ]]; then
1381 + SRC_URI="http://libvirt.org/sources/stable_updates/${P}.tar.xz"
1382 + else
1383 + SRC_URI="http://libvirt.org/sources/${P}.tar.xz"
1384 + fi
1385 + KEYWORDS="~amd64 ~arm64 ~x86"
1386 + SLOT="0/${PV}"
1387 +fi
1388 +
1389 +DESCRIPTION="C toolkit to manipulate virtual machines"
1390 +HOMEPAGE="http://www.libvirt.org/"
1391 +LICENSE="LGPL-2.1"
1392 +IUSE="
1393 + apparmor audit +caps +dbus firewalld fuse glusterfs iscsi +libvirtd lvm
1394 + libssh lxc +macvtap nfs nls numa openvz parted pcap phyp policykit
1395 + +qemu rbd sasl selinux +udev uml +vepa virtualbox virt-network
1396 + wireshark-plugins xen zeroconf zfs
1397 +"
1398 +
1399 +REQUIRED_USE="
1400 + firewalld? ( virt-network )
1401 + libvirtd? ( || ( lxc openvz qemu uml virtualbox xen ) )
1402 + lxc? ( caps libvirtd )
1403 + openvz? ( libvirtd )
1404 + policykit? ( dbus )
1405 + qemu? ( libvirtd )
1406 + uml? ( libvirtd )
1407 + vepa? ( macvtap )
1408 + virt-network? ( libvirtd )
1409 + virtualbox? ( libvirtd )
1410 + xen? ( libvirtd )"
1411 +
1412 +# gettext.sh command is used by the libvirt command wrappers, and it's
1413 +# non-optional, so put it into RDEPEND.
1414 +# We can use both libnl:1.1 and libnl:3, but if you have both installed, the
1415 +# package will use 3 by default. Since we don't have slot pinning in an API,
1416 +# we must go with the most recent
1417 +RDEPEND="
1418 + app-misc/scrub
1419 + dev-libs/libgcrypt:0
1420 + dev-libs/libnl:3
1421 + >=dev-libs/libxml2-2.7.6
1422 + || ( >=net-analyzer/netcat6-1.0-r2 >=net-analyzer/openbsd-netcat-1.105-r1 )
1423 + >=net-libs/gnutls-1.0.25:0=
1424 + net-libs/libssh2
1425 + >=net-misc/curl-7.18.0
1426 + sys-apps/dmidecode
1427 + >=sys-apps/util-linux-2.17
1428 + sys-devel/gettext
1429 + sys-libs/ncurses:0=
1430 + sys-libs/readline:=
1431 + apparmor? ( sys-libs/libapparmor )
1432 + audit? ( sys-process/audit )
1433 + caps? ( sys-libs/libcap-ng )
1434 + dbus? ( sys-apps/dbus )
1435 + firewalld? ( net-firewall/firewalld )
1436 + fuse? ( >=sys-fs/fuse-2.8.6:= )
1437 + glusterfs? ( >=sys-cluster/glusterfs-3.4.1 )
1438 + iscsi? ( sys-block/open-iscsi )
1439 + libssh? ( net-libs/libssh )
1440 + lvm? ( >=sys-fs/lvm2-2.02.48-r2[-device-mapper-only(-)] )
1441 + nfs? ( net-fs/nfs-utils )
1442 + numa? (
1443 + >sys-process/numactl-2.0.2
1444 + sys-process/numad
1445 + )
1446 + parted? (
1447 + >=sys-block/parted-1.8[device-mapper]
1448 + sys-fs/lvm2[-device-mapper-only(-)]
1449 + )
1450 + pcap? ( >=net-libs/libpcap-1.0.0 )
1451 + policykit? ( >=sys-auth/polkit-0.9 )
1452 + qemu? (
1453 + >=app-emulation/qemu-0.13.0
1454 + dev-libs/yajl
1455 + )
1456 + rbd? ( sys-cluster/ceph )
1457 + sasl? ( dev-libs/cyrus-sasl )
1458 + selinux? ( >=sys-libs/libselinux-2.0.85 )
1459 + virt-network? (
1460 + net-dns/dnsmasq[script]
1461 + net-firewall/ebtables
1462 + >=net-firewall/iptables-1.4.10[ipv6]
1463 + net-misc/radvd
1464 + sys-apps/iproute2[-minimal]
1465 + )
1466 + virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) )
1467 + wireshark-plugins? ( net-analyzer/wireshark:= )
1468 + xen? (
1469 + app-emulation/xen
1470 + app-emulation/xen-tools:=
1471 + )
1472 + udev? (
1473 + virtual/udev
1474 + >=x11-libs/libpciaccess-0.10.9
1475 + )
1476 + zeroconf? ( >=net-dns/avahi-0.6[dbus] )
1477 + zfs? ( sys-fs/zfs )"
1478 +
1479 +DEPEND="${RDEPEND}
1480 + app-text/xhtml1
1481 + dev-lang/perl
1482 + dev-libs/libxslt
1483 + dev-perl/XML-XPath
1484 + virtual/pkgconfig"
1485 +
1486 +PATCHES=(
1487 + "${FILESDIR}"/${PN}-1.3.0-do_not_use_sysconf.patch
1488 + "${FILESDIR}"/${PN}-1.2.16-fix_paths_in_libvirt-guests_sh.patch
1489 + "${FILESDIR}"/${PN}-3.0.0-fix_paths_for_apparmor.patch
1490 + "${FILESDIR}"/${PN}-1.3.4-glibc-2.23.patch
1491 +)
1492 +
1493 +pkg_setup() {
1494 + if use qemu; then
1495 + enewgroup qemu 77
1496 + enewuser qemu 77 -1 -1 "qemu,kvm"
1497 + fi
1498 +
1499 + use policykit && enewgroup libvirt
1500 +
1501 + # Check kernel configuration:
1502 + CONFIG_CHECK=""
1503 + use fuse && CONFIG_CHECK+="
1504 + ~FUSE_FS"
1505 +
1506 + use lvm && CONFIG_CHECK+="
1507 + ~BLK_DEV_DM
1508 + ~DM_MULTIPATH
1509 + ~DM_SNAPSHOT"
1510 +
1511 + use lxc && CONFIG_CHECK+="
1512 + ~BLK_CGROUP
1513 + ~CGROUP_CPUACCT
1514 + ~CGROUP_DEVICE
1515 + ~CGROUP_FREEZER
1516 + ~CGROUP_NET_PRIO
1517 + ~CGROUP_PERF
1518 + ~CGROUPS
1519 + ~CGROUP_SCHED
1520 + ~CPUSETS
1521 + ~IPC_NS
1522 + ~MACVLAN
1523 + ~NAMESPACES
1524 + ~NET_CLS_CGROUP
1525 + ~NET_NS
1526 + ~PID_NS
1527 + ~POSIX_MQUEUE
1528 + ~SECURITYFS
1529 + ~USER_NS
1530 + ~UTS_NS
1531 + ~VETH
1532 + ~!GRKERNSEC_CHROOT_MOUNT
1533 + ~!GRKERNSEC_CHROOT_DOUBLE
1534 + ~!GRKERNSEC_CHROOT_PIVOT
1535 + ~!GRKERNSEC_CHROOT_CHMOD
1536 + ~!GRKERNSEC_CHROOT_CAPS"
1537 +
1538 + kernel_is lt 4 7 && use lxc && CONFIG_CHECK+="
1539 + ~DEVPTS_MULTIPLE_INSTANCES"
1540 +
1541 + use macvtap && CONFIG_CHECK+="
1542 + ~MACVTAP"
1543 +
1544 + use virt-network && CONFIG_CHECK+="
1545 + ~BRIDGE_EBT_MARK_T
1546 + ~BRIDGE_NF_EBTABLES
1547 + ~NETFILTER_ADVANCED
1548 + ~NETFILTER_XT_CONNMARK
1549 + ~NETFILTER_XT_MARK
1550 + ~NETFILTER_XT_TARGET_CHECKSUM"
1551 + # Bandwidth Limiting Support
1552 + use virt-network && CONFIG_CHECK+="
1553 + ~BRIDGE_EBT_T_NAT
1554 + ~NET_ACT_POLICE
1555 + ~NET_CLS_FW
1556 + ~NET_CLS_U32
1557 + ~NET_SCH_HTB
1558 + ~NET_SCH_INGRESS
1559 + ~NET_SCH_SFQ"
1560 +
1561 + # Handle specific kernel versions for different features
1562 + kernel_is lt 3 6 && CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR"
1563 + if kernel_is ge 3 6; then
1564 + CONFIG_CHECK+=" ~MEMCG ~MEMCG_SWAP "
1565 + kernel_is lt 4 5 && CONFIG_CHECK+=" ~MEMCG_KMEM "
1566 + fi
1567 +
1568 + ERROR_USER_NS="Optional depending on LXC configuration."
1569 +
1570 + if [[ -n ${CONFIG_CHECK} ]]; then
1571 + linux-info_pkg_setup
1572 + fi
1573 +}
1574 +
1575 +src_prepare() {
1576 + touch "${S}/.mailmap"
1577 +
1578 + default
1579 +
1580 + if [[ ${PV} = *9999* ]]; then
1581 + # git checkouts require bootstrapping to create the configure script.
1582 + # Additionally the submodules must be cloned to the right locations
1583 + # bug #377279
1584 + ./bootstrap || die "bootstrap failed"
1585 + (
1586 + git submodule status | sed 's/^[ +-]//;s/ .*//'
1587 + git hash-object bootstrap.conf
1588 + ) >.git-module-status
1589 + fi
1590 +
1591 + # Tweak the init script:
1592 + cp "${FILESDIR}/libvirtd.init-r16" "${S}/libvirtd.init" || die
1593 + sed -e "s/USE_FLAG_FIREWALLD/$(usex firewalld 'need firewalld' '')/" \
1594 + -e "s/USE_FLAG_AVAHI/$(usex zeroconf 'use avahi-daemon' '')/" \
1595 + -e "s/USE_FLAG_ISCSI/$(usex iscsi 'use iscsid' '')/" \
1596 + -e "s/USE_FLAG_RBD/$(usex rbd 'use ceph' '')/" \
1597 + -i "${S}/libvirtd.init" || die "sed failed"
1598 +
1599 + eautoreconf
1600 +}
1601 +
1602 +src_configure() {
1603 + local myeconfargs=(
1604 + $(use_with apparmor)
1605 + $(use_with apparmor apparmor-profiles)
1606 + $(use_with audit)
1607 + $(use_with caps capng)
1608 + $(use_with dbus)
1609 + $(use_with firewalld)
1610 + $(use_with fuse)
1611 + $(use_with glusterfs)
1612 + $(use_with glusterfs storage-gluster)
1613 + $(use_with iscsi storage-iscsi)
1614 + $(use_with libvirtd)
1615 + $(use_with libssh)
1616 + $(use_with lvm storage-lvm)
1617 + $(use_with lvm storage-mpath)
1618 + $(use_with lxc)
1619 + $(use_with macvtap)
1620 + $(use_enable nls)
1621 + $(use_with numa numactl)
1622 + $(use_with numa numad)
1623 + $(use_with openvz)
1624 + $(use_with parted storage-disk)
1625 + $(use_with pcap libpcap)
1626 + $(use_with phyp)
1627 + $(use_with policykit polkit)
1628 + $(use_with qemu)
1629 + $(use_with qemu yajl)
1630 + $(use_with rbd storage-rbd)
1631 + $(use_with sasl)
1632 + $(use_with selinux)
1633 + $(use_with udev)
1634 + $(use_with uml)
1635 + $(use_with vepa virtualport)
1636 + $(use_with virt-network network)
1637 + $(use_with wireshark-plugins wireshark-dissector)
1638 + $(use_with xen)
1639 + $(use_with xen xen-inotify)
1640 + $(use_with xen libxl)
1641 + $(use_with zeroconf avahi)
1642 + $(use_with zfs storage-zfs)
1643 +
1644 + --without-hal
1645 + --without-netcf
1646 + --without-sanlock
1647 + --without-xenapi
1648 +
1649 + --with-esx
1650 + --with-init-script=systemd
1651 + --with-qemu-group=$(usex caps qemu root)
1652 + --with-qemu-user=$(usex caps qemu root)
1653 + --with-remote
1654 + --with-storage-fs
1655 + --with-vmware
1656 +
1657 + --disable-static
1658 + --disable-werror
1659 +
1660 + --with-html-subdir=${PF}/html
1661 + --localstatedir=/var
1662 + )
1663 +
1664 + if use virtualbox && has_version app-emulation/virtualbox-ose; then
1665 + myeconfargs+=( --with-vbox=/usr/lib/virtualbox-ose/ )
1666 + else
1667 + myeconfargs+=( $(use_with virtualbox vbox) )
1668 + fi
1669 +
1670 + econf "${myeconfargs[@]}"
1671 +
1672 + if [[ ${PV} = *9999* ]]; then
1673 + # Restore gnulib's config.sub and config.guess
1674 + # bug #377279
1675 + (cd .gnulib && git reset --hard > /dev/null)
1676 + fi
1677 +}
1678 +
1679 +src_test() {
1680 + cd "${BUILD_DIR}"
1681 +
1682 + # remove problematic tests, bug #591416, bug #591418
1683 + sed -i -e 's#commandtest$(EXEEXT) # #' \
1684 + -e 's#virfirewalltest$(EXEEXT) # #' \
1685 + -e 's#nwfilterebiptablestest$(EXEEXT) # #' \
1686 + -e 's#nwfilterxml2firewalltest$(EXEEXT)$##' \
1687 + tests/Makefile
1688 +
1689 + export VIR_TEST_DEBUG=1
1690 + HOME="${T}" emake check || die "tests failed"
1691 +}
1692 +
1693 +src_install() {
1694 + emake DESTDIR="${D}" \
1695 + SYSTEMD_UNIT_DIR="$(systemd_get_systemunitdir)" install
1696 +
1697 + find "${D}" -name '*.la' -delete || die
1698 +
1699 + # Remove bogus, empty directories. They are either not used, or
1700 + # libvirtd is able to create them on demand
1701 + rm -rf "${D}"/etc/sysconfig
1702 + rm -rf "${D}"/var/cache
1703 + rm -rf "${D}"/var/run
1704 + rm -rf "${D}"/var/log
1705 +
1706 + use libvirtd || return 0
1707 + # From here, only libvirtd-related instructions, be warned!
1708 +
1709 + systemd_install_serviced \
1710 + "${FILESDIR}"/libvirtd.service.conf libvirtd.service
1711 +
1712 + systemd_newtmpfilesd "${FILESDIR}"/libvirtd.tmpfiles.conf libvirtd.conf
1713 +
1714 + newinitd "${S}/libvirtd.init" libvirtd || die
1715 + newinitd "${FILESDIR}/libvirt-guests.init-r2" libvirt-guests || die
1716 + newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd || die
1717 + newinitd "${FILESDIR}/virtlogd.init-r1" virtlogd || die
1718 +
1719 + newconfd "${FILESDIR}/libvirtd.confd-r5" libvirtd || die
1720 + newconfd "${FILESDIR}/libvirt-guests.confd" libvirt-guests || die
1721 +
1722 + DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r2")
1723 + DISABLE_AUTOFORMATTING=true
1724 + readme.gentoo_create_doc
1725 +}
1726 +
1727 +pkg_preinst() {
1728 + # we only ever want to generate this once
1729 + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
1730 + rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml
1731 + fi
1732 +}
1733 +
1734 +pkg_postinst() {
1735 + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
1736 + touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml
1737 + fi
1738 +
1739 + use libvirtd || return 0
1740 + # From here, only libvirtd-related instructions, be warned!
1741 +
1742 + readme.gentoo_print_elog
1743 +}
1744
1745 diff --git a/app-emulation/libvirt/metadata.xml b/app-emulation/libvirt/metadata.xml
1746 new file mode 100644
1747 index 0000000..5750757
1748 --- /dev/null
1749 +++ b/app-emulation/libvirt/metadata.xml
1750 @@ -0,0 +1,102 @@
1751 +<?xml version="1.0" encoding="UTF-8"?>
1752 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
1753 +<pkgmetadata>
1754 +<maintainer type="person">
1755 + <email>samuelbernardo.mail@×××××.com</email>
1756 + <name>Samuel Bernardo</name>
1757 +</maintainer>
1758 +<maintainer type="project">
1759 + <email>virtualization@g.o</email>
1760 + <name>Gentoo Virtualization Project</name>
1761 +</maintainer>
1762 +<use>
1763 + <!-- Pool backend flags -->
1764 + <flag name="iscsi">
1765 + Allow using an iSCSI remote storage server as pool for disk image storage
1766 + </flag>
1767 + <flag name="lvm">
1768 + Allow using the Logical Volume Manager (<pkg>sys-fs/lvm2</pkg>) as pool for disk image
1769 + storage
1770 + </flag>
1771 + <flag name="nfs">
1772 + Allow using Network File System mounts as pool for disk image storage
1773 + </flag>
1774 + <flag name="parted">
1775 + Allow using real disk partitions as pool for disk image storage, using
1776 + <pkg>sys-block/parted</pkg> to create, resize and delete them.
1777 + </flag>
1778 + <flag name="rbd">
1779 + Enable rados block device support via <pkg>sys-cluster/ceph</pkg>
1780 + </flag>
1781 + <!-- Virtualisation backends -->
1782 + <flag name="lxc">
1783 + Support management of Linux Containers virtualisation (<pkg>app-emulation/lxc</pkg>)
1784 + </flag>
1785 + <flag name="openvz">
1786 + Support management of OpenVZ virtualisation (openvz-sources)
1787 + </flag>
1788 + <flag name="uml">
1789 + Support management of User Mode Linux virtualisation
1790 + </flag>
1791 + <flag name="qemu">
1792 + Support management of QEMU virtualisation (<pkg>app-emulation/qemu</pkg>)
1793 + </flag>
1794 + <flag name="xen">
1795 + Support management of Xen virtualisation (<pkg>app-emulation/xen</pkg>)
1796 + </flag>
1797 + <flag name="virtualbox">
1798 + Support management of VirtualBox virtualisation (one of <pkg>app-emulation/virtualbox</pkg> or
1799 + <pkg>app-emulation/virtualbox-bin</pkg>)
1800 + </flag>
1801 + <flag name="phyp">
1802 + Support IBM HMC / IVM hypervisor via PHYP protocol
1803 + </flag>
1804 + <!-- Miscellaneous flags -->
1805 + <flag name="apparmor">Enable AppArmor support</flag>
1806 + <flag name="fuse">Allow LXC to use <pkg>sys-fs/fuse</pkg> for mount
1807 + points</flag>
1808 + <flag name="numa">
1809 + Use NUMA for memory segmenting via <pkg>sys-process/numactl</pkg> and
1810 + <pkg>sys-process/numad</pkg>
1811 + </flag>
1812 + <flag name="libvirtd">
1813 + Builds the libvirtd daemon as well as the client utilities instead of just the client
1814 + utilities
1815 + </flag>
1816 + <flag name="libssh">
1817 + Use <pkg>net-libs/libssh</pkg> to communicate with remote libvirtd hosts,
1818 + for example: qemu+libssh://server/system
1819 + </flag>
1820 + <flag name="pcap">
1821 + Support auto learning IP addreses for routing
1822 + </flag>
1823 + <flag name="macvtap">
1824 + Support for MAC-based TAP (macvlan/macvtap). For networking instead
1825 + of the normal TUN/TAP. It has its advantages and disadvantages.
1826 + macvtap support requires very new kernels and is
1827 + currently evolving. Support for this is experimental at best.
1828 + </flag>
1829 + <flag name="vepa">Virtual Ethernet Port Aggregator (VEPA) / 802.1Qbg
1830 + support. Relies on macvtap support.</flag>
1831 + <flag name="virt-network">
1832 + Enable virtual networking (NAT) support for guests. Includes all
1833 + the dependencies for NATed network mode. Effectively any network
1834 + setup that relies on libvirt to setup and configure network
1835 + interfaces on your host. This can include bridged and routed
1836 + networks ONLY if you are allowing libvirt to create and manage
1837 + the underlying devices for you. In some cases this requires
1838 + enabling the 'netcf' USE flag (currently unavailable).
1839 + </flag>
1840 + <flag name="firewalld">DBus interface to iptables/ebtables allowing
1841 + for better runtime management of your firewall.</flag>
1842 + <flag name="wireshark-plugins">
1843 + Build the <pkg>net-analyzer/wireshark</pkg> plugin for the Libvirt RPC protocol
1844 + </flag>
1845 + <flag name="glusterfs">
1846 + Enable GlusterFS support via <pkg>sys-cluster/glusterfs</pkg>
1847 + </flag>
1848 + <flag name="zfs">
1849 + Enable ZFS backend storage <pkg>sys-fs/zfs</pkg>
1850 + </flag>
1851 +</use>
1852 +</pkgmetadata>