Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: app-emulation/libvirt/, app-emulation/libvirt/files/
Date: Fri, 22 Feb 2019 12:32:00
Message-Id: 1550833464.064bbc524f208807c821e22a606d34ee6a04103e.blueness@gentoo
1 commit: 064bbc524f208807c821e22a606d34ee6a04103e
2 Author: g3ngr33n <gengreen <AT> tutanota <DOT> com>
3 AuthorDate: Thu Feb 21 15:01:39 2019 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 22 11:04:24 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=064bbc52
7
8 Small fix libvirt
9
10 Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
11
12 app-emulation/libvirt/Manifest | 1 +
13 app-emulation/libvirt/files/README.gentoo-r2 | 58 +++
14 ...irt-1.2.16-fix_paths_in_libvirt-guests_sh.patch | 19 +
15 .../libvirt-3.10.0-r2-fix_paths_for_apparmor.patch | 77 ++++
16 .../files/libvirt-4.10.0-fix_apparmor_rules.patch | 14 +
17 .../libvirt/files/libvirt-4.10.0-musl.patch | 10 +
18 .../files/libvirt-4.5.0-do_not_use_sysconf.patch | 216 ++++++++++++
19 .../libvirt-4.5.0-fix_typo_in_apparmor_rule.patch | 13 +
20 .../files/libvirt-5.0.0-do-not-use-sysconf.patch | 216 ++++++++++++
21 .../libvirt-5.0.0-fix-paths-for-apparmor.patch | 110 ++++++
22 .../files/libvirt-5.1.0-do-not-use-sysconf.patch | 216 ++++++++++++
23 app-emulation/libvirt/files/libvirt-guests.confd | 68 ++++
24 app-emulation/libvirt/files/libvirt-guests.init-r2 | 235 +++++++++++++
25 app-emulation/libvirt/files/libvirt-guests.init-r3 | 236 +++++++++++++
26 app-emulation/libvirt/files/libvirtd.confd-r5 | 18 +
27 app-emulation/libvirt/files/libvirtd.init-r16 | 34 ++
28 app-emulation/libvirt/files/libvirtd.service.conf | 10 +
29 app-emulation/libvirt/files/libvirtd.tmpfiles.conf | 1 +
30 app-emulation/libvirt/files/virtlockd.init-r1 | 23 ++
31 app-emulation/libvirt/files/virtlogd.init-r1 | 23 ++
32 app-emulation/libvirt/libvirt-4.10.0.ebuild | 388 +++++++++++++++++++++
33 app-emulation/libvirt/metadata.xml | 102 ++++++
34 22 files changed, 2088 insertions(+)
35
36 diff --git a/app-emulation/libvirt/Manifest b/app-emulation/libvirt/Manifest
37 new file mode 100644
38 index 0000000..d9d3295
39 --- /dev/null
40 +++ b/app-emulation/libvirt/Manifest
41 @@ -0,0 +1 @@
42 +DIST libvirt-4.10.0.tar.xz 14841188 BLAKE2B b52f2ed1c4c65930339a6b6fc9e7b034c7661edc0defdd78642f305b97332c33247bfc552efc43aa75a8d360c0d721d1a58a22fa7a016e7cf14ee2219d70a762 SHA512 a4f97aed6299c7954518ab88738ab781cee0755bfd64094a44468f77f99cac5eb2bc74ecd6aec90177317606ebd073292f5b5d0056054d1d94973fa938589fbd
43
44 diff --git a/app-emulation/libvirt/files/README.gentoo-r2 b/app-emulation/libvirt/files/README.gentoo-r2
45 new file mode 100644
46 index 0000000..1c086c1
47 --- /dev/null
48 +++ b/app-emulation/libvirt/files/README.gentoo-r2
49 @@ -0,0 +1,58 @@
50 +Important: The openrc libvirtd init script is now broken up into two
51 +separate services: libvirtd, that solely handles the daemon, and
52 +libvirt-guests, that takes care of clients during shutdown/restart of the
53 +host. In order to reenable client handling, edit /etc/conf.d/libvirt-guests
54 +and enable the service and start it:
55 +
56 + $ rc-update add libvirt-guests
57 + $ service libvirt-guests start
58 +
59 +
60 +For the basic networking support (bridged and routed networks) you don't
61 +need any extra software. For more complex network modes including but not
62 +limited to NATed network, you can enable the 'virt-network' USE flag. It
63 +will pull in required runtime dependencies
64 +
65 +
66 +If you are using dnsmasq on your system, you will have to configure
67 +/etc/dnsmasq.conf to enable the following settings:
68 +
69 + bind-interfaces
70 + interface or except-interface
71 +
72 +Otherwise you might have issues with your existing DNS server.
73 +
74 +
75 +For openrc users:
76 +
77 + Please use /etc/conf.d/libvirtd to control the '--listen' parameter for
78 + libvirtd.
79 +
80 + Use /etc/init.d/libvirt-guests to manage clients on restart/shutdown of
81 + the host. The default configuration will suspend and resume running kvm
82 + guests with 'managedsave'. This behavior can be changed under
83 + /etc/conf.d/libvirt-guests
84 +
85 +
86 +For systemd users:
87 +
88 + Please use /etc/systemd/system/libvirtd.service.d/00gentoo.conf
89 + to control the '--listen' parameter for libvirtd.
90 +
91 + The configuration for the 'libvirt-guests.service' is found under
92 + /etc/libvirt/libvirt-guests.conf"
93 +
94 +
95 +If you have built libvirt with policykit support, a new group "libvirt" has
96 +been created. Simply add a user to the libvirt group in order to grant
97 +administrative access to libvirtd. Alternatively, drop a custom policykit
98 +rule into /etc/polkit-1/rules.d.
99 +
100 +If you have built libvirt without policykit support (USE=-policykit), you
101 +must change the unix sock group and/or perms in /etc/libvirt/libvirtd.conf
102 +in order to allow normal users to connect to libvirtd.
103 +
104 +
105 +If libvirtd is built with USE=caps, libvirt will now start qemu/kvm VMs
106 +with non-root privileges. Ensure any resources your VMs use are accessible
107 +by qemu:qemu.
108
109 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
110 new file mode 100644
111 index 0000000..ddedb1f
112 --- /dev/null
113 +++ b/app-emulation/libvirt/files/libvirt-1.2.16-fix_paths_in_libvirt-guests_sh.patch
114 @@ -0,0 +1,19 @@
115 +diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in
116 +index 7f74b85..ea58119 100644
117 +--- a/tools/libvirt-guests.sh.in
118 ++++ b/tools/libvirt-guests.sh.in
119 +@@ -41,11 +41,11 @@ CONNECT_RETRIES=10
120 + RETRIES_SLEEP=1
121 + SYNC_TIME=0
122 +
123 +-test -f "$sysconfdir"/sysconfig/libvirt-guests &&
124 +- . "$sysconfdir"/sysconfig/libvirt-guests
125 ++test -f "$sysconfdir"/libvirt/libvirt-guests.conf &&
126 ++ . "$sysconfdir"/libvirt/libvirt-guests.conf
127 +
128 + LISTFILE="$localstatedir"/lib/libvirt/libvirt-guests
129 +-VAR_SUBSYS_LIBVIRT_GUESTS="$localstatedir"/lock/subsys/libvirt-guests
130 ++VAR_SUBSYS_LIBVIRT_GUESTS="$localstatedir"/lock/libvirt-guests
131 +
132 + RETVAL=0
133 +
134
135 diff --git a/app-emulation/libvirt/files/libvirt-3.10.0-r2-fix_paths_for_apparmor.patch b/app-emulation/libvirt/files/libvirt-3.10.0-r2-fix_paths_for_apparmor.patch
136 new file mode 100644
137 index 0000000..f1360ae
138 --- /dev/null
139 +++ b/app-emulation/libvirt/files/libvirt-3.10.0-r2-fix_paths_for_apparmor.patch
140 @@ -0,0 +1,77 @@
141 +diff --git a/examples/Makefile.am b/examples/Makefile.am
142 +index ef2f79db3..d8cdb9b3f 100644
143 +--- a/examples/Makefile.am
144 ++++ b/examples/Makefile.am
145 +@@ -23,7 +23,7 @@ EXTRA_DIST = \
146 + apparmor/TEMPLATE.lxc \
147 + apparmor/libvirt-qemu \
148 + apparmor/libvirt-lxc \
149 +- apparmor/usr.lib.libvirt.virt-aa-helper \
150 ++ apparmor/usr.libexec.virt-aa-helper \
151 + apparmor/usr.sbin.libvirtd \
152 + lxcconvert/virt-lxc-convert \
153 + polkit/libvirt-acl.rules \
154 +@@ -70,7 +70,7 @@ admin_logging_SOURCES = admin/logging.c
155 + if WITH_APPARMOR_PROFILES
156 + apparmordir = $(sysconfdir)/apparmor.d/
157 + apparmor_DATA = \
158 +- apparmor/usr.lib.libvirt.virt-aa-helper \
159 ++ apparmor/usr.libexec.virt-aa-helper \
160 + apparmor/usr.sbin.libvirtd \
161 + $(NULL)
162 +
163 +diff --git a/examples/apparmor/libvirt-qemu b/examples/apparmor/libvirt-qemu
164 +index d4fad85a1..0b22009e5 100644
165 +--- a/examples/apparmor/libvirt-qemu
166 ++++ b/examples/apparmor/libvirt-qemu
167 +@@ -86,6 +86,8 @@
168 + /usr/share/AAVMF/** r,
169 + /usr/share/qemu-efi/** r,
170 + /usr/share/slof/** r,
171 ++ /usr/share/seavgabios/** r,
172 ++ /usr/share/edk2-ovmf/** r,
173 +
174 + # access PKI infrastructure
175 + /etc/pki/libvirt-vnc/** r,
176 +diff --git a/examples/apparmor/usr.lib.libvirt.virt-aa-helper b/examples/apparmor/usr.libexec.virt-aa-helper
177 +similarity index 92%
178 +rename from examples/apparmor/usr.lib.libvirt.virt-aa-helper
179 +rename to examples/apparmor/usr.libexec.virt-aa-helper
180 +index bd6181d00..4086f140a 100644
181 +--- a/examples/apparmor/usr.lib.libvirt.virt-aa-helper
182 ++++ b/examples/apparmor/usr.libexec.virt-aa-helper
183 +@@ -1,7 +1,7 @@
184 + # Last Modified: Mon Apr 5 15:10:27 2010
185 + #include <tunables/global>
186 +
187 +-profile virt-aa-helper /usr/{lib,lib64}/libvirt/virt-aa-helper {
188 ++profile virt-aa-helper /usr/libexec/virt-aa-helper {
189 + #include <abstractions/base>
190 +
191 + # needed for searching directories
192 +@@ -32,7 +32,7 @@ profile virt-aa-helper /usr/{lib,lib64}/libvirt/virt-aa-helper {
193 + deny /dev/mapper/ r,
194 + deny /dev/mapper/* r,
195 +
196 +- /usr/{lib,lib64}/libvirt/virt-aa-helper mr,
197 ++ /usr/libexec/virt-aa-helper mr,
198 + /{usr/,}sbin/apparmor_parser Ux,
199 +
200 + /etc/apparmor.d/libvirt/* r,
201 +diff --git a/examples/apparmor/usr.sbin.libvirtd b/examples/apparmor/usr.sbin.libvirtd
202 +index 8d61d154e..656a5595b 100644
203 +--- a/examples/apparmor/usr.sbin.libvirtd
204 ++++ b/examples/apparmor/usr.sbin.libvirtd
205 +@@ -84,8 +84,10 @@
206 + audit deny /sys/kernel/security/apparmor/.* rwxl,
207 + /sys/kernel/security/apparmor/profiles r,
208 + /usr/{lib,lib64}/libvirt/* PUxr,
209 +- /usr/{lib,lib64}/libvirt/libvirt_parthelper ix,
210 +- /usr/{lib,lib64}/libvirt/libvirt_iohelper ix,
211 ++ /usr/libexec/virt-aa-helper PUxr,
212 ++ /usr/libexec/libvirt_lxc PUxr,
213 ++ /usr/libexec/libvirt_parthelper ix,
214 ++ /usr/libexec/libvirt_iohelper ix,
215 + /etc/libvirt/hooks/** rmix,
216 + /etc/xen/scripts/** rmix,
217 +
218
219 diff --git a/app-emulation/libvirt/files/libvirt-4.10.0-fix_apparmor_rules.patch b/app-emulation/libvirt/files/libvirt-4.10.0-fix_apparmor_rules.patch
220 new file mode 100644
221 index 0000000..e561bf4
222 --- /dev/null
223 +++ b/app-emulation/libvirt/files/libvirt-4.10.0-fix_apparmor_rules.patch
224 @@ -0,0 +1,14 @@
225 +diff --git a/examples/apparmor/usr.lib.libvirt.virt-aa-helper b/examples/apparmor/usr.lib.libvirt.virt-aa-helper
226 +index de94368..5fbae27 100644
227 +--- a/examples/apparmor/usr.lib.libvirt.virt-aa-helper
228 ++++ b/examples/apparmor/usr.lib.libvirt.virt-aa-helper
229 +@@ -39,6 +39,9 @@ profile virt-aa-helper /usr/{lib,lib64}/libvirt/virt-aa-helper {
230 + /etc/apparmor.d/libvirt/* r,
231 + /etc/apparmor.d/libvirt/libvirt-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]* rw,
232 +
233 ++ # Gentoo specific path for uefi firmware
234 ++ /usr/share/edk2-ovmf/* r,
235 ++
236 + # for backingstore -- allow access to non-hidden files in @{HOME} as well
237 + # as storage pools
238 + audit deny @{HOME}/.* mrwkl,
239
240 diff --git a/app-emulation/libvirt/files/libvirt-4.10.0-musl.patch b/app-emulation/libvirt/files/libvirt-4.10.0-musl.patch
241 new file mode 100644
242 index 0000000..6f826c7
243 --- /dev/null
244 +++ b/app-emulation/libvirt/files/libvirt-4.10.0-musl.patch
245 @@ -0,0 +1,10 @@
246 +--- a/src/storage/storage_backend_fs.c
247 ++++ b/src/storage/storage_backend_fs.c
248 +@@ -26,6 +26,7 @@
249 + #include <sys/types.h>
250 + #include <sys/stat.h>
251 + #include <fcntl.h>
252 ++#include <paths.h>
253 +
254 + #include "virerror.h"
255 + #include "storage_backend_fs.h"
256 \ No newline at end of file
257
258 diff --git a/app-emulation/libvirt/files/libvirt-4.5.0-do_not_use_sysconf.patch b/app-emulation/libvirt/files/libvirt-4.5.0-do_not_use_sysconf.patch
259 new file mode 100644
260 index 0000000..3e430cb
261 --- /dev/null
262 +++ b/app-emulation/libvirt/files/libvirt-4.5.0-do_not_use_sysconf.patch
263 @@ -0,0 +1,216 @@
264 +From a365e2d5b4af1ab2be743773412fe265579a9a0b Mon Sep 17 00:00:00 2001
265 +Message-Id: <a365e2d5b4af1ab2be743773412fe265579a9a0b.1529989118.git.mprivozn@××××××.com>
266 +From: Michal Privoznik <mprivozn@××××××.com>
267 +Date: Tue, 26 Jun 2018 06:51:06 +0200
268 +Subject: [PATCH] gentoo: do not use sysconf
269 +
270 +Signed-off-by: Michal Privoznik <mprivozn@××××××.com>
271 +---
272 + src/Makefile.am | 29 ++++++-----------------------
273 + src/locking/virtlockd.service.in | 3 +--
274 + src/logging/virtlogd.service.in | 3 +--
275 + src/remote/libvirtd.service.in | 3 +--
276 + tools/Makefile.am | 17 ++++-------------
277 + tools/libvirt-guests.service.in | 2 +-
278 + tools/libvirt-guests.sysconf | 7 +++++++
279 + 7 files changed, 21 insertions(+), 43 deletions(-)
280 +
281 +diff --git a/src/Makefile.am b/src/Makefile.am
282 +index db8c8ebd1a..63d7a9ca46 100644
283 +--- a/src/Makefile.am
284 ++++ b/src/Makefile.am
285 +@@ -757,23 +757,6 @@ endif WITH_SETUID_RPC_CLIENT
286 +
287 + EXTRA_DIST += $(SYSCONF_FILES)
288 +
289 +-install-sysconfig:
290 +- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
291 +- for f in $(SYSCONF_FILES:%.sysconf=%) ; \
292 +- do \
293 +- tgt=`basename $$f`; \
294 +- $(INSTALL_DATA) $(srcdir)/$$f.sysconf \
295 +- $(DESTDIR)$(sysconfdir)/sysconfig/$$tgt; \
296 +- done
297 +-
298 +-uninstall-sysconfig:
299 +- for f in $(SYSCONF_FILES:%.sysconf=%) ; \
300 +- do \
301 +- tgt=`basename $$f`; \
302 +- rm -f $(DESTDIR)$(sysconfdir)/sysconfig/$$tgt; \
303 +- done
304 +- rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
305 +-
306 + SYSVINIT_FILES_IN += \
307 + locking/virtlockd.init.in \
308 + $(NULL)
309 +@@ -814,14 +797,14 @@ uninstall-logrotate:
310 + endif ! WITH_LIBVIRTD
311 +
312 + if LIBVIRT_INIT_SCRIPT_RED_HAT
313 +-install-init:: $(SYSVINIT_FILES) install-sysconfig
314 ++install-init:: $(SYSVINIT_FILES)
315 + $(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
316 + for f in $(SYSVINIT_FILES:%.init=%) ; \
317 + do \
318 + $(INSTALL_SCRIPT) $$f.init $(DESTDIR)$(sysconfdir)/rc.d/init.d/$$f; \
319 + done
320 +
321 +-uninstall-init:: uninstall-sysconfig
322 ++uninstall-init::
323 + rm -f $(SYSVINIT_FILES:%.init=$(DESTDIR)$(sysconfdir)/rc.d/init.d/%)
324 + rmdir $(DESTDIR)$(sysconfdir)/rc.d/init.d || :
325 +
326 +@@ -859,14 +842,14 @@ SYSTEMD_UNIT_FILES = $(notdir $(SYSTEMD_UNIT_FILES_IN:%.in=%))
327 + BUILT_SOURCES += $(SYSTEMD_UNIT_FILES)
328 + DISTCLEANFILES += $(SYSTEMD_UNIT_FILES)
329 +
330 +-install-systemd: $(SYSTEMD_UNIT_FILES) install-sysconfig
331 ++install-systemd: $(SYSTEMD_UNIT_FILES)
332 + $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
333 + for f in $(SYSTEMD_UNIT_FILES); \
334 + do \
335 + $(INSTALL_DATA) $$f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/ ; \
336 + done
337 +
338 +-uninstall-systemd: uninstall-sysconfig
339 ++uninstall-systemd:
340 + rm -f $(SYSTEMD_UNIT_FILES:%=$(DESTDIR)$(SYSTEMD_UNIT_DIR)/%)
341 + rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
342 + else ! LIBVIRT_INIT_SCRIPT_SYSTEMD
343 +@@ -884,7 +867,7 @@ EXTRA_DIST += $(UPSTART_FILES)
344 + if WITH_LIBVIRTD
345 + if LIBVIRT_INIT_SCRIPT_UPSTART
346 +
347 +-install-upstart: install-sysconfig
348 ++install-upstart:
349 + $(MKDIR_P) $(DESTDIR)$(sysconfdir)/event.d
350 + for f in $(UPSTART_FILES:%.upstart=%); \
351 + do \
352 +@@ -893,7 +876,7 @@ install-upstart: install-sysconfig
353 + $(DESTDIR)$(sysconfdir)/event.d/$$tgt ; \
354 + done
355 +
356 +-uninstall-upstart: uninstall-sysconfig
357 ++uninstall-upstart:
358 + for f in $(UPSTART_FILES:%.upstart=%); \
359 + do \
360 + tgt=`basename $$f` ; \
361 +diff --git a/src/locking/virtlockd.service.in b/src/locking/virtlockd.service.in
362 +index 3c9d587032..2449b201d9 100644
363 +--- a/src/locking/virtlockd.service.in
364 ++++ b/src/locking/virtlockd.service.in
365 +@@ -7,8 +7,7 @@ Documentation=man:virtlockd(8)
366 + Documentation=https://libvirt.org
367 +
368 + [Service]
369 +-EnvironmentFile=-/etc/sysconfig/virtlockd
370 +-ExecStart=@sbindir@/virtlockd $VIRTLOCKD_ARGS
371 ++ExecStart=@sbindir@/virtlockd
372 + ExecReload=/bin/kill -USR1 $MAINPID
373 + # Loosing the locks is a really bad thing that will
374 + # cause the machine to be fenced (rebooted), so make
375 +diff --git a/src/logging/virtlogd.service.in b/src/logging/virtlogd.service.in
376 +index 3d9ae36150..43736191d5 100644
377 +--- a/src/logging/virtlogd.service.in
378 ++++ b/src/logging/virtlogd.service.in
379 +@@ -7,8 +7,7 @@ Documentation=man:virtlogd(8)
380 + Documentation=https://libvirt.org
381 +
382 + [Service]
383 +-EnvironmentFile=-/etc/sysconfig/virtlogd
384 +-ExecStart=@sbindir@/virtlogd $VIRTLOGD_ARGS
385 ++ExecStart=@sbindir@/virtlogd
386 + ExecReload=/bin/kill -USR1 $MAINPID
387 + # Loosing the logs is a really bad thing that will
388 + # cause the machine to be fenced (rebooted), so make
389 +diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
390 +index 7f689e08a8..239beeced9 100644
391 +--- a/src/remote/libvirtd.service.in
392 ++++ b/src/remote/libvirtd.service.in
393 +@@ -22,8 +22,7 @@ Documentation=https://libvirt.org
394 +
395 + [Service]
396 + Type=notify
397 +-EnvironmentFile=-/etc/sysconfig/libvirtd
398 +-ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
399 ++ExecStart=@sbindir@/libvirtd
400 + ExecReload=/bin/kill -HUP $MAINPID
401 + KillMode=process
402 + Restart=on-failure
403 +diff --git a/tools/Makefile.am b/tools/Makefile.am
404 +index 1452d984a0..cef08741cb 100644
405 +--- a/tools/Makefile.am
406 ++++ b/tools/Makefile.am
407 +@@ -336,15 +336,6 @@ install-data-local: install-init install-systemd install-nss \
408 + uninstall-local: uninstall-init uninstall-systemd uninstall-nss \
409 + uninstall-bash-completion
410 +
411 +-install-sysconfig:
412 +- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
413 +- $(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \
414 +- $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
415 +-
416 +-uninstall-sysconfig:
417 +- rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
418 +- rmdir $(DESTDIR)$(sysconfdir)/sysconfig ||:
419 +-
420 + EXTRA_DIST += libvirt-guests.sh.in libvirt-guests.init.in
421 +
422 + install-initscript: libvirt-guests.init
423 +@@ -359,8 +350,8 @@ uninstall-initscript:
424 +
425 + if LIBVIRT_INIT_SCRIPT_RED_HAT
426 + BUILT_SOURCES += libvirt-guests.init
427 +-install-init: install-sysconfig install-initscript
428 +-uninstall-init: uninstall-sysconfig uninstall-initscript
429 ++install-init: install-initscript
430 ++uninstall-init: uninstall-initscript
431 + else ! LIBVIRT_INIT_SCRIPT_RED_HAT
432 + install-init:
433 + uninstall-init:
434 +@@ -391,12 +382,12 @@ EXTRA_DIST += libvirt-guests.service.in
435 + SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
436 +
437 + if LIBVIRT_INIT_SCRIPT_SYSTEMD
438 +-install-systemd: libvirt-guests.service install-sysconfig libvirt-guests.sh
439 ++install-systemd: libvirt-guests.service libvirt-guests.sh
440 + $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
441 + $(INSTALL_DATA) libvirt-guests.service \
442 + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
443 +
444 +-uninstall-systemd: uninstall-sysconfig
445 ++uninstall-systemd:
446 + rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
447 + rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) ||:
448 +
449 +diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
450 +index 491ca62138..f0f417bffb 100644
451 +--- a/tools/libvirt-guests.service.in
452 ++++ b/tools/libvirt-guests.service.in
453 +@@ -10,7 +10,7 @@ Documentation=man:libvirtd(8)
454 + Documentation=https://libvirt.org
455 +
456 + [Service]
457 +-EnvironmentFile=-/etc/sysconfig/libvirt-guests
458 ++EnvironmentFile=-/etc/libvirt/libvirt-guests.conf
459 + # Hack just call traditional service until we factor
460 + # out the code
461 + ExecStart=@libexecdir@/libvirt-guests.sh start
462 +diff --git a/tools/libvirt-guests.sysconf b/tools/libvirt-guests.sysconf
463 +index 669b046507..45b0b9ea46 100644
464 +--- a/tools/libvirt-guests.sysconf
465 ++++ b/tools/libvirt-guests.sysconf
466 +@@ -1,3 +1,10 @@
467 ++#
468 ++# Warning: This configuration file is only sourced by the systemd
469 ++# libvirt-guests.service unit. The coresponding openrc facility is in
470 ++# /etc/init.d/libvirtd and /etc/conf.d/libvirtd
471 ++#
472 ++
473 ++
474 + # URIs to check for running guests
475 + # example: URIS='default xen:///system vbox+tcp://host/system lxc:///system'
476 + #URIS=default
477 +--
478 +2.16.4
479 +
480
481 diff --git a/app-emulation/libvirt/files/libvirt-4.5.0-fix_typo_in_apparmor_rule.patch b/app-emulation/libvirt/files/libvirt-4.5.0-fix_typo_in_apparmor_rule.patch
482 new file mode 100644
483 index 0000000..4d1bfaf
484 --- /dev/null
485 +++ b/app-emulation/libvirt/files/libvirt-4.5.0-fix_typo_in_apparmor_rule.patch
486 @@ -0,0 +1,13 @@
487 +diff --git a/examples/apparmor/usr.libexec.virt-aa-helper b/examples/apparmor/usr.libexec.virt-aa-helper
488 +index d21723f..99ab4ea 100644
489 +--- a/examples/apparmor/usr.libexec.virt-aa-helper
490 ++++ b/examples/apparmor/usr.libexec.virt-aa-helper
491 +@@ -50,7 +50,7 @@ profile virt-aa-helper /usr/libexec/virt-aa-helper {
492 + @{HOME}/** r,
493 + /var/lib/libvirt/images/ r,
494 + /var/lib/libvirt/images/** r,
495 +- /var/lib/nova/instances/_base/* r
496 ++ /var/lib/nova/instances/_base/* r,
497 + /{media,mnt,opt,srv}/** r,
498 + # For virt-sandbox
499 + /{,var/}run/libvirt/**/[sv]d[a-z] r,
500
501 diff --git a/app-emulation/libvirt/files/libvirt-5.0.0-do-not-use-sysconf.patch b/app-emulation/libvirt/files/libvirt-5.0.0-do-not-use-sysconf.patch
502 new file mode 100644
503 index 0000000..d4e37e4
504 --- /dev/null
505 +++ b/app-emulation/libvirt/files/libvirt-5.0.0-do-not-use-sysconf.patch
506 @@ -0,0 +1,216 @@
507 +From 947ef7a44e94989f324e0d533499454d540fdef9 Mon Sep 17 00:00:00 2001
508 +Message-Id: <947ef7a44e94989f324e0d533499454d540fdef9.1547196492.git.mprivozn@××××××.com>
509 +From: Michal Privoznik <mprivozn@××××××.com>
510 +Date: Tue, 26 Jun 2018 06:51:06 +0200
511 +Subject: [PATCH] gentoo: do not use sysconf
512 +
513 +Signed-off-by: Michal Privoznik <mprivozn@××××××.com>
514 +---
515 + src/Makefile.am | 29 ++++++-----------------------
516 + src/locking/virtlockd.service.in | 3 +--
517 + src/logging/virtlogd.service.in | 3 +--
518 + src/remote/libvirtd.service.in | 3 +--
519 + tools/Makefile.am | 17 ++++-------------
520 + tools/libvirt-guests.service.in | 2 +-
521 + tools/libvirt-guests.sysconf | 7 +++++++
522 + 7 files changed, 21 insertions(+), 43 deletions(-)
523 +
524 +diff --git a/src/Makefile.am b/src/Makefile.am
525 +index cd386297ed..52a63885d6 100644
526 +--- a/src/Makefile.am
527 ++++ b/src/Makefile.am
528 +@@ -756,23 +756,6 @@ endif WITH_SETUID_RPC_CLIENT
529 +
530 + EXTRA_DIST += $(SYSCONF_FILES)
531 +
532 +-install-sysconfig:
533 +- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
534 +- for f in $(SYSCONF_FILES:%.sysconf=%) ; \
535 +- do \
536 +- tgt=`basename $$f`; \
537 +- $(INSTALL_DATA) $(srcdir)/$$f.sysconf \
538 +- $(DESTDIR)$(sysconfdir)/sysconfig/$$tgt; \
539 +- done
540 +-
541 +-uninstall-sysconfig:
542 +- for f in $(SYSCONF_FILES:%.sysconf=%) ; \
543 +- do \
544 +- tgt=`basename $$f`; \
545 +- rm -f $(DESTDIR)$(sysconfdir)/sysconfig/$$tgt; \
546 +- done
547 +- rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
548 +-
549 + SYSVINIT_FILES_IN += \
550 + locking/virtlockd.init.in \
551 + $(NULL)
552 +@@ -816,14 +799,14 @@ if WITH_LIBVIRTD
553 + if LIBVIRT_INIT_SCRIPT_RED_HAT
554 + initdir = $(sysconfdir)/rc.d/init.d
555 +
556 +-install-init:: $(SYSVINIT_FILES) install-sysconfig
557 ++install-init:: $(SYSVINIT_FILES)
558 + $(MKDIR_P) $(DESTDIR)$(initdir)
559 + for f in $(SYSVINIT_FILES:%.init=%) ; \
560 + do \
561 + $(INSTALL_SCRIPT) $$f.init $(DESTDIR)$(initdir)/$$f; \
562 + done
563 +
564 +-uninstall-init:: uninstall-sysconfig
565 ++uninstall-init::
566 + rm -f $(SYSVINIT_FILES:%.init=$(DESTDIR)$(initdir)/%)
567 + rmdir $(DESTDIR)$(initdir) || :
568 +
569 +@@ -862,14 +845,14 @@ SYSTEMD_UNIT_FILES = $(notdir $(SYSTEMD_UNIT_FILES_IN:%.in=%))
570 + BUILT_SOURCES += $(SYSTEMD_UNIT_FILES)
571 + DISTCLEANFILES += $(SYSTEMD_UNIT_FILES)
572 +
573 +-install-systemd: $(SYSTEMD_UNIT_FILES) install-sysconfig
574 ++install-systemd: $(SYSTEMD_UNIT_FILES)
575 + $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
576 + for f in $(SYSTEMD_UNIT_FILES); \
577 + do \
578 + $(INSTALL_DATA) $$f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/ ; \
579 + done
580 +
581 +-uninstall-systemd: uninstall-sysconfig
582 ++uninstall-systemd:
583 + rm -f $(SYSTEMD_UNIT_FILES:%=$(DESTDIR)$(SYSTEMD_UNIT_DIR)/%)
584 + rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
585 +
586 +@@ -884,7 +867,7 @@ EXTRA_DIST += $(UPSTART_FILES)
587 + if WITH_LIBVIRTD
588 + if LIBVIRT_INIT_SCRIPT_UPSTART
589 +
590 +-install-upstart: install-sysconfig
591 ++install-upstart:
592 + $(MKDIR_P) $(DESTDIR)$(sysconfdir)/event.d
593 + for f in $(UPSTART_FILES:%.upstart=%); \
594 + do \
595 +@@ -893,7 +876,7 @@ install-upstart: install-sysconfig
596 + $(DESTDIR)$(sysconfdir)/event.d/$$tgt ; \
597 + done
598 +
599 +-uninstall-upstart: uninstall-sysconfig
600 ++uninstall-upstart:
601 + for f in $(UPSTART_FILES:%.upstart=%); \
602 + do \
603 + tgt=`basename $$f` ; \
604 +diff --git a/src/locking/virtlockd.service.in b/src/locking/virtlockd.service.in
605 +index 3c9d587032..2449b201d9 100644
606 +--- a/src/locking/virtlockd.service.in
607 ++++ b/src/locking/virtlockd.service.in
608 +@@ -7,8 +7,7 @@ Documentation=man:virtlockd(8)
609 + Documentation=https://libvirt.org
610 +
611 + [Service]
612 +-EnvironmentFile=-/etc/sysconfig/virtlockd
613 +-ExecStart=@sbindir@/virtlockd $VIRTLOCKD_ARGS
614 ++ExecStart=@sbindir@/virtlockd
615 + ExecReload=/bin/kill -USR1 $MAINPID
616 + # Loosing the locks is a really bad thing that will
617 + # cause the machine to be fenced (rebooted), so make
618 +diff --git a/src/logging/virtlogd.service.in b/src/logging/virtlogd.service.in
619 +index 3d9ae36150..43736191d5 100644
620 +--- a/src/logging/virtlogd.service.in
621 ++++ b/src/logging/virtlogd.service.in
622 +@@ -7,8 +7,7 @@ Documentation=man:virtlogd(8)
623 + Documentation=https://libvirt.org
624 +
625 + [Service]
626 +-EnvironmentFile=-/etc/sysconfig/virtlogd
627 +-ExecStart=@sbindir@/virtlogd $VIRTLOGD_ARGS
628 ++ExecStart=@sbindir@/virtlogd
629 + ExecReload=/bin/kill -USR1 $MAINPID
630 + # Loosing the logs is a really bad thing that will
631 + # cause the machine to be fenced (rebooted), so make
632 +diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
633 +index 7f689e08a8..239beeced9 100644
634 +--- a/src/remote/libvirtd.service.in
635 ++++ b/src/remote/libvirtd.service.in
636 +@@ -22,8 +22,7 @@ Documentation=https://libvirt.org
637 +
638 + [Service]
639 + Type=notify
640 +-EnvironmentFile=-/etc/sysconfig/libvirtd
641 +-ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
642 ++ExecStart=@sbindir@/libvirtd
643 + ExecReload=/bin/kill -HUP $MAINPID
644 + KillMode=process
645 + Restart=on-failure
646 +diff --git a/tools/Makefile.am b/tools/Makefile.am
647 +index 613c9a77f0..224b511074 100644
648 +--- a/tools/Makefile.am
649 ++++ b/tools/Makefile.am
650 +@@ -339,15 +339,6 @@ install-data-local: install-init install-systemd install-nss \
651 + uninstall-local: uninstall-init uninstall-systemd uninstall-nss \
652 + uninstall-bash-completion
653 +
654 +-install-sysconfig:
655 +- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
656 +- $(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \
657 +- $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
658 +-
659 +-uninstall-sysconfig:
660 +- rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
661 +- rmdir $(DESTDIR)$(sysconfdir)/sysconfig ||:
662 +-
663 + EXTRA_DIST += libvirt-guests.sh.in libvirt-guests.init.in
664 +
665 + install-initscript: libvirt-guests.init
666 +@@ -362,8 +353,8 @@ uninstall-initscript:
667 +
668 + if LIBVIRT_INIT_SCRIPT_RED_HAT
669 + BUILT_SOURCES += libvirt-guests.init
670 +-install-init: install-sysconfig install-initscript
671 +-uninstall-init: uninstall-sysconfig uninstall-initscript
672 ++install-init: install-initscript
673 ++uninstall-init: uninstall-initscript
674 + else ! LIBVIRT_INIT_SCRIPT_RED_HAT
675 + install-init:
676 + uninstall-init:
677 +@@ -394,12 +385,12 @@ EXTRA_DIST += libvirt-guests.service.in
678 + SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
679 +
680 + if LIBVIRT_INIT_SCRIPT_SYSTEMD
681 +-install-systemd: libvirt-guests.service install-sysconfig libvirt-guests.sh
682 ++install-systemd: libvirt-guests.service libvirt-guests.sh
683 + $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
684 + $(INSTALL_DATA) libvirt-guests.service \
685 + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
686 +
687 +-uninstall-systemd: uninstall-sysconfig
688 ++uninstall-systemd:
689 + rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
690 + rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) ||:
691 +
692 +diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
693 +index 491ca62138..f0f417bffb 100644
694 +--- a/tools/libvirt-guests.service.in
695 ++++ b/tools/libvirt-guests.service.in
696 +@@ -10,7 +10,7 @@ Documentation=man:libvirtd(8)
697 + Documentation=https://libvirt.org
698 +
699 + [Service]
700 +-EnvironmentFile=-/etc/sysconfig/libvirt-guests
701 ++EnvironmentFile=-/etc/libvirt/libvirt-guests.conf
702 + # Hack just call traditional service until we factor
703 + # out the code
704 + ExecStart=@libexecdir@/libvirt-guests.sh start
705 +diff --git a/tools/libvirt-guests.sysconf b/tools/libvirt-guests.sysconf
706 +index 669b046507..45b0b9ea46 100644
707 +--- a/tools/libvirt-guests.sysconf
708 ++++ b/tools/libvirt-guests.sysconf
709 +@@ -1,3 +1,10 @@
710 ++#
711 ++# Warning: This configuration file is only sourced by the systemd
712 ++# libvirt-guests.service unit. The coresponding openrc facility is in
713 ++# /etc/init.d/libvirtd and /etc/conf.d/libvirtd
714 ++#
715 ++
716 ++
717 + # URIs to check for running guests
718 + # example: URIS='default xen:///system vbox+tcp://host/system lxc:///system'
719 + #URIS=default
720 +--
721 +2.19.2
722 +
723
724 diff --git a/app-emulation/libvirt/files/libvirt-5.0.0-fix-paths-for-apparmor.patch b/app-emulation/libvirt/files/libvirt-5.0.0-fix-paths-for-apparmor.patch
725 new file mode 100644
726 index 0000000..ca9f952
727 --- /dev/null
728 +++ b/app-emulation/libvirt/files/libvirt-5.0.0-fix-paths-for-apparmor.patch
729 @@ -0,0 +1,110 @@
730 +From 563706143779166624812b3faf498d869f5dd383 Mon Sep 17 00:00:00 2001
731 +Message-Id: <563706143779166624812b3faf498d869f5dd383.1547196492.git.mprivozn@××××××.com>
732 +From: Michal Privoznik <mprivozn@××××××.com>
733 +Date: Fri, 11 Jan 2019 09:41:06 +0100
734 +Subject: [PATCH] gentoo: fix paths for apparmor
735 +
736 +Signed-off-by: Michal Privoznik <mprivozn@××××××.com>
737 +---
738 + src/security/Makefile.inc.am | 10 +++++-----
739 + src/security/apparmor/libvirt-qemu | 2 ++
740 + ...bvirt.virt-aa-helper => usr.libexec.virt-aa-helper} | 4 ++--
741 + src/security/apparmor/usr.sbin.libvirtd | 6 ++++--
742 + 4 files changed, 13 insertions(+), 9 deletions(-)
743 + rename src/security/apparmor/{usr.lib.libvirt.virt-aa-helper => usr.libexec.virt-aa-helper} (93%)
744 +
745 +diff --git a/src/security/Makefile.inc.am b/src/security/Makefile.inc.am
746 +index b24cdfd083..ae8e979b84 100644
747 +--- a/src/security/Makefile.inc.am
748 ++++ b/src/security/Makefile.inc.am
749 +@@ -36,7 +36,7 @@ EXTRA_DIST += \
750 + security/apparmor/TEMPLATE.lxc \
751 + security/apparmor/libvirt-qemu \
752 + security/apparmor/libvirt-lxc \
753 +- security/apparmor/usr.lib.libvirt.virt-aa-helper \
754 ++ security/apparmor/usr.libexec.virt-aa-helper \
755 + security/apparmor/usr.sbin.libvirtd \
756 + $(NULL)
757 +
758 +@@ -90,7 +90,7 @@ endif WITH_SECDRIVER_APPARMOR
759 + if WITH_APPARMOR_PROFILES
760 + apparmordir = $(sysconfdir)/apparmor.d/
761 + apparmor_DATA = \
762 +- security/apparmor/usr.lib.libvirt.virt-aa-helper \
763 ++ security/apparmor/usr.libexec.virt-aa-helper \
764 + security/apparmor/usr.sbin.libvirtd \
765 + $(NULL)
766 +
767 +@@ -110,11 +110,11 @@ APPARMOR_LOCAL_DIR = "$(DESTDIR)$(apparmordir)/local"
768 + install-apparmor-local:
769 + $(MKDIR_P) "$(APPARMOR_LOCAL_DIR)"
770 + echo "# Site-specific additions and overrides for \
771 +- 'usr.lib.libvirt.virt-aa-helper'" \
772 +- >"$(APPARMOR_LOCAL_DIR)/usr.lib.libvirt.virt-aa-helper"
773 ++ 'usr.libexec.virt-aa-helper'" \
774 ++ >"$(APPARMOR_LOCAL_DIR)/usr.libexec.virt-aa-helper"
775 +
776 + uninstall-apparmor-local:
777 +- rm -f "$(APPARMOR_LOCAL_DIR)/usr.lib.libvirt.virt-aa-helper"
778 ++ rm -f "$(APPARMOR_LOCAL_DIR)/usr.libexec.virt-aa-helper"
779 + rmdir "$(APPARMOR_LOCAL_DIR)" || :
780 +
781 + INSTALL_DATA_LOCAL += install-apparmor-local
782 +diff --git a/src/security/apparmor/libvirt-qemu b/src/security/apparmor/libvirt-qemu
783 +index eaa5167525..9be50bbbe0 100644
784 +--- a/src/security/apparmor/libvirt-qemu
785 ++++ b/src/security/apparmor/libvirt-qemu
786 +@@ -87,6 +87,8 @@
787 + /usr/share/AAVMF/** r,
788 + /usr/share/qemu-efi/** r,
789 + /usr/share/slof/** r,
790 ++ /usr/share/seavgabios/** r,
791 ++ /usr/share/edk2-ovmf/** r,
792 +
793 + # pki for libvirt-vnc and libvirt-spice (LP: #901272, #1690140)
794 + /etc/pki/CA/ r,
795 +diff --git a/src/security/apparmor/usr.lib.libvirt.virt-aa-helper b/src/security/apparmor/usr.libexec.virt-aa-helper
796 +similarity index 93%
797 +rename from src/security/apparmor/usr.lib.libvirt.virt-aa-helper
798 +rename to src/security/apparmor/usr.libexec.virt-aa-helper
799 +index de9436872c..99ab4ea527 100644
800 +--- a/src/security/apparmor/usr.lib.libvirt.virt-aa-helper
801 ++++ b/src/security/apparmor/usr.libexec.virt-aa-helper
802 +@@ -1,7 +1,7 @@
803 + # Last Modified: Mon Apr 5 15:10:27 2010
804 + #include <tunables/global>
805 +
806 +-profile virt-aa-helper /usr/{lib,lib64}/libvirt/virt-aa-helper {
807 ++profile virt-aa-helper /usr/libexec/virt-aa-helper {
808 + #include <abstractions/base>
809 +
810 + # needed for searching directories
811 +@@ -33,7 +33,7 @@ profile virt-aa-helper /usr/{lib,lib64}/libvirt/virt-aa-helper {
812 + deny /dev/mapper/ r,
813 + deny /dev/mapper/* r,
814 +
815 +- /usr/{lib,lib64}/libvirt/virt-aa-helper mr,
816 ++ /usr/libexec/virt-aa-helper mr,
817 + /{usr/,}sbin/apparmor_parser Ux,
818 +
819 + /etc/apparmor.d/libvirt/* r,
820 +diff --git a/src/security/apparmor/usr.sbin.libvirtd b/src/security/apparmor/usr.sbin.libvirtd
821 +index f0ffc53008..8a402bd6ec 100644
822 +--- a/src/security/apparmor/usr.sbin.libvirtd
823 ++++ b/src/security/apparmor/usr.sbin.libvirtd
824 +@@ -98,8 +98,10 @@
825 + audit deny /sys/kernel/security/apparmor/.* rwxl,
826 + /sys/kernel/security/apparmor/profiles r,
827 + /usr/{lib,lib64}/libvirt/* PUxr,
828 +- /usr/{lib,lib64}/libvirt/libvirt_parthelper ix,
829 +- /usr/{lib,lib64}/libvirt/libvirt_iohelper ix,
830 ++ /usr/libexec/virt-aa-helper PUxr,
831 ++ /usr/libexec/libvirt_lxc PUxr,
832 ++ /usr/libexec/libvirt_parthelper ix,
833 ++ /usr/libexec/libvirt_iohelper ix,
834 + /etc/libvirt/hooks/** rmix,
835 + /etc/xen/scripts/** rmix,
836 +
837 +--
838 +2.19.2
839 +
840
841 diff --git a/app-emulation/libvirt/files/libvirt-5.1.0-do-not-use-sysconf.patch b/app-emulation/libvirt/files/libvirt-5.1.0-do-not-use-sysconf.patch
842 new file mode 100644
843 index 0000000..3c32ab8
844 --- /dev/null
845 +++ b/app-emulation/libvirt/files/libvirt-5.1.0-do-not-use-sysconf.patch
846 @@ -0,0 +1,216 @@
847 +From cbc26250bcdc4eb3b1c4e7e09c824f3504d41b27 Mon Sep 17 00:00:00 2001
848 +Message-Id: <cbc26250bcdc4eb3b1c4e7e09c824f3504d41b27.1548428073.git.mprivozn@××××××.com>
849 +From: Michal Privoznik <mprivozn@××××××.com>
850 +Date: Tue, 26 Jun 2018 06:51:06 +0200
851 +Subject: [PATCH] gentoo: do not use sysconf
852 +
853 +Signed-off-by: Michal Privoznik <mprivozn@××××××.com>
854 +---
855 + src/Makefile.am | 29 ++++++-----------------------
856 + src/locking/virtlockd.service.in | 3 +--
857 + src/logging/virtlogd.service.in | 3 +--
858 + src/remote/libvirtd.service.in | 3 +--
859 + tools/Makefile.am | 17 ++++-------------
860 + tools/libvirt-guests.service.in | 2 +-
861 + tools/libvirt-guests.sysconf | 7 +++++++
862 + 7 files changed, 21 insertions(+), 43 deletions(-)
863 +
864 +diff --git a/src/Makefile.am b/src/Makefile.am
865 +index 8c8dfe3dcf..25ced3abf3 100644
866 +--- a/src/Makefile.am
867 ++++ b/src/Makefile.am
868 +@@ -756,23 +756,6 @@ endif WITH_SETUID_RPC_CLIENT
869 +
870 + EXTRA_DIST += $(SYSCONF_FILES)
871 +
872 +-install-sysconfig:
873 +- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
874 +- for f in $(SYSCONF_FILES:%.sysconf=%) ; \
875 +- do \
876 +- tgt=`basename $$f`; \
877 +- $(INSTALL_DATA) $(srcdir)/$$f.sysconf \
878 +- $(DESTDIR)$(sysconfdir)/sysconfig/$$tgt; \
879 +- done
880 +-
881 +-uninstall-sysconfig:
882 +- for f in $(SYSCONF_FILES:%.sysconf=%) ; \
883 +- do \
884 +- tgt=`basename $$f`; \
885 +- rm -f $(DESTDIR)$(sysconfdir)/sysconfig/$$tgt; \
886 +- done
887 +- rmdir $(DESTDIR)$(sysconfdir)/sysconfig || :
888 +-
889 + SYSVINIT_FILES_IN += \
890 + locking/virtlockd.init.in \
891 + $(NULL)
892 +@@ -816,14 +799,14 @@ if WITH_LIBVIRTD
893 + if LIBVIRT_INIT_SCRIPT_RED_HAT
894 + initdir = $(sysconfdir)/rc.d/init.d
895 +
896 +-install-init: $(SYSVINIT_FILES) install-sysconfig
897 ++install-init: $(SYSVINIT_FILES)
898 + $(MKDIR_P) $(DESTDIR)$(initdir)
899 + for f in $(SYSVINIT_FILES:%.init=%) ; \
900 + do \
901 + $(INSTALL_SCRIPT) $$f.init $(DESTDIR)$(initdir)/$$f; \
902 + done
903 +
904 +-uninstall-init: uninstall-sysconfig
905 ++uninstall-init:
906 + rm -f $(SYSVINIT_FILES:%.init=$(DESTDIR)$(initdir)/%)
907 + rmdir $(DESTDIR)$(initdir) || :
908 +
909 +@@ -862,14 +845,14 @@ SYSTEMD_UNIT_FILES = $(notdir $(SYSTEMD_UNIT_FILES_IN:%.in=%))
910 + BUILT_SOURCES += $(SYSTEMD_UNIT_FILES)
911 + DISTCLEANFILES += $(SYSTEMD_UNIT_FILES)
912 +
913 +-install-systemd: $(SYSTEMD_UNIT_FILES) install-sysconfig
914 ++install-systemd: $(SYSTEMD_UNIT_FILES)
915 + $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
916 + for f in $(SYSTEMD_UNIT_FILES); \
917 + do \
918 + $(INSTALL_DATA) $$f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/ ; \
919 + done
920 +
921 +-uninstall-systemd: uninstall-sysconfig
922 ++uninstall-systemd:
923 + rm -f $(SYSTEMD_UNIT_FILES:%=$(DESTDIR)$(SYSTEMD_UNIT_DIR)/%)
924 + rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
925 +
926 +@@ -884,7 +867,7 @@ EXTRA_DIST += $(UPSTART_FILES)
927 + if WITH_LIBVIRTD
928 + if LIBVIRT_INIT_SCRIPT_UPSTART
929 +
930 +-install-upstart: install-sysconfig
931 ++install-upstart:
932 + $(MKDIR_P) $(DESTDIR)$(sysconfdir)/event.d
933 + for f in $(UPSTART_FILES:%.upstart=%); \
934 + do \
935 +@@ -893,7 +876,7 @@ install-upstart: install-sysconfig
936 + $(DESTDIR)$(sysconfdir)/event.d/$$tgt ; \
937 + done
938 +
939 +-uninstall-upstart: uninstall-sysconfig
940 ++uninstall-upstart:
941 + for f in $(UPSTART_FILES:%.upstart=%); \
942 + do \
943 + tgt=`basename $$f` ; \
944 +diff --git a/src/locking/virtlockd.service.in b/src/locking/virtlockd.service.in
945 +index 3c9d587032..2449b201d9 100644
946 +--- a/src/locking/virtlockd.service.in
947 ++++ b/src/locking/virtlockd.service.in
948 +@@ -7,8 +7,7 @@ Documentation=man:virtlockd(8)
949 + Documentation=https://libvirt.org
950 +
951 + [Service]
952 +-EnvironmentFile=-/etc/sysconfig/virtlockd
953 +-ExecStart=@sbindir@/virtlockd $VIRTLOCKD_ARGS
954 ++ExecStart=@sbindir@/virtlockd
955 + ExecReload=/bin/kill -USR1 $MAINPID
956 + # Loosing the locks is a really bad thing that will
957 + # cause the machine to be fenced (rebooted), so make
958 +diff --git a/src/logging/virtlogd.service.in b/src/logging/virtlogd.service.in
959 +index 3d9ae36150..43736191d5 100644
960 +--- a/src/logging/virtlogd.service.in
961 ++++ b/src/logging/virtlogd.service.in
962 +@@ -7,8 +7,7 @@ Documentation=man:virtlogd(8)
963 + Documentation=https://libvirt.org
964 +
965 + [Service]
966 +-EnvironmentFile=-/etc/sysconfig/virtlogd
967 +-ExecStart=@sbindir@/virtlogd $VIRTLOGD_ARGS
968 ++ExecStart=@sbindir@/virtlogd
969 + ExecReload=/bin/kill -USR1 $MAINPID
970 + # Loosing the logs is a really bad thing that will
971 + # cause the machine to be fenced (rebooted), so make
972 +diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
973 +index 7f689e08a8..239beeced9 100644
974 +--- a/src/remote/libvirtd.service.in
975 ++++ b/src/remote/libvirtd.service.in
976 +@@ -22,8 +22,7 @@ Documentation=https://libvirt.org
977 +
978 + [Service]
979 + Type=notify
980 +-EnvironmentFile=-/etc/sysconfig/libvirtd
981 +-ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
982 ++ExecStart=@sbindir@/libvirtd
983 + ExecReload=/bin/kill -HUP $MAINPID
984 + KillMode=process
985 + Restart=on-failure
986 +diff --git a/tools/Makefile.am b/tools/Makefile.am
987 +index 613c9a77f0..224b511074 100644
988 +--- a/tools/Makefile.am
989 ++++ b/tools/Makefile.am
990 +@@ -339,15 +339,6 @@ install-data-local: install-init install-systemd install-nss \
991 + uninstall-local: uninstall-init uninstall-systemd uninstall-nss \
992 + uninstall-bash-completion
993 +
994 +-install-sysconfig:
995 +- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig
996 +- $(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \
997 +- $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
998 +-
999 +-uninstall-sysconfig:
1000 +- rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests
1001 +- rmdir $(DESTDIR)$(sysconfdir)/sysconfig ||:
1002 +-
1003 + EXTRA_DIST += libvirt-guests.sh.in libvirt-guests.init.in
1004 +
1005 + install-initscript: libvirt-guests.init
1006 +@@ -362,8 +353,8 @@ uninstall-initscript:
1007 +
1008 + if LIBVIRT_INIT_SCRIPT_RED_HAT
1009 + BUILT_SOURCES += libvirt-guests.init
1010 +-install-init: install-sysconfig install-initscript
1011 +-uninstall-init: uninstall-sysconfig uninstall-initscript
1012 ++install-init: install-initscript
1013 ++uninstall-init: uninstall-initscript
1014 + else ! LIBVIRT_INIT_SCRIPT_RED_HAT
1015 + install-init:
1016 + uninstall-init:
1017 +@@ -394,12 +385,12 @@ EXTRA_DIST += libvirt-guests.service.in
1018 + SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
1019 +
1020 + if LIBVIRT_INIT_SCRIPT_SYSTEMD
1021 +-install-systemd: libvirt-guests.service install-sysconfig libvirt-guests.sh
1022 ++install-systemd: libvirt-guests.service libvirt-guests.sh
1023 + $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
1024 + $(INSTALL_DATA) libvirt-guests.service \
1025 + $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
1026 +
1027 +-uninstall-systemd: uninstall-sysconfig
1028 ++uninstall-systemd:
1029 + rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
1030 + rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) ||:
1031 +
1032 +diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
1033 +index 491ca62138..f0f417bffb 100644
1034 +--- a/tools/libvirt-guests.service.in
1035 ++++ b/tools/libvirt-guests.service.in
1036 +@@ -10,7 +10,7 @@ Documentation=man:libvirtd(8)
1037 + Documentation=https://libvirt.org
1038 +
1039 + [Service]
1040 +-EnvironmentFile=-/etc/sysconfig/libvirt-guests
1041 ++EnvironmentFile=-/etc/libvirt/libvirt-guests.conf
1042 + # Hack just call traditional service until we factor
1043 + # out the code
1044 + ExecStart=@libexecdir@/libvirt-guests.sh start
1045 +diff --git a/tools/libvirt-guests.sysconf b/tools/libvirt-guests.sysconf
1046 +index 669b046507..45b0b9ea46 100644
1047 +--- a/tools/libvirt-guests.sysconf
1048 ++++ b/tools/libvirt-guests.sysconf
1049 +@@ -1,3 +1,10 @@
1050 ++#
1051 ++# Warning: This configuration file is only sourced by the systemd
1052 ++# libvirt-guests.service unit. The coresponding openrc facility is in
1053 ++# /etc/init.d/libvirtd and /etc/conf.d/libvirtd
1054 ++#
1055 ++
1056 ++
1057 + # URIs to check for running guests
1058 + # example: URIS='default xen:///system vbox+tcp://host/system lxc:///system'
1059 + #URIS=default
1060 +--
1061 +2.19.2
1062 +
1063
1064 diff --git a/app-emulation/libvirt/files/libvirt-guests.confd b/app-emulation/libvirt/files/libvirt-guests.confd
1065 new file mode 100644
1066 index 0000000..ed2ce58
1067 --- /dev/null
1068 +++ b/app-emulation/libvirt/files/libvirt-guests.confd
1069 @@ -0,0 +1,68 @@
1070 +# /etc/conf.d/libvirtd
1071 +
1072 +# LIBVIRT_URIS
1073 +# space separated list of libvirt URIs to communicate with to start/stop guests
1074 +# Valid values are anything that can be passed to 'virsh connect'
1075 +
1076 +#LIBVIRT_URIS="qemu:///system"
1077 +
1078 +
1079 +# LIBVIRT_SHUTDOWN
1080 +# Valid options:
1081 +# * managedsave - Performs a state save external to the VM (for hypervisors
1082 +# supporting this operation). qemu-kvm will stop the CPU
1083 +# and save off all state to a separate file. When the
1084 +# machine is started again, it will resume like nothing
1085 +# ever happened. This is guarenteed to always successfully
1086 +# stop your machine and restart it.
1087 +#
1088 +# * shutdown - Sends an ACPI shutdown (think of this as a request to
1089 +# your guest to shutdown). There is no way to distinguish
1090 +# between guests that are ignoring the shutdown request or
1091 +# are stuck or are taking a long time to shutdown. We will
1092 +# wait LIBVIRT_MAXWAIT seconds before yanking the power
1093 +# out.
1094 +#
1095 +# * destroy - Immediately stop all running guests. Use with caution as
1096 +# this can leave the guest in a corrupted state and might
1097 +# lead to data loss.
1098 +#
1099 +
1100 +#LIBVIRT_SHUTDOWN="managedsave"
1101 +
1102 +
1103 +# LIBVIRT_MAXWAIT
1104 +# Timeout in seconds until stopping a guest and "pulling the plug" on the
1105 +# guest
1106 +# Valid values are any integer over 0
1107 +
1108 +#LIBVIRT_MAXWAIT="500"
1109 +
1110 +
1111 +# LIBVIRT_START
1112 +# If this value is set to 'no', then guests and networks that were shutdown
1113 +# by this script when it was stopped will not be started when it is started
1114 +# back up.
1115 +# Valid values are yes or no
1116 +
1117 +#LIBVIRT_START="yes"
1118 +
1119 +
1120 +# LIBVIRT_IGNORE_AUTOSTART
1121 +# If the VM is marked for autostart in its XML configuration then we won't
1122 +# save its start when the init script is stopped. The result is that when
1123 +# the init script starts back up, no attempt will be made to start the VM or
1124 +# confirm it is started.
1125 +# Valid values are yes or no
1126 +
1127 +#LIBVIRT_IGNORE_AUTOSTART="no"
1128 +
1129 +
1130 +# LIBVIRT_NET_SHUTDOWN
1131 +# If libvirtd created networks for you (e.g. NATed networks) then this init
1132 +# script will shut them down for you if this is set to 'yes'. Otherwise,
1133 +# the networks will be left running. For this option to be useful you must
1134 +# have enabled the 'virt-network' USE flag and have had libvirt create a
1135 +# NATed network for you. Valid values: 'yes' or 'no'
1136 +
1137 +#LIBVIRT_NET_SHUTDOWN="yes"
1138
1139 diff --git a/app-emulation/libvirt/files/libvirt-guests.init-r2 b/app-emulation/libvirt/files/libvirt-guests.init-r2
1140 new file mode 100644
1141 index 0000000..8455918
1142 --- /dev/null
1143 +++ b/app-emulation/libvirt/files/libvirt-guests.init-r2
1144 @@ -0,0 +1,235 @@
1145 +#!/sbin/openrc-run
1146 +
1147 +description="Virtual Machine Management (libvirt) Guests"
1148 +
1149 +depend() {
1150 + use libvirtd
1151 +}
1152 +
1153 +# set the default to QEMU
1154 +[ -z "${LIBVIRT_URIS}" ] && LIBVIRT_URIS="qemu:///system"
1155 +
1156 +# default to suspending the VM via managedsave
1157 +case "${LIBVIRT_SHUTDOWN}" in
1158 + managedsave|shutdown|destroy) ;;
1159 + *) LIBVIRT_SHUTDOWN="managedsave" ;;
1160 +esac
1161 +
1162 +# default to 500 seconds
1163 +[ -z ${LIBVIRT_MAXWAIT} ] && LIBVIRT_MAXWAIT=500
1164 +
1165 +gueststatefile="/var/lib/libvirt/libvirt-guests.state"
1166 +netstatefile="/var/lib/libvirt/libvirt-net.state"
1167 +
1168 +do_virsh() {
1169 + local hvuri=$1
1170 + shift
1171 +
1172 + # if unset, default to qemu
1173 + [ -z ${hvuri} ] && hvuri="qemu:///system"
1174 + # if only qemu was supplied then correct the value
1175 + [ "xqemu" = x${hvuri} ] && hvuri="qemu:///system"
1176 +
1177 + # Silence errors because virsh always throws an error about
1178 + # not finding the hypervisor version when connecting to libvirtd
1179 + # lastly strip the blank line at the end
1180 + LC_ALL=C virsh -c ${hvuri} "$@" 2>/dev/null | head -n -1
1181 +}
1182 +
1183 +libvirtd_dom_list() {
1184 + # Only work with domains by their UUIDs
1185 + local hvuri=$1
1186 + shift
1187 +
1188 + do_virsh "${hvuri}" list --uuid $@
1189 +}
1190 +
1191 +libvirtd_dom_count() {
1192 + local hvuri=$1
1193 + shift
1194 +
1195 + libvirtd_dom_list "${hvuri}" $@ | wc -l
1196 +}
1197 +
1198 +libvirtd_net_list() {
1199 + # Only work with networks by their UUIDs
1200 + local hvuri=$1
1201 + shift
1202 +
1203 + do_virsh "${hvuri}" net-list --uuid $@
1204 +}
1205 +
1206 +libvirtd_net_count() {
1207 + local hvuri=$1
1208 + shift
1209 +
1210 + libvirtd_net_list "${hvuri}" $@ | wc -l
1211 +}
1212 +
1213 +libvirtd_dom_stop() {
1214 + # stops all persistent or transient domains for a given URI
1215 + # $1 - uri
1216 + # $2 - persisent/transient
1217 +
1218 + local uri=$1
1219 + local persist=$2
1220 + local shutdown_type=${LIBVIRT_SHUTDOWN}
1221 + local counter=${LIBVIRT_MAXWAIT}
1222 + local dom_name=
1223 + local dom_as=
1224 + local dom_ids=
1225 + local uuid=
1226 + local dom_count=
1227 +
1228 + [ "${persist}" = "--transient" ] && shutdown_type="shutdown"
1229 + [ -n "${counter}" ] || counter=500
1230 +
1231 + einfo " Shutting down domain(s) ..."
1232 +
1233 + # grab all persistent or transient domains running
1234 + dom_ids=$(libvirtd_dom_list ${uri} ${persist})
1235 +
1236 + for uuid in ${dom_ids}; do
1237 + # Get the name
1238 + dom_name=$(do_virsh ${uri} domname ${uuid})
1239 + einfo " ${dom_name}"
1240 + # Get autostart state
1241 + dom_as=$(do_virsh ${uri} dominfo ${uuid} | \
1242 + awk '$1 == "Autostart:" { print $2 }')
1243 +
1244 + if [ "${persist}" = "--persistent" ]; then
1245 + # Save our running state only if LIBVIRT_IGNORE_AUTOSTART != yes
1246 + if [ "x${LIBVIRT_IGNORE_AUTOSTART}" = "xyes" ] && \
1247 + [ ${dom_as} = "enabled" ]; then
1248 + :
1249 + else
1250 + echo "${uri} ${uuid}" >> ${gueststatefile}
1251 + fi
1252 +
1253 + fi
1254 +
1255 + # Now let's stop it
1256 + do_virsh "${uri}" ${shutdown_type} ${uuid} > /dev/null
1257 +
1258 + done
1259 +
1260 + dom_count="$(libvirtd_dom_count ${uri} ${persist})"
1261 + while [ ${dom_count} -gt 0 ] && [ ${counter} -gt 0 ] ; do
1262 + dom_count="$(libvirtd_dom_count ${uri} ${persist})"
1263 + sleep 1
1264 + if [ "${shutdown_type}" = "shutdown" ]; then
1265 + counter=$((${counter} - 1))
1266 + fi
1267 + printf "."
1268 + done
1269 +
1270 + if [ "${shutdown_type}" = "shutdown" ]; then
1271 + # grab all domains still running
1272 + dom_ids=$(libvirtd_dom_list ${uri} ${persist})
1273 + for uuid in ${dom_ids}; do
1274 + dom_name=$(do_virsh ${uri} domname ${uuid})
1275 + eerror " ${dom_name} forcibly stopped"
1276 + do_virsh "${uri}" destroy ${uuid} > /dev/null
1277 + done
1278 + fi
1279 +}
1280 +
1281 +libvirtd_net_stop() {
1282 + # stops all persistent or transient domains for a given URI
1283 + # $1 - uri
1284 + # $2 - persisent/transient
1285 +
1286 + local uri=$1
1287 + local persist=$2
1288 + local uuid=
1289 + local net_name=
1290 +
1291 + if [ "${LIBVIRT_NET_SHUTDOWN}" != "no" ]; then
1292 +
1293 + einfo " Shutting down network(s):"
1294 + for uuid in $(libvirtd_net_list ${uri} ${persist}); do
1295 + net_name=$(do_virsh ${uri} net-name ${uuid})
1296 + einfo " ${net_name}"
1297 +
1298 + if [ "${persist}" = "--persistent" ]; then
1299 + # Save our running state
1300 + echo "${uri} ${uuid}" >> ${netstatefile}
1301 +
1302 + fi
1303 +
1304 + # Actually stop the network
1305 + do_virsh qemu net-destroy ${uuid} > /dev/null
1306 + done
1307 +
1308 + fi
1309 +}
1310 +
1311 +start() {
1312 + local uri=
1313 + local uuid=
1314 + local name=
1315 +
1316 + for uri in ${LIBVIRT_URIS}; do
1317 + do_virsh "${uri}" connect
1318 + if [ $? -ne 0 ]; then
1319 + eerror "Failed to connect to '${uri}'. Domains may not start."
1320 + fi
1321 + done
1322 +
1323 + [ ! -e "${netstatefile}" ] && touch "${netstatefile}"
1324 + [ ! -e "${gueststatefile}" ] && touch "${gueststatefile}"
1325 +
1326 + # if the user didn't want to start any guests up then respect their wish
1327 + [ "x${LIBVIRT_START}" = "xno" ] && return 0
1328 +
1329 + # start networks
1330 + ebegin "Starting libvirt networks"
1331 + while read -r uri uuid
1332 + do
1333 + # ignore trash
1334 + [ -z "${uri}" ] || [ -z "${uuid}" ] && continue
1335 +
1336 + name=$(do_virsh "${uri}" net-name ${uuid})
1337 + einfo " ${name}"
1338 + do_virsh "${uri}" net-start ${uuid} > /dev/null
1339 + done <"${netstatefile}"
1340 + eend 0
1341 +
1342 + # start domains
1343 + ebegin "Starting libvirt domains"
1344 + while read -r uri uuid
1345 + do
1346 + # ignore trash
1347 + [ -z "${uri}" ] || [ -z "${uuid}" ] && continue
1348 +
1349 + name=$(do_virsh "${uri}" domname ${uuid})
1350 + einfo " ${name}"
1351 + do_virsh "${uri}" start ${uuid} > /dev/null
1352 + done <"${gueststatefile}"
1353 + eend 0
1354 +}
1355 +
1356 +stop() {
1357 + local counter=
1358 + local dom_name=
1359 + local net_name=
1360 + local dom_ids=
1361 + local uuid=
1362 + local dom_count=
1363 +
1364 + rm -f "${gueststatefile}"
1365 + [ $? -ne 0 ] && eerror "Unable to save domain state"
1366 + rm -f "${netstatefile}"
1367 + [ $? -ne 0 ] && eerror "Unable to save net state"
1368 +
1369 + for uri in ${LIBVIRT_URIS}; do
1370 + einfo "Stopping libvirt domains and networks for ${uri}"
1371 +
1372 + libvirtd_dom_stop "${uri}" "--persistent"
1373 + libvirtd_dom_stop "${uri}" "--transient"
1374 + libvirtd_net_stop "${uri}" "--persistent"
1375 + libvirtd_net_stop "${uri}" "--transient"
1376 +
1377 + einfo "Done stopping domains and networks for ${uri}"
1378 + done
1379 +}
1380
1381 diff --git a/app-emulation/libvirt/files/libvirt-guests.init-r3 b/app-emulation/libvirt/files/libvirt-guests.init-r3
1382 new file mode 100644
1383 index 0000000..10797e1
1384 --- /dev/null
1385 +++ b/app-emulation/libvirt/files/libvirt-guests.init-r3
1386 @@ -0,0 +1,236 @@
1387 +#!/sbin/openrc-run
1388 +
1389 +description="Virtual Machine Management (libvirt) Guests"
1390 +
1391 +depend() {
1392 + use libvirtd
1393 +}
1394 +
1395 +# set the default to QEMU
1396 +[ -z "${LIBVIRT_URIS}" ] && LIBVIRT_URIS="qemu:///system"
1397 +
1398 +# default to suspending the VM via managedsave
1399 +case "${LIBVIRT_SHUTDOWN}" in
1400 + managedsave|shutdown|destroy) ;;
1401 + *) LIBVIRT_SHUTDOWN="managedsave" ;;
1402 +esac
1403 +
1404 +# default to 500 seconds
1405 +[ -z ${LIBVIRT_MAXWAIT} ] && LIBVIRT_MAXWAIT=500
1406 +
1407 +gueststatefile="/var/lib/libvirt/libvirt-guests.state"
1408 +netstatefile="/var/lib/libvirt/libvirt-net.state"
1409 +
1410 +do_virsh() {
1411 + local hvuri=$1
1412 + shift
1413 +
1414 + # if unset, default to qemu
1415 + [ -z ${hvuri} ] && hvuri="qemu:///system"
1416 + # if only qemu was supplied then correct the value
1417 + [ "xqemu" = x${hvuri} ] && hvuri="qemu:///system"
1418 +
1419 + # Silence errors because virsh always throws an error about
1420 + # not finding the hypervisor version when connecting to libvirtd
1421 + # lastly strip the blank line at the end
1422 + LC_ALL=C virsh -c ${hvuri} "$@" 2>/dev/null | head -n -1
1423 +}
1424 +
1425 +libvirtd_dom_list() {
1426 + # Only work with domains by their UUIDs
1427 + local hvuri=$1
1428 + shift
1429 +
1430 + # The grep is to remove dom0 for xen domains. Otherwise we never hit 0
1431 + do_virsh "${hvuri}" list --uuid $@ | grep -v 00000000-0000-0000-0000-000000000000
1432 +}
1433 +
1434 +libvirtd_dom_count() {
1435 + local hvuri=$1
1436 + shift
1437 +
1438 + libvirtd_dom_list "${hvuri}" $@ | wc -l
1439 +}
1440 +
1441 +libvirtd_net_list() {
1442 + # Only work with networks by their UUIDs
1443 + local hvuri=$1
1444 + shift
1445 +
1446 + do_virsh "${hvuri}" net-list --uuid $@
1447 +}
1448 +
1449 +libvirtd_net_count() {
1450 + local hvuri=$1
1451 + shift
1452 +
1453 + libvirtd_net_list "${hvuri}" $@ | wc -l
1454 +}
1455 +
1456 +libvirtd_dom_stop() {
1457 + # stops all persistent or transient domains for a given URI
1458 + # $1 - uri
1459 + # $2 - persisent/transient
1460 +
1461 + local uri=$1
1462 + local persist=$2
1463 + local shutdown_type=${LIBVIRT_SHUTDOWN}
1464 + local counter=${LIBVIRT_MAXWAIT}
1465 + local dom_name=
1466 + local dom_as=
1467 + local dom_ids=
1468 + local uuid=
1469 + local dom_count=
1470 +
1471 + [ "${persist}" = "--transient" ] && shutdown_type="shutdown"
1472 + [ -n "${counter}" ] || counter=500
1473 +
1474 + einfo " Shutting down domain(s) ..."
1475 +
1476 + # grab all persistent or transient domains running
1477 + dom_ids=$(libvirtd_dom_list ${uri} ${persist})
1478 +
1479 + for uuid in ${dom_ids}; do
1480 + # Get the name
1481 + dom_name=$(do_virsh ${uri} domname ${uuid})
1482 + einfo " ${dom_name}"
1483 + # Get autostart state
1484 + dom_as=$(do_virsh ${uri} dominfo ${uuid} | \
1485 + awk '$1 == "Autostart:" { print $2 }')
1486 +
1487 + if [ "${persist}" = "--persistent" ]; then
1488 + # Save our running state only if LIBVIRT_IGNORE_AUTOSTART != yes
1489 + if [ "x${LIBVIRT_IGNORE_AUTOSTART}" = "xyes" ] && \
1490 + [ ${dom_as} = "enabled" ]; then
1491 + :
1492 + else
1493 + echo "${uri} ${uuid}" >> ${gueststatefile}
1494 + fi
1495 +
1496 + fi
1497 +
1498 + # Now let's stop it
1499 + do_virsh "${uri}" ${shutdown_type} ${uuid} > /dev/null
1500 +
1501 + done
1502 +
1503 + dom_count="$(libvirtd_dom_count ${uri} ${persist})"
1504 + while [ ${dom_count} -gt 0 ] && [ ${counter} -gt 0 ] ; do
1505 + dom_count="$(libvirtd_dom_count ${uri} ${persist})"
1506 + sleep 1
1507 + if [ "${shutdown_type}" = "shutdown" ]; then
1508 + counter=$((${counter} - 1))
1509 + fi
1510 + printf "."
1511 + done
1512 +
1513 + if [ "${shutdown_type}" = "shutdown" ]; then
1514 + # grab all domains still running
1515 + dom_ids=$(libvirtd_dom_list ${uri} ${persist})
1516 + for uuid in ${dom_ids}; do
1517 + dom_name=$(do_virsh ${uri} domname ${uuid})
1518 + eerror " ${dom_name} forcibly stopped"
1519 + do_virsh "${uri}" destroy ${uuid} > /dev/null
1520 + done
1521 + fi
1522 +}
1523 +
1524 +libvirtd_net_stop() {
1525 + # stops all persistent or transient domains for a given URI
1526 + # $1 - uri
1527 + # $2 - persisent/transient
1528 +
1529 + local uri=$1
1530 + local persist=$2
1531 + local uuid=
1532 + local net_name=
1533 +
1534 + if [ "${LIBVIRT_NET_SHUTDOWN}" != "no" ]; then
1535 +
1536 + einfo " Shutting down network(s):"
1537 + for uuid in $(libvirtd_net_list ${uri} ${persist}); do
1538 + net_name=$(do_virsh ${uri} net-name ${uuid})
1539 + einfo " ${net_name}"
1540 +
1541 + if [ "${persist}" = "--persistent" ]; then
1542 + # Save our running state
1543 + echo "${uri} ${uuid}" >> ${netstatefile}
1544 +
1545 + fi
1546 +
1547 + # Actually stop the network
1548 + do_virsh qemu net-destroy ${uuid} > /dev/null
1549 + done
1550 +
1551 + fi
1552 +}
1553 +
1554 +start() {
1555 + local uri=
1556 + local uuid=
1557 + local name=
1558 +
1559 + for uri in ${LIBVIRT_URIS}; do
1560 + do_virsh "${uri}" connect
1561 + if [ $? -ne 0 ]; then
1562 + eerror "Failed to connect to '${uri}'. Domains may not start."
1563 + fi
1564 + done
1565 +
1566 + [ ! -e "${netstatefile}" ] && touch "${netstatefile}"
1567 + [ ! -e "${gueststatefile}" ] && touch "${gueststatefile}"
1568 +
1569 + # if the user didn't want to start any guests up then respect their wish
1570 + [ "x${LIBVIRT_START}" = "xno" ] && return 0
1571 +
1572 + # start networks
1573 + ebegin "Starting libvirt networks"
1574 + while read -r uri uuid
1575 + do
1576 + # ignore trash
1577 + [ -z "${uri}" ] || [ -z "${uuid}" ] && continue
1578 +
1579 + name=$(do_virsh "${uri}" net-name ${uuid})
1580 + einfo " ${name}"
1581 + do_virsh "${uri}" net-start ${uuid} > /dev/null
1582 + done <"${netstatefile}"
1583 + eend 0
1584 +
1585 + # start domains
1586 + ebegin "Starting libvirt domains"
1587 + while read -r uri uuid
1588 + do
1589 + # ignore trash
1590 + [ -z "${uri}" ] || [ -z "${uuid}" ] && continue
1591 +
1592 + name=$(do_virsh "${uri}" domname ${uuid})
1593 + einfo " ${name}"
1594 + do_virsh "${uri}" start ${uuid} > /dev/null
1595 + done <"${gueststatefile}"
1596 + eend 0
1597 +}
1598 +
1599 +stop() {
1600 + local counter=
1601 + local dom_name=
1602 + local net_name=
1603 + local dom_ids=
1604 + local uuid=
1605 + local dom_count=
1606 +
1607 + rm -f "${gueststatefile}"
1608 + [ $? -ne 0 ] && eerror "Unable to save domain state"
1609 + rm -f "${netstatefile}"
1610 + [ $? -ne 0 ] && eerror "Unable to save net state"
1611 +
1612 + for uri in ${LIBVIRT_URIS}; do
1613 + einfo "Stopping libvirt domains and networks for ${uri}"
1614 +
1615 + libvirtd_dom_stop "${uri}" "--persistent"
1616 + libvirtd_dom_stop "${uri}" "--transient"
1617 + libvirtd_net_stop "${uri}" "--persistent"
1618 + libvirtd_net_stop "${uri}" "--transient"
1619 +
1620 + einfo "Done stopping domains and networks for ${uri}"
1621 + done
1622 +}
1623
1624 diff --git a/app-emulation/libvirt/files/libvirtd.confd-r5 b/app-emulation/libvirt/files/libvirtd.confd-r5
1625 new file mode 100644
1626 index 0000000..c326531
1627 --- /dev/null
1628 +++ b/app-emulation/libvirt/files/libvirtd.confd-r5
1629 @@ -0,0 +1,18 @@
1630 +# /etc/conf.d/libvirtd
1631 +
1632 +# Startup dependency
1633 +# libvirtd typically requires all networks to be up and settled which
1634 +# is what rc_need="net" provides. However if you only use specific networks
1635 +# for libvirtd, you may override this. Or if you only use libvirtd locally.
1636 +rc_need="net"
1637 +
1638 +# The termination timeout (start-stop-daemon parameter "retry") ensures
1639 +# that the service will be terminated within a given time (25 + 5 seconds
1640 +# per default) when you are stopping the service.
1641 +#LIBVIRTD_TERMTIMEOUT="TERM/25/KILL/5"
1642 +
1643 +# LIBVIRTD_OPTS
1644 +# You may want to add '--listen' to have libvirtd listen for tcp/ip connections
1645 +# if you want to use libvirt for remote control
1646 +# Please consult 'libvirtd --help' for more options
1647 +#LIBVIRTD_OPTS="--listen"
1648
1649 diff --git a/app-emulation/libvirt/files/libvirtd.init-r16 b/app-emulation/libvirt/files/libvirtd.init-r16
1650 new file mode 100644
1651 index 0000000..be660e3
1652 --- /dev/null
1653 +++ b/app-emulation/libvirt/files/libvirtd.init-r16
1654 @@ -0,0 +1,34 @@
1655 +#!/sbin/openrc-run
1656 +# Copyright 1999-2015 Gentoo Foundation
1657 +# Distributed under the terms of the GNU General Public License v2
1658 +
1659 +description="Virtual Machine Management daemon (libvirt)"
1660 +
1661 +LIBVIRTD_OPTS=${LIBVIRTD_OPTS:-"${LIBVIRTD_OPTS}"}
1662 +LIBVIRTD_TIMEOUT=${LIBVIRTD_TERMTIMEOUT:-"TERM/25/KILL/5"}
1663 +
1664 +command="/usr/sbin/libvirtd"
1665 +command_args="-d ${LIBVIRTD_OPTS}"
1666 +start_stop_daemon_args="--env KRB5_KTNAME=/etc/libvirt/krb5.tab"
1667 +pidfile="/var/run/libvirtd.pid"
1668 +retry="${LIBVIRTD_TERMTIMEOUT}"
1669 +
1670 +depend() {
1671 + need virtlogd
1672 + use dbus virtlockd
1673 + after ntp-client ntpd nfs nfsmount portmap rpc.statd iptables ip6tables ebtables corosync sanlock cgconfig xenconsoled
1674 + USE_FLAG_FIREWALLD
1675 + USE_FLAG_AVAHI
1676 + USE_FLAG_ISCSI
1677 + USE_FLAG_RBD
1678 +}
1679 +
1680 +start_pre() {
1681 + # Test configuration directories in /etc/libvirt/ to be either not
1682 + # present or a directory, i.e. not a regular file, bug #532892
1683 +
1684 + checkpath --directory /etc/libvirt/lxc || return 1
1685 + checkpath --directory /etc/libvirt/nwfilter || return 1
1686 + checkpath --directory /etc/libvirt/qemu || return 1
1687 + checkpath --directory /etc/libvirt/storage || return 1
1688 +}
1689
1690 diff --git a/app-emulation/libvirt/files/libvirtd.service.conf b/app-emulation/libvirt/files/libvirtd.service.conf
1691 new file mode 100644
1692 index 0000000..f087922
1693 --- /dev/null
1694 +++ b/app-emulation/libvirt/files/libvirtd.service.conf
1695 @@ -0,0 +1,10 @@
1696 +# Uncomment the following three lines to start libvirtd with the '--listen'
1697 +# directive such that it listens for TCP/IP connections (honoring the
1698 +# listen_tls and listen_tcp settings in /etc/libvirt/libvirtd.conf). If
1699 +# libvirtd is started without the '--listen' parameter, network connection
1700 +# (for the daemon) is globally disabled:
1701 +
1702 +# [Service]
1703 +# ExecStart=
1704 +# ExecStart=/usr/sbin/libvirtd --listen
1705 +
1706
1707 diff --git a/app-emulation/libvirt/files/libvirtd.tmpfiles.conf b/app-emulation/libvirt/files/libvirtd.tmpfiles.conf
1708 new file mode 100644
1709 index 0000000..c22c23d
1710 --- /dev/null
1711 +++ b/app-emulation/libvirt/files/libvirtd.tmpfiles.conf
1712 @@ -0,0 +1 @@
1713 +d /run/libvirt/lxc 0755 root root -
1714
1715 diff --git a/app-emulation/libvirt/files/virtlockd.init-r1 b/app-emulation/libvirt/files/virtlockd.init-r1
1716 new file mode 100644
1717 index 0000000..e7c3db2
1718 --- /dev/null
1719 +++ b/app-emulation/libvirt/files/virtlockd.init-r1
1720 @@ -0,0 +1,23 @@
1721 +#!/sbin/openrc-run
1722 +# Copyright 1999-2015 Gentoo Foundation
1723 +# Distributed under the terms of the GNU General Public License v2
1724 +
1725 +description="libvirt virtual machine lock manager"
1726 +command="/usr/sbin/virtlockd"
1727 +command_args="-d"
1728 +pidfile="/var/run/virtlockd.pid"
1729 +
1730 +extra_started_commands="reload"
1731 +description_reload="re-exec the daemon, while maintaining locks and clients"
1732 +
1733 +
1734 +depend() {
1735 + after ntp-client ntpd nfs nfsmount corosync
1736 +}
1737 +
1738 +reload() {
1739 + ebegin "re-exec() virtlockd"
1740 +
1741 + start-stop-daemon --signal SIGUSR1 \
1742 + --exec "${command}" --pidfile "${pidfile}"
1743 +}
1744
1745 diff --git a/app-emulation/libvirt/files/virtlogd.init-r1 b/app-emulation/libvirt/files/virtlogd.init-r1
1746 new file mode 100644
1747 index 0000000..438070e
1748 --- /dev/null
1749 +++ b/app-emulation/libvirt/files/virtlogd.init-r1
1750 @@ -0,0 +1,23 @@
1751 +#!/sbin/openrc-run
1752 +# Copyright 1999-2015 Gentoo Foundation
1753 +# Distributed under the terms of the GNU General Public License v2
1754 +
1755 +description="libvirt virtual machine logging manager"
1756 +command="/usr/sbin/virtlogd"
1757 +command_args="-d"
1758 +pidfile="/var/run/virtlogd.pid"
1759 +
1760 +extra_started_commands="reload"
1761 +description_reload="re-exec the daemon, while maintaining open connections"
1762 +
1763 +
1764 +depend() {
1765 + after ntp-client ntpd nfs nfsmount corosync
1766 +}
1767 +
1768 +reload() {
1769 + ebegin "re-exec() virtlogd"
1770 +
1771 + start-stop-daemon --signal SIGUSR1 \
1772 + --exec "${command}" --pidfile "${pidfile}"
1773 +}
1774
1775 diff --git a/app-emulation/libvirt/libvirt-4.10.0.ebuild b/app-emulation/libvirt/libvirt-4.10.0.ebuild
1776 new file mode 100644
1777 index 0000000..ca093b5
1778 --- /dev/null
1779 +++ b/app-emulation/libvirt/libvirt-4.10.0.ebuild
1780 @@ -0,0 +1,388 @@
1781 +# Copyright 1999-2018 Gentoo Authors
1782 +# Distributed under the terms of the GNU General Public License v2
1783 +
1784 +EAPI=7
1785 +
1786 +PYTHON_COMPAT=( python3_{4,5,6,7} )
1787 +
1788 +inherit autotools bash-completion-r1 eutils linux-info python-any-r1 readme.gentoo-r1 systemd user
1789 +
1790 +if [[ ${PV} = *9999* ]]; then
1791 + inherit git-r3
1792 + EGIT_REPO_URI="https://libvirt.org/git/libvirt.git"
1793 + SRC_URI=""
1794 + KEYWORDS=""
1795 + SLOT="0"
1796 +else
1797 + # Versions with 4 numbers are stable updates:
1798 + if [[ ${PV} =~ ^[0-9]+(\.[0-9]+){3} ]]; then
1799 + SRC_URI="https://libvirt.org/sources/stable_updates/${P}.tar.xz"
1800 + else
1801 + SRC_URI="https://libvirt.org/sources/${P}.tar.xz"
1802 + fi
1803 + KEYWORDS="~amd64 ~arm64 ~x86"
1804 + SLOT="0/${PV}"
1805 +fi
1806 +
1807 +DESCRIPTION="C toolkit to manipulate virtual machines"
1808 +HOMEPAGE="http://www.libvirt.org/"
1809 +LICENSE="LGPL-2.1"
1810 +IUSE="
1811 + apparmor audit +caps +dbus firewalld fuse glusterfs iscsi +libvirtd lvm
1812 + libssh lxc +macvtap nfs nls numa openvz parted pcap phyp policykit
1813 + +qemu rbd sasl selinux +udev uml +vepa virtualbox virt-network
1814 + wireshark-plugins xen zeroconf zfs
1815 +"
1816 +
1817 +REQUIRED_USE="
1818 + firewalld? ( virt-network )
1819 + libvirtd? ( || ( lxc openvz qemu uml virtualbox xen ) )
1820 + lxc? ( caps libvirtd )
1821 + openvz? ( libvirtd )
1822 + policykit? ( dbus )
1823 + qemu? ( libvirtd )
1824 + uml? ( libvirtd )
1825 + vepa? ( macvtap )
1826 + virt-network? ( libvirtd )
1827 + virtualbox? ( libvirtd )
1828 + xen? ( libvirtd )"
1829 +
1830 +# gettext.sh command is used by the libvirt command wrappers, and it's
1831 +# non-optional, so put it into RDEPEND.
1832 +# We can use both libnl:1.1 and libnl:3, but if you have both installed, the
1833 +# package will use 3 by default. Since we don't have slot pinning in an API,
1834 +# we must go with the most recent
1835 +RDEPEND="
1836 + app-misc/scrub
1837 + dev-libs/libgcrypt:0
1838 + dev-libs/libnl:3
1839 + >=dev-libs/libxml2-2.7.6
1840 + || (
1841 + >=net-analyzer/gnu-netcat-0.7.1-r3
1842 + >=net-analyzer/netcat-110-r9
1843 + >=net-analyzer/netcat6-1.0-r2
1844 + >=net-analyzer/openbsd-netcat-1.105-r1
1845 + )
1846 + >=net-libs/gnutls-1.0.25:0=
1847 + net-libs/libssh2
1848 + net-libs/libtirpc
1849 + net-libs/rpcsvc-proto
1850 + >=net-misc/curl-7.18.0
1851 + sys-apps/dmidecode
1852 + >=sys-apps/util-linux-2.17
1853 + sys-devel/gettext
1854 + sys-libs/ncurses:0=
1855 + sys-libs/readline:=
1856 + apparmor? ( sys-libs/libapparmor )
1857 + audit? ( sys-process/audit )
1858 + caps? ( sys-libs/libcap-ng )
1859 + dbus? ( sys-apps/dbus )
1860 + firewalld? ( net-firewall/firewalld )
1861 + fuse? ( >=sys-fs/fuse-2.8.6:= )
1862 + glusterfs? ( >=sys-cluster/glusterfs-3.4.1 )
1863 + iscsi? ( sys-block/open-iscsi )
1864 + libssh? ( net-libs/libssh )
1865 + lvm? ( >=sys-fs/lvm2-2.02.48-r2[-device-mapper-only(-)] )
1866 + nfs? ( net-fs/nfs-utils )
1867 + numa? (
1868 + >sys-process/numactl-2.0.2
1869 + sys-process/numad
1870 + )
1871 + parted? (
1872 + >=sys-block/parted-1.8[device-mapper]
1873 + sys-fs/lvm2[-device-mapper-only(-)]
1874 + )
1875 + pcap? ( >=net-libs/libpcap-1.0.0 )
1876 + policykit? ( >=sys-auth/polkit-0.9 )
1877 + qemu? (
1878 + >=app-emulation/qemu-1.5.0
1879 + dev-libs/yajl
1880 + )
1881 + rbd? ( sys-cluster/ceph )
1882 + sasl? ( dev-libs/cyrus-sasl )
1883 + selinux? ( >=sys-libs/libselinux-2.0.85 )
1884 + virt-network? (
1885 + net-dns/dnsmasq[script]
1886 + net-firewall/ebtables
1887 + >=net-firewall/iptables-1.4.10[ipv6]
1888 + net-misc/radvd
1889 + sys-apps/iproute2[-minimal]
1890 + )
1891 + virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) )
1892 + wireshark-plugins? ( net-analyzer/wireshark:= )
1893 + xen? (
1894 + >=app-emulation/xen-4.6.0
1895 + app-emulation/xen-tools:=
1896 + )
1897 + udev? (
1898 + virtual/udev
1899 + >=x11-libs/libpciaccess-0.10.9
1900 + )
1901 + zeroconf? ( >=net-dns/avahi-0.6[dbus] )
1902 + zfs? ( sys-fs/zfs )"
1903 +
1904 +DEPEND="${RDEPEND}
1905 + ${PYTHON_DEPS}
1906 + app-text/xhtml1
1907 + dev-lang/perl
1908 + dev-libs/libxslt
1909 + dev-perl/XML-XPath
1910 + virtual/pkgconfig"
1911 +
1912 +PATCHES=(
1913 + "${FILESDIR}"/${PN}-4.5.0-do_not_use_sysconf.patch
1914 + "${FILESDIR}"/${PN}-1.2.16-fix_paths_in_libvirt-guests_sh.patch
1915 + "${FILESDIR}"/${PN}-4.10.0-fix_apparmor_rules.patch
1916 + "${FILESDIR}"/${PN}-4.10.0-musl.patch
1917 +)
1918 +
1919 +pkg_setup() {
1920 + if use qemu; then
1921 + enewgroup qemu 77
1922 + enewuser qemu 77 -1 -1 "qemu,kvm"
1923 + fi
1924 +
1925 + use policykit && enewgroup libvirt
1926 +
1927 + # Check kernel configuration:
1928 + CONFIG_CHECK=""
1929 + use fuse && CONFIG_CHECK+="
1930 + ~FUSE_FS"
1931 +
1932 + use lvm && CONFIG_CHECK+="
1933 + ~BLK_DEV_DM
1934 + ~DM_MULTIPATH
1935 + ~DM_SNAPSHOT"
1936 +
1937 + use lxc && CONFIG_CHECK+="
1938 + ~BLK_CGROUP
1939 + ~CGROUP_CPUACCT
1940 + ~CGROUP_DEVICE
1941 + ~CGROUP_FREEZER
1942 + ~CGROUP_NET_PRIO
1943 + ~CGROUP_PERF
1944 + ~CGROUPS
1945 + ~CGROUP_SCHED
1946 + ~CPUSETS
1947 + ~IPC_NS
1948 + ~MACVLAN
1949 + ~NAMESPACES
1950 + ~NET_CLS_CGROUP
1951 + ~NET_NS
1952 + ~PID_NS
1953 + ~POSIX_MQUEUE
1954 + ~SECURITYFS
1955 + ~USER_NS
1956 + ~UTS_NS
1957 + ~VETH
1958 + ~!GRKERNSEC_CHROOT_MOUNT
1959 + ~!GRKERNSEC_CHROOT_DOUBLE
1960 + ~!GRKERNSEC_CHROOT_PIVOT
1961 + ~!GRKERNSEC_CHROOT_CHMOD
1962 + ~!GRKERNSEC_CHROOT_CAPS"
1963 +
1964 + kernel_is lt 4 7 && use lxc && CONFIG_CHECK+="
1965 + ~DEVPTS_MULTIPLE_INSTANCES"
1966 +
1967 + use macvtap && CONFIG_CHECK+="
1968 + ~MACVTAP"
1969 +
1970 + use virt-network && CONFIG_CHECK+="
1971 + ~BRIDGE_EBT_MARK_T
1972 + ~BRIDGE_NF_EBTABLES
1973 + ~NETFILTER_ADVANCED
1974 + ~NETFILTER_XT_CONNMARK
1975 + ~NETFILTER_XT_MARK
1976 + ~NETFILTER_XT_TARGET_CHECKSUM"
1977 + # Bandwidth Limiting Support
1978 + use virt-network && CONFIG_CHECK+="
1979 + ~BRIDGE_EBT_T_NAT
1980 + ~IP_NF_TARGET_REJECT
1981 + ~NET_ACT_POLICE
1982 + ~NET_CLS_FW
1983 + ~NET_CLS_U32
1984 + ~NET_SCH_HTB
1985 + ~NET_SCH_INGRESS
1986 + ~NET_SCH_SFQ"
1987 +
1988 + # Handle specific kernel versions for different features
1989 + kernel_is lt 3 6 && CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR"
1990 + if kernel_is ge 3 6; then
1991 + CONFIG_CHECK+=" ~MEMCG ~MEMCG_SWAP "
1992 + kernel_is lt 4 5 && CONFIG_CHECK+=" ~MEMCG_KMEM "
1993 + fi
1994 +
1995 + ERROR_USER_NS="Optional depending on LXC configuration."
1996 +
1997 + if [[ -n ${CONFIG_CHECK} ]]; then
1998 + linux-info_pkg_setup
1999 + fi
2000 +}
2001 +
2002 +src_prepare() {
2003 + touch "${S}/.mailmap"
2004 +
2005 + default
2006 +
2007 + if [[ ${PV} = *9999* ]]; then
2008 + # git checkouts require bootstrapping to create the configure script.
2009 + # Additionally the submodules must be cloned to the right locations
2010 + # bug #377279
2011 + ./bootstrap || die "bootstrap failed"
2012 + (
2013 + git submodule status | sed 's/^[ +-]//;s/ .*//'
2014 + git hash-object bootstrap.conf
2015 + ) >.git-module-status
2016 + fi
2017 +
2018 + # Tweak the init script:
2019 + cp "${FILESDIR}/libvirtd.init-r16" "${S}/libvirtd.init" || die
2020 + sed -e "s/USE_FLAG_FIREWALLD/$(usex firewalld 'need firewalld' '')/" \
2021 + -e "s/USE_FLAG_AVAHI/$(usex zeroconf 'use avahi-daemon' '')/" \
2022 + -e "s/USE_FLAG_ISCSI/$(usex iscsi 'use iscsid' '')/" \
2023 + -e "s/USE_FLAG_RBD/$(usex rbd 'use ceph' '')/" \
2024 + -i "${S}/libvirtd.init" || die "sed failed"
2025 +
2026 + eautoreconf
2027 +}
2028 +
2029 +src_configure() {
2030 + local myeconfargs=(
2031 + $(use_with apparmor)
2032 + $(use_with apparmor apparmor-profiles)
2033 + $(use_with audit)
2034 + $(use_with caps capng)
2035 + $(use_with dbus)
2036 + $(use_with firewalld)
2037 + $(use_with fuse)
2038 + $(use_with glusterfs)
2039 + $(use_with glusterfs storage-gluster)
2040 + $(use_with iscsi storage-iscsi)
2041 + $(use_with libvirtd)
2042 + $(use_with libssh)
2043 + $(use_with lvm storage-lvm)
2044 + $(use_with lvm storage-mpath)
2045 + $(use_with lxc)
2046 + $(use_with macvtap)
2047 + $(use_enable nls)
2048 + $(use_with numa numactl)
2049 + $(use_with numa numad)
2050 + $(use_with openvz)
2051 + $(use_with parted storage-disk)
2052 + $(use_with pcap libpcap)
2053 + $(use_with phyp)
2054 + $(use_with policykit polkit)
2055 + $(use_with qemu)
2056 + $(use_with qemu yajl)
2057 + $(use_with rbd storage-rbd)
2058 + $(use_with sasl)
2059 + $(use_with selinux)
2060 + $(use_with udev)
2061 + $(use_with uml)
2062 + $(use_with vepa virtualport)
2063 + $(use_with virt-network network)
2064 + $(use_with wireshark-plugins wireshark-dissector)
2065 + $(use_with xen libxl)
2066 + $(use_with zeroconf avahi)
2067 + $(use_with zfs storage-zfs)
2068 +
2069 + --without-hal
2070 + --without-netcf
2071 + --without-sanlock
2072 +
2073 + --with-esx
2074 + --with-init-script=systemd
2075 + --with-qemu-group=$(usex caps qemu root)
2076 + --with-qemu-user=$(usex caps qemu root)
2077 + --with-remote
2078 + --with-storage-fs
2079 + --with-vmware
2080 +
2081 + --disable-static
2082 + --disable-werror
2083 +
2084 + --with-html-subdir=${PF}/html
2085 + --localstatedir=/var
2086 + )
2087 +
2088 + if use virtualbox && has_version app-emulation/virtualbox-ose; then
2089 + myeconfargs+=( --with-vbox=/usr/lib/virtualbox-ose/ )
2090 + else
2091 + myeconfargs+=( $(use_with virtualbox vbox) )
2092 + fi
2093 +
2094 + econf "${myeconfargs[@]}"
2095 +
2096 + if [[ ${PV} = *9999* ]]; then
2097 + # Restore gnulib's config.sub and config.guess
2098 + # bug #377279
2099 + (cd .gnulib && git reset --hard > /dev/null)
2100 + fi
2101 +}
2102 +
2103 +src_test() {
2104 + cd "${BUILD_DIR}"
2105 +
2106 + # remove problematic tests, bug #591416, bug #591418
2107 + sed -i -e 's#commandtest$(EXEEXT) # #' \
2108 + -e 's#virfirewalltest$(EXEEXT) # #' \
2109 + -e 's#nwfilterebiptablestest$(EXEEXT) # #' \
2110 + -e 's#nwfilterxml2firewalltest$(EXEEXT)$##' \
2111 + tests/Makefile
2112 +
2113 + export VIR_TEST_DEBUG=1
2114 + HOME="${T}" emake check || die "tests failed"
2115 +}
2116 +
2117 +src_install() {
2118 + emake DESTDIR="${D}" \
2119 + SYSTEMD_UNIT_DIR="$(systemd_get_systemunitdir)" install
2120 +
2121 + find "${D}" -name '*.la' -delete || die
2122 +
2123 + # Remove bogus, empty directories. They are either not used, or
2124 + # libvirtd is able to create them on demand
2125 + rm -rf "${D}"/etc/sysconfig
2126 + rm -rf "${D}"/var
2127 +
2128 + use libvirtd || return 0
2129 + # From here, only libvirtd-related instructions, be warned!
2130 +
2131 + systemd_install_serviced \
2132 + "${FILESDIR}"/libvirtd.service.conf libvirtd.service
2133 +
2134 + systemd_newtmpfilesd "${FILESDIR}"/libvirtd.tmpfiles.conf libvirtd.conf
2135 +
2136 + newinitd "${S}/libvirtd.init" libvirtd || die
2137 + newinitd "${FILESDIR}/libvirt-guests.init-r3" libvirt-guests || die
2138 + newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd || die
2139 + newinitd "${FILESDIR}/virtlogd.init-r1" virtlogd || die
2140 +
2141 + newconfd "${FILESDIR}/libvirtd.confd-r5" libvirtd || die
2142 + newconfd "${FILESDIR}/libvirt-guests.confd" libvirt-guests || die
2143 +
2144 + newbashcomp "${S}/tools/bash-completion/vsh" vsh
2145 + bashcomp_alias vsh virsh virt-admin
2146 +
2147 + DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r2")
2148 + DISABLE_AUTOFORMATTING=true
2149 + readme.gentoo_create_doc
2150 +}
2151 +
2152 +pkg_preinst() {
2153 + # we only ever want to generate this once
2154 + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
2155 + rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml
2156 + fi
2157 +}
2158 +
2159 +pkg_postinst() {
2160 + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then
2161 + touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml
2162 + fi
2163 +
2164 + use libvirtd || return 0
2165 + # From here, only libvirtd-related instructions, be warned!
2166 +
2167 + readme.gentoo_print_elog
2168 +}
2169
2170 diff --git a/app-emulation/libvirt/metadata.xml b/app-emulation/libvirt/metadata.xml
2171 new file mode 100644
2172 index 0000000..06697bc
2173 --- /dev/null
2174 +++ b/app-emulation/libvirt/metadata.xml
2175 @@ -0,0 +1,102 @@
2176 +<?xml version="1.0" encoding="UTF-8"?>
2177 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
2178 +<pkgmetadata>
2179 +<maintainer type="person">
2180 + <email>tamiko@g.o</email>
2181 + <name>Matthias Maier</name>
2182 +</maintainer>
2183 +<maintainer type="project">
2184 + <email>virtualization@g.o</email>
2185 + <name>Gentoo Virtualization Project</name>
2186 +</maintainer>
2187 +<use>
2188 + <!-- Pool backend flags -->
2189 + <flag name="iscsi">
2190 + Allow using an iSCSI remote storage server as pool for disk image storage
2191 + </flag>
2192 + <flag name="lvm">
2193 + Allow using the Logical Volume Manager (<pkg>sys-fs/lvm2</pkg>) as pool for disk image
2194 + storage
2195 + </flag>
2196 + <flag name="nfs">
2197 + Allow using Network File System mounts as pool for disk image storage
2198 + </flag>
2199 + <flag name="parted">
2200 + Allow using real disk partitions as pool for disk image storage, using
2201 + <pkg>sys-block/parted</pkg> to create, resize and delete them.
2202 + </flag>
2203 + <flag name="rbd">
2204 + Enable rados block device support via <pkg>sys-cluster/ceph</pkg>
2205 + </flag>
2206 + <!-- Virtualisation backends -->
2207 + <flag name="lxc">
2208 + Support management of Linux Containers virtualisation (<pkg>app-emulation/lxc</pkg>)
2209 + </flag>
2210 + <flag name="openvz">
2211 + Support management of OpenVZ virtualisation (openvz-sources)
2212 + </flag>
2213 + <flag name="uml">
2214 + Support management of User Mode Linux virtualisation
2215 + </flag>
2216 + <flag name="qemu">
2217 + Support management of QEMU virtualisation (<pkg>app-emulation/qemu</pkg>)
2218 + </flag>
2219 + <flag name="xen">
2220 + Support management of Xen virtualisation (<pkg>app-emulation/xen</pkg>)
2221 + </flag>
2222 + <flag name="virtualbox">
2223 + Support management of VirtualBox virtualisation (one of <pkg>app-emulation/virtualbox</pkg> or
2224 + <pkg>app-emulation/virtualbox-bin</pkg>)
2225 + </flag>
2226 + <flag name="phyp">
2227 + Support IBM HMC / IVM hypervisor via PHYP protocol
2228 + </flag>
2229 + <!-- Miscellaneous flags -->
2230 + <flag name="apparmor">Enable AppArmor support</flag>
2231 + <flag name="fuse">Allow LXC to use <pkg>sys-fs/fuse</pkg> for mount
2232 + points</flag>
2233 + <flag name="numa">
2234 + Use NUMA for memory segmenting via <pkg>sys-process/numactl</pkg> and
2235 + <pkg>sys-process/numad</pkg>
2236 + </flag>
2237 + <flag name="libvirtd">
2238 + Builds the libvirtd daemon as well as the client utilities instead of just the client
2239 + utilities
2240 + </flag>
2241 + <flag name="libssh">
2242 + Use <pkg>net-libs/libssh</pkg> to communicate with remote libvirtd hosts,
2243 + for example: qemu+libssh://server/system
2244 + </flag>
2245 + <flag name="pcap">
2246 + Support auto learning IP addreses for routing
2247 + </flag>
2248 + <flag name="macvtap">
2249 + Support for MAC-based TAP (macvlan/macvtap). For networking instead
2250 + of the normal TUN/TAP. It has its advantages and disadvantages.
2251 + macvtap support requires very new kernels and is
2252 + currently evolving. Support for this is experimental at best.
2253 + </flag>
2254 + <flag name="vepa">Virtual Ethernet Port Aggregator (VEPA) / 802.1Qbg
2255 + support. Relies on macvtap support.</flag>
2256 + <flag name="virt-network">
2257 + Enable virtual networking (NAT) support for guests. Includes all
2258 + the dependencies for NATed network mode. Effectively any network
2259 + setup that relies on libvirt to setup and configure network
2260 + interfaces on your host. This can include bridged and routed
2261 + networks ONLY if you are allowing libvirt to create and manage
2262 + the underlying devices for you. In some cases this requires
2263 + enabling the 'netcf' USE flag (currently unavailable).
2264 + </flag>
2265 + <flag name="firewalld">DBus interface to iptables/ebtables allowing
2266 + for better runtime management of your firewall.</flag>
2267 + <flag name="wireshark-plugins">
2268 + Build the <pkg>net-analyzer/wireshark</pkg> plugin for the Libvirt RPC protocol
2269 + </flag>
2270 + <flag name="glusterfs">
2271 + Enable GlusterFS support via <pkg>sys-cluster/glusterfs</pkg>
2272 + </flag>
2273 + <flag name="zfs">
2274 + Enable ZFS backend storage <pkg>sys-fs/zfs</pkg>
2275 + </flag>
2276 +</use>
2277 +</pkgmetadata>