-

 - e-mail

 

 -

   zerg_from_hive

 -

( : 2) _ _
( : 3) __ _ _

 -

 LiveInternet.ru:
: 05.09.2006
:
:
: 63701

:


KVM vs XEN,

, 15 2011 . 16:50 +
- Anthrax/Among The Living (1987)/Among The Living
, XEN RHEL , , CentOS , 2014 . KVM, . , , , , virt-manager', ... , . .. , , . , on_poweroff destroy. , destroy shutdown, , , -- , . destroy -- , .
, XEN , , , - KVM . , , -- , :
http://www.salstar.sk/pub/salpack/etc/rc.d/init.d/virt-shutdown
( http://www.mail-archive.com/libvir-list@redhat.com/msg14754.html)
, , -, , , libvirtd " , !" /etc/init.d/libvirtd ( "# Default-Start: 3 4 5")
# Required-Stop: virt-shutdown
, : . 8-)

:
#!/bin/sh

# the following is the LSB init header see
# http://www.linux-foundation.org/spec//booksets/LSB...re-generic.html#INITSCRCOMCONV
#
### BEGIN INIT INFO
# Provides: virt-shutdown
# Should-Start: libvirtd
# Default-Start: 3 4 5
# Short-Description: shutdown libvirt domains
# Description: This is a script for shutting down virtual machines
# on shutdown of host system.
### END INIT INFO

# the following is chkconfig init header
#
# virt-shutdown: shutdown libvirt domains
#
# chkconfig: 345 97 01
# description: This is a scripts for shutting down virtual machines
# on shutdown of host system.
#

# Source function library.
. /etc/rc.d/init.d/functions

LC_ALL=C
VIRSH="virsh -c qemu:///system"
WAIT_SECONDS=300
post_script() {
true
}

RETVAL=0

[ -e /etc/sysconfig/virt-shutdown ] && . /etc/sysconfig/virt-shutdown

stop() {
echo -n $"Shutting down virtual machines: "

DOM_LIST=`$VIRSH list | grep running | awk '{ print $1 }'`
for DOM_ID in $DOM_LIST; do
echo -n "`$VIRSH domname $DOM_ID | head -n 1` "
$VIRSH shutdown $DOM_ID >/dev/null
done

N=`$VIRSH list | grep running | wc -l`
WAIT_SECONDS=$((WAIT_SECONDS*N))
for i in `seq $WAIT_SECONDS`; do
N=`$VIRSH list | grep running | wc -l`
if [ $N -eq 0 ]; then
break
fi
sleep 1
echo -n "$N "
done

if [ $N -eq 0 ]; then
RETVAL=0
echo
else
echo
echo "These virtual machines are still running:"
$VIRSH list | grep running
RETVAL=1
fi
post_script stop
}

# See how we were called.
case "$1" in
start)
touch /var/lock/subsys/virt-shutdown
RETVAL=0
;;
stop)
stop
rm -f /var/lock/subsys/virt-shutdown
;;
status)
status virt-shutdown
$VIRSH list
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status}"
exit 1
;;
esac
exit $RETVAL
:  

all_T   , 16 2011 . 18:44 ()
. . . : exit $RET VAL .
: (exit) ($RET) (VAL)
   
   , 16 2011 . 20:48 ()
, :D
VServer .
   
zerg_from_hive   , 16 2011 . 22:34 ()
all_T, libvirtd , . 8-)
, -, , . 8-)
, , ACPI, . VServer .
   
: [1] []
 

:
: 

: ( )

:

  URL