diff options
Diffstat (limited to 'community/libvirt')
-rw-r--r-- | community/libvirt/PKGBUILD | 29 | ||||
-rw-r--r-- | community/libvirt/libvirtd-guests.rc.d | 161 | ||||
-rw-r--r-- | community/libvirt/libvirtd.rc.d | 66 |
3 files changed, 9 insertions, 247 deletions
diff --git a/community/libvirt/PKGBUILD b/community/libvirt/PKGBUILD index 1619b5b1e..b44eabbc9 100644 --- a/community/libvirt/PKGBUILD +++ b/community/libvirt/PKGBUILD @@ -1,10 +1,10 @@ -# $Id: PKGBUILD 89909 2013-05-05 14:49:00Z spupykin $ +# $Id: PKGBUILD 92095 2013-05-31 13:59:18Z spupykin $ # Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com> # Contributor: Jonathan Wiersma <archaur at jonw dot org> pkgname=libvirt pkgver=1.0.5 -pkgrel=1 +pkgrel=7 pkgdesc="API for controlling virtualization engines (openvz,kvm,qemu,virtualbox,xen,etc)" arch=('i686' 'x86_64' 'mips64el') url="http://libvirt.org/" @@ -31,15 +31,11 @@ backup=('etc/conf.d/libvirtd' 'etc/sasl2/libvirt.conf') install="libvirt.install" source=("http://libvirt.org/sources/$pkgname-$pkgver.tar.gz" - libvirtd.rc.d libvirtd.conf.d - libvirtd-guests.rc.d libvirtd-guests.conf.d libvirt.tmpfiles.d) md5sums=('91c4145f49bcf92e89470fa3fb28fff6' - 'c43244c40a0437038c82089618e7beaa' '3ed0e24f5b5e25bf553f5427d64915e6' - '0ee5b6c58590ff392a266f20f7928d1f' '0a96ed876ffb1fcb9dff5a9b3a609c1e' '020971887442ebbf1b6949e031c8dd3f') @@ -54,21 +50,18 @@ build() { done export LDFLAGS=-lX11 - export RADVD=/usr/sbin/radvd - [ -f Makefile ] || ./configure --prefix=/usr --libexec=/usr/lib/"$pkgname" \ + export RADVD=/usr/bin/radvd + [ -f Makefile ] || ./configure --prefix=/usr --libexec=/usr/lib/"$pkgname" --sbindir=/usr/bin \ --with-storage-lvm --without-xen --with-udev --without-hal --disable-static \ --with-init-script=systemd --with-audit \ --with-qemu-user=nobody --with-qemu-group=nobody \ - --without-netcf --with-interface + --without-netcf --with-interface \ + --with-dnsmasq-path=/usr/bin/dnsmasq \ + --with-iptables-path=/usr/bin/iptables make - sed -i 's|/etc/sysconfig/libvirtd|/etc/conf.d/libvirtd|' daemon/libvirtd.service - sed -i \ - -e 's|/etc/sysconfig/libvirt-guests|/etc/conf.d/libvirtd-guests|' \ - -e 's|/etc/init.d/libvirt-g|/etc/rc.d/libvirtd-g|g' \ - -e 's|After=.*|After=syslog.target network.target libvirtd.service|' \ - tools/libvirt-guests.service - sed -i 's|@sbindir@|/usr/sbin|g' src/virtlockd.service + sed -i 's|/etc/sysconfig/|/etc/conf.d/|' daemon/libvirtd.service tools/libvirt-guests.service + sed -i 's|@sbindir@|/usr/bin|g' src/virtlockd.service sed -i 's|#group =.*|group="kvm"|' src/qemu/qemu.conf } @@ -77,17 +70,13 @@ package() { make DESTDIR="$pkgdir" install - install -D -m755 "$srcdir"/libvirtd.rc.d "$pkgdir"/etc/rc.d/libvirtd install -D -m644 "$srcdir"/libvirtd.conf.d "$pkgdir"/etc/conf.d/libvirtd - - install -D -m755 "$srcdir"/libvirtd-guests.rc.d "$pkgdir"/etc/rc.d/libvirtd-guests install -D -m644 "$srcdir"/libvirtd-guests.conf.d "$pkgdir"/etc/conf.d/libvirtd-guests # systemd stuff install -D -m644 "$srcdir"/libvirt.tmpfiles.d "$pkgdir"/usr/lib/tmpfiles.d/libvirt.conf mv "$pkgdir"/lib/* "$pkgdir"/usr/lib/ - rm -rf \ "$pkgdir"/var/run \ "$pkgdir"/etc/sysconfig \ diff --git a/community/libvirt/libvirtd-guests.rc.d b/community/libvirt/libvirtd-guests.rc.d deleted file mode 100644 index 3100b34fb..000000000 --- a/community/libvirt/libvirtd-guests.rc.d +++ /dev/null @@ -1,161 +0,0 @@ -#!/bin/bash - -source /etc/conf.d/libvirtd-guests -[ -f /etc/rc.conf ] && source /etc/rc.conf - -if [ -f /etc/rc.d/functions ]; then - . /etc/rc.d/functions -else - stat_busy() { - echo "$*" - } - - stat_fail() { - echo "FAIL" - } - - stat_done() { - echo "DONE" - } - - add_daemon() { - true - } - - rm_daemon() { - true - } -fi - - -LIBVIRTD_LISTFILE="/var/state/libvirtd/vm-list" - -# get guest state by name -libvirt_get_guest_state() -{ - virsh $LIBVIRTD_URI dominfo "$1" | grep -E '^State:' | awk '{print $2}' -} - -# list IDs of running guests -libvirt_list() -{ - - list=$(virsh $LIBVIRTD_URI list) - - if [ $? -ne 0 ]; then - RETVAL=1 - return 1 - fi - - uuids= - for id in $(echo "$list" | awk 'NR > 2 {print $1}'); do - uuid=$(virsh $LIBVIRTD_UTI dominfo $id | awk '/^UUID:/{print $2}') - if [ -z "$uuid" ]; then - RETVAL=1 - return 1 - fi - uuids="$uuids $uuid" - done - - echo $uuids - -} - -libvirt_domname() -{ - uuid=$1 - name=$(virsh $LIBVIRTD_URI dominfo $uuid | awk 'NR == 2 {$1=""; print}') - - echo $name -} - -# suspend guest by name -libvirt_suspend() -{ - virsh $LIBVIRTD_URI $LIBVIRTD_BYPASS_CACHE managedsave "$1" >/dev/null - timeout=$LIBVIRTD_SHUTDOWN_TIMEOUT - while [ "$timeout" -gt 0 ]; do - sleep 1 - timeout=$((timeout - 1)) - state=`libvirt_get_guest_state "$1"` - [ "x$state" == "xshut" ] && return 0 - done - return 1 -} - -# shutdown guest by name -libvirt_shutdown() -{ - virsh $LIBVIRTD_URI shutdown "$1" >/dev/null - timeout=$LIBVIRTD_SHUTDOWN_TIMEOUT - while [ "$timeout" -gt 0 ]; do - sleep 1 - timeout=$((timeout - 1)) - state=`libvirt_get_guest_state "$1"` - [ "x$state" == "xshut" ] && return 0 - done - return 1 -} - -# start guest by name -libvirt_start() -{ - virsh $LIBVIRTD_URI $LIBVIRTD_BYPASS_CACHE start "$1" >/dev/null -} - -# stop all guests -libvirt_stop_all() -{ - mkdir -p `dirname $LIBVIRTD_LISTFILE` - echo -n >$LIBVIRTD_LISTFILE - - for i in `libvirt_list`; do - name=`libvirt_domname $i` - if [ "x$LIBVIRTD_STOP_ACTION" == "xsuspend" ]; then - stat_busy "Suspending libvirtd/$name guest" - libvirt_suspend "$i" - else - stat_busy "Shutting libvirtd/$i guest down" - libvirt_shutdown "$i" - fi - [ $? -eq 0 ] && stat_done || stat_fail - echo $i >>$LIBVIRTD_LISTFILE - done -} - -# start all guests -libvirt_start_all() -{ - if [ -f $LIBVIRTD_LISTFILE ]; then - for i in `cat $LIBVIRTD_LISTFILE`; do - name=`libvirt_domname $i` - stat_busy "Starting/resuming libvirtd/$name guest" - libvirt_start "$i" - [ $? -eq 0 ] && { sleep $LIBVIRTD_START_DELAY; stat_done; } || stat_fail - done - fi - rm -f $LIBVIRTD_LISTFILE -} - -# main -LC_ALL=C -LANG=C -case "$1" in - start) - libvirt_start_all - add_daemon libvirtd-guests - ;; - stop) - libvirt_stop_all - rm_daemon libvirtd-guests - ;; - restart) - $0 stop - sleep 1 - $0 start - ;; - *) - echo $"Usage: $0 {start|stop|restart}" - ;; -esac -exit 0 diff --git a/community/libvirt/libvirtd.rc.d b/community/libvirt/libvirtd.rc.d deleted file mode 100644 index 193bffa9c..000000000 --- a/community/libvirt/libvirtd.rc.d +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -. /etc/rc.conf -. /etc/conf.d/libvirtd -. /etc/rc.d/functions - -LIBVIRTD_CONFIG_ARGS= -if [ -n "$LIBVIRTD_CONFIG" ] -then - LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG" -fi - -PID=`pidof -o %PPID /usr/sbin/libvirtd` -case "$1" in - start) - stat_busy "Starting libvirtd" - export RADVD=/usr/sbin/radvd - for i in /var/run/libvirt/qemu /var/run/libvirt/lxc /var/run/libvirt/uml /var/run/libvirt/network; do - [ -d $i ] || mkdir -p $i - done - [ -z "$PID" ] && ( - mkdir -p /var/{cache,run}/libvirt - rm -rf /var/cache/libvirt/* - KRB5_KTNAME=$KRB5_KTNAME \ - /usr/sbin/libvirtd --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS - ) - if [ $? -gt 0 ]; then - stat_fail - else - add_daemon libvirtd - stat_done - fi - ;; - stop) - stat_busy "Stopping libvirtd" - [ ! -z "$PID" ] && ( - kill $PID &> /dev/null - rm -rf /var/cache/libvirt/* - rm -f /var/run/libvirtd.pid - ) - if [ $? -gt 0 ]; then - stat_fail - else - rm_daemon libvirtd - stat_done - fi - ;; - restart) - $0 stop - sleep 1 - $0 start - ;; - reload) - stat_busy "Reloading libvirtd configuration" - [ ! -z "$PID" ] && kill -HUP $PID &> /dev/null - if [ $? -gt 0 ]; then - stat_fail - else - stat_done - fi - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload}" - ;; -esac -exit 0 |