diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /app-emulation/libvirt | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'app-emulation/libvirt')
-rw-r--r-- | app-emulation/libvirt/Manifest | 3 | ||||
-rw-r--r-- | app-emulation/libvirt/files/libvirt-1.2.16-fix_paths_in_libvirt-guests_sh.patch | 19 | ||||
-rw-r--r-- | app-emulation/libvirt/files/libvirt-1.2.17-fix_paths_for_apparmor.patch | 161 | ||||
-rw-r--r-- | app-emulation/libvirt/files/libvirt-1.2.9-do_not_use_sysconf.patch | 112 | ||||
-rw-r--r-- | app-emulation/libvirt/files/libvirtd.confd-r4 | 43 | ||||
-rw-r--r-- | app-emulation/libvirt/files/libvirtd.init-r14 | 139 | ||||
-rw-r--r-- | app-emulation/libvirt/files/libvirtd.service.conf | 10 | ||||
-rw-r--r-- | app-emulation/libvirt/files/libvirtd.tmpfiles.conf | 1 | ||||
-rw-r--r-- | app-emulation/libvirt/files/virtlockd.init-r1 | 24 | ||||
-rw-r--r-- | app-emulation/libvirt/libvirt-1.2.15-r1.ebuild | 464 | ||||
-rw-r--r-- | app-emulation/libvirt/libvirt-1.2.17-r4.ebuild | 480 | ||||
-rw-r--r-- | app-emulation/libvirt/libvirt-1.2.18.ebuild | 480 | ||||
-rw-r--r-- | app-emulation/libvirt/libvirt-9999.ebuild | 480 | ||||
-rw-r--r-- | app-emulation/libvirt/metadata.xml | 98 |
14 files changed, 2514 insertions, 0 deletions
diff --git a/app-emulation/libvirt/Manifest b/app-emulation/libvirt/Manifest new file mode 100644 index 000000000000..676dc7154cb0 --- /dev/null +++ b/app-emulation/libvirt/Manifest @@ -0,0 +1,3 @@ +DIST libvirt-1.2.15.tar.gz 29094868 SHA256 5f88041b8c212f8f687c672fe583108833240d6175b512ce4de92ab6660194c6 SHA512 c5dd3af86e89e3804d6c3b527c6dbd98c79d87d2591725a13af33530e0e9a9a2e9aeb9491844469d44ec4f4d17adb036c76391f964158ada23ec042a75556fbc WHIRLPOOL a43aad4caeff707c8d7a6872ff3c46911c96fd90ece02a7f6ceabb4ccd00e467b5341ab9d922912cc2968a2bb8826e970b253b257c5a8981b37364550f9b3616 +DIST libvirt-1.2.17.tar.gz 29320317 SHA256 e07eaf20b0590fae05ba3b53ad4dac3e5fbd771437563cc78b692f23ddd02fad SHA512 133ee2da30352d5eeb81c3e24f6eaf21c40b5afeb05abece9298956fa9c52c62ebc3468433311853cf2d65894e38e98f5c6744269d2d64fa3b3cf6f4b9b0cc46 WHIRLPOOL 4fdd6554989ea7d32600cc978d2c95582433ac223e933b55d838ba4ddffba2d6444a0d556348681ad36766e73ba2bf9788b37180c980636324b5b6fa093a2347 +DIST libvirt-1.2.18.tar.gz 29412554 SHA256 d5a5ff18af4cced21fed986d28fa0a21b782d256920326bf0ff1c7731eeb6ade SHA512 e89d494066ebec4de4c9a53089f015635b7b5ccf4a10ab9749883cc81f6f9607b18ca91a1bd01a9cdacb3a46de86223f0432fae3954106cb92dd275e5b4138c5 WHIRLPOOL dbbbd627ccb9be154bc680407898cd32dfdbc218a67f54560e6b0f0200cbc157a9aa05834de5d9d23e3b6da0625fd5943b4c8e38f8bb9a6ff920bc5820287bfc 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 new file mode 100644 index 000000000000..ddedb1f90cd3 --- /dev/null +++ b/app-emulation/libvirt/files/libvirt-1.2.16-fix_paths_in_libvirt-guests_sh.patch @@ -0,0 +1,19 @@ +diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in +index 7f74b85..ea58119 100644 +--- a/tools/libvirt-guests.sh.in ++++ b/tools/libvirt-guests.sh.in +@@ -41,11 +41,11 @@ CONNECT_RETRIES=10 + RETRIES_SLEEP=1 + SYNC_TIME=0 + +-test -f "$sysconfdir"/sysconfig/libvirt-guests && +- . "$sysconfdir"/sysconfig/libvirt-guests ++test -f "$sysconfdir"/libvirt/libvirt-guests.conf && ++ . "$sysconfdir"/libvirt/libvirt-guests.conf + + LISTFILE="$localstatedir"/lib/libvirt/libvirt-guests +-VAR_SUBSYS_LIBVIRT_GUESTS="$localstatedir"/lock/subsys/libvirt-guests ++VAR_SUBSYS_LIBVIRT_GUESTS="$localstatedir"/lock/libvirt-guests + + RETVAL=0 + diff --git a/app-emulation/libvirt/files/libvirt-1.2.17-fix_paths_for_apparmor.patch b/app-emulation/libvirt/files/libvirt-1.2.17-fix_paths_for_apparmor.patch new file mode 100644 index 000000000000..c900ada85f95 --- /dev/null +++ b/app-emulation/libvirt/files/libvirt-1.2.17-fix_paths_for_apparmor.patch @@ -0,0 +1,161 @@ +From bde898de482645f6963b673e8ff0b486a0a6db25 Mon Sep 17 00:00:00 2001 +From: Matthias Maier <tamiko@kyomu.43-1.org> +Date: Tue, 28 Jul 2015 11:10:59 -0500 +Subject: [PATCH] adapt paths for gentoo's fs layout + +https://bugs.gentoo.org/show_bug.cgi?id=554628 +--- + examples/apparmor/Makefile.am | 4 +- + examples/apparmor/usr.lib.libvirt.virt-aa-helper | 48 ------------------------ + examples/apparmor/usr.libexec.virt-aa-helper | 48 ++++++++++++++++++++++++ + examples/apparmor/usr.sbin.libvirtd | 4 +- + 4 files changed, 52 insertions(+), 52 deletions(-) + delete mode 100644 examples/apparmor/usr.lib.libvirt.virt-aa-helper + create mode 100644 examples/apparmor/usr.libexec.virt-aa-helper + +diff --git a/examples/apparmor/Makefile.am b/examples/apparmor/Makefile.am +index 7a20e16..c3c67b6 100644 +--- a/examples/apparmor/Makefile.am ++++ b/examples/apparmor/Makefile.am +@@ -19,13 +19,13 @@ EXTRA_DIST= \ + TEMPLATE.lxc \ + libvirt-qemu \ + libvirt-lxc \ +- usr.lib.libvirt.virt-aa-helper \ ++ usr.libexec.virt-aa-helper \ + usr.sbin.libvirtd + + if WITH_APPARMOR_PROFILES + apparmordir = $(sysconfdir)/apparmor.d/ + apparmor_DATA = \ +- usr.lib.libvirt.virt-aa-helper \ ++ usr.libexec.virt-aa-helper \ + usr.sbin.libvirtd \ + $(NULL) + +diff --git a/examples/apparmor/usr.lib.libvirt.virt-aa-helper b/examples/apparmor/usr.lib.libvirt.virt-aa-helper +deleted file mode 100644 +index b34fb35..0000000 +--- a/examples/apparmor/usr.lib.libvirt.virt-aa-helper ++++ /dev/null +@@ -1,48 +0,0 @@ +-# Last Modified: Mon Apr 5 15:10:27 2010 +-#include <tunables/global> +- +-profile virt-aa-helper /usr/{lib,lib64}/libvirt/virt-aa-helper { +- #include <abstractions/base> +- +- # needed for searching directories +- capability dac_override, +- capability dac_read_search, +- +- # needed for when disk is on a network filesystem +- network inet, +- +- deny @{PROC}/[0-9]*/mounts r, +- @{PROC}/[0-9]*/net/psched r, +- owner @{PROC}/[0-9]*/status r, +- @{PROC}/filesystems r, +- +- # for hostdev +- /sys/devices/ r, +- /sys/devices/** r, +- +- /usr/{lib,lib64}/libvirt/virt-aa-helper mr, +- /sbin/apparmor_parser Ux, +- +- /etc/apparmor.d/libvirt/* r, +- /etc/apparmor.d/libvirt/libvirt-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]* rw, +- +- # for backingstore -- allow access to non-hidden files in @{HOME} as well +- # as storage pools +- audit deny @{HOME}/.* mrwkl, +- audit deny @{HOME}/.*/ rw, +- audit deny @{HOME}/.*/** mrwkl, +- audit deny @{HOME}/bin/ rw, +- audit deny @{HOME}/bin/** mrwkl, +- @{HOME}/ r, +- @{HOME}/** r, +- /var/lib/libvirt/images/ r, +- /var/lib/libvirt/images/** r, +- /{media,mnt,opt,srv}/** r, +- +- /**.img r, +- /**.qcow{,2} r, +- /**.qed r, +- /**.vmdk r, +- /**.[iI][sS][oO] r, +- /**/disk{,.*} r, +-} +diff --git a/examples/apparmor/usr.libexec.virt-aa-helper b/examples/apparmor/usr.libexec.virt-aa-helper +new file mode 100644 +index 0000000..b34fb35 +--- /dev/null ++++ b/examples/apparmor/usr.libexec.virt-aa-helper +@@ -0,0 +1,48 @@ ++# Last Modified: Mon Apr 5 15:10:27 2010 ++#include <tunables/global> ++ ++profile virt-aa-helper /usr/libexec/virt-aa-helper { ++ #include <abstractions/base> ++ ++ # needed for searching directories ++ capability dac_override, ++ capability dac_read_search, ++ ++ # needed for when disk is on a network filesystem ++ network inet, ++ ++ deny @{PROC}/[0-9]*/mounts r, ++ @{PROC}/[0-9]*/net/psched r, ++ owner @{PROC}/[0-9]*/status r, ++ @{PROC}/filesystems r, ++ ++ # for hostdev ++ /sys/devices/ r, ++ /sys/devices/** r, ++ ++ /usr/libexec/virt-aa-helper mr, ++ /sbin/apparmor_parser Ux, ++ ++ /etc/apparmor.d/libvirt/* r, ++ /etc/apparmor.d/libvirt/libvirt-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]* rw, ++ ++ # for backingstore -- allow access to non-hidden files in @{HOME} as well ++ # as storage pools ++ audit deny @{HOME}/.* mrwkl, ++ audit deny @{HOME}/.*/ rw, ++ audit deny @{HOME}/.*/** mrwkl, ++ audit deny @{HOME}/bin/ rw, ++ audit deny @{HOME}/bin/** mrwkl, ++ @{HOME}/ r, ++ @{HOME}/** r, ++ /var/lib/libvirt/images/ r, ++ /var/lib/libvirt/images/** r, ++ /{media,mnt,opt,srv}/** r, ++ ++ /**.img r, ++ /**.qcow{,2} r, ++ /**.qed r, ++ /**.vmdk r, ++ /**.[iI][sS][oO] r, ++ /**/disk{,.*} r, ++} +diff --git a/examples/apparmor/usr.sbin.libvirtd b/examples/apparmor/usr.sbin.libvirtd +index 5d606e6..ab2f1a9 100644 +--- a/examples/apparmor/usr.sbin.libvirtd ++++ b/examples/apparmor/usr.sbin.libvirtd +@@ -58,8 +58,8 @@ + audit deny /sys/kernel/security/apparmor/.* rwxl, + /sys/kernel/security/apparmor/profiles r, + /usr/{lib,lib64}/libvirt/* PUxr, +- /usr/{lib,lib64}/libvirt/libvirt_parthelper ix, +- /usr/{lib,lib64}/libvirt/libvirt_iohelper ix, ++ /usr/libexec/libvirt_parthelper ix, ++ /usr/libexec/libvirt_iohelper ix, + /etc/libvirt/hooks/** rmix, + /etc/xen/scripts/** rmix, + +-- +2.3.6 + diff --git a/app-emulation/libvirt/files/libvirt-1.2.9-do_not_use_sysconf.patch b/app-emulation/libvirt/files/libvirt-1.2.9-do_not_use_sysconf.patch new file mode 100644 index 000000000000..e766f49d33e9 --- /dev/null +++ b/app-emulation/libvirt/files/libvirt-1.2.9-do_not_use_sysconf.patch @@ -0,0 +1,112 @@ +From 69372a32025ac16578ad277c6356e89713a3f9f4 Mon Sep 17 00:00:00 2001 +From: Matthias Maier <tamiko@kyomu.43-1.org> +Date: Mon, 3 Nov 2014 00:51:35 +0100 +Subject: [PATCH] Do not use /etc/sysconf + +--- + daemon/Makefile.am | 4 +--- + daemon/libvirtd.service.in | 3 +-- + src/Makefile.am | 3 --- + src/locking/virtlockd.service.in | 3 +-- + tools/Makefile.am | 2 +- + tools/libvirt-guests.service.in | 2 +- + 6 files changed, 5 insertions(+), 12 deletions(-) + +diff --git a/daemon/Makefile.am b/daemon/Makefile.am +index b95a79d..1e98422 100644 +--- a/daemon/Makefile.am ++++ b/daemon/Makefile.am +@@ -328,9 +328,7 @@ uninstall-logrotate: + rmdir $(DESTDIR)$(sysconfdir)/logrotate.d || : + + install-sysconfig: +- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig +- $(INSTALL_DATA) $(srcdir)/libvirtd.sysconf \ +- $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd ++ + uninstall-sysconfig: + rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd + rmdir $(DESTDIR)$(sysconfdir)/sysconfig || : +diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in +index 1759ac8..cd337a1 100644 +--- a/daemon/libvirtd.service.in ++++ b/daemon/libvirtd.service.in +@@ -10,8 +10,7 @@ Documentation=http://libvirt.org + + [Service] + Type=notify +-EnvironmentFile=-/etc/sysconfig/libvirtd +-ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS ++ExecStart=@sbindir@/libvirtd + ExecReload=/bin/kill -HUP $MAINPID + KillMode=process + Restart=on-failure +diff --git a/src/Makefile.am b/src/Makefile.am +index e65177f..18bbbb4 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -2269,9 +2269,6 @@ EXTRA_DIST += locking/virtlockd.sysconf \ + locking/test_libvirt_lockd.aug.in + + install-sysconfig: +- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig +- $(INSTALL_DATA) $(srcdir)/locking/virtlockd.sysconf \ +- $(DESTDIR)$(sysconfdir)/sysconfig/virtlockd + + uninstall-sysconfig: + rm -f $(DESTDIR)$(sysconfdir)/sysconfig/virtlockd +diff --git a/src/locking/virtlockd.service.in b/src/locking/virtlockd.service.in +index 57089b0..ace0c83 100644 +--- a/src/locking/virtlockd.service.in ++++ b/src/locking/virtlockd.service.in +@@ -5,8 +5,7 @@ Documentation=man:virtlockd(8) + Documentation=http://libvirt.org + + [Service] +-EnvironmentFile=-/etc/sysconfig/virtlockd +-ExecStart=@sbindir@/virtlockd $VIRTLOCKD_ARGS ++ExecStart=@sbindir@/virtlockd + ExecReload=/bin/kill -USR1 $MAINPID + # Loosing the locks is a really bad thing that will + # cause the machine to be fenced (rebooted), so make +diff --git a/tools/Makefile.am b/tools/Makefile.am +index 93d642d..2da0e97 100644 +--- a/tools/Makefile.am ++++ b/tools/Makefile.am +@@ -259,7 +259,7 @@ uninstall-local: uninstall-init uninstall-systemd + install-sysconfig: + $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sysconfig + $(INSTALL_DATA) $(srcdir)/libvirt-guests.sysconf \ +- $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests ++ $(DESTDIR)$(sysconfdir)/libvirt/libvirt-guests.conf + + uninstall-sysconfig: + rm -f $(DESTDIR)$(sysconfdir)/sysconfig/libvirt-guests +diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in +index cc04b6d..9be514b 100644 +--- a/tools/libvirt-guests.service.in ++++ b/tools/libvirt-guests.service.in +@@ -5,7 +5,7 @@ Documentation=man:libvirtd(8) + Documentation=http://libvirt.org + + [Service] +-EnvironmentFile=-/etc/sysconfig/libvirt-guests ++EnvironmentFile=-/etc/libvirt/libvirt-guests.conf + # Hack just call traditional service until we factor + # out the code + ExecStart=@libexecdir@/libvirt-guests.sh start +--- a/tools/libvirt-guests.sysconf ++++ b/tools/libvirt-guests.sysconf +@@ -1,3 +1,10 @@ ++# ++# Warning: This configuration file is only sourced by the systemd ++# libvirt-guests.service unit. The coresponding openrc facility is in ++# /etc/init.d/libvirtd and /etc/conf.d/libvirtd ++# ++ ++ + # URIs to check for running guests + # example: URIS='default xen:/// vbox+tcp://host/system lxc:///' + #URIS=default +-- +2.0.4 diff --git a/app-emulation/libvirt/files/libvirtd.confd-r4 b/app-emulation/libvirt/files/libvirtd.confd-r4 new file mode 100644 index 000000000000..48ab1252e3bf --- /dev/null +++ b/app-emulation/libvirt/files/libvirtd.confd-r4 @@ -0,0 +1,43 @@ +# /etc/conf.d/libvirtd + +# Startup dependency +# libvirtd typically requires all networks to be up and settled which +# is what rc_need="net" provides. However if you only use specific networks +# for libvirtd, you may override this. Or if you only use libvirtd locally. +rc_need="net" + +# LIBVIRTD_OPTS +# You may want to add '--listen' to have libvirtd listen for tcp/ip connections +# if you want to use libvirt for remote control +# Please consult 'libvirtd --help' for more options +#LIBVIRTD_OPTS="--listen" + +# LIBVIRTD_KVM_SHUTDOWN +# Valid options: +# * shutdown - Sends an ACPI shutdown (think when you tap the power button +# on your machine and it begins a graceful shutdown). If your +# VM ignores this, it will have the power yanked out from under +# it in LIBVIRTD_KVM_SHUTDOWN_MAXWAIT seconds. +# * managedsave - Performs a state save external to the VM. qemu-kvm will stop +# stop the CPU and save off all state to a separate file. When +# the machine is started again, it will resume like nothing ever +# happened. This is guarenteed to always successfully stop your +# machine and restart it. However it may take some time to finish. +# * none - No attempts will be made to stop any VMs. If you are restarting your +# machine the qemu-kvm process will be simply killed, which may result +# in your VMs having disk corruption. +LIBVIRTD_KVM_SHUTDOWN="managedsave" + +# LIBVIRTD_KVM_SHUTDOWN_MAXWAIT +# Timeout in seconds until stopping libvirtd and "pulling the plug" on the +# remaining VM's still in a running state +#LIBVIRTD_KVM_SHUTDOWN_MAXWAIT="500" + +# LIBVIRTD_KVM_NET_SHUTDOWN +# If libvirtd created networks for you (e.g. NATed networks) then this init +# script will shut them down for you if this is set to 'yes'. Otherwise, +# the networks will be left running once libvirt is shutdown. For this +# option to be useful you must have enabled the 'virt-network' USE flag and +# have had libvirt create a NATed network for you. +# Valid values: 'yes' or 'no' +#LIBVIRTD_KVM_NET_SHUTDOWN="yes" diff --git a/app-emulation/libvirt/files/libvirtd.init-r14 b/app-emulation/libvirt/files/libvirtd.init-r14 new file mode 100644 index 000000000000..7bab68249eda --- /dev/null +++ b/app-emulation/libvirt/files/libvirtd.init-r14 @@ -0,0 +1,139 @@ +#!/sbin/runscript + +description="Virtual Machine Management daemon (libvirt)" +extra_started_commands="reload halt" +description_halt="Stops the libvirt daemon without stopping your VMs" +description_reload="Restarts the libvirt daemon without stopping your VMs" + +depend() { + USE_FLAG_FIREWALLD + use USE_FLAG_AVAHI USE_FLAG_ISCSI USE_FLAG_RBD dbus virtlockd + after ntp-client ntpd nfs nfsmount portmap rpc.statd iptables ip6tables ebtables corosync sanlock cgconfig xenconsoled +} + +libvirtd_virsh() { + local mode=$1 + shift + + # Silence errors because virsh always throws an error about + # not finding the hypervisor version when connecting to libvirtd + LC_ALL=C virsh -c ${mode}:///system "$@" 2>/dev/null +} + +libvirtd_dom_list() { + # Make sure that it wouldn't be confused if the domain name + # contains the word running. + libvirtd_virsh $1 list | awk '$3 == "running" { print $1 }' +} + +libvirtd_dom_count() { + # Make sure that it wouldn't be confused if the domain name + # contains the word running. + libvirtd_virsh $1 list | awk 'BEGIN { count = 0 } \ + $3 == "running" { count++ } \ + END { print count }' +} + +libvirtd_net_list() { + # The purpose of the awk is to avoid networks with 'active' in the name + libvirtd_virsh $1 net-list | awk '$2 == "active" { print $1 }' +} + +libvirtd_net_count() { + # The purpose of the awk is to avoid networks with 'active' in the name + libvirtd_virsh $1 net-list | awk 'BEGIN { count = 0 } \ + $2 == "active" { count++ } \ + END { print count }' +} + + +start() { + # Test configuration directories in /etc/libvirt/ to be either not + # present or a directory, i.e. not a regular file, bug #532892 + for dir in lxc nwfilter qemu storage; do + if [ -f /etc/libvirt/$dir ]; then + eerror "/etc/libvirt/$dir was created as a regular file. It must be either" + eerror "a directory or not present for libvirtd to start up successfully." + return 1 + fi + done + + ebegin "Starting libvirtd" + start-stop-daemon --start \ + --env KRB5_KTNAME=/etc/libvirt/krb5.tab \ + --exec /usr/sbin/libvirtd -- -d ${LIBVIRTD_OPTS} + eend $? +} + +stop() { + local counter= + local vm_name= + local net_name= + local dom_id= + + ebegin "Stopping libvirtd" + # try to shutdown all (KVM/Qemu) domains + if [ "${LIBVIRTD_KVM_SHUTDOWN}" != "none" ] \ + && [ "$(libvirtd_dom_count qemu)" != "0" ] ; then + + einfo " Shutting down domain(s):" + for dom_id in $(libvirtd_dom_list qemu) ; do + vm_name="$(libvirtd_virsh qemu domname ${dom_id} | head -n 1)" + einfo " ${vm_name}" + libvirtd_virsh qemu ${LIBVIRTD_KVM_SHUTDOWN} ${dom_id} > /dev/null + done + + if [ -n "${LIBVIRTD_KVM_SHUTDOWN_MAXWAIT}" ] ; then + counter="${LIBVIRTD_KVM_SHUTDOWN_MAXWAIT}" + else + counter=500 + fi + + if [ "${LIBVIRTD_KVM_SHUTDOWN}" = "shutdown" ]; then + einfo " Waiting ${counter} seconds while domains shutdown ..." + DOM_COUNT="$(libvirtd_dom_count qemu)" + while [ ${DOM_COUNT} -gt 0 ] && [ ${counter} -gt 0 ] ; do + DOM_COUNT="$(libvirtd_dom_count qemu)" + sleep 1 + counter=$((${counter} - 1)) + echo -n "." + done + fi + + if [ "$(libvirtd_dom_count qemu)" != "0" ] ; then + eerror " !!! Some guests are still running, stopping anyway" + fi + + fi + + if [ "${LIBVIRTD_KVM_NET_SHUTDOWN}" != "no" ] \ + && [ "$(libvirtd_net_count qemu)" != "0" ]; then + + einfo " Shutting down network(s):" + for net_name in $(libvirtd_net_list qemu); do + einfo " ${net_name}" + libvirtd_virsh qemu net-destroy ${net_name} > /dev/null + done + + if [ "$(libvirtd_net_count qemu)" != "0" ]; then + eerror " !!! Some networks are still active, stopping anyway" + fi + fi + + # Now actually stop the daemon + start-stop-daemon --stop --quiet --exec \ + /usr/sbin/libvirtd --pidfile=/var/run/libvirtd.pid + eend $? +} + +halt() { + ebegin "Stopping libvirtd without shutting down your VMs" + start-stop-daemon --stop --quiet --exec \ + /usr/sbin/libvirtd --pidfile=/var/run/libvirtd.pid + eend $? +} + +reload() { + halt + start +} diff --git a/app-emulation/libvirt/files/libvirtd.service.conf b/app-emulation/libvirt/files/libvirtd.service.conf new file mode 100644 index 000000000000..f08792260b72 --- /dev/null +++ b/app-emulation/libvirt/files/libvirtd.service.conf @@ -0,0 +1,10 @@ +# Uncomment the following three lines to start libvirtd with the '--listen' +# directive such that it listens for TCP/IP connections (honoring the +# listen_tls and listen_tcp settings in /etc/libvirt/libvirtd.conf). If +# libvirtd is started without the '--listen' parameter, network connection +# (for the daemon) is globally disabled: + +# [Service] +# ExecStart= +# ExecStart=/usr/sbin/libvirtd --listen + diff --git a/app-emulation/libvirt/files/libvirtd.tmpfiles.conf b/app-emulation/libvirt/files/libvirtd.tmpfiles.conf new file mode 100644 index 000000000000..c22c23dd469f --- /dev/null +++ b/app-emulation/libvirt/files/libvirtd.tmpfiles.conf @@ -0,0 +1 @@ +d /run/libvirt/lxc 0755 root root - diff --git a/app-emulation/libvirt/files/virtlockd.init-r1 b/app-emulation/libvirt/files/virtlockd.init-r1 new file mode 100644 index 000000000000..396ab65434d9 --- /dev/null +++ b/app-emulation/libvirt/files/virtlockd.init-r1 @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +description="libvirt virtual machine lock manager" +command="/usr/sbin/virtlockd" +command_args="-d" +pidfile="/var/run/virtlockd.pid" + +extra_started_commands="reload" +description_reload="re-exec the daemon, while maintaining locks and clients" + + +depend() { + after ntp-client ntpd nfs nfsmount corosync +} + +reload() { + ebegin "re-exec() virtlockd" + + start-stop-daemon --signal SIGUSR1 \ + --exec "${command}" --pidfile "${pidfile}" +} diff --git a/app-emulation/libvirt/libvirt-1.2.15-r1.ebuild b/app-emulation/libvirt/libvirt-1.2.15-r1.ebuild new file mode 100644 index 000000000000..fb28921a11be --- /dev/null +++ b/app-emulation/libvirt/libvirt-1.2.15-r1.ebuild @@ -0,0 +1,464 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +AUTOTOOLIZE=yes + +MY_P="${P/_rc/-rc}" + +inherit eutils user autotools linux-info systemd readme.gentoo + +BACKPORTS="" + +if [[ ${PV} = *9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="git://libvirt.org/libvirt.git" + SRC_URI="" + KEYWORDS="" + SLOT="0" +else + # Versions with 4 numbers are stable updates: + if [[ ${PV} =~ ^[0-9]+(\.[0-9]+){3} ]]; then + SRC_URI="http://libvirt.org/sources/stable_updates/${MY_P}.tar.gz" + else + SRC_URI="http://libvirt.org/sources/${MY_P}.tar.gz" + fi + SRC_URI+=" ${BACKPORTS:+ + http://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz + http://dev.gentoo.org/~tamiko/distfiles/${P}-${BACKPORTS}.tar.xz}" + KEYWORDS="amd64 x86" + SLOT="0/${PV}" +fi +S="${WORKDIR}/${P%_rc*}" + +DESCRIPTION="C toolkit to manipulate virtual machines" +HOMEPAGE="http://www.libvirt.org/" +LICENSE="LGPL-2.1" +# TODO: Reenable IUSE wireshark-plugins +IUSE="audit avahi +caps firewalld fuse glusterfs iscsi +libvirtd lvm lxc \ + +macvtap nfs nls numa openvz parted pcap phyp policykit +qemu rbd sasl \ + selinux +udev uml +vepa virtualbox virt-network wireshark-plugins xen \ + elibc_glibc systemd" +REQUIRED_USE="libvirtd? ( || ( lxc openvz qemu uml virtualbox xen ) ) + lxc? ( caps libvirtd ) + openvz? ( libvirtd ) + qemu? ( libvirtd ) + uml? ( libvirtd ) + vepa? ( macvtap ) + virtualbox? ( libvirtd ) + xen? ( libvirtd ) + virt-network? ( libvirtd ) + firewalld? ( virt-network )" + +# gettext.sh command is used by the libvirt command wrappers, and it's +# non-optional, so put it into RDEPEND. +# We can use both libnl:1.1 and libnl:3, but if you have both installed, the +# package will use 3 by default. Since we don't have slot pinning in an API, +# we must go with the most recent +RDEPEND="sys-libs/readline:= + sys-libs/ncurses + >=net-misc/curl-7.18.0 + dev-libs/libgcrypt:0 + >=dev-libs/libxml2-2.7.6 + dev-libs/libnl:3 + >=net-libs/gnutls-1.0.25 + net-libs/libssh2 + sys-apps/dmidecode + >=sys-apps/util-linux-2.17 + sys-devel/gettext + >=net-analyzer/netcat6-1.0-r2 + app-misc/scrub + audit? ( sys-process/audit ) + avahi? ( >=net-dns/avahi-0.6[dbus] ) + caps? ( sys-libs/libcap-ng ) + fuse? ( >=sys-fs/fuse-2.8.6 ) + glusterfs? ( >=sys-cluster/glusterfs-3.4.1 ) + iscsi? ( sys-block/open-iscsi ) + lxc? ( !systemd? ( sys-power/pm-utils ) ) + lvm? ( >=sys-fs/lvm2-2.02.48-r2 ) + nfs? ( net-fs/nfs-utils ) + numa? ( + >sys-process/numactl-2.0.2 + sys-process/numad + ) + openvz? ( sys-kernel/openvz-sources:* ) + parted? ( + >=sys-block/parted-1.8[device-mapper] + sys-fs/lvm2 + ) + pcap? ( >=net-libs/libpcap-1.0.0 ) + policykit? ( >=sys-auth/polkit-0.9 ) + qemu? ( + >=app-emulation/qemu-0.13.0 + dev-libs/yajl + !systemd? ( sys-power/pm-utils ) + ) + rbd? ( sys-cluster/ceph ) + sasl? ( dev-libs/cyrus-sasl ) + selinux? ( >=sys-libs/libselinux-2.0.85 ) + systemd? ( sys-apps/systemd ) + virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) ) + wireshark-plugins? ( net-analyzer/wireshark:= ) + xen? ( app-emulation/xen-tools app-emulation/xen ) + udev? ( virtual/udev >=x11-libs/libpciaccess-0.10.9 ) + virt-network? ( net-dns/dnsmasq[script] + >=net-firewall/iptables-1.4.10[ipv6] + net-misc/radvd + net-firewall/ebtables + sys-apps/iproute2[-minimal] + firewalld? ( net-firewall/firewalld ) + ) + elibc_glibc? ( || ( >=net-libs/libtirpc-0.2.2-r1 <sys-libs/glibc-2.14 ) )" + +DEPEND="${RDEPEND} + virtual/pkgconfig + app-text/xhtml1 + dev-lang/perl + dev-perl/XML-XPath + dev-libs/libxslt" + +DOC_CONTENTS="For the basic networking support (bridged and routed networks) +you don't need any extra software. For more complex network modes +including but not limited to NATed network, you can enable the +'virt-network' USE flag.\n\n +If you are using dnsmasq on your system, you will have +to configure /etc/dnsmasq.conf to enable the following settings:\n\n + bind-interfaces\n + interface or except-interface\n\n +Otherwise you might have issues with your existing DNS server." + +LXC_CONFIG_CHECK=" + ~CGROUPS + ~CGROUP_FREEZER + ~CGROUP_DEVICE + ~CGROUP_CPUACCT + ~CGROUP_SCHED + ~CGROUP_PERF + ~BLK_CGROUP + ~NET_CLS_CGROUP + ~CGROUP_NET_PRIO + ~CPUSETS + ~NAMESPACES + ~UTS_NS + ~IPC_NS + ~PID_NS + ~NET_NS + ~USER_NS + ~DEVPTS_MULTIPLE_INSTANCES + ~VETH + ~MACVLAN + ~POSIX_MQUEUE + ~SECURITYFS + ~!GRKERNSEC_CHROOT_MOUNT + ~!GRKERNSEC_CHROOT_DOUBLE + ~!GRKERNSEC_CHROOT_PIVOT + ~!GRKERNSEC_CHROOT_CHMOD + ~!GRKERNSEC_CHROOT_CAPS +" + +VIRTNET_CONFIG_CHECK=" + ~BRIDGE_NF_EBTABLES + ~BRIDGE_EBT_MARK_T + ~NETFILTER_ADVANCED + ~NETFILTER_XT_TARGET_CHECKSUM + ~NETFILTER_XT_CONNMARK + ~NETFILTER_XT_MARK +" + +BWLMT_CONFIG_CHECK=" + ~BRIDGE_EBT_T_NAT + ~NET_SCH_HTB + ~NET_SCH_SFQ + ~NET_SCH_INGRESS + ~NET_CLS_FW + ~NET_CLS_U32 + ~NET_ACT_POLICE +" + +MACVTAP_CONFIG_CHECK=" ~MACVTAP" + +LVM_CONFIG_CHECK=" ~BLK_DEV_DM ~DM_SNAPSHOT ~DM_MULTIPATH" + +ERROR_USER_NS="Optional depending on LXC configuration." + +pkg_setup() { + enewgroup qemu 77 + enewuser qemu 77 -1 -1 qemu kvm + + # Some people used the masked ebuild which was not adding the qemu + # user to the kvm group originally. This results in VMs failing to + # start for some users. bug #430808 + egetent group kvm | grep -q qemu + if [[ $? -ne 0 ]]; then + gpasswd -a qemu kvm + fi + + # Handle specific kernel versions for different features + kernel_is lt 3 6 && LXC_CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR" + kernel_is ge 3 6 && LXC_CONFIG_CHECK+=" ~MEMCG ~MEMCG_SWAP ~MEMCG_KMEM" + + CONFIG_CHECK="" + use fuse && CONFIG_CHECK+=" ~FUSE_FS" + use lvm && CONFIG_CHECK+="${LVM_CONFIG_CHECK}" + use lxc && CONFIG_CHECK+="${LXC_CONFIG_CHECK}" + use macvtap && CONFIG_CHECK+="${MACVTAP_CONFIG_CHECK}" + use virt-network && CONFIG_CHECK+="${VIRTNET_CONFIG_CHECK}" + # Bandwidth Limiting Support + use virt-network && CONFIG_CHECK+="${BWLMT_CONFIG_CHECK}" + if [[ -n ${CONFIG_CHECK} ]]; then + linux-info_pkg_setup + fi +} + +src_prepare() { + touch "${S}/.mailmap" + + if [[ ${PV} = *9999* ]]; then + # git checkouts require bootstrapping to create the configure script. + # Additionally the submodules must be cloned to the right locations + # bug #377279 + ./bootstrap || die "bootstrap failed" + ( + git submodule status | sed 's/^[ +-]//;s/ .*//' + git hash-object bootstrap.conf + ) >.git-module-status + fi + + epatch "${FILESDIR}"/${PN}-1.2.9-do_not_use_sysconf.patch + + [[ -n ${BACKPORTS} ]] && \ + EPATCH_FORCE=yes EPATCH_SUFFIX="patch" \ + EPATCH_SOURCE="${WORKDIR}/patches" epatch + + epatch_user + + [[ -n ${AUTOTOOLIZE} ]] && eautoreconf + + # Tweak the init script + local avahi_init= + local iscsi_init= + local rbd_init= + local firewalld_init= + cp "${FILESDIR}/libvirtd.init-r14" "${S}/libvirtd.init" + use avahi && avahi_init='avahi-daemon' + use iscsi && iscsi_init='iscsid' + use rbd && rbd_init='ceph' + use firewalld && firewalld_init='need firewalld' + + sed -e "s/USE_FLAG_FIREWALLD/${firewalld_init}/" -i "${S}/libvirtd.init" + sed -e "s/USE_FLAG_AVAHI/${avahi_init}/" -i "${S}/libvirtd.init" + sed -e "s/USE_FLAG_ISCSI/${iscsi_init}/" -i "${S}/libvirtd.init" + sed -e "s/USE_FLAG_RBD/${rbd_init}/" -i "${S}/libvirtd.init" +} + +src_configure() { + local myconf="" + + ## enable/disable daemon, otherwise client only utils + myconf+=" $(use_with libvirtd)" + + ## enable/disable the daemon using avahi to find VMs + myconf+=" $(use_with avahi)" + + ## hypervisors on the local host + myconf+=" $(use_with xen) $(use_with xen xen-inotify)" + myconf+=" --without-xenapi" + if use xen && has_version ">=app-emulation/xen-tools-4.2.0"; then + myconf+=" --with-libxl" + else + myconf+=" --without-libxl" + fi + myconf+=" $(use_with openvz)" + myconf+=" $(use_with lxc)" + if use virtualbox && has_version app-emulation/virtualbox-ose; then + myconf+=" --with-vbox=/usr/lib/virtualbox-ose/" + else + myconf+=" $(use_with virtualbox vbox)" + fi + myconf+=" $(use_with uml)" + myconf+=" $(use_with qemu)" + myconf+=" $(use_with qemu yajl)" # Use QMP over HMP + myconf+=" $(use_with phyp)" + myconf+=" --with-esx" + myconf+=" --with-vmware" + + ## additional host drivers + myconf+=" $(use_with virt-network network)" + myconf+=" --with-storage-fs" + myconf+=" $(use_with lvm storage-lvm)" + myconf+=" $(use_with iscsi storage-iscsi)" + myconf+=" $(use_with parted storage-disk)" + mycond+=" $(use_with glusterfs)" + mycond+=" $(use_with glusterfs storage-gluster)" + myconf+=" $(use_with lvm storage-mpath)" + myconf+=" $(use_with rbd storage-rbd)" + myconf+=" $(use_with numa numactl)" + myconf+=" $(use_with numa numad)" + myconf+=" $(use_with selinux)" + myconf+=" $(use_with fuse)" + + # udev for device support details + myconf+=" $(use_with udev)" + myconf+=" --without-hal" + + # linux capability support so we don't need privileged accounts + myconf+=" $(use_with caps capng)" + + ## auth stuff + myconf+=" $(use_with policykit polkit)" + myconf+=" $(use_with sasl)" + + # network bits + myconf+=" $(use_with macvtap)" + myconf+=" $(use_with pcap libpcap)" + myconf+=" $(use_with vepa virtualport)" + myconf+=" $(use_with firewalld)" + + ## other + myconf+=" $(use_enable nls)" + + # user privilege bits fir qemu/kvm + if use caps; then + myconf+=" --with-qemu-user=qemu" + myconf+=" --with-qemu-group=qemu" + else + myconf+=" --with-qemu-user=root" + myconf+=" --with-qemu-group=root" + fi + + # audit support + myconf+=" $(use_with audit)" + + # wireshark dissector + myconf+=" $(use_with wireshark-plugins wireshark-dissector)" + + ## stuff we don't yet support + myconf+=" --without-netcf" + + # locking support + myconf+=" --without-sanlock" + + # systemd unit files + myconf+=" $(use_with systemd systemd-daemon)" + use systemd && myconf+=" --with-init-script=systemd" + + # this is a nasty trick to work around the problem in bug + # #275073. The reason why we don't solve this properly is that + # it'll require us to rebuild autotools (and we don't really want + # to do that right now). The proper solution has been sent + # upstream and should hopefully land in 0.7.7, in the mean time, + # mime the same functionality with this. + case ${CHOST} in + *cygwin* | *mingw* ) + ;; + *) + ac_cv_prog_WINDRES=no + ;; + esac + + econf \ + ${myconf} \ + --disable-static \ + --disable-werror \ + --with-remote \ + --docdir=/usr/share/doc/${PF} \ + --localstatedir=/var + + if [[ ${PV} = *9999* ]]; then + # Restore gnulib's config.sub and config.guess + # bug #377279 + (cd .gnulib && git reset --hard > /dev/null) + fi +} + +src_test() { + # Explicitly allow parallel build of tests + export VIR_TEST_DEBUG=1 + HOME="${T}" emake check || die "tests failed" +} + +src_install() { + emake install \ + DESTDIR="${D}" \ + HTML_DIR=/usr/share/doc/${PF}/html \ + DOCS_DIR=/usr/share/doc/${PF} \ + EXAMPLE_DIR=/usr/share/doc/${PF}/examples \ + SYSTEMD_UNIT_DIR="$(systemd_get_unitdir)" \ + || die "emake install failed" + + find "${D}" -name '*.la' -delete || die + + # Remove bogus, empty directories. They are either not used, or + # libvirtd is able to create them on demand + rm -rf "${D}"/etc/sysconf + rm -rf "${D}"/var/cache + rm -rf "${D}"/var/run + rm -rf "${D}"/var/log + + use libvirtd || return 0 + # From here, only libvirtd-related instructions, be warned! + + use systemd && systemd_install_serviced \ + "${FILESDIR}"/libvirtd.service.conf libvirtd.service + + systemd_newtmpfilesd "${FILESDIR}"/libvirtd.tmpfiles.conf libvirtd.conf + + newinitd "${S}/libvirtd.init" libvirtd || die + newconfd "${FILESDIR}/libvirtd.confd-r4" libvirtd || die + newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd || die + + readme.gentoo_create_doc +} + +pkg_preinst() { + # we only ever want to generate this once + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then + rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml + fi + + # We really don't want to use or support old PolicyKit cause it + # screws with the new polkit integration + if has_version sys-auth/policykit; then + rm -rf "${D}"/usr/share/PolicyKit/policy/org.libvirt.unix.policy + fi + + # Only sysctl files ending in .conf work + dodir /etc/sysctl.d + mv "${D}"/usr/lib/sysctl.d/libvirtd.conf "${D}"/etc/sysctl.d/libvirtd.conf +} + +pkg_postinst() { + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then + touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml + fi + + if ! use policykit; then + elog "To allow normal users to connect to libvirtd you must change the" + elog "unix sock group and/or perms in /etc/libvirt/libvirtd.conf" + fi + + use libvirtd || return 0 + # From here, only libvirtd-related instructions, be warned! + + readme.gentoo_print_elog + + if use caps && use qemu; then + elog "libvirt will now start qemu/kvm VMs with non-root privileges." + elog "Ensure any resources your VMs use are accessible by qemu:qemu" + fi + + if [[ -n "${REPLACING_VERSIONS}" ]]; then + elog "" + elog "The systemd service-file configuration under /etc/sysconfig has" + elog "been removed. Please use" + elog " /etc/systemd/system/libvirtd.service.d/00gentoo.conf" + elog "to control the '--listen' parameter for libvirtd. The configuration" + elog "for the libvirt-guests.service is now found under" + elog " /etc/libvirt/libvirt-guests.conf" + elog "The openrc configuration has not been changed. Thus no action is" + elog "required for the openrc service manager." + elog "" + fi +} diff --git a/app-emulation/libvirt/libvirt-1.2.17-r4.ebuild b/app-emulation/libvirt/libvirt-1.2.17-r4.ebuild new file mode 100644 index 000000000000..783647ae937a --- /dev/null +++ b/app-emulation/libvirt/libvirt-1.2.17-r4.ebuild @@ -0,0 +1,480 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +AUTOTOOLIZE=yes + +MY_P="${P/_rc/-rc}" + +inherit eutils user autotools linux-info systemd readme.gentoo + +BACKPORTS="" + +if [[ ${PV} = *9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="git://libvirt.org/libvirt.git" + SRC_URI="" + KEYWORDS="" + SLOT="0" +else + # Versions with 4 numbers are stable updates: + if [[ ${PV} =~ ^[0-9]+(\.[0-9]+){3} ]]; then + SRC_URI="http://libvirt.org/sources/stable_updates/${MY_P}.tar.gz" + else + SRC_URI="http://libvirt.org/sources/${MY_P}.tar.gz" + fi + SRC_URI+=" ${BACKPORTS:+ + http://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz + http://dev.gentoo.org/~tamiko/distfiles/${P}-${BACKPORTS}.tar.xz}" + KEYWORDS="~amd64 ~x86" + SLOT="0/${PV}" +fi +S="${WORKDIR}/${P%_rc*}" + +DESCRIPTION="C toolkit to manipulate virtual machines" +HOMEPAGE="http://www.libvirt.org/" +LICENSE="LGPL-2.1" +# TODO: Reenable IUSE wireshark-plugins +IUSE="apparmor audit avahi +caps firewalld fuse glusterfs iscsi +libvirtd lvm \ + lxc +macvtap nfs nls numa openvz parted pcap phyp policykit +qemu rbd sasl \ + selinux +udev uml +vepa virtualbox virt-network wireshark-plugins xen \ + elibc_glibc systemd" +REQUIRED_USE="libvirtd? ( || ( lxc openvz qemu uml virtualbox xen ) ) + lxc? ( caps libvirtd ) + openvz? ( libvirtd ) + qemu? ( libvirtd ) + uml? ( libvirtd ) + vepa? ( macvtap ) + virtualbox? ( libvirtd ) + xen? ( libvirtd ) + virt-network? ( libvirtd ) + firewalld? ( virt-network )" + +# gettext.sh command is used by the libvirt command wrappers, and it's +# non-optional, so put it into RDEPEND. +# We can use both libnl:1.1 and libnl:3, but if you have both installed, the +# package will use 3 by default. Since we don't have slot pinning in an API, +# we must go with the most recent +RDEPEND="sys-libs/readline:= + sys-libs/ncurses + >=net-misc/curl-7.18.0 + net-firewall/ebtables + >=net-firewall/iptables-1.4.10[ipv6] + dev-libs/libgcrypt:0 + >=dev-libs/libxml2-2.7.6 + dev-libs/libnl:3 + >=net-libs/gnutls-1.0.25 + net-libs/libssh2 + sys-apps/dmidecode + >=sys-apps/util-linux-2.17 + sys-devel/gettext + >=net-analyzer/netcat6-1.0-r2 + app-misc/scrub + apparmor? ( sys-libs/libapparmor ) + audit? ( sys-process/audit ) + avahi? ( >=net-dns/avahi-0.6[dbus] ) + caps? ( sys-libs/libcap-ng ) + fuse? ( >=sys-fs/fuse-2.8.6 ) + glusterfs? ( >=sys-cluster/glusterfs-3.4.1 ) + iscsi? ( sys-block/open-iscsi ) + lxc? ( !systemd? ( sys-power/pm-utils ) ) + lvm? ( >=sys-fs/lvm2-2.02.48-r2 ) + nfs? ( net-fs/nfs-utils ) + numa? ( + >sys-process/numactl-2.0.2 + sys-process/numad + ) + openvz? ( sys-kernel/openvz-sources:* ) + parted? ( + >=sys-block/parted-1.8[device-mapper] + sys-fs/lvm2 + ) + pcap? ( >=net-libs/libpcap-1.0.0 ) + policykit? ( >=sys-auth/polkit-0.9 ) + qemu? ( + >=app-emulation/qemu-0.13.0 + dev-libs/yajl + !systemd? ( sys-power/pm-utils ) + ) + rbd? ( sys-cluster/ceph ) + sasl? ( dev-libs/cyrus-sasl ) + selinux? ( >=sys-libs/libselinux-2.0.85 ) + systemd? ( sys-apps/systemd ) + virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) ) + wireshark-plugins? ( net-analyzer/wireshark:= ) + xen? ( app-emulation/xen-tools app-emulation/xen ) + udev? ( virtual/udev >=x11-libs/libpciaccess-0.10.9 ) + virt-network? ( net-dns/dnsmasq[script] + net-misc/radvd + sys-apps/iproute2[-minimal] + firewalld? ( net-firewall/firewalld ) + ) + elibc_glibc? ( || ( >=net-libs/libtirpc-0.2.2-r1 <sys-libs/glibc-2.14 ) )" + +DEPEND="${RDEPEND} + virtual/pkgconfig + app-text/xhtml1 + dev-lang/perl + dev-perl/XML-XPath + dev-libs/libxslt" + +# gentoo.readme stuff: +DISABLE_AUTOFORMATTING=true +DOC_CONTENTS="For the basic networking support (bridged and routed networks) you don't +need any extra software. For more complex network modes including but not +limited to NATed network, you can enable the 'virt-network' USE flag. + +If you are using dnsmasq on your system, you will have to configure +/etc/dnsmasq.conf to enable the following settings: + bind-interfaces + interface or except-interface +Otherwise you might have issues with your existing DNS server. + +For openrc users: + + Please use /etc/conf.d/libvirtd to control the '--listen' parameter for + libvirtd. + + The default configuration will suspend and resume running kvm guests + with 'managedsave'. This behavior can be changed under + /etc/conf.d/libvirtd + +For systemd users: + + Please use /etc/systemd/system/libvirtd.service.d/00gentoo.conf + to control the '--listen' parameter for libvirtd. + + The configuration for the 'libvirt-guests.service' is found under + /etc/libvirt/libvirt-guests.conf" + +! use policykit && DOC_CONTENTS+=" + +To allow normal users to connect to libvirtd you must change the unix sock +group and/or perms in /etc/libvirt/libvirtd.conf" + +use caps && use qemu && DOC_CONTENTS+=" + +libvirt will now start qemu/kvm VMs with non-root privileges. Ensure any +resources your VMs use are accessible by qemu:qemu" + +LXC_CONFIG_CHECK=" + ~CGROUPS + ~CGROUP_FREEZER + ~CGROUP_DEVICE + ~CGROUP_CPUACCT + ~CGROUP_SCHED + ~CGROUP_PERF + ~BLK_CGROUP + ~NET_CLS_CGROUP + ~CGROUP_NET_PRIO + ~CPUSETS + ~NAMESPACES + ~UTS_NS + ~IPC_NS + ~PID_NS + ~NET_NS + ~USER_NS + ~DEVPTS_MULTIPLE_INSTANCES + ~VETH + ~MACVLAN + ~POSIX_MQUEUE + ~SECURITYFS + ~!GRKERNSEC_CHROOT_MOUNT + ~!GRKERNSEC_CHROOT_DOUBLE + ~!GRKERNSEC_CHROOT_PIVOT + ~!GRKERNSEC_CHROOT_CHMOD + ~!GRKERNSEC_CHROOT_CAPS +" + +VIRTNET_CONFIG_CHECK=" + ~BRIDGE_NF_EBTABLES + ~BRIDGE_EBT_MARK_T + ~NETFILTER_ADVANCED + ~NETFILTER_XT_TARGET_CHECKSUM + ~NETFILTER_XT_CONNMARK + ~NETFILTER_XT_MARK +" + +BWLMT_CONFIG_CHECK=" + ~BRIDGE_EBT_T_NAT + ~NET_SCH_HTB + ~NET_SCH_SFQ + ~NET_SCH_INGRESS + ~NET_CLS_FW + ~NET_CLS_U32 + ~NET_ACT_POLICE +" + +MACVTAP_CONFIG_CHECK=" ~MACVTAP" + +LVM_CONFIG_CHECK=" ~BLK_DEV_DM ~DM_SNAPSHOT ~DM_MULTIPATH" + +ERROR_USER_NS="Optional depending on LXC configuration." + +pkg_setup() { + enewgroup qemu 77 + enewuser qemu 77 -1 -1 qemu kvm + + # Some people used the masked ebuild which was not adding the qemu + # user to the kvm group originally. This results in VMs failing to + # start for some users. bug #430808 + egetent group kvm | grep -q qemu + if [[ $? -ne 0 ]]; then + gpasswd -a qemu kvm + fi + + # Handle specific kernel versions for different features + kernel_is lt 3 6 && LXC_CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR" + kernel_is ge 3 6 && LXC_CONFIG_CHECK+=" ~MEMCG ~MEMCG_SWAP ~MEMCG_KMEM" + + CONFIG_CHECK="" + use fuse && CONFIG_CHECK+=" ~FUSE_FS" + use lvm && CONFIG_CHECK+="${LVM_CONFIG_CHECK}" + use lxc && CONFIG_CHECK+="${LXC_CONFIG_CHECK}" + use macvtap && CONFIG_CHECK+="${MACVTAP_CONFIG_CHECK}" + use virt-network && CONFIG_CHECK+="${VIRTNET_CONFIG_CHECK}" + # Bandwidth Limiting Support + use virt-network && CONFIG_CHECK+="${BWLMT_CONFIG_CHECK}" + if [[ -n ${CONFIG_CHECK} ]]; then + linux-info_pkg_setup + fi +} + +src_prepare() { + touch "${S}/.mailmap" + + if [[ ${PV} = *9999* ]]; then + # git checkouts require bootstrapping to create the configure script. + # Additionally the submodules must be cloned to the right locations + # bug #377279 + ./bootstrap || die "bootstrap failed" + ( + git submodule status | sed 's/^[ +-]//;s/ .*//' + git hash-object bootstrap.conf + ) >.git-module-status + fi + + epatch \ + "${FILESDIR}"/${PN}-1.2.9-do_not_use_sysconf.patch \ + "${FILESDIR}"/${PN}-1.2.16-fix_paths_in_libvirt-guests_sh.patch \ + "${FILESDIR}"/${P}-fix_paths_for_apparmor.patch + + [[ -n ${BACKPORTS} ]] && \ + EPATCH_FORCE=yes EPATCH_SUFFIX="patch" \ + EPATCH_SOURCE="${WORKDIR}/patches" epatch + + epatch_user + + [[ -n ${AUTOTOOLIZE} ]] && eautoreconf + + # Tweak the init script + local avahi_init= + local iscsi_init= + local rbd_init= + local firewalld_init= + cp "${FILESDIR}/libvirtd.init-r14" "${S}/libvirtd.init" + use avahi && avahi_init='avahi-daemon' + use iscsi && iscsi_init='iscsid' + use rbd && rbd_init='ceph' + use firewalld && firewalld_init='need firewalld' + + sed -e "s/USE_FLAG_FIREWALLD/${firewalld_init}/" -i "${S}/libvirtd.init" + sed -e "s/USE_FLAG_AVAHI/${avahi_init}/" -i "${S}/libvirtd.init" + sed -e "s/USE_FLAG_ISCSI/${iscsi_init}/" -i "${S}/libvirtd.init" + sed -e "s/USE_FLAG_RBD/${rbd_init}/" -i "${S}/libvirtd.init" +} + +src_configure() { + local myconf="" + + ## enable/disable daemon, otherwise client only utils + myconf+=" $(use_with libvirtd)" + + ## enable/disable the daemon using avahi to find VMs + myconf+=" $(use_with avahi)" + + ## hypervisors on the local host + myconf+=" $(use_with xen) $(use_with xen xen-inotify)" + myconf+=" --without-xenapi" + if use xen && has_version ">=app-emulation/xen-tools-4.2.0"; then + myconf+=" --with-libxl" + else + myconf+=" --without-libxl" + fi + myconf+=" $(use_with openvz)" + myconf+=" $(use_with lxc)" + if use virtualbox && has_version app-emulation/virtualbox-ose; then + myconf+=" --with-vbox=/usr/lib/virtualbox-ose/" + else + myconf+=" $(use_with virtualbox vbox)" + fi + myconf+=" $(use_with uml)" + myconf+=" $(use_with qemu)" + myconf+=" $(use_with qemu yajl)" # Use QMP over HMP + myconf+=" $(use_with phyp)" + myconf+=" --with-esx" + myconf+=" --with-vmware" + + ## additional host drivers + myconf+=" $(use_with apparmor)" + myconf+=" $(use_with apparmor apparmor-profiles)" + myconf+=" $(use_with virt-network network)" + myconf+=" --with-storage-fs" + myconf+=" $(use_with lvm storage-lvm)" + myconf+=" $(use_with iscsi storage-iscsi)" + myconf+=" $(use_with parted storage-disk)" + mycond+=" $(use_with glusterfs)" + mycond+=" $(use_with glusterfs storage-gluster)" + myconf+=" $(use_with lvm storage-mpath)" + myconf+=" $(use_with rbd storage-rbd)" + myconf+=" $(use_with numa numactl)" + myconf+=" $(use_with numa numad)" + myconf+=" $(use_with selinux)" + myconf+=" $(use_with fuse)" + + # udev for device support details + myconf+=" $(use_with udev)" + myconf+=" --without-hal" + + # linux capability support so we don't need privileged accounts + myconf+=" $(use_with caps capng)" + + ## auth stuff + myconf+=" $(use_with policykit polkit)" + myconf+=" $(use_with sasl)" + + # network bits + myconf+=" $(use_with macvtap)" + myconf+=" $(use_with pcap libpcap)" + myconf+=" $(use_with vepa virtualport)" + myconf+=" $(use_with firewalld)" + + ## other + myconf+=" $(use_enable nls)" + + # user privilege bits fir qemu/kvm + if use caps; then + myconf+=" --with-qemu-user=qemu" + myconf+=" --with-qemu-group=qemu" + else + myconf+=" --with-qemu-user=root" + myconf+=" --with-qemu-group=root" + fi + + # audit support + myconf+=" $(use_with audit)" + + # wireshark dissector + myconf+=" $(use_with wireshark-plugins wireshark-dissector)" + + ## stuff we don't yet support + myconf+=" --without-netcf" + + # locking support + myconf+=" --without-sanlock" + + # systemd unit files + myconf+=" $(use_with systemd systemd-daemon)" + use systemd && myconf+=" --with-init-script=systemd" + + # this is a nasty trick to work around the problem in bug + # #275073. The reason why we don't solve this properly is that + # it'll require us to rebuild autotools (and we don't really want + # to do that right now). The proper solution has been sent + # upstream and should hopefully land in 0.7.7, in the mean time, + # mime the same functionality with this. + case ${CHOST} in + *cygwin* | *mingw* ) + ;; + *) + ac_cv_prog_WINDRES=no + ;; + esac + + econf \ + ${myconf} \ + --disable-static \ + --disable-werror \ + --with-remote \ + --docdir=/usr/share/doc/${PF} \ + --localstatedir=/var + + if [[ ${PV} = *9999* ]]; then + # Restore gnulib's config.sub and config.guess + # bug #377279 + (cd .gnulib && git reset --hard > /dev/null) + fi +} + +src_test() { + # Explicitly allow parallel build of tests + export VIR_TEST_DEBUG=1 + HOME="${T}" emake check || die "tests failed" +} + +src_install() { + emake install \ + DESTDIR="${D}" \ + HTML_DIR=/usr/share/doc/${PF}/html \ + DOCS_DIR=/usr/share/doc/${PF} \ + EXAMPLE_DIR=/usr/share/doc/${PF}/examples \ + SYSTEMD_UNIT_DIR="$(systemd_get_unitdir)" \ + || die "emake install failed" + + find "${D}" -name '*.la' -delete || die + + # Remove bogus, empty directories. They are either not used, or + # libvirtd is able to create them on demand + rm -rf "${D}"/etc/sysconfig + rm -rf "${D}"/var/cache + rm -rf "${D}"/var/run + rm -rf "${D}"/var/log + + use libvirtd || return 0 + # From here, only libvirtd-related instructions, be warned! + + use systemd && systemd_install_serviced \ + "${FILESDIR}"/libvirtd.service.conf libvirtd.service + + systemd_newtmpfilesd "${FILESDIR}"/libvirtd.tmpfiles.conf libvirtd.conf + + newinitd "${S}/libvirtd.init" libvirtd || die + newconfd "${FILESDIR}/libvirtd.confd-r4" libvirtd || die + newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd || die + + readme.gentoo_create_doc +} + +pkg_preinst() { + # we only ever want to generate this once + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then + rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml + fi + + # We really don't want to use or support old PolicyKit cause it + # screws with the new polkit integration + if has_version sys-auth/policykit; then + rm -rf "${D}"/usr/share/PolicyKit/policy/org.libvirt.unix.policy + fi + + # Only sysctl files ending in .conf work + dodir /etc/sysctl.d + mv "${D}"/usr/lib/sysctl.d/libvirtd.conf "${D}"/etc/sysctl.d/libvirtd.conf +} + +pkg_postinst() { + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then + touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml + fi + + use libvirtd || return 0 + # From here, only libvirtd-related instructions, be warned! + + if [[ -n ${REPLACING_VERSIONS} ]] && ! version_is_at_least 1.2.17-r2 ${REPLACING_VERSIONS} ]]; then + FORCE_PRINT_ELOG=true + fi + + readme.gentoo_print_elog +} diff --git a/app-emulation/libvirt/libvirt-1.2.18.ebuild b/app-emulation/libvirt/libvirt-1.2.18.ebuild new file mode 100644 index 000000000000..9fcab0928995 --- /dev/null +++ b/app-emulation/libvirt/libvirt-1.2.18.ebuild @@ -0,0 +1,480 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +AUTOTOOLIZE=yes + +MY_P="${P/_rc/-rc}" + +inherit eutils user autotools linux-info systemd readme.gentoo + +BACKPORTS="" + +if [[ ${PV} = *9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="git://libvirt.org/libvirt.git" + SRC_URI="" + KEYWORDS="" + SLOT="0" +else + # Versions with 4 numbers are stable updates: + if [[ ${PV} =~ ^[0-9]+(\.[0-9]+){3} ]]; then + SRC_URI="http://libvirt.org/sources/stable_updates/${MY_P}.tar.gz" + else + SRC_URI="http://libvirt.org/sources/${MY_P}.tar.gz" + fi + SRC_URI+=" ${BACKPORTS:+ + http://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz + http://dev.gentoo.org/~tamiko/distfiles/${P}-${BACKPORTS}.tar.xz}" + KEYWORDS="~amd64 ~x86" + SLOT="0/${PV}" +fi +S="${WORKDIR}/${P%_rc*}" + +DESCRIPTION="C toolkit to manipulate virtual machines" +HOMEPAGE="http://www.libvirt.org/" +LICENSE="LGPL-2.1" +# TODO: Reenable IUSE wireshark-plugins +IUSE="apparmor audit avahi +caps firewalld fuse glusterfs iscsi +libvirtd lvm \ + lxc +macvtap nfs nls numa openvz parted pcap phyp policykit +qemu rbd sasl \ + selinux +udev uml +vepa virtualbox virt-network wireshark-plugins xen \ + elibc_glibc systemd" +REQUIRED_USE="libvirtd? ( || ( lxc openvz qemu uml virtualbox xen ) ) + lxc? ( caps libvirtd ) + openvz? ( libvirtd ) + qemu? ( libvirtd ) + uml? ( libvirtd ) + vepa? ( macvtap ) + virtualbox? ( libvirtd ) + xen? ( libvirtd ) + virt-network? ( libvirtd ) + firewalld? ( virt-network )" + +# gettext.sh command is used by the libvirt command wrappers, and it's +# non-optional, so put it into RDEPEND. +# We can use both libnl:1.1 and libnl:3, but if you have both installed, the +# package will use 3 by default. Since we don't have slot pinning in an API, +# we must go with the most recent +RDEPEND="sys-libs/readline:= + sys-libs/ncurses + >=net-misc/curl-7.18.0 + net-firewall/ebtables + >=net-firewall/iptables-1.4.10[ipv6] + dev-libs/libgcrypt:0 + >=dev-libs/libxml2-2.7.6 + dev-libs/libnl:3 + >=net-libs/gnutls-1.0.25 + net-libs/libssh2 + sys-apps/dmidecode + >=sys-apps/util-linux-2.17 + sys-devel/gettext + >=net-analyzer/netcat6-1.0-r2 + app-misc/scrub + apparmor? ( sys-libs/libapparmor ) + audit? ( sys-process/audit ) + avahi? ( >=net-dns/avahi-0.6[dbus] ) + caps? ( sys-libs/libcap-ng ) + fuse? ( >=sys-fs/fuse-2.8.6 ) + glusterfs? ( >=sys-cluster/glusterfs-3.4.1 ) + iscsi? ( sys-block/open-iscsi ) + lxc? ( !systemd? ( sys-power/pm-utils ) ) + lvm? ( >=sys-fs/lvm2-2.02.48-r2 ) + nfs? ( net-fs/nfs-utils ) + numa? ( + >sys-process/numactl-2.0.2 + sys-process/numad + ) + openvz? ( sys-kernel/openvz-sources:* ) + parted? ( + >=sys-block/parted-1.8[device-mapper] + sys-fs/lvm2 + ) + pcap? ( >=net-libs/libpcap-1.0.0 ) + policykit? ( >=sys-auth/polkit-0.9 ) + qemu? ( + >=app-emulation/qemu-0.13.0 + dev-libs/yajl + !systemd? ( sys-power/pm-utils ) + ) + rbd? ( sys-cluster/ceph ) + sasl? ( dev-libs/cyrus-sasl ) + selinux? ( >=sys-libs/libselinux-2.0.85 ) + systemd? ( sys-apps/systemd ) + virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) ) + wireshark-plugins? ( net-analyzer/wireshark:= ) + xen? ( app-emulation/xen-tools app-emulation/xen ) + udev? ( virtual/udev >=x11-libs/libpciaccess-0.10.9 ) + virt-network? ( net-dns/dnsmasq[script] + net-misc/radvd + sys-apps/iproute2[-minimal] + firewalld? ( net-firewall/firewalld ) + ) + elibc_glibc? ( || ( >=net-libs/libtirpc-0.2.2-r1 <sys-libs/glibc-2.14 ) )" + +DEPEND="${RDEPEND} + virtual/pkgconfig + app-text/xhtml1 + dev-lang/perl + dev-perl/XML-XPath + dev-libs/libxslt" + +# gentoo.readme stuff: +DISABLE_AUTOFORMATTING=true +DOC_CONTENTS="For the basic networking support (bridged and routed networks) you don't +need any extra software. For more complex network modes including but not +limited to NATed network, you can enable the 'virt-network' USE flag. + +If you are using dnsmasq on your system, you will have to configure +/etc/dnsmasq.conf to enable the following settings: + bind-interfaces + interface or except-interface +Otherwise you might have issues with your existing DNS server. + +For openrc users: + + Please use /etc/conf.d/libvirtd to control the '--listen' parameter for + libvirtd. + + The default configuration will suspend and resume running kvm guests + with 'managedsave'. This behavior can be changed under + /etc/conf.d/libvirtd + +For systemd users: + + Please use /etc/systemd/system/libvirtd.service.d/00gentoo.conf + to control the '--listen' parameter for libvirtd. + + The configuration for the 'libvirt-guests.service' is found under + /etc/libvirt/libvirt-guests.conf" + +! use policykit && DOC_CONTENTS+=" + +To allow normal users to connect to libvirtd you must change the unix sock +group and/or perms in /etc/libvirt/libvirtd.conf" + +use caps && use qemu && DOC_CONTENTS+=" + +libvirt will now start qemu/kvm VMs with non-root privileges. Ensure any +resources your VMs use are accessible by qemu:qemu" + +LXC_CONFIG_CHECK=" + ~CGROUPS + ~CGROUP_FREEZER + ~CGROUP_DEVICE + ~CGROUP_CPUACCT + ~CGROUP_SCHED + ~CGROUP_PERF + ~BLK_CGROUP + ~NET_CLS_CGROUP + ~CGROUP_NET_PRIO + ~CPUSETS + ~NAMESPACES + ~UTS_NS + ~IPC_NS + ~PID_NS + ~NET_NS + ~USER_NS + ~DEVPTS_MULTIPLE_INSTANCES + ~VETH + ~MACVLAN + ~POSIX_MQUEUE + ~SECURITYFS + ~!GRKERNSEC_CHROOT_MOUNT + ~!GRKERNSEC_CHROOT_DOUBLE + ~!GRKERNSEC_CHROOT_PIVOT + ~!GRKERNSEC_CHROOT_CHMOD + ~!GRKERNSEC_CHROOT_CAPS +" + +VIRTNET_CONFIG_CHECK=" + ~BRIDGE_NF_EBTABLES + ~BRIDGE_EBT_MARK_T + ~NETFILTER_ADVANCED + ~NETFILTER_XT_TARGET_CHECKSUM + ~NETFILTER_XT_CONNMARK + ~NETFILTER_XT_MARK +" + +BWLMT_CONFIG_CHECK=" + ~BRIDGE_EBT_T_NAT + ~NET_SCH_HTB + ~NET_SCH_SFQ + ~NET_SCH_INGRESS + ~NET_CLS_FW + ~NET_CLS_U32 + ~NET_ACT_POLICE +" + +MACVTAP_CONFIG_CHECK=" ~MACVTAP" + +LVM_CONFIG_CHECK=" ~BLK_DEV_DM ~DM_SNAPSHOT ~DM_MULTIPATH" + +ERROR_USER_NS="Optional depending on LXC configuration." + +pkg_setup() { + enewgroup qemu 77 + enewuser qemu 77 -1 -1 qemu kvm + + # Some people used the masked ebuild which was not adding the qemu + # user to the kvm group originally. This results in VMs failing to + # start for some users. bug #430808 + egetent group kvm | grep -q qemu + if [[ $? -ne 0 ]]; then + gpasswd -a qemu kvm + fi + + # Handle specific kernel versions for different features + kernel_is lt 3 6 && LXC_CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR" + kernel_is ge 3 6 && LXC_CONFIG_CHECK+=" ~MEMCG ~MEMCG_SWAP ~MEMCG_KMEM" + + CONFIG_CHECK="" + use fuse && CONFIG_CHECK+=" ~FUSE_FS" + use lvm && CONFIG_CHECK+="${LVM_CONFIG_CHECK}" + use lxc && CONFIG_CHECK+="${LXC_CONFIG_CHECK}" + use macvtap && CONFIG_CHECK+="${MACVTAP_CONFIG_CHECK}" + use virt-network && CONFIG_CHECK+="${VIRTNET_CONFIG_CHECK}" + # Bandwidth Limiting Support + use virt-network && CONFIG_CHECK+="${BWLMT_CONFIG_CHECK}" + if [[ -n ${CONFIG_CHECK} ]]; then + linux-info_pkg_setup + fi +} + +src_prepare() { + touch "${S}/.mailmap" + + if [[ ${PV} = *9999* ]]; then + # git checkouts require bootstrapping to create the configure script. + # Additionally the submodules must be cloned to the right locations + # bug #377279 + ./bootstrap || die "bootstrap failed" + ( + git submodule status | sed 's/^[ +-]//;s/ .*//' + git hash-object bootstrap.conf + ) >.git-module-status + fi + + epatch \ + "${FILESDIR}"/${PN}-1.2.9-do_not_use_sysconf.patch \ + "${FILESDIR}"/${PN}-1.2.16-fix_paths_in_libvirt-guests_sh.patch \ + "${FILESDIR}"/${PN}-1.2.17-fix_paths_for_apparmor.patch + + [[ -n ${BACKPORTS} ]] && \ + EPATCH_FORCE=yes EPATCH_SUFFIX="patch" \ + EPATCH_SOURCE="${WORKDIR}/patches" epatch + + epatch_user + + [[ -n ${AUTOTOOLIZE} ]] && eautoreconf + + # Tweak the init script + local avahi_init= + local iscsi_init= + local rbd_init= + local firewalld_init= + cp "${FILESDIR}/libvirtd.init-r14" "${S}/libvirtd.init" + use avahi && avahi_init='avahi-daemon' + use iscsi && iscsi_init='iscsid' + use rbd && rbd_init='ceph' + use firewalld && firewalld_init='need firewalld' + + sed -e "s/USE_FLAG_FIREWALLD/${firewalld_init}/" -i "${S}/libvirtd.init" + sed -e "s/USE_FLAG_AVAHI/${avahi_init}/" -i "${S}/libvirtd.init" + sed -e "s/USE_FLAG_ISCSI/${iscsi_init}/" -i "${S}/libvirtd.init" + sed -e "s/USE_FLAG_RBD/${rbd_init}/" -i "${S}/libvirtd.init" +} + +src_configure() { + local myconf="" + + ## enable/disable daemon, otherwise client only utils + myconf+=" $(use_with libvirtd)" + + ## enable/disable the daemon using avahi to find VMs + myconf+=" $(use_with avahi)" + + ## hypervisors on the local host + myconf+=" $(use_with xen) $(use_with xen xen-inotify)" + myconf+=" --without-xenapi" + if use xen && has_version ">=app-emulation/xen-tools-4.2.0"; then + myconf+=" --with-libxl" + else + myconf+=" --without-libxl" + fi + myconf+=" $(use_with openvz)" + myconf+=" $(use_with lxc)" + if use virtualbox && has_version app-emulation/virtualbox-ose; then + myconf+=" --with-vbox=/usr/lib/virtualbox-ose/" + else + myconf+=" $(use_with virtualbox vbox)" + fi + myconf+=" $(use_with uml)" + myconf+=" $(use_with qemu)" + myconf+=" $(use_with qemu yajl)" # Use QMP over HMP + myconf+=" $(use_with phyp)" + myconf+=" --with-esx" + myconf+=" --with-vmware" + + ## additional host drivers + myconf+=" $(use_with apparmor)" + myconf+=" $(use_with apparmor apparmor-profiles)" + myconf+=" $(use_with virt-network network)" + myconf+=" --with-storage-fs" + myconf+=" $(use_with lvm storage-lvm)" + myconf+=" $(use_with iscsi storage-iscsi)" + myconf+=" $(use_with parted storage-disk)" + mycond+=" $(use_with glusterfs)" + mycond+=" $(use_with glusterfs storage-gluster)" + myconf+=" $(use_with lvm storage-mpath)" + myconf+=" $(use_with rbd storage-rbd)" + myconf+=" $(use_with numa numactl)" + myconf+=" $(use_with numa numad)" + myconf+=" $(use_with selinux)" + myconf+=" $(use_with fuse)" + + # udev for device support details + myconf+=" $(use_with udev)" + myconf+=" --without-hal" + + # linux capability support so we don't need privileged accounts + myconf+=" $(use_with caps capng)" + + ## auth stuff + myconf+=" $(use_with policykit polkit)" + myconf+=" $(use_with sasl)" + + # network bits + myconf+=" $(use_with macvtap)" + myconf+=" $(use_with pcap libpcap)" + myconf+=" $(use_with vepa virtualport)" + myconf+=" $(use_with firewalld)" + + ## other + myconf+=" $(use_enable nls)" + + # user privilege bits fir qemu/kvm + if use caps; then + myconf+=" --with-qemu-user=qemu" + myconf+=" --with-qemu-group=qemu" + else + myconf+=" --with-qemu-user=root" + myconf+=" --with-qemu-group=root" + fi + + # audit support + myconf+=" $(use_with audit)" + + # wireshark dissector + myconf+=" $(use_with wireshark-plugins wireshark-dissector)" + + ## stuff we don't yet support + myconf+=" --without-netcf" + + # locking support + myconf+=" --without-sanlock" + + # systemd unit files + myconf+=" $(use_with systemd systemd-daemon)" + use systemd && myconf+=" --with-init-script=systemd" + + # this is a nasty trick to work around the problem in bug + # #275073. The reason why we don't solve this properly is that + # it'll require us to rebuild autotools (and we don't really want + # to do that right now). The proper solution has been sent + # upstream and should hopefully land in 0.7.7, in the mean time, + # mime the same functionality with this. + case ${CHOST} in + *cygwin* | *mingw* ) + ;; + *) + ac_cv_prog_WINDRES=no + ;; + esac + + econf \ + ${myconf} \ + --disable-static \ + --disable-werror \ + --with-remote \ + --docdir=/usr/share/doc/${PF} \ + --localstatedir=/var + + if [[ ${PV} = *9999* ]]; then + # Restore gnulib's config.sub and config.guess + # bug #377279 + (cd .gnulib && git reset --hard > /dev/null) + fi +} + +src_test() { + # Explicitly allow parallel build of tests + export VIR_TEST_DEBUG=1 + HOME="${T}" emake check || die "tests failed" +} + +src_install() { + emake install \ + DESTDIR="${D}" \ + HTML_DIR=/usr/share/doc/${PF}/html \ + DOCS_DIR=/usr/share/doc/${PF} \ + EXAMPLE_DIR=/usr/share/doc/${PF}/examples \ + SYSTEMD_UNIT_DIR="$(systemd_get_unitdir)" \ + || die "emake install failed" + + find "${D}" -name '*.la' -delete || die + + # Remove bogus, empty directories. They are either not used, or + # libvirtd is able to create them on demand + rm -rf "${D}"/etc/sysconfig + rm -rf "${D}"/var/cache + rm -rf "${D}"/var/run + rm -rf "${D}"/var/log + + use libvirtd || return 0 + # From here, only libvirtd-related instructions, be warned! + + use systemd && systemd_install_serviced \ + "${FILESDIR}"/libvirtd.service.conf libvirtd.service + + systemd_newtmpfilesd "${FILESDIR}"/libvirtd.tmpfiles.conf libvirtd.conf + + newinitd "${S}/libvirtd.init" libvirtd || die + newconfd "${FILESDIR}/libvirtd.confd-r4" libvirtd || die + newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd || die + + readme.gentoo_create_doc +} + +pkg_preinst() { + # we only ever want to generate this once + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then + rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml + fi + + # We really don't want to use or support old PolicyKit cause it + # screws with the new polkit integration + if has_version sys-auth/policykit; then + rm -rf "${D}"/usr/share/PolicyKit/policy/org.libvirt.unix.policy + fi + + # Only sysctl files ending in .conf work + dodir /etc/sysctl.d + mv "${D}"/usr/lib/sysctl.d/libvirtd.conf "${D}"/etc/sysctl.d/libvirtd.conf +} + +pkg_postinst() { + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then + touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml + fi + + use libvirtd || return 0 + # From here, only libvirtd-related instructions, be warned! + + if [[ -n ${REPLACING_VERSIONS} ]] && ! version_is_at_least 1.2.17-r2 ${REPLACING_VERSIONS} ]]; then + FORCE_PRINT_ELOG=true + fi + + readme.gentoo_print_elog +} diff --git a/app-emulation/libvirt/libvirt-9999.ebuild b/app-emulation/libvirt/libvirt-9999.ebuild new file mode 100644 index 000000000000..783647ae937a --- /dev/null +++ b/app-emulation/libvirt/libvirt-9999.ebuild @@ -0,0 +1,480 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +AUTOTOOLIZE=yes + +MY_P="${P/_rc/-rc}" + +inherit eutils user autotools linux-info systemd readme.gentoo + +BACKPORTS="" + +if [[ ${PV} = *9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="git://libvirt.org/libvirt.git" + SRC_URI="" + KEYWORDS="" + SLOT="0" +else + # Versions with 4 numbers are stable updates: + if [[ ${PV} =~ ^[0-9]+(\.[0-9]+){3} ]]; then + SRC_URI="http://libvirt.org/sources/stable_updates/${MY_P}.tar.gz" + else + SRC_URI="http://libvirt.org/sources/${MY_P}.tar.gz" + fi + SRC_URI+=" ${BACKPORTS:+ + http://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz + http://dev.gentoo.org/~tamiko/distfiles/${P}-${BACKPORTS}.tar.xz}" + KEYWORDS="~amd64 ~x86" + SLOT="0/${PV}" +fi +S="${WORKDIR}/${P%_rc*}" + +DESCRIPTION="C toolkit to manipulate virtual machines" +HOMEPAGE="http://www.libvirt.org/" +LICENSE="LGPL-2.1" +# TODO: Reenable IUSE wireshark-plugins +IUSE="apparmor audit avahi +caps firewalld fuse glusterfs iscsi +libvirtd lvm \ + lxc +macvtap nfs nls numa openvz parted pcap phyp policykit +qemu rbd sasl \ + selinux +udev uml +vepa virtualbox virt-network wireshark-plugins xen \ + elibc_glibc systemd" +REQUIRED_USE="libvirtd? ( || ( lxc openvz qemu uml virtualbox xen ) ) + lxc? ( caps libvirtd ) + openvz? ( libvirtd ) + qemu? ( libvirtd ) + uml? ( libvirtd ) + vepa? ( macvtap ) + virtualbox? ( libvirtd ) + xen? ( libvirtd ) + virt-network? ( libvirtd ) + firewalld? ( virt-network )" + +# gettext.sh command is used by the libvirt command wrappers, and it's +# non-optional, so put it into RDEPEND. +# We can use both libnl:1.1 and libnl:3, but if you have both installed, the +# package will use 3 by default. Since we don't have slot pinning in an API, +# we must go with the most recent +RDEPEND="sys-libs/readline:= + sys-libs/ncurses + >=net-misc/curl-7.18.0 + net-firewall/ebtables + >=net-firewall/iptables-1.4.10[ipv6] + dev-libs/libgcrypt:0 + >=dev-libs/libxml2-2.7.6 + dev-libs/libnl:3 + >=net-libs/gnutls-1.0.25 + net-libs/libssh2 + sys-apps/dmidecode + >=sys-apps/util-linux-2.17 + sys-devel/gettext + >=net-analyzer/netcat6-1.0-r2 + app-misc/scrub + apparmor? ( sys-libs/libapparmor ) + audit? ( sys-process/audit ) + avahi? ( >=net-dns/avahi-0.6[dbus] ) + caps? ( sys-libs/libcap-ng ) + fuse? ( >=sys-fs/fuse-2.8.6 ) + glusterfs? ( >=sys-cluster/glusterfs-3.4.1 ) + iscsi? ( sys-block/open-iscsi ) + lxc? ( !systemd? ( sys-power/pm-utils ) ) + lvm? ( >=sys-fs/lvm2-2.02.48-r2 ) + nfs? ( net-fs/nfs-utils ) + numa? ( + >sys-process/numactl-2.0.2 + sys-process/numad + ) + openvz? ( sys-kernel/openvz-sources:* ) + parted? ( + >=sys-block/parted-1.8[device-mapper] + sys-fs/lvm2 + ) + pcap? ( >=net-libs/libpcap-1.0.0 ) + policykit? ( >=sys-auth/polkit-0.9 ) + qemu? ( + >=app-emulation/qemu-0.13.0 + dev-libs/yajl + !systemd? ( sys-power/pm-utils ) + ) + rbd? ( sys-cluster/ceph ) + sasl? ( dev-libs/cyrus-sasl ) + selinux? ( >=sys-libs/libselinux-2.0.85 ) + systemd? ( sys-apps/systemd ) + virtualbox? ( || ( app-emulation/virtualbox >=app-emulation/virtualbox-bin-2.2.0 ) ) + wireshark-plugins? ( net-analyzer/wireshark:= ) + xen? ( app-emulation/xen-tools app-emulation/xen ) + udev? ( virtual/udev >=x11-libs/libpciaccess-0.10.9 ) + virt-network? ( net-dns/dnsmasq[script] + net-misc/radvd + sys-apps/iproute2[-minimal] + firewalld? ( net-firewall/firewalld ) + ) + elibc_glibc? ( || ( >=net-libs/libtirpc-0.2.2-r1 <sys-libs/glibc-2.14 ) )" + +DEPEND="${RDEPEND} + virtual/pkgconfig + app-text/xhtml1 + dev-lang/perl + dev-perl/XML-XPath + dev-libs/libxslt" + +# gentoo.readme stuff: +DISABLE_AUTOFORMATTING=true +DOC_CONTENTS="For the basic networking support (bridged and routed networks) you don't +need any extra software. For more complex network modes including but not +limited to NATed network, you can enable the 'virt-network' USE flag. + +If you are using dnsmasq on your system, you will have to configure +/etc/dnsmasq.conf to enable the following settings: + bind-interfaces + interface or except-interface +Otherwise you might have issues with your existing DNS server. + +For openrc users: + + Please use /etc/conf.d/libvirtd to control the '--listen' parameter for + libvirtd. + + The default configuration will suspend and resume running kvm guests + with 'managedsave'. This behavior can be changed under + /etc/conf.d/libvirtd + +For systemd users: + + Please use /etc/systemd/system/libvirtd.service.d/00gentoo.conf + to control the '--listen' parameter for libvirtd. + + The configuration for the 'libvirt-guests.service' is found under + /etc/libvirt/libvirt-guests.conf" + +! use policykit && DOC_CONTENTS+=" + +To allow normal users to connect to libvirtd you must change the unix sock +group and/or perms in /etc/libvirt/libvirtd.conf" + +use caps && use qemu && DOC_CONTENTS+=" + +libvirt will now start qemu/kvm VMs with non-root privileges. Ensure any +resources your VMs use are accessible by qemu:qemu" + +LXC_CONFIG_CHECK=" + ~CGROUPS + ~CGROUP_FREEZER + ~CGROUP_DEVICE + ~CGROUP_CPUACCT + ~CGROUP_SCHED + ~CGROUP_PERF + ~BLK_CGROUP + ~NET_CLS_CGROUP + ~CGROUP_NET_PRIO + ~CPUSETS + ~NAMESPACES + ~UTS_NS + ~IPC_NS + ~PID_NS + ~NET_NS + ~USER_NS + ~DEVPTS_MULTIPLE_INSTANCES + ~VETH + ~MACVLAN + ~POSIX_MQUEUE + ~SECURITYFS + ~!GRKERNSEC_CHROOT_MOUNT + ~!GRKERNSEC_CHROOT_DOUBLE + ~!GRKERNSEC_CHROOT_PIVOT + ~!GRKERNSEC_CHROOT_CHMOD + ~!GRKERNSEC_CHROOT_CAPS +" + +VIRTNET_CONFIG_CHECK=" + ~BRIDGE_NF_EBTABLES + ~BRIDGE_EBT_MARK_T + ~NETFILTER_ADVANCED + ~NETFILTER_XT_TARGET_CHECKSUM + ~NETFILTER_XT_CONNMARK + ~NETFILTER_XT_MARK +" + +BWLMT_CONFIG_CHECK=" + ~BRIDGE_EBT_T_NAT + ~NET_SCH_HTB + ~NET_SCH_SFQ + ~NET_SCH_INGRESS + ~NET_CLS_FW + ~NET_CLS_U32 + ~NET_ACT_POLICE +" + +MACVTAP_CONFIG_CHECK=" ~MACVTAP" + +LVM_CONFIG_CHECK=" ~BLK_DEV_DM ~DM_SNAPSHOT ~DM_MULTIPATH" + +ERROR_USER_NS="Optional depending on LXC configuration." + +pkg_setup() { + enewgroup qemu 77 + enewuser qemu 77 -1 -1 qemu kvm + + # Some people used the masked ebuild which was not adding the qemu + # user to the kvm group originally. This results in VMs failing to + # start for some users. bug #430808 + egetent group kvm | grep -q qemu + if [[ $? -ne 0 ]]; then + gpasswd -a qemu kvm + fi + + # Handle specific kernel versions for different features + kernel_is lt 3 6 && LXC_CONFIG_CHECK+=" ~CGROUP_MEM_RES_CTLR" + kernel_is ge 3 6 && LXC_CONFIG_CHECK+=" ~MEMCG ~MEMCG_SWAP ~MEMCG_KMEM" + + CONFIG_CHECK="" + use fuse && CONFIG_CHECK+=" ~FUSE_FS" + use lvm && CONFIG_CHECK+="${LVM_CONFIG_CHECK}" + use lxc && CONFIG_CHECK+="${LXC_CONFIG_CHECK}" + use macvtap && CONFIG_CHECK+="${MACVTAP_CONFIG_CHECK}" + use virt-network && CONFIG_CHECK+="${VIRTNET_CONFIG_CHECK}" + # Bandwidth Limiting Support + use virt-network && CONFIG_CHECK+="${BWLMT_CONFIG_CHECK}" + if [[ -n ${CONFIG_CHECK} ]]; then + linux-info_pkg_setup + fi +} + +src_prepare() { + touch "${S}/.mailmap" + + if [[ ${PV} = *9999* ]]; then + # git checkouts require bootstrapping to create the configure script. + # Additionally the submodules must be cloned to the right locations + # bug #377279 + ./bootstrap || die "bootstrap failed" + ( + git submodule status | sed 's/^[ +-]//;s/ .*//' + git hash-object bootstrap.conf + ) >.git-module-status + fi + + epatch \ + "${FILESDIR}"/${PN}-1.2.9-do_not_use_sysconf.patch \ + "${FILESDIR}"/${PN}-1.2.16-fix_paths_in_libvirt-guests_sh.patch \ + "${FILESDIR}"/${P}-fix_paths_for_apparmor.patch + + [[ -n ${BACKPORTS} ]] && \ + EPATCH_FORCE=yes EPATCH_SUFFIX="patch" \ + EPATCH_SOURCE="${WORKDIR}/patches" epatch + + epatch_user + + [[ -n ${AUTOTOOLIZE} ]] && eautoreconf + + # Tweak the init script + local avahi_init= + local iscsi_init= + local rbd_init= + local firewalld_init= + cp "${FILESDIR}/libvirtd.init-r14" "${S}/libvirtd.init" + use avahi && avahi_init='avahi-daemon' + use iscsi && iscsi_init='iscsid' + use rbd && rbd_init='ceph' + use firewalld && firewalld_init='need firewalld' + + sed -e "s/USE_FLAG_FIREWALLD/${firewalld_init}/" -i "${S}/libvirtd.init" + sed -e "s/USE_FLAG_AVAHI/${avahi_init}/" -i "${S}/libvirtd.init" + sed -e "s/USE_FLAG_ISCSI/${iscsi_init}/" -i "${S}/libvirtd.init" + sed -e "s/USE_FLAG_RBD/${rbd_init}/" -i "${S}/libvirtd.init" +} + +src_configure() { + local myconf="" + + ## enable/disable daemon, otherwise client only utils + myconf+=" $(use_with libvirtd)" + + ## enable/disable the daemon using avahi to find VMs + myconf+=" $(use_with avahi)" + + ## hypervisors on the local host + myconf+=" $(use_with xen) $(use_with xen xen-inotify)" + myconf+=" --without-xenapi" + if use xen && has_version ">=app-emulation/xen-tools-4.2.0"; then + myconf+=" --with-libxl" + else + myconf+=" --without-libxl" + fi + myconf+=" $(use_with openvz)" + myconf+=" $(use_with lxc)" + if use virtualbox && has_version app-emulation/virtualbox-ose; then + myconf+=" --with-vbox=/usr/lib/virtualbox-ose/" + else + myconf+=" $(use_with virtualbox vbox)" + fi + myconf+=" $(use_with uml)" + myconf+=" $(use_with qemu)" + myconf+=" $(use_with qemu yajl)" # Use QMP over HMP + myconf+=" $(use_with phyp)" + myconf+=" --with-esx" + myconf+=" --with-vmware" + + ## additional host drivers + myconf+=" $(use_with apparmor)" + myconf+=" $(use_with apparmor apparmor-profiles)" + myconf+=" $(use_with virt-network network)" + myconf+=" --with-storage-fs" + myconf+=" $(use_with lvm storage-lvm)" + myconf+=" $(use_with iscsi storage-iscsi)" + myconf+=" $(use_with parted storage-disk)" + mycond+=" $(use_with glusterfs)" + mycond+=" $(use_with glusterfs storage-gluster)" + myconf+=" $(use_with lvm storage-mpath)" + myconf+=" $(use_with rbd storage-rbd)" + myconf+=" $(use_with numa numactl)" + myconf+=" $(use_with numa numad)" + myconf+=" $(use_with selinux)" + myconf+=" $(use_with fuse)" + + # udev for device support details + myconf+=" $(use_with udev)" + myconf+=" --without-hal" + + # linux capability support so we don't need privileged accounts + myconf+=" $(use_with caps capng)" + + ## auth stuff + myconf+=" $(use_with policykit polkit)" + myconf+=" $(use_with sasl)" + + # network bits + myconf+=" $(use_with macvtap)" + myconf+=" $(use_with pcap libpcap)" + myconf+=" $(use_with vepa virtualport)" + myconf+=" $(use_with firewalld)" + + ## other + myconf+=" $(use_enable nls)" + + # user privilege bits fir qemu/kvm + if use caps; then + myconf+=" --with-qemu-user=qemu" + myconf+=" --with-qemu-group=qemu" + else + myconf+=" --with-qemu-user=root" + myconf+=" --with-qemu-group=root" + fi + + # audit support + myconf+=" $(use_with audit)" + + # wireshark dissector + myconf+=" $(use_with wireshark-plugins wireshark-dissector)" + + ## stuff we don't yet support + myconf+=" --without-netcf" + + # locking support + myconf+=" --without-sanlock" + + # systemd unit files + myconf+=" $(use_with systemd systemd-daemon)" + use systemd && myconf+=" --with-init-script=systemd" + + # this is a nasty trick to work around the problem in bug + # #275073. The reason why we don't solve this properly is that + # it'll require us to rebuild autotools (and we don't really want + # to do that right now). The proper solution has been sent + # upstream and should hopefully land in 0.7.7, in the mean time, + # mime the same functionality with this. + case ${CHOST} in + *cygwin* | *mingw* ) + ;; + *) + ac_cv_prog_WINDRES=no + ;; + esac + + econf \ + ${myconf} \ + --disable-static \ + --disable-werror \ + --with-remote \ + --docdir=/usr/share/doc/${PF} \ + --localstatedir=/var + + if [[ ${PV} = *9999* ]]; then + # Restore gnulib's config.sub and config.guess + # bug #377279 + (cd .gnulib && git reset --hard > /dev/null) + fi +} + +src_test() { + # Explicitly allow parallel build of tests + export VIR_TEST_DEBUG=1 + HOME="${T}" emake check || die "tests failed" +} + +src_install() { + emake install \ + DESTDIR="${D}" \ + HTML_DIR=/usr/share/doc/${PF}/html \ + DOCS_DIR=/usr/share/doc/${PF} \ + EXAMPLE_DIR=/usr/share/doc/${PF}/examples \ + SYSTEMD_UNIT_DIR="$(systemd_get_unitdir)" \ + || die "emake install failed" + + find "${D}" -name '*.la' -delete || die + + # Remove bogus, empty directories. They are either not used, or + # libvirtd is able to create them on demand + rm -rf "${D}"/etc/sysconfig + rm -rf "${D}"/var/cache + rm -rf "${D}"/var/run + rm -rf "${D}"/var/log + + use libvirtd || return 0 + # From here, only libvirtd-related instructions, be warned! + + use systemd && systemd_install_serviced \ + "${FILESDIR}"/libvirtd.service.conf libvirtd.service + + systemd_newtmpfilesd "${FILESDIR}"/libvirtd.tmpfiles.conf libvirtd.conf + + newinitd "${S}/libvirtd.init" libvirtd || die + newconfd "${FILESDIR}/libvirtd.confd-r4" libvirtd || die + newinitd "${FILESDIR}/virtlockd.init-r1" virtlockd || die + + readme.gentoo_create_doc +} + +pkg_preinst() { + # we only ever want to generate this once + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then + rm -rf "${D}"/etc/libvirt/qemu/networks/default.xml + fi + + # We really don't want to use or support old PolicyKit cause it + # screws with the new polkit integration + if has_version sys-auth/policykit; then + rm -rf "${D}"/usr/share/PolicyKit/policy/org.libvirt.unix.policy + fi + + # Only sysctl files ending in .conf work + dodir /etc/sysctl.d + mv "${D}"/usr/lib/sysctl.d/libvirtd.conf "${D}"/etc/sysctl.d/libvirtd.conf +} + +pkg_postinst() { + if [[ -e "${ROOT}"/etc/libvirt/qemu/networks/default.xml ]]; then + touch "${ROOT}"/etc/libvirt/qemu/networks/default.xml + fi + + use libvirtd || return 0 + # From here, only libvirtd-related instructions, be warned! + + if [[ -n ${REPLACING_VERSIONS} ]] && ! version_is_at_least 1.2.17-r2 ${REPLACING_VERSIONS} ]]; then + FORCE_PRINT_ELOG=true + fi + + readme.gentoo_print_elog +} diff --git a/app-emulation/libvirt/metadata.xml b/app-emulation/libvirt/metadata.xml new file mode 100644 index 000000000000..34d90a3666da --- /dev/null +++ b/app-emulation/libvirt/metadata.xml @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer> + <email>tamiko@gentoo.org</email> + <name>Matthias Maier</name> + <description>Please assign bugs to me</description> +</maintainer> +<maintainer> + <email>cardoe@gentoo.org</email> + <name>Doug Goldstein</name> +</maintainer> +<herd>virtualization</herd> +<use> + <!-- Pool backend flags --> + <flag name="iscsi"> + Allow using an iSCSI remote storage server as pool for disk image storage + </flag> + <flag name="lvm"> + Allow using the Logical Volume Manager (<pkg>sys-apps/lvm2</pkg>) as pool for disk image + storage + </flag> + <flag name="nfs"> + Allow using Network File System mounts as pool for disk image storage + </flag> + <flag name="parted"> + Allow using real disk partitions as pool for disk image storage, using + <pkg>sys-block/parted</pkg> to create, resize and delete them. + </flag> + <flag name="rbd"> + Enable rados block device support via <pkg>sys-cluster/ceph</pkg> + </flag> + <!-- Virtualisation backends --> + <flag name="lxc"> + Support management of Linux Containers virtualisation (<pkg>app-emulation/lxc</pkg>) + </flag> + <flag name="openvz"> + Support management of OpenVZ virtualisation (see <pkg>sys-kernel/openvz-sources</pkg>) + </flag> + <flag name="uml"> + Support management of User Mode Linux virtualisation + </flag> + <flag name="qemu"> + Support management of QEMU virtualisation (<pkg>app-emulation/qemu</pkg>) + </flag> + <flag name="xen"> + Support management of Xen virtualisation (<pkg>app-emulation/xen</pkg>) + </flag> + <flag name="virtualbox"> + Support management of VirtualBox virtualisation (one of <pkg>app-emulation/virtualbox</pkg> or + <pkg>app-emulation/virtualbox-ose</pkg>) + </flag> + <flag name="phyp"> + Support IBM HMC / IVM hypervisor via PHYP protocol + </flag> + <!-- Miscellaneous flags --> + <flag name="apparmor">Enable AppArmor support</flag> + <flag name="audit">support <pkg>sys-process/audit</pkg></flag> + <flag name="fuse">Allow LXC to use <pkg>sys-fs/fuse</pkg> for mount + points</flag> + <flag name="numa"> + Use NUMA for memory segmenting via <pkg>sys-process/numactl</pkg> and + <pkg>sys-process/numad</pkg> + </flag> + <flag name="libvirtd"> + Builds the libvirtd daemon as well as the client utilities instead of just the client + utilities + </flag> + <flag name="pcap"> + Support auto learning IP addreses for routing + </flag> + <flag name="macvtap"> + Support for MAC-based TAP (macvlan/macvtap). For networking instead + of the normal TUN/TAP. It has its advantages and disadvantages. + macvtap support requires very new kernels and is + currently evolving. Support for this is experimental at best. + </flag> + <flag name="vepa">Virtual Ethernet Port Aggregator (VEPA) / 802.1Qbg + support. Relies on macvtap support.</flag> + <flag name="virt-network"> + Enable virtual networking (NAT) support for guests. Includes all + the dependencies for NATed network mode. Effectively any network + setup that relies on libvirt to setup and configure network + interfaces on your host. This can include bridged and routed + networks ONLY if you are allowing libvirt to create and manage + the underlying devices for you. In some cases this requires + enabling the 'netcf' USE flag (currently unavailable). + </flag> + <flag name="firewalld">DBus interface to iptables/ebtables allowing + for better runtime management of your firewall.</flag> + <flag name="wireshark-plugins"> + Build the <pkg>net-analyzer/wireshark</pkg> plugin for the Libvirt RPC protocol + </flag> + <flag name="glusterfs"> + Enable GlusterFS support via <pkg>sys-cluster/glusterfs</pkg> + </flag> +</use> +</pkgmetadata> |