diff options
author | Lance Albertson <ramereth@gentoo.org> | 2011-01-22 02:07:43 +0000 |
---|---|---|
committer | Lance Albertson <ramereth@gentoo.org> | 2011-01-22 02:07:43 +0000 |
commit | 58d190d20241911b2786fc7a6e26363a558ff25a (patch) | |
tree | a4205fe1459f23b5405752dd746846508f81f7c6 /app-emulation/ganeti/files | |
parent | Properly fix parallel install (bug #352321 by Tolga Dalman). (diff) | |
download | gentoo-2-58d190d20241911b2786fc7a6e26363a558ff25a.tar.gz gentoo-2-58d190d20241911b2786fc7a6e26363a558ff25a.tar.bz2 gentoo-2-58d190d20241911b2786fc7a6e26363a558ff25a.zip |
Version bump. Add upstream KVM poweroff init script (gentoofied)
(Portage version: 2.1.9.25/cvs/Linux x86_64)
Diffstat (limited to 'app-emulation/ganeti/files')
-rw-r--r-- | app-emulation/ganeti/files/ganeti-kvm-poweroff.confd | 4 | ||||
-rw-r--r-- | app-emulation/ganeti/files/ganeti-kvm-poweroff.initd | 58 |
2 files changed, 62 insertions, 0 deletions
diff --git a/app-emulation/ganeti/files/ganeti-kvm-poweroff.confd b/app-emulation/ganeti/files/ganeti-kvm-poweroff.confd new file mode 100644 index 000000000000..6ab21c3709a5 --- /dev/null +++ b/app-emulation/ganeti/files/ganeti-kvm-poweroff.confd @@ -0,0 +1,4 @@ +# /etc/conf.d/ganeti-kvm-poweroff: config file for /etc/init.d/ganeti-kvm-poweroff + +# Maximum time in seconds to wait until KVM VMs shutdown before giving up. +# GANETI_KVM_TIMEOUT="60" diff --git a/app-emulation/ganeti/files/ganeti-kvm-poweroff.initd b/app-emulation/ganeti/files/ganeti-kvm-poweroff.initd new file mode 100644 index 000000000000..93d352187689 --- /dev/null +++ b/app-emulation/ganeti/files/ganeti-kvm-poweroff.initd @@ -0,0 +1,58 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-emulation/ganeti/files/ganeti-kvm-poweroff.initd,v 1.1 2011/01/22 02:07:43 ramereth Exp $ + +depend() { + after ganeti + after bootmisc +} + +CONTROL_PATH="/var/run/ganeti/kvm-hypervisor/ctrl" +GANETI_KVM_TIMEOUT=${GANETI_KVM_TIMEOUT:-60} + +start() { + return 0 +} + +# Taken from doc/examples/ganeti-kvm-poweroff.initd.in in ganeti package +stop() { + ebegin "Stopping Ganeti KVM VMs" + # shutdown VMs and remove sockets of those not running + for vm_monitor in $(find $CONTROL_PATH -type s -name '*.monitor') ; do + if ! echo system_powerdown | \ + socat -U UNIX:$vm_monitor STDIO > /dev/null 2>&1; then + # remove disconnected socket + rm -f $vm_monitor + fi + done + + einfo " Waiting for VMs to poweroff" + waiting=true + remaining=$GANETI_KVM_TIMEOUT + while $waiting && [ $remaining -ne 0 ]; do + if [ -z "$(find $CONTROL_PATH -type s -name '*.monitor')" ] ; then + break + fi + + echo -n "." + for vm_monitor in $(find $CONTROL_PATH -type s -name '*.monitor') ; do + if ! echo | socat -U UNIX:$vm_monitor STDIO > /dev/null 2>&1; then + rm -rf $vm_monitor + fi + done + + sleep 5 + let remaining-=5 1 + done + + if [ -n "$(find $CONTROL_PATH -type s -name '*.monitor')" ] ; then + eerror " Some ganeti VMs did not shutdown" + fi + echo + eend $? +} + +restart() { + eerror "restart not supported" +} |