diff options
author | Lance Albertson <ramereth@gentoo.org> | 2008-07-15 17:25:46 +0000 |
---|---|---|
committer | Lance Albertson <ramereth@gentoo.org> | 2008-07-15 17:25:46 +0000 |
commit | 7c8dc0eb1eccdcd96a0b74f17781fb7e4c96a580 (patch) | |
tree | 4aeac14ee0c63efeb45ded689478ac2bc74ca472 /app-emulation | |
parent | Version bump. (diff) | |
download | historical-7c8dc0eb1eccdcd96a0b74f17781fb7e4c96a580.tar.gz historical-7c8dc0eb1eccdcd96a0b74f17781fb7e4c96a580.tar.bz2 historical-7c8dc0eb1eccdcd96a0b74f17781fb7e4c96a580.zip |
Add kvm support to libvirt, update init script, fix DEPEND, etc
Diffstat (limited to 'app-emulation')
-rw-r--r-- | app-emulation/libvirt/ChangeLog | 20 | ||||
-rw-r--r-- | app-emulation/libvirt/Manifest | 7 | ||||
-rw-r--r-- | app-emulation/libvirt/files/libvirt-0.4.4-binary-paths.patch | 69 | ||||
-rw-r--r-- | app-emulation/libvirt/files/libvirt-0.4.4-capabilities-kvm-path.patch | 12 | ||||
-rw-r--r-- | app-emulation/libvirt/files/libvirtd.confd | 7 | ||||
-rwxr-xr-x | app-emulation/libvirt/files/libvirtd.init | 58 | ||||
-rw-r--r-- | app-emulation/libvirt/libvirt-0.4.4-r1.ebuild | 96 |
7 files changed, 264 insertions, 5 deletions
diff --git a/app-emulation/libvirt/ChangeLog b/app-emulation/libvirt/ChangeLog index c5e642bdc807..8c75cc3ab6a0 100644 --- a/app-emulation/libvirt/ChangeLog +++ b/app-emulation/libvirt/ChangeLog @@ -1,6 +1,24 @@ # ChangeLog for app-emulation/libvirt # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/libvirt/ChangeLog,v 1.12 2008/07/08 22:57:29 ramereth Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-emulation/libvirt/ChangeLog,v 1.13 2008/07/15 17:25:45 ramereth Exp $ + +*libvirt-0.4.4-r1 (15 Jul 2008) + + 15 Jul 2008; Lance Albertson <ramereth@gentoo.org> + +files/libvirt-0.4.4-binary-paths.patch, + +files/libvirt-0.4.4-capabilities-kvm-path.patch, files/libvirtd.confd, + files/libvirtd.init, +libvirt-0.4.4-r1.ebuild: + Add support for kvm + * Add patches to deal with kvm binary names + * Fix DEPEND + - Discovered that bridge-utils, nc, and dnsmasq are needed to run libvirt + properly. Make dnsmasq a dep only if needing libvirtd + * Set default pidfile location to be in /var/run + * Add server useflag to choose whether you wanted libvirtd or not + * Update init script + - Deal with shutting down kvm domains properly + - Add reload for libvirtd + - Remove need to specify pidfile during startup *libvirt-0.4.4 (08 Jul 2008) diff --git a/app-emulation/libvirt/Manifest b/app-emulation/libvirt/Manifest index c49c623d6ee2..f6a47347c2c8 100644 --- a/app-emulation/libvirt/Manifest +++ b/app-emulation/libvirt/Manifest @@ -1,6 +1,8 @@ +AUX libvirt-0.4.4-binary-paths.patch 2947 RMD160 10d150facbe7baaefbba6ec4b0287050db8f31c8 SHA1 6f1f912e83f4090293f287068c2f97b9a973a145 SHA256 2a83c75d19291bf3ac7110f48b1b6929515005826fbd7dcbaf4377cb4afb3115 +AUX libvirt-0.4.4-capabilities-kvm-path.patch 680 RMD160 42516e1ca91fa59f5c34079874be2af922afd8f6 SHA1 64c867dde6c75a6390af4f4176c5efedda2ae176 SHA256 7a8ae9cc24840132131903cb865338369b5ded3d9535cf911b0b0d77d49ababc AUX libvirt-0.4.4-kvm-cdrom-fix.patch 1183 RMD160 35555fcee1bbe7550066450c7fcf1a8c20f3c73c SHA1 4a4c728630e645dee99e2625aa900e0099930590 SHA256 2f2573ba4969fb8c068ee8e1af7b60adc97a5caa7d26b58e3caa48ce3371b721 -AUX libvirtd.confd 232 RMD160 2daafe89b89fab5b40f225835e070ba83d1caec8 SHA1 8d817c4e39f1b21abaf861f473566892d4e5ee43 SHA256 e6ca0a896f799048ddf9325d207353d33ef0b2118adfb0876c67c5d97dd3a658 -AUX libvirtd.init 331 RMD160 076b6f857958576bafcc699551108c4f411511fb SHA1 fa6c973fe7ccfd15406dae9d9a223c11b661494a SHA256 880f9806f1e5675b1c5b6615f99858d8504200ce832ec9780066fd8087728def +AUX libvirtd.confd 476 RMD160 63b92da0cf0d589c1c6e76551982deb6b5fc8f9a SHA1 5b76082bb28705606758880c19af922dde1ccb01 SHA256 ff2c94d2a64058152be669256d8d2e241cde4356a77bd653eac9fa3b084666f6 +AUX libvirtd.init 1863 RMD160 fe417593085f42c49ebe08dc2cab7472e59f5439 SHA1 35a7f16f5a9aa32c5987979f8ff5448065740493 SHA256 f292e11128c5dfb2a81dea2b65dcbed9e072a2eb079ec9b77c369844493b7180 DIST libvirt-0.1.3.tar.gz 585339 RMD160 69cb5f031214ddd2119a2756d838fcbe56ce56cc SHA1 52e90e9331e33776905146dfdafe0cc920374be4 SHA256 9557030a6e898299d150bc05ad74489d9b6638cd36092757a37a5c16f483f3a7 DIST libvirt-0.1.4.tar.gz 609075 RMD160 bf120066a7c551c307cdf68d0e8ec283d1547cda SHA1 56233639f56133cd3b503b8691188b72a2e76504 SHA256 ad7a27c732aaec3c1c1f56304326509eb031fd79d06bb72abd872a1e663e1566 DIST libvirt-0.1.7.tar.gz 692709 RMD160 6324a5c157c155db68c5774ebdfc3e2731e438bd SHA1 eb85985bf2f09f754518b01277ca18de69bdf252 SHA256 9249cd9f4891789ba7b05055095e9788c2cf33d664601a37380b6c8a351f4118 @@ -14,6 +16,7 @@ EBUILD libvirt-0.1.7.ebuild 635 RMD160 065d29cf299ba77d92cabd642fe588f6da777f06 EBUILD libvirt-0.2.3.ebuild 977 RMD160 80e7af8d8ce220517ebe48cfbeca2b045d94cb7b SHA1 3702cb5747d8cf4eb0ad3870c3555c94948f7885 SHA256 d67b02360406d3261969dbfa1a7a2467239e1face337204a74d93f3b25476f32 EBUILD libvirt-0.3.3.ebuild 977 RMD160 7e8b025dcc2e4e7e8646662c219b0849d026d7ad SHA1 846f6f7443a2ffd430cdf740e18236ef8b20a14d SHA256 3e7bb4acb64cb0c984f256c37a91e9317d64481ccc2f4b6bf6bbd563d010642c EBUILD libvirt-0.4.2.ebuild 1644 RMD160 3a23e3c22763288585458d606a16b3c7499bf853 SHA1 ed82e260c8496c0e91a37dbe6d372add5508a06c SHA256 cdf54f0a74786b339f92bdf5e6cac25a130380291ed5029f077739c8f34bab41 +EBUILD libvirt-0.4.4-r1.ebuild 2624 RMD160 763302de4fd12fae0ec5929933dc3f5e754abb8c SHA1 b5dc6928bc5e5599810a55956cd3da721ac0475a SHA256 c86d558bc263c54a13ea06f2e4d9b516882146380579ba96531e338c16667df9 EBUILD libvirt-0.4.4.ebuild 1834 RMD160 32d4157fb27cce97384057b1ad4f4143ff029927 SHA1 59ee7b19e3a33da4b94bd9d1d76066760b385e1b SHA256 4d755eca2aa75a87ea54ac994db35cd8601f9a9ded7202647d29bf68d94910ec MISC ChangeLog 2265 RMD160 763eaa96c1a6fe83e171b184e30c6bb65038c029 SHA1 dd39e24dc838326a1a8e24bf55c5538f2396b44f SHA256 31ae9a40e1ee6c221cda1adfe47d4b7142aa63b7b5f51efbe5ad882d2c87a5cf MISC metadata.xml 352 RMD160 8ecec71524546a162a8f9a8a6518c8c1efc51f47 SHA1 6b0febbf1d8a74f93cdc47e9357068e090468b4a SHA256 a0862db0915069404eb2d268e788e840cf5e135989d1d6db752611402b0c6a17 diff --git a/app-emulation/libvirt/files/libvirt-0.4.4-binary-paths.patch b/app-emulation/libvirt/files/libvirt-0.4.4-binary-paths.patch new file mode 100644 index 000000000000..1a9e470c08cd --- /dev/null +++ b/app-emulation/libvirt/files/libvirt-0.4.4-binary-paths.patch @@ -0,0 +1,69 @@ +--- libvirt-0.4.4/configure.in 2008-06-25 01:37:56.000000000 -0700 ++++ libvirt-0.4.4-new/configure.in 2008-07-14 04:51:49.000000000 -0700 +@@ -661,7 +661,41 @@ + fi + AM_CONDITIONAL([WITH_STORAGE_FS], [test "$with_storage_fs" = "yes"]) + +-AC_PATH_PROG([QEMU_IMG], [qemu-img], [], [$PATH:/sbin:/usr/sbin:/bin:/usr/bin]) ++AC_MSG_CHECKING([path the of the binary for qemu]) ++AC_ARG_WITH([qemu-path], [AC_HELP_STRING([--with-qemu-path=[path of binary|/usr/bin/qemu]], [Path of the qemu binary])]) ++if test "x$with_qemu_path" == "x" ; then ++ QEMU_BIN="/usr/bin/qemu" ++else ++ QEMU_BIN="$with_qemu_path" ++fi ++AC_SUBST([QEMU_BIN]) ++AC_MSG_RESULT($QEMU_BIN) ++AC_DEFINE_UNQUOTED([QEMU_BIN],["$QEMU_BIN"], ++ [Path of the qemu program]) ++ ++AC_MSG_CHECKING([path the of the binary for qemu-kvm]) ++AC_ARG_WITH([qemu-kvm-path], [AC_HELP_STRING([--with-qemu-kvm-path=[path of binary|/usr/bin/qemu-kvm]], [Path of the qemu-kvm binary])]) ++if test "x$with_qemu_kvm_path" == "x" ; then ++ KVM_BIN="/usr/bin/qemu-kvm" ++else ++ KVM_BIN="$with_qemu_kvm_path" ++fi ++AC_SUBST([KVM_BIN]) ++AC_MSG_RESULT($KVM_BIN) ++AC_DEFINE_UNQUOTED([KVM_BIN],["$KVM_BIN"], ++ [Name of the qemu-kvm program]) ++ ++AC_MSG_CHECKING([name the disk image binary for qemu is]) ++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_SUBST([QEMU_IMG_BIN]) ++AC_MSG_RESULT($QEMU_IMG_BIN) ++ ++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"], +--- libvirt-0.4.4/src/qemu_conf.c 2008-06-19 06:15:02.000000000 -0700 ++++ libvirt-0.4.4-new/src/qemu_conf.c 2008-07-14 04:50:55.000000000 -0700 +@@ -372,7 +372,7 @@ + if (access("/dev/kvm", F_OK) == 0 && + virCapabilitiesAddGuestDomain(guest, + "kvm", +- "/usr/bin/qemu-kvm", ++ KVM_BIN, + NULL, + 0, + NULL) == NULL) +--- libvirt-0.4.4/src/qemu_driver.c 2008-06-12 07:52:53.000000000 -0700 ++++ libvirt-0.4.4-new/src/qemu_driver.c 2008-07-14 04:50:27.000000000 -0700 +@@ -1682,7 +1682,9 @@ + { + if ((virFileExists("/usr/bin/qemu")) || + (virFileExists("/usr/bin/qemu-kvm")) || +- (virFileExists("/usr/bin/xenner"))) { ++ (virFileExists("/usr/bin/xenner")) || ++ (virFileExists(QEMU_BIN)) || ++ (virFileExists(KVM_BIN))) { + if (getuid() == 0) { + return("qemu:///system"); + } else { diff --git a/app-emulation/libvirt/files/libvirt-0.4.4-capabilities-kvm-path.patch b/app-emulation/libvirt/files/libvirt-0.4.4-capabilities-kvm-path.patch new file mode 100644 index 000000000000..677e49542d8a --- /dev/null +++ b/app-emulation/libvirt/files/libvirt-0.4.4-capabilities-kvm-path.patch @@ -0,0 +1,12 @@ +diff -ur libvirt-0.4.4/src/qemu_conf.c libvirt-0.4.4-new/src/qemu_conf.c +--- libvirt-0.4.4/src/qemu_conf.c 2008-06-19 13:15:02.000000000 +0000 ++++ libvirt-0.4.4-new/src/qemu_conf.c 2008-07-13 19:50:01.000000000 +0000 +@@ -309,7 +309,7 @@ + /* The archicture tables for supported QEMU archs */ + static const struct qemu_arch_info const arch_info_hvm[] = { + { "i686", 32, arch_info_hvm_x86_machines, 2, +- "/usr/bin/qemu", arch_info_i686_flags, 4 }, ++ "/usr/bin/kvm", arch_info_i686_flags, 4 }, + { "x86_64", 64, arch_info_hvm_x86_machines, 2, + "/usr/bin/qemu-system-x86_64", arch_info_x86_64_flags, 2 }, + { "mips", 32, arch_info_hvm_mips_machines, 1, diff --git a/app-emulation/libvirt/files/libvirtd.confd b/app-emulation/libvirt/files/libvirtd.confd index c41e3c9aad1a..705b78532b39 100644 --- a/app-emulation/libvirt/files/libvirtd.confd +++ b/app-emulation/libvirt/files/libvirtd.confd @@ -6,3 +6,10 @@ # 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 index aaf6f0ecd97d..a832eb7d2c13 100755 --- a/app-emulation/libvirt/files/libvirtd.init +++ b/app-emulation/libvirt/files/libvirtd.init @@ -1,14 +1,68 @@ #!/sbin/runscript +opts="start stop status reload restart" + +depend() { + need net + before sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp +} + +hypervisor_type() { + virsh version | grep "Running hypervisor" | grep QEMU | wc -l +} + +libvirtd_domains() { + virsh list | grep running | wc -l +} + start() { ebegin "Starting libvirtd" - start-stop-daemon --start --quiet --exec /usr/sbin/libvirtd -- \ - -d --pid-file /var/run/libvirtd.pid ${LIBVIRTD_OPTS} + start-stop-daemon --start --quiet --exec /usr/sbin/libvirtd -- -d ${LIBVIRTD_OPTS} eend $? } stop() { ebegin "Stopping libvirtd" + # try to shutdown all (KVM) domains + DOM_COUNT="$(libvirtd_domains)" + HYPERVISOR_KVM="$(hypervisor_type)" + if [ ${HYPERVISOR_KVM} ] \ + && [ "${LIBVIRTD_KVM_SHUTDOWN}" = "yes" ] \ + && [ "${DOM_COUNT}" != "0" ] ; then + + einfo " Shutting down domain(s):" + for DOM_ID in $(virsh list | grep running | awk '{ print $1 }') ; do + NAME="$(virsh domname ${DOM_ID} | head -n 1)" + einfo " ${NAME}" + 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_domains)" + while [ ${DOM_COUNT} -gt 0 ] && [ ${COUNTER} -gt 0 ] ; do + DOM_COUNT="$(libvirtd_domains)" + sleep 1 + let COUNTER=COUNTER-1 + done + + DOM_COUNT="$(libvirtd_domains)" + if [ "${DOM_COUNT}" != "0" ] ; then + eerror " !!! Some guests are still running, stopping anyways" + fi + + fi start-stop-daemon --stop --quiet --exec /usr/sbin/libvirtd --pid-file=/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.4.4-r1.ebuild b/app-emulation/libvirt/libvirt-0.4.4-r1.ebuild new file mode 100644 index 000000000000..2ae2c92e71ec --- /dev/null +++ b/app-emulation/libvirt/libvirt-0.4.4-r1.ebuild @@ -0,0 +1,96 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-emulation/libvirt/libvirt-0.4.4-r1.ebuild,v 1.1 2008/07/15 17:25:45 ramereth 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 kvm openvz parted qemu sasl selinux server xen" #policykit is in package.mask + +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 + 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 ) + server? ( net-dns/dnsmasq ) + xen? ( app-emulation/xen-tools app-emulation/xen ) + " + #policykit? ( >=sys-auth/policykit-0.6 ) + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}"/"${P}"-kvm-cdrom-fix.patch + + # app-emulation/kvm renames its binaries with kvm-* prefixes, deal with it + # in a sane manner for libvirt but use qemu-img if the useflag is set + if use kvm && ! use qemu ; then + epatch "${FILESDIR}"/"${P}"-binary-paths.patch + epatch "${FILESDIR}"/"${P}"-capabilities-kvm-path.patch + eautoreconf + fi +} + +pkg_setup() { + if ! use qemu && ! use xen && ! use openvz && ! use kvm ; then + local msg="You must enable one of these USE flags: qemu xen openvz kvm" + eerror "$msg" + die "$msg" + fi +} + +src_compile() { + local my_conf="" + if use qemu || use kvm ; then + my_conf="--with-qemu \ + $(use_with !qemu qemu-img-path /usr/bin/kvm-img)" + else + my_conf="--without-qemu" + fi + + econf \ + $(use_with avahi) \ + $(use_with iscsi storage-iscsi) \ + $(use_with kvm qemu-kvm-path /usr/bin/kvm) \ + $(use_with lvm storage-lvm) \ + $(use_with openvz) \ + $(use_with parted storage-disk) \ + $(use_with sasl) \ + $(use_with selinux) \ + $(use_with server libvirtd) \ + $(use_with xen) \ + ${my_conf} \ + --with-remote \ + --disable-iptables-lokkit \ + --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} + if use server ; then + newinitd "${FILESDIR}"/libvirtd.init libvirtd + newconfd "${FILESDIR}"/libvirtd.confd libvirtd + fi +} |