Search
j0ke.net Open Build Service
>
Projects
>
virtualization
:
xen
:
redhat
:
3.3.0
>
xen
> xen-3.3.0-initscripts.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File xen-3.3.0-initscripts.patch of Package xen
diff -ruN xen-3.3.0.orig/tools/examples/init.d/xend xen-3.3.0/tools/examples/init.d/xend --- xen-3.3.0.orig/tools/examples/init.d/xend 2008-08-22 11:49:07.000000000 +0200 +++ xen-3.3.0/tools/examples/init.d/xend 2008-08-28 17:53:58.000000000 +0200 @@ -6,53 +6,80 @@ # # chkconfig: 2345 98 01 # description: Starts and stops the Xen control daemon. -### BEGIN INIT INFO -# Provides: xend -# Required-Start: $syslog $remote_fs -# Should-Start: -# Required-Stop: $syslog $remote_fs -# Should-Stop: -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Default-Enabled: yes -# Short-Description: Start/stop xend -# Description: Starts and stops the Xen control daemon. -### END INIT INFO +# Source function library. +. /etc/rc.d/init.d/functions + +RETVAL=0 +if [ ! -d /proc/xen ]; then + exit 0 +fi if ! grep -q "control_d" /proc/xen/capabilities ; then exit 0 fi +prog=xend + +XENCONSOLED_LOG_HYPERVISOR=no +XENCONSOLED_LOG_GUESTS=no +XENCONSOLED_TIMESTAMP_HYPERVISOR_LOG=no +XENCONSOLED_TIMESTAMP_GUEST_LOG=no +XENCONSOLED_LOG_DIR=/var/log/xen/console + +test -f /etc/sysconfig/xend && . /etc/sysconfig/xend # Wait for Xend to be up function await_daemons_up { i=1 rets=10 - xend status + /usr/sbin/xend status while [ $? -ne 0 -a $i -lt $rets ]; do sleep 1 echo -n . i=$(($i + 1)) - xend status + /usr/sbin/xend status done + if [ $i -ge $rets ]; then + RETVAL=-1 + return 1 + fi + return 0 } case "$1" in start) - xend start + echo -n $"Starting $prog: " + modprobe blkbk + modprobe blktap + modprobe netbk + modprobe netloop + + export XENCONSOLED_LOG_DIR + export XENCONSOLED_LOG_GUESTS + export XENCONSOLED_LOG_HYPERVISOR + export XENCONSOLED_TIMESTAMP_HYPERVISOR_LOG + export XENCONSOLED_TIMESTAMP_GUEST_LOG + + /usr/sbin/xend start await_daemons_up ;; stop) - xend stop + echo -n $"Stopping $prog: " + /usr/sbin/xend stop + RETVAL=$? ;; status) - xend status + /usr/sbin/xend status + if [ $? = 0 ] ; then + echo xend is running + else + echo xend is stopped + fi + exit 0 ;; - reload) - xend reload - ;; - restart|force-reload) - xend restart + restart|reload|force-reload) + echo -n $"$1 $prog: " + /usr/sbin/xend restart await_daemons_up ;; *) @@ -62,5 +89,12 @@ exit 1 esac -exit $? +if [ $RETVAL = 0 ] ; then + echo_success + echo +else + echo_failure + echo +fi +exit $RETVAL diff -ruN xen-3.3.0.orig/tools/examples/init.d/xendomains xen-3.3.0/tools/examples/init.d/xendomains --- xen-3.3.0.orig/tools/examples/init.d/xendomains 2008-08-22 11:49:07.000000000 +0200 +++ xen-3.3.0/tools/examples/init.d/xendomains 2008-08-28 17:53:58.000000000 +0200 @@ -58,7 +58,18 @@ _SMSG=(done failed failed missed failed skipped unused failed failed) _RC_UNUSED=6 fi - if test -e /etc/init.d/functions; then + if test -e /lib/lsb/init-functions; then + # LSB + . /lib/lsb/init-functions + echo_rc() + { + if test ${_RC_RV} = 0; then + log_success_msg " [${_SMSG[${_RC_RV}]}] " + else + log_failure_msg " [${_SMSG[${_RC_RV}]}] " + fi + } + elif test -e /etc/init.d/functions; then # REDHAT . /etc/init.d/functions echo_rc() @@ -70,24 +81,6 @@ failure " [${_SMSG[${_RC_RV}]}] " fi } - elif test -e /lib/lsb/init-functions; then - # LSB - . /lib/lsb/init-functions - if alias log_success_msg >/dev/null 2>/dev/null; then - echo_rc() - { - echo " [${_SMSG[${_RC_RV}]}] " - } - else - echo_rc() - { - if test ${_RC_RV} = 0; then - log_success_msg " [${_SMSG[${_RC_RV}]}] " - else - log_failure_msg " [${_SMSG[${_RC_RV}]}] " - fi - } - fi else # emulate it echo_rc() @@ -182,31 +175,25 @@ parseln() { - if [[ "$1" =~ "\(domain" ]]; then - name=;id= - else if [[ "$1" =~ "\(name" ]]; then - name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/') - else if [[ "$1" =~ "\(domid" ]]; then - id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/') - fi; fi; fi - - [ -n "$name" -a -n "$id" ] && return 0 || return 1 + name=`echo "$1" | cut -c0-17` + name=${name%% *} + rest=`echo "$1" | cut -c18- ` + read id mem cpu vcpu state tm < <(echo "$rest") } is_running() { rdname $1 RC=1 - name=;id= while read LN; do - parseln "$LN" || continue + parseln "$LN" if test $id = 0; then continue; fi case $name in ($NM) RC=0 ;; esac - done < <(xm list -l | grep '(\(domain\|domid\|name\)') + done < <(xm list | grep -v '^Name') return $RC } @@ -221,26 +208,21 @@ if [ "$XENDOMAINS_RESTORE" = "true" ] && contains_something "$XENDOMAINS_SAVE" then - mkdir -p $(dirname "$LOCKFILE") + mkdir -p $(dirname "$LOCKFILE") touch $LOCKFILE echo -n "Restoring Xen domains:" saved_domains=`ls $XENDOMAINS_SAVE` - for dom in $XENDOMAINS_SAVE/*; do - if [ -f $dom ] ; then - HEADER=`head -c 16 $dom | head -n 1 2> /dev/null` - if [ $HEADER = "LinuxGuestRecord" ]; then - echo -n " ${dom##*/}" - xm restore $dom - if [ $? -ne 0 ]; then - rc_failed $? - echo -n '!' - else - # mv $dom ${dom%/*}/.${dom##*/} - rm $dom - fi - fi - fi - done + for dom in $XENDOMAINS_SAVE/*; do + echo -n " ${dom##*/}" + xm restore $dom + if [ $? -ne 0 ]; then + rc_failed $? + echo -n '!' + else + # mv $dom ${dom%/*}/.${dom##*/} + rm $dom + fi + done echo . fi @@ -278,14 +260,13 @@ all_zombies() { - name=;id= while read LN; do - parseln "$LN" || continue + parseln "$LN" if test $id = 0; then continue; fi if test "$state" != "-b---d" -a "$state" != "-----d"; then return 1; fi - done < <(xm list -l | grep '(\(domain\|domid\|name\)') + done < <(xm list | grep -v '^Name') return 0 } @@ -321,9 +302,8 @@ rdnames fi echo -n "Shutting down Xen domains:" - name=;id= while read LN; do - parseln "$LN" || continue + parseln "$LN" if test $id = 0; then continue; fi echo -n " $name" if test "$XENDOMAINS_AUTO_ONLY" = "true"; then @@ -397,7 +377,7 @@ fi kill $WDOG_PID >/dev/null 2>&1 fi - done < <(xm list -l | grep '(\(domain\|domid\|name\)') + done < <(xm list | grep -v '^Name') # NB. this shuts down ALL Xen domains (politely), not just the ones in # AUTODIR/* @@ -422,16 +402,15 @@ check_domain_up() { - name=;id= while read LN; do - parseln "$LN" || continue + parseln "$LN" if test $id = 0; then continue; fi case $name in ($1) return 0 ;; esac - done < <(xm list -l | grep '(\(domain\|domid\|name\)') + done < <(xm list | grep -v "^Name") return 1 }