diff options
Diffstat (limited to 'app-emulation/libvirt')
-rw-r--r-- | app-emulation/libvirt/Manifest | 5 | ||||
-rw-r--r-- | app-emulation/libvirt/files/libvirt-0.4.6-qemu-img-name.patch | 18 | ||||
-rw-r--r-- | app-emulation/libvirt/files/libvirtd.confd | 15 | ||||
-rwxr-xr-x | app-emulation/libvirt/files/libvirtd.init | 73 | ||||
-rw-r--r-- | app-emulation/libvirt/libvirt-0.6.1.ebuild | 108 |
5 files changed, 219 insertions, 0 deletions
diff --git a/app-emulation/libvirt/Manifest b/app-emulation/libvirt/Manifest new file mode 100644 index 0000000..f9b3f08 --- /dev/null +++ b/app-emulation/libvirt/Manifest @@ -0,0 +1,5 @@ +AUX libvirt-0.4.6-qemu-img-name.patch 811 RMD160 821ad55830f4724fc4d3314d58d7ea7971f0060c SHA1 1e154cf2a0522db05fd202ebddafb530e714c657 SHA256 fe0eb8a43a79c7c3d764387170addb3d490673d5e942ea1dd7b7633da4b11b7d +AUX libvirtd.confd 476 RMD160 63b92da0cf0d589c1c6e76551982deb6b5fc8f9a SHA1 5b76082bb28705606758880c19af922dde1ccb01 SHA256 ff2c94d2a64058152be669256d8d2e241cde4356a77bd653eac9fa3b084666f6 +AUX libvirtd.init 2045 RMD160 b544578c242c6f84e2cf07682a06ce261bf40b8a SHA1 81976137c43f6b507e27ac926a6d7947e1a329d3 SHA256 96cbdf8e68a171d170f91167a4217a366325ca668b9e2621ec6800fd35d42c5c +EBUILD libvirt-0.6.1.ebuild 2725 RMD160 16d2d0b713504ffa8d1316faca890ab4d1a23f45 SHA1 71f2864639c37efc30ef8a9968dd96fd5d898a3d SHA256 3763bbb0662e4a155cfde71dbd0779ecc442e9e99a7ed7e9278c1a85578baf37 +DIST libvirt-0.6.1.tar.gz 6476130 RMD160 fbd10cda5494efeafe59ff190d97e6543ff6f330 SHA1 705d8409ed28619fcd4cd6c2063d60228762c45d SHA256 65a54819eec280a28fdf1a19b960aa33a8275f14a8ede06ae54752d5023b99de diff --git a/app-emulation/libvirt/files/libvirt-0.4.6-qemu-img-name.patch b/app-emulation/libvirt/files/libvirt-0.4.6-qemu-img-name.patch new file mode 100644 index 0000000..a1c27d2 --- /dev/null +++ b/app-emulation/libvirt/files/libvirt-0.4.6-qemu-img-name.patch @@ -0,0 +1,18 @@ +--- libvirt-0.4.6/configure.in.orig 2008-11-20 22:44:26.000000000 -0500 ++++ libvirt-0.4.6/configure.in 2008-11-20 23:06:29.000000000 -0500 +@@ -698,7 +698,14 @@ + [Location or name of the showmount program]) + fi + +-AC_PATH_PROG([QEMU_IMG], [qemu-img], [], [$PATH:/sbin:/usr/sbin:/bin:/usr/bin]) ++AC_ARG_WITH([qemu-img-name], [AC_HELP_STRING([--with-qemu-img-name=[name of binary|qemu-img]], [Name of the qemu-img binary])]) ++if test "x$with_qemu_img_name" == "x" ; then ++ QEMU_IMG_BIN="qemu-img" ++else ++ QEMU_IMG_BIN="$with_qemu_img_name" ++fi ++ ++AC_PATH_PROG([QEMU_IMG], [$QEMU_IMG_BIN], [], [$PATH:/sbin:/usr/sbin:/bin:/usr/bin]) + if test -n "$QEMU_IMG" ; then + AC_DEFINE_UNQUOTED([HAVE_QEMU_IMG], 1, [whether qemu-img is available for non-raw files]) + AC_DEFINE_UNQUOTED([QEMU_IMG],["$QEMU_IMG"], diff --git a/app-emulation/libvirt/files/libvirtd.confd b/app-emulation/libvirt/files/libvirtd.confd new file mode 100644 index 0000000..705b785 --- /dev/null +++ b/app-emulation/libvirt/files/libvirtd.confd @@ -0,0 +1,15 @@ +# /etc/conf.d/libvirtd + +# 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" + +# Automatically shutdown KVM domains when stopping libvirtd +LIBVIRTD_KVM_SHUTDOWN="yes" + +# Timeout in seconds until stopping libvirtd and "pulling the plug" on the +# remaining VM's still in a running state +#LIBVIRTD_KVM_SHUTDOWN_MAXWAIT="100" diff --git a/app-emulation/libvirt/files/libvirtd.init b/app-emulation/libvirt/files/libvirtd.init new file mode 100755 index 0000000..10765f5 --- /dev/null +++ b/app-emulation/libvirt/files/libvirtd.init @@ -0,0 +1,73 @@ +#!/sbin/runscript + +opts="start stop status reload restart" + +depend() { + need net + before sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp +} + +libvirtd_virsh() { + # Silence errors because virsh always throws an error about + # not finding the hypervisor version when connecting to libvirtd + LC_ALL=C virsh -c qemu:///system "$@" 2>/dev/null +} + +libvirtd_dom_list() { + libvirtd_virsh list | grep running | awk '{ print $1 }' +} + +libvirtd_dom_count() { + libvirtd_dom_list | wc -l +} + +start() { + ebegin "Starting libvirtd" + start-stop-daemon --start --quiet --exec /usr/sbin/libvirtd -- -d ${LIBVIRTD_OPTS} + eend $? +} + +stop() { + ebegin "Stopping libvirtd" + # try to shutdown all (KVM/Qemu) domains + DOM_COUNT="$(libvirtd_dom_count)" + if [ "${LIBVIRTD_KVM_SHUTDOWN}" = "yes" ] \ + && [ "${DOM_COUNT}" != "0" ] ; then + + einfo " Shutting down domain(s):" + for DOM_ID in $(libvirtd_dom_list) ; do + NAME="$(libvirtd_virsh domname ${DOM_ID} | head -n 1)" + einfo " ${NAME}" + libvirtd_virsh shutdown ${DOM_ID} > /dev/null + done + + if [ -n "${LIBVIRTD_KVM_SHUTDOWN_MAXWAIT}" ] ; then + COUNTER="${LIBVIRTD_KVM_SHUTDOWN_MAXWAIT}" + else + COUNTER=100 + fi + + einfo " Waiting ${COUNTER} seconds while domains shutdown ..." + DOM_COUNT="$(libvirtd_dom_count)" + while [ ${DOM_COUNT} -gt 0 ] && [ ${COUNTER} -gt 0 ] ; do + DOM_COUNT="$(libvirtd_dom_count)" + sleep 1 + COUNTER=$((${COUNTER} - 1)) + echo -n "." + done + + DOM_COUNT="$(libvirtd_dom_count)" + if [ "${DOM_COUNT}" != "0" ] ; then + eerror " !!! Some guests are still running, stopping anyways" + fi + + fi + start-stop-daemon --stop --quiet --exec /usr/sbin/libvirtd --pidfile=/var/run/libvirtd.pid + eend $? +} + +reload() { + ebegin "Reloading libvirtd" + start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/libvirtd.pid --oknodo + eend $? +} diff --git a/app-emulation/libvirt/libvirt-0.6.1.ebuild b/app-emulation/libvirt/libvirt-0.6.1.ebuild new file mode 100644 index 0000000..7160731 --- /dev/null +++ b/app-emulation/libvirt/libvirt-0.6.1.ebuild @@ -0,0 +1,108 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-emulation/libvirt/libvirt-0.5.1.ebuild,v 1.2 2009/02/20 17:47:32 cardoe Exp $ + +inherit eutils autotools + +DESCRIPTION="C toolkit to manipulate virtual machines" +HOMEPAGE="http://www.libvirt.org/" +SRC_URI="http://libvirt.org/sources/${P}.tar.gz" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="avahi iscsi lvm lxc hal kvm openvz parted qemu sasl selinux uml xen" +# policykit is in package.mask +# devicekit isn't in portage + +DEPEND="sys-libs/readline + sys-libs/ncurses + >=dev-libs/libxml2-2.5 + >=net-libs/gnutls-1.0.25 + dev-lang/python + sys-fs/sysfsutils + net-misc/bridge-utils + net-analyzer/netcat + net-dns/dnsmasq + dev-util/pkgconfig + avahi? ( >=net-dns/avahi-0.6 ) + iscsi? ( sys-block/open-iscsi ) + kvm? ( app-emulation/kvm ) + lvm? ( sys-fs/lvm2 ) + openvz? ( sys-kernel/openvz-sources ) + parted? ( >=sys-apps/parted-1.8 ) + qemu? ( app-emulation/qemu ) + sasl? ( dev-libs/cyrus-sasl ) + selinux? ( sys-libs/libselinux ) + xen? ( app-emulation/xen-tools app-emulation/xen ) + policykit? ( >=sys-auth/policykit-0.6 )" + +src_unpack() { + unpack ${A} + cd "${S}" + + epatch "${FILESDIR}"/"${PN}"-0.4.6-qemu-img-name.patch + eautoreconf +} + +pkg_setup() { + local hasbackend=0 + local backends="lxc kvm openvz qemu uml xen" + local backend + + for backend in $backends ; do + use $backend && hasbackend=1 + done + + if [ "$hasbackend" == 0 ]; then + local msg="You must enable one of these USE flags: $backends" + eerror "$msg" + die "$msg" + fi +} + +src_compile() { + local my_conf="" + if use qemu || use kvm ; then + # fix path for kvm-img but use qemu-img if the useflag is set + my_conf="--with-qemu \ + $(use_with !qemu qemu-img-name kvm-img)" + else + my_conf="--without-qemu" + fi + + econf \ + $(use_with avahi) \ + $(use_with iscsi storage-iscsi) \ + $(use_with lvm storage-lvm) \ + $(use_with lxc) \ + $(use_with hal) \ + $(use_with openvz) \ + $(use_with parted storage-disk) \ + $(use_with sasl) \ + $(use_with selinux) \ + $(use_with uml) \ + $(use_with xen) \ + $(use_with polkit) \ + ${my_conf} \ + --without-devkit \ + --with-remote \ + --disable-iptables-lokkit \ + --localstatedir=/var \ + --with-remote-pid-file=/var/run/libvirtd.pid \ + || die "econf failed" + #$(use_with policykit) \ + emake || die "emake failed" +} + +src_install() { + emake DESTDIR="${D}" install || die + mv "${D}"/usr/share/doc/{${PN}-python*,${P}/python} + newinitd "${FILESDIR}"/libvirtd.init libvirtd + newconfd "${FILESDIR}"/libvirtd.confd libvirtd +} + +pkg_postinst() { + 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" +} |