[Pkg-xen-devel] Bug#772274: xen-utils-common: when upgrading package: insserv: Service xenstored has to be enabled to start service xendomains

chris21.roux at free.fr chris21.roux at free.fr
Sat Dec 6 13:25:42 UTC 2014


Package: xen-utils-common
Version: 4.4.1-5
Severity: important

Dear Maintainer,

I tried to upgrade xen-utils-4.4 depending on xen-utils-common.
Here is aptitude answer:
...
Paramétrage de xen-utils-common (4.4.1-5) ...
insserv: Service xenstored has to be enabled to start service xendomains
insserv: Service xenconsoled has to be enabled to start service xendomains
insserv: exiting now!
update-rc.d: error: insserv rejected the script header
dpkg: erreur de traitement du paquet xen-utils-common (--configure) :
 le sous-processus script post-installation installé a retourné une erreur de
sortie d'état 1
...

then xen-utils-4.4 and xen-utils-common are not configured



-- System Information:
Debian Release: 8.0
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.18.0-rc7 (SMP w/24 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages xen-utils-common depends on:
ii  lsb-base        4.1+Debian13+nmu1
ii  python          2.7.8-2
ii  ucf             3.0030
ii  udev            215-7
ii  xenstore-utils  4.4.1-5

xen-utils-common recommends no packages.

xen-utils-common suggests no packages.

-- Configuration Files:
/etc/default/xendomains changed:
XENDOMAINS_SYSRQ=""
XENDOMAINS_USLEEP=100000
XENDOMAINS_CREATE_USLEEP=5000000
XENDOMAINS_MIGRATE=""
XENDOMAINS_SAVE=""
XENDOMAINS_SHUTDOWN="--wait"
XENDOMAINS_SHUTDOWN_ALL="--all --wait"
XENDOMAINS_RESTORE=false
XENDOMAINS_AUTO=/etc/xen/auto
XENDOMAINS_AUTO_ONLY=true
XENDOMAINS_STOP_MAXWAIT=300

/etc/init.d/xendomains changed:
. /etc/xen/scripts/hotplugpath.sh
CMD=${SBINDIR}/xm
HEADCOMP="LinuxGuestRecord"
$CMD list &> /dev/null
if test $? -ne 0
then
	CMD=${SBINDIR}/xl
	HEADCOMP="Xen saved domain"
fi
$CMD list &> /dev/null
if test $? -ne 0
then
	exit 0;
fi
if ! [ -e /proc/xen/privcmd ]; then
	exit 0
fi
if [ -d /var/lock/subsys ]; then
	LOCKFILE=/var/lock/subsys/xendomains
else
	LOCKFILE=/var/lock/xendomains
fi
if [ -d /etc/sysconfig ]; then
	XENDOM_CONFIG=/etc/sysconfig/xendomains
else
	XENDOM_CONFIG=/etc/default/xendomains
fi
test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing";
	if [ "$1" = "stop" ]; then exit 0;
	else exit 6; fi; }
. $XENDOM_CONFIG
if test -e /etc/rc.status; then
    # SUSE rc script library
    . /etc/rc.status
else    
    _cmd=$1
    declare -a _SMSG
    if test "${_cmd}" = "status"; then
	_SMSG=(running dead dead unused unknown)
	_RC_UNUSED=3
    else
	_SMSG=(done failed failed missed failed skipped unused failed failed)
	_RC_UNUSED=6
    fi
    if test -e /etc/init.d/functions; then
	# REDHAT
	. /etc/init.d/functions
	echo_rc()
	{
	    #echo -n "  [${_SMSG[${_RC_RV}]}] "
	    if test ${_RC_RV} = 0; then
		success "  [${_SMSG[${_RC_RV}]}] "
	    else
		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()
	{
	    echo "  [${_SMSG[${_RC_RV}]}] "
	}
    fi
    rc_reset() { _RC_RV=0; }
    rc_failed()
    {
	if test -z "$1"; then 
	    _RC_RV=1;
	elif test "$1" != "0"; then 
	    _RC_RV=$1; 
    	fi
	return ${_RC_RV}
    }
    rc_check()
    {
	return rc_failed $?
    }	
    rc_status()
    {
	rc_failed $?
	if test "$1" = "-r"; then _RC_RV=0; shift; fi
	if test "$1" = "-s"; then rc_failed 5; echo_rc; rc_failed 3; shift; fi
	if test "$1" = "-u"; then rc_failed ${_RC_UNUSED}; echo_rc; rc_failed 3; shift; fi
	if test "$1" = "-v"; then echo_rc; shift; fi
	if test "$1" = "-r"; then _RC_RV=0; shift; fi
	return ${_RC_RV}
    }
    rc_exit() { exit ${_RC_RV}; }
    rc_active() 
    {
	if test -z "$RUNLEVEL"; then read RUNLEVEL REST < <(/sbin/runlevel); fi
	if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi
	return 1
    }
fi
if ! which usleep >&/dev/null
then
  usleep()
  {
    if [ -n "$1" ]
    then
      sleep $(( $1 / 1000000 ))
    fi
  }
fi
rc_reset
contains_something()
{
  if [ -d "$1" ] && [ `/bin/ls $1 | wc -l` -gt 0 ]
  then
    return 0
  else
    return 1
  fi
}
rdname()
{
    NM=$($CMD create --quiet --dryrun --defconfig "$1" |
         sed -n 's/^.*(name \(.*\))$/\1/p;s/^.*"name": "\(.*\)",$/\1/p')
}
rdnames()
{
    NAMES=
    if ! contains_something "$XENDOMAINS_AUTO"
    then 
	return
    fi
    for dom in $XENDOMAINS_AUTO/*; do
	rdname $dom
	if test -z $NAMES; then 
	    NAMES=$NM; 
	else
	    NAMES="$NAMES|$NM"
	fi
    done
}
LIST_GREP='(domain\|(domid\|(name\|^    {$\|"name":\|"domid":'
parseln()
{
    if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
        name=;id=
    elif [[ "$1" =~ '(name' ]]; then
        name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/')
    elif [[ "$1" =~ '(domid' ]]; then
        id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/')
    elif [[ "$1" =~ '"name":' ]]; then
        name=$(echo $1 | sed -e 's/^.*"name": "\(.*\)",$/\1/')
    elif [[ "$1" =~ '"domid":' ]]; then
        id=$(echo $1 | sed -e 's/^.*"domid": \(.*\),$/\1/')
    fi
    [ -n "$name" -a -n "$id" ] && return 0 || return 1
}
is_running()
{
    rdname $1
    RC=1
    name=;id=
    while read LN; do
	parseln "$LN" || continue
	if test $id = 0; then continue; fi
	case $name in 
	    ($NM)
		RC=0
		;;
	esac
    done < <($CMD list -l | grep "$LIST_GREP")
    return $RC
}
start() 
{
    if [ -f $LOCKFILE ]; then 
	echo -e "xendomains already running (lockfile exists)"
	return; 
    fi
    saved_domains=" "
    if [ "$XENDOMAINS_RESTORE" = "true" ] &&
       contains_something "$XENDOMAINS_SAVE"
    then
	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" = "$HEADCOMP" ]; then
                    echo -n " ${dom##*/}"
                    XMR=`$CMD restore $dom 2>&1 1>/dev/null`
                    #$CMD restore $dom
                    if [ $? -ne 0 ]; then
                        echo -e "\nAn error occurred while restoring domain ${dom##*/}:\n$XMR"
                        rc_failed $?
                        echo -e '!'
                    else
                        # mv $dom ${dom%/*}/.${dom##*/}
                        rm $dom
                    fi
                fi
            fi
        done
	echo -e
    fi
    if contains_something "$XENDOMAINS_AUTO"
    then
	touch $LOCKFILE
	echo -n "Starting auto Xen domains:"
	# We expect config scripts for auto starting domains to be in
	# XENDOMAINS_AUTO - they could just be symlinks to files elsewhere
	# Create all domains with config files in XENDOMAINS_AUTO.
	# TODO: We should record which domain name belongs 
	# so we have the option to selectively shut down / migrate later
	# If a domain statefile from $XENDOMAINS_SAVE matches a domain name
	# in $XENDOMAINS_AUTO, do not try to start that domain; if it didn't 
	# restore correctly it requires administrative attention.
	for dom in $XENDOMAINS_AUTO/*; do
	    echo -n " ${dom##*/}"
	    shortdom=$(echo $dom | sed -n 's/^.*\/\(.*\)$/\1/p')
	    echo $saved_domains | grep -w $shortdom > /dev/null
	    if [ $? -eq 0 ] || is_running $dom; then
		echo -n "(skip)"
	    else
		XMC=`$CMD create --quiet --defconfig $dom`
		if [ $? -ne 0 ]; then
		    echo -e "\nAn error occurred while creating domain ${dom##*/}: $XMC\n"
		    rc_failed $?
		    echo -e '!'
		else
		    usleep $XENDOMAINS_CREATE_USLEEP
		fi
	    fi
	done
    fi
}
all_zombies()
{
    name=;id=
    while read LN; do
	parseln "$LN" || continue
	if test $id = 0; then continue; fi
	if test "$state" != "-b---d" -a "$state" != "-----d"; then
	    return 1;
	fi
    done < <($CMD list -l | grep "$LIST_GREP")
    return 0
}
watchdog_xencmd()
{
    if test -z "$XENDOMAINS_STOP_MAXWAIT" -o "$XENDOMAINS_STOP_MAXWAIT" = "0"; then
	exit
    fi
    usleep 20000
    for no in `seq 0 $XENDOMAINS_STOP_MAXWAIT`; do
	# exit if $CMD save/migrate/shutdown is finished
	PSAX=`ps axlw | grep "$CMD $1" | grep -v grep`
	if test -z "$PSAX"; then exit; fi
	if ! test -n "$3"; then echo -n '.'; fi
	sleep 1
	# go to kill immediately if there's only zombies left
	if all_zombies && test -n "$2"; then break; fi
    done
    sleep 1
    read PSF PSUID PSPID PSPPID < <(echo "$PSAX")
    # kill $CMD $1
    kill $PSPID >/dev/null 2>&1
    
    echo -e .
}
stop()
{
    exec 3>&2 2> /dev/null
    
    # Collect list of domains to shut down
    if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
	rdnames
    fi
    echo -n "Shutting down Xen domains:"
    name=;id=
    while read LN; do
	parseln "$LN" || continue
	if test $id = 0; then continue; fi
	echo -n " $name"
	if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
	    eval "
	    case \"\$name\" in
		($NAMES)
		    # nothing
		    ;;
		(*)
		    echo -e '(skip)'
		    continue
		    ;;
	    esac
	    "
	fi
	# XENDOMAINS_SYSRQ chould be something like just "s" 
	# or "s e i u" or even "s e s i u o"
	# for the latter, you should set XENDOMAINS_USLEEP to 1200000 or so
	if test -n "$XENDOMAINS_SYSRQ"; then
	    for sysrq in $XENDOMAINS_SYSRQ; do
		echo -n "(SR-$sysrq)"
		XMR=`$CMD sysrq $id $sysrq 2>&1 1>/dev/null`
		if test $? -ne 0; then
		    echo -e "\nAn error occurred while doing sysrq on domain:\n$XMR\n"
		    rc_failed $?
		    echo -n '!'
		fi
		# usleep just ignores empty arg
		usleep $XENDOMAINS_USLEEP
	    done
	fi
	if test "$state" = "-b---d" -o "$state" = "-----d"; then
	    echo -n "(zomb)"
	    continue
	fi
	if test -n "$XENDOMAINS_MIGRATE"; then
	    echo -n "(migr)"
	    watchdog_xencmd migrate &
	    WDOG_PID=$!
	    XMR=`$CMD migrate $id $XENDOMAINS_MIGRATE 2>&1 1>/dev/null`
	    if test $? -ne 0; then
		echo -e "\nAn error occurred while migrating domain:\n$XMR\n"
		rc_failed $?
		echo -e '!'
		kill $WDOG_PID >/dev/null 2>&1
	    else
		kill $WDOG_PID >/dev/null 2>&1
		
		echo -e .
		usleep 1000
		continue
	    fi
	fi
	if test -n "$XENDOMAINS_SAVE"; then
	    echo -n "(save)"
	    watchdog_xencmd save &
	    WDOG_PID=$!
	    mkdir -p "$XENDOMAINS_SAVE"
	    XMR=`$CMD save $id $XENDOMAINS_SAVE/$name 2>&1 1>/dev/null`
	    if test $? -ne 0; then
		echo -e "\nAn error occurred while saving domain:\n$XMR\n"
		rc_failed $?
		echo -e '!'
		kill $WDOG_PID >/dev/null 2>&1
	    else
		kill $WDOG_PID >/dev/null 2>&1
		echo -e .
		usleep 1000
		continue
	    fi
	fi
	if test -n "$XENDOMAINS_SHUTDOWN"; then
	    # XENDOMAINS_SHUTDOWN should be "--wait"
	    echo -n "(shut)"
	    watchdog_xencmd shutdown &
	    WDOG_PID=$!
	    XMR=`$CMD shutdown $XENDOMAINS_SHUTDOWN $id 2>&1 1>/dev/null`
	    if test $? -ne 0; then
		echo -e "\nAn error occurred while shutting down domain:\n$XMR\n"
		rc_failed $?
		echo -e '!'
	    fi
	    kill $WDOG_PID >/dev/null 2>&1
	fi
    done < <($CMD list -l | grep "$LIST_GREP")
    # NB. this shuts down ALL Xen domains (politely), not just the ones in
    # AUTODIR/*
    # This is because it's easier to do ;-) but arguably if this script is run
    # on system shutdown then it's also the right thing to do.
    if ! all_zombies && test -n "$XENDOMAINS_SHUTDOWN_ALL"; then
	# XENDOMAINS_SHUTDOWN_ALL should be "--all --wait"
	echo -n " SHUTDOWN_ALL "
	watchdog_xencmd shutdown 1 false &
	WDOG_PID=$!
	XMR=`$CMD shutdown $XENDOMAINS_SHUTDOWN_ALL 2>&1 1>/dev/null`
	if test $? -ne 0; then
	    echo -e "\nAn error occurred while shutting down all domains: $XMR\n"
	    rc_failed $?
	    echo -e '!'
	fi
	kill $WDOG_PID >/dev/null 2>&1
    fi
    # Unconditionally delete lock file
    rm -f $LOCKFILE
    
    exec 2>&3
}
check_domain_up()
{
    name=;id=
    while read LN; do
	parseln "$LN" || continue
	if test $id = 0; then continue; fi
	case $name in 
	    ($1)
		return 0
		;;
	esac
    done < <($CMD list -l | grep "$LIST_GREP")
    return 1
}
check_all_auto_domains_up()
{
    if ! contains_something "$XENDOMAINS_AUTO"
    then
      return 0
    fi
    missing=
    for nm in $XENDOMAINS_AUTO/*; do
	rdname $nm
	found=0
	if check_domain_up "$NM"; then 
	    echo -n " $name"
	else 
	    missing="$missing $NM"
	fi
    done
    if test -n "$missing"; then
	echo -n " MISS AUTO:$missing"
	return 1
    fi
    return 0
}
check_all_saved_domains_up()
{
    if ! contains_something "$XENDOMAINS_SAVE" 
    then
      return 0
    fi
    missing=`/bin/ls $XENDOMAINS_SAVE`
    echo -n " MISS SAVED: " $missing
    return 1
}
restart()
{
    stop
    start
}
reload()
{
    restart
}
case "$1" in
    start)
	start
	rc_status
	if test -f $LOCKFILE; then rc_status -v; fi
	;;
    stop)
	stop
	rc_status -v
	;;
    restart)
	restart
	;;
    reload)
	reload
	;;
    status)
	echo -n "Checking for xendomains:" 
	if test ! -f $LOCKFILE; then 
	    rc_failed 3
	else
	    check_all_auto_domains_up
	    rc_status
	    check_all_saved_domains_up
	    rc_status
	fi
	rc_status -v
	;;
    *)
	echo "Usage: $0 {start|stop|restart|reload|status}"
	rc_failed 3
	rc_status -v
	;;
esac
rc_exit

/etc/xen/scripts/blktap dfe099d899c3c348193d7dd97ae39828 [Errno 2] Aucun fichier ou dossier de ce type: u'/etc/xen/scripts/blktap dfe099d899c3c348193d7dd97ae39828'
/etc/xen/scripts/hotplugpath.sh changed:
SBINDIR="/usr/local/sbin"
BINDIR="/usr/local/bin"
LIBEXEC="/usr/local/lib/xen-/bin"
LIBDIR="/usr/local/lib/x86_64-linux-gnu"
SHAREDIR="/usr/local/share"
PRIVATE_BINDIR="/usr/local/lib/xen-/bin"
XENFIRMWAREDIR="/usr/local/lib/xen-/boot"
XEN_CONFIG_DIR="/etc/xen"
XEN_SCRIPT_DIR="/etc/xen/scripts"
XEN_LOCK_DIR="/var/lock"
XEN_RUN_DIR="/var/run/xen"
XEN_PAGING_DIR="/var/lib/xen/xenpaging"

/etc/xen/scripts/qemu-ifup changed:
echo 'config qemu network with xen bridge for ' $*
bridge=$2
if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ]
then
   if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ]
   then
      bridge="eth${bridge#xenbr}"
   fi
fi
ifconfig $1 0.0.0.0 up
brctl addif $bridge $1 || true

/etc/xen/xend-config.sxp 3d85692b796dff7dc33ebcb7d62dbb93 [Errno 2] Aucun fichier ou dossier de ce type: u'/etc/xen/xend-config.sxp 3d85692b796dff7dc33ebcb7d62dbb93'
/etc/xen/xend-pci-permissive.sxp 729a07fd8785b4aee8d4518a767bc7e7 [Errno 2] Aucun fichier ou dossier de ce type: u'/etc/xen/xend-pci-permissive.sxp 729a07fd8785b4aee8d4518a767bc7e7'
/etc/xen/xend-pci-quirks.sxp 88c052ad9a8de50b10905d41ad81e735 [Errno 2] Aucun fichier ou dossier de ce type: u'/etc/xen/xend-pci-quirks.sxp 88c052ad9a8de50b10905d41ad81e735'

-- no debconf information



-- System Information:
Debian Release: 8.0
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.18.0-rc7 (SMP w/24 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages xen-utils-common depends on:
ii  lsb-base        4.1+Debian13+nmu1
ii  python          2.7.8-2
ii  ucf             3.0030
ii  udev            215-7
ii  xenstore-utils  4.4.1-5

xen-utils-common recommends no packages.

xen-utils-common suggests no packages.

-- Configuration Files:
/etc/default/xendomains changed:
XENDOMAINS_SYSRQ=""
XENDOMAINS_USLEEP=100000
XENDOMAINS_CREATE_USLEEP=5000000
XENDOMAINS_MIGRATE=""
XENDOMAINS_SAVE=""
XENDOMAINS_SHUTDOWN="--wait"
XENDOMAINS_SHUTDOWN_ALL="--all --wait"
XENDOMAINS_RESTORE=false
XENDOMAINS_AUTO=/etc/xen/auto
XENDOMAINS_AUTO_ONLY=true
XENDOMAINS_STOP_MAXWAIT=300

/etc/init.d/xendomains changed:
. /etc/xen/scripts/hotplugpath.sh
CMD=${SBINDIR}/xm
HEADCOMP="LinuxGuestRecord"
$CMD list &> /dev/null
if test $? -ne 0
then
	CMD=${SBINDIR}/xl
	HEADCOMP="Xen saved domain"
fi
$CMD list &> /dev/null
if test $? -ne 0
then
	exit 0;
fi
if ! [ -e /proc/xen/privcmd ]; then
	exit 0
fi
if [ -d /var/lock/subsys ]; then
	LOCKFILE=/var/lock/subsys/xendomains
else
	LOCKFILE=/var/lock/xendomains
fi
if [ -d /etc/sysconfig ]; then
	XENDOM_CONFIG=/etc/sysconfig/xendomains
else
	XENDOM_CONFIG=/etc/default/xendomains
fi
test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing";
	if [ "$1" = "stop" ]; then exit 0;
	else exit 6; fi; }
. $XENDOM_CONFIG
if test -e /etc/rc.status; then
    # SUSE rc script library
    . /etc/rc.status
else    
    _cmd=$1
    declare -a _SMSG
    if test "${_cmd}" = "status"; then
	_SMSG=(running dead dead unused unknown)
	_RC_UNUSED=3
    else
	_SMSG=(done failed failed missed failed skipped unused failed failed)
	_RC_UNUSED=6
    fi
    if test -e /etc/init.d/functions; then
	# REDHAT
	. /etc/init.d/functions
	echo_rc()
	{
	    #echo -n "  [${_SMSG[${_RC_RV}]}] "
	    if test ${_RC_RV} = 0; then
		success "  [${_SMSG[${_RC_RV}]}] "
	    else
		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()
	{
	    echo "  [${_SMSG[${_RC_RV}]}] "
	}
    fi
    rc_reset() { _RC_RV=0; }
    rc_failed()
    {
	if test -z "$1"; then 
	    _RC_RV=1;
	elif test "$1" != "0"; then 
	    _RC_RV=$1; 
    	fi
	return ${_RC_RV}
    }
    rc_check()
    {
	return rc_failed $?
    }	
    rc_status()
    {
	rc_failed $?
	if test "$1" = "-r"; then _RC_RV=0; shift; fi
	if test "$1" = "-s"; then rc_failed 5; echo_rc; rc_failed 3; shift; fi
	if test "$1" = "-u"; then rc_failed ${_RC_UNUSED}; echo_rc; rc_failed 3; shift; fi
	if test "$1" = "-v"; then echo_rc; shift; fi
	if test "$1" = "-r"; then _RC_RV=0; shift; fi
	return ${_RC_RV}
    }
    rc_exit() { exit ${_RC_RV}; }
    rc_active() 
    {
	if test -z "$RUNLEVEL"; then read RUNLEVEL REST < <(/sbin/runlevel); fi
	if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi
	return 1
    }
fi
if ! which usleep >&/dev/null
then
  usleep()
  {
    if [ -n "$1" ]
    then
      sleep $(( $1 / 1000000 ))
    fi
  }
fi
rc_reset
contains_something()
{
  if [ -d "$1" ] && [ `/bin/ls $1 | wc -l` -gt 0 ]
  then
    return 0
  else
    return 1
  fi
}
rdname()
{
    NM=$($CMD create --quiet --dryrun --defconfig "$1" |
         sed -n 's/^.*(name \(.*\))$/\1/p;s/^.*"name": "\(.*\)",$/\1/p')
}
rdnames()
{
    NAMES=
    if ! contains_something "$XENDOMAINS_AUTO"
    then 
	return
    fi
    for dom in $XENDOMAINS_AUTO/*; do
	rdname $dom
	if test -z $NAMES; then 
	    NAMES=$NM; 
	else
	    NAMES="$NAMES|$NM"
	fi
    done
}
LIST_GREP='(domain\|(domid\|(name\|^    {$\|"name":\|"domid":'
parseln()
{
    if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
        name=;id=
    elif [[ "$1" =~ '(name' ]]; then
        name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/')
    elif [[ "$1" =~ '(domid' ]]; then
        id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/')
    elif [[ "$1" =~ '"name":' ]]; then
        name=$(echo $1 | sed -e 's/^.*"name": "\(.*\)",$/\1/')
    elif [[ "$1" =~ '"domid":' ]]; then
        id=$(echo $1 | sed -e 's/^.*"domid": \(.*\),$/\1/')
    fi
    [ -n "$name" -a -n "$id" ] && return 0 || return 1
}
is_running()
{
    rdname $1
    RC=1
    name=;id=
    while read LN; do
	parseln "$LN" || continue
	if test $id = 0; then continue; fi
	case $name in 
	    ($NM)
		RC=0
		;;
	esac
    done < <($CMD list -l | grep "$LIST_GREP")
    return $RC
}
start() 
{
    if [ -f $LOCKFILE ]; then 
	echo -e "xendomains already running (lockfile exists)"
	return; 
    fi
    saved_domains=" "
    if [ "$XENDOMAINS_RESTORE" = "true" ] &&
       contains_something "$XENDOMAINS_SAVE"
    then
	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" = "$HEADCOMP" ]; then
                    echo -n " ${dom##*/}"
                    XMR=`$CMD restore $dom 2>&1 1>/dev/null`
                    #$CMD restore $dom
                    if [ $? -ne 0 ]; then
                        echo -e "\nAn error occurred while restoring domain ${dom##*/}:\n$XMR"
                        rc_failed $?
                        echo -e '!'
                    else
                        # mv $dom ${dom%/*}/.${dom##*/}
                        rm $dom
                    fi
                fi
            fi
        done
	echo -e
    fi
    if contains_something "$XENDOMAINS_AUTO"
    then
	touch $LOCKFILE
	echo -n "Starting auto Xen domains:"
	# We expect config scripts for auto starting domains to be in
	# XENDOMAINS_AUTO - they could just be symlinks to files elsewhere
	# Create all domains with config files in XENDOMAINS_AUTO.
	# TODO: We should record which domain name belongs 
	# so we have the option to selectively shut down / migrate later
	# If a domain statefile from $XENDOMAINS_SAVE matches a domain name
	# in $XENDOMAINS_AUTO, do not try to start that domain; if it didn't 
	# restore correctly it requires administrative attention.
	for dom in $XENDOMAINS_AUTO/*; do
	    echo -n " ${dom##*/}"
	    shortdom=$(echo $dom | sed -n 's/^.*\/\(.*\)$/\1/p')
	    echo $saved_domains | grep -w $shortdom > /dev/null
	    if [ $? -eq 0 ] || is_running $dom; then
		echo -n "(skip)"
	    else
		XMC=`$CMD create --quiet --defconfig $dom`
		if [ $? -ne 0 ]; then
		    echo -e "\nAn error occurred while creating domain ${dom##*/}: $XMC\n"
		    rc_failed $?
		    echo -e '!'
		else
		    usleep $XENDOMAINS_CREATE_USLEEP
		fi
	    fi
	done
    fi
}
all_zombies()
{
    name=;id=
    while read LN; do
	parseln "$LN" || continue
	if test $id = 0; then continue; fi
	if test "$state" != "-b---d" -a "$state" != "-----d"; then
	    return 1;
	fi
    done < <($CMD list -l | grep "$LIST_GREP")
    return 0
}
watchdog_xencmd()
{
    if test -z "$XENDOMAINS_STOP_MAXWAIT" -o "$XENDOMAINS_STOP_MAXWAIT" = "0"; then
	exit
    fi
    usleep 20000
    for no in `seq 0 $XENDOMAINS_STOP_MAXWAIT`; do
	# exit if $CMD save/migrate/shutdown is finished
	PSAX=`ps axlw | grep "$CMD $1" | grep -v grep`
	if test -z "$PSAX"; then exit; fi
	if ! test -n "$3"; then echo -n '.'; fi
	sleep 1
	# go to kill immediately if there's only zombies left
	if all_zombies && test -n "$2"; then break; fi
    done
    sleep 1
    read PSF PSUID PSPID PSPPID < <(echo "$PSAX")
    # kill $CMD $1
    kill $PSPID >/dev/null 2>&1
    
    echo -e .
}
stop()
{
    exec 3>&2 2> /dev/null
    
    # Collect list of domains to shut down
    if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
	rdnames
    fi
    echo -n "Shutting down Xen domains:"
    name=;id=
    while read LN; do
	parseln "$LN" || continue
	if test $id = 0; then continue; fi
	echo -n " $name"
	if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
	    eval "
	    case \"\$name\" in
		($NAMES)
		    # nothing
		    ;;
		(*)
		    echo -e '(skip)'
		    continue
		    ;;
	    esac
	    "
	fi
	# XENDOMAINS_SYSRQ chould be something like just "s" 
	# or "s e i u" or even "s e s i u o"
	# for the latter, you should set XENDOMAINS_USLEEP to 1200000 or so
	if test -n "$XENDOMAINS_SYSRQ"; then
	    for sysrq in $XENDOMAINS_SYSRQ; do
		echo -n "(SR-$sysrq)"
		XMR=`$CMD sysrq $id $sysrq 2>&1 1>/dev/null`
		if test $? -ne 0; then
		    echo -e "\nAn error occurred while doing sysrq on domain:\n$XMR\n"
		    rc_failed $?
		    echo -n '!'
		fi
		# usleep just ignores empty arg
		usleep $XENDOMAINS_USLEEP
	    done
	fi
	if test "$state" = "-b---d" -o "$state" = "-----d"; then
	    echo -n "(zomb)"
	    continue
	fi
	if test -n "$XENDOMAINS_MIGRATE"; then
	    echo -n "(migr)"
	    watchdog_xencmd migrate &
	    WDOG_PID=$!
	    XMR=`$CMD migrate $id $XENDOMAINS_MIGRATE 2>&1 1>/dev/null`
	    if test $? -ne 0; then
		echo -e "\nAn error occurred while migrating domain:\n$XMR\n"
		rc_failed $?
		echo -e '!'
		kill $WDOG_PID >/dev/null 2>&1
	    else
		kill $WDOG_PID >/dev/null 2>&1
		
		echo -e .
		usleep 1000
		continue
	    fi
	fi
	if test -n "$XENDOMAINS_SAVE"; then
	    echo -n "(save)"
	    watchdog_xencmd save &
	    WDOG_PID=$!
	    mkdir -p "$XENDOMAINS_SAVE"
	    XMR=`$CMD save $id $XENDOMAINS_SAVE/$name 2>&1 1>/dev/null`
	    if test $? -ne 0; then
		echo -e "\nAn error occurred while saving domain:\n$XMR\n"
		rc_failed $?
		echo -e '!'
		kill $WDOG_PID >/dev/null 2>&1
	    else
		kill $WDOG_PID >/dev/null 2>&1
		echo -e .
		usleep 1000
		continue
	    fi
	fi
	if test -n "$XENDOMAINS_SHUTDOWN"; then
	    # XENDOMAINS_SHUTDOWN should be "--wait"
	    echo -n "(shut)"
	    watchdog_xencmd shutdown &
	    WDOG_PID=$!
	    XMR=`$CMD shutdown $XENDOMAINS_SHUTDOWN $id 2>&1 1>/dev/null`
	    if test $? -ne 0; then
		echo -e "\nAn error occurred while shutting down domain:\n$XMR\n"
		rc_failed $?
		echo -e '!'
	    fi
	    kill $WDOG_PID >/dev/null 2>&1
	fi
    done < <($CMD list -l | grep "$LIST_GREP")
    # NB. this shuts down ALL Xen domains (politely), not just the ones in
    # AUTODIR/*
    # This is because it's easier to do ;-) but arguably if this script is run
    # on system shutdown then it's also the right thing to do.
    if ! all_zombies && test -n "$XENDOMAINS_SHUTDOWN_ALL"; then
	# XENDOMAINS_SHUTDOWN_ALL should be "--all --wait"
	echo -n " SHUTDOWN_ALL "
	watchdog_xencmd shutdown 1 false &
	WDOG_PID=$!
	XMR=`$CMD shutdown $XENDOMAINS_SHUTDOWN_ALL 2>&1 1>/dev/null`
	if test $? -ne 0; then
	    echo -e "\nAn error occurred while shutting down all domains: $XMR\n"
	    rc_failed $?
	    echo -e '!'
	fi
	kill $WDOG_PID >/dev/null 2>&1
    fi
    # Unconditionally delete lock file
    rm -f $LOCKFILE
    
    exec 2>&3
}
check_domain_up()
{
    name=;id=
    while read LN; do
	parseln "$LN" || continue
	if test $id = 0; then continue; fi
	case $name in 
	    ($1)
		return 0
		;;
	esac
    done < <($CMD list -l | grep "$LIST_GREP")
    return 1
}
check_all_auto_domains_up()
{
    if ! contains_something "$XENDOMAINS_AUTO"
    then
      return 0
    fi
    missing=
    for nm in $XENDOMAINS_AUTO/*; do
	rdname $nm
	found=0
	if check_domain_up "$NM"; then 
	    echo -n " $name"
	else 
	    missing="$missing $NM"
	fi
    done
    if test -n "$missing"; then
	echo -n " MISS AUTO:$missing"
	return 1
    fi
    return 0
}
check_all_saved_domains_up()
{
    if ! contains_something "$XENDOMAINS_SAVE" 
    then
      return 0
    fi
    missing=`/bin/ls $XENDOMAINS_SAVE`
    echo -n " MISS SAVED: " $missing
    return 1
}
restart()
{
    stop
    start
}
reload()
{
    restart
}
case "$1" in
    start)
	start
	rc_status
	if test -f $LOCKFILE; then rc_status -v; fi
	;;
    stop)
	stop
	rc_status -v
	;;
    restart)
	restart
	;;
    reload)
	reload
	;;
    status)
	echo -n "Checking for xendomains:" 
	if test ! -f $LOCKFILE; then 
	    rc_failed 3
	else
	    check_all_auto_domains_up
	    rc_status
	    check_all_saved_domains_up
	    rc_status
	fi
	rc_status -v
	;;
    *)
	echo "Usage: $0 {start|stop|restart|reload|status}"
	rc_failed 3
	rc_status -v
	;;
esac
rc_exit

/etc/xen/scripts/blktap dfe099d899c3c348193d7dd97ae39828 [Errno 2] Aucun fichier ou dossier de ce type: u'/etc/xen/scripts/blktap dfe099d899c3c348193d7dd97ae39828'
/etc/xen/scripts/hotplugpath.sh changed:
SBINDIR="/usr/local/sbin"
BINDIR="/usr/local/bin"
LIBEXEC="/usr/local/lib/xen-/bin"
LIBDIR="/usr/local/lib/x86_64-linux-gnu"
SHAREDIR="/usr/local/share"
PRIVATE_BINDIR="/usr/local/lib/xen-/bin"
XENFIRMWAREDIR="/usr/local/lib/xen-/boot"
XEN_CONFIG_DIR="/etc/xen"
XEN_SCRIPT_DIR="/etc/xen/scripts"
XEN_LOCK_DIR="/var/lock"
XEN_RUN_DIR="/var/run/xen"
XEN_PAGING_DIR="/var/lib/xen/xenpaging"

/etc/xen/scripts/qemu-ifup changed:
echo 'config qemu network with xen bridge for ' $*
bridge=$2
if [ ! -e "/sys/class/net/$bridge" ] && [ -z "${bridge##xenbr*}" ]
then
   if [ -e "/sys/class/net/eth${bridge#xenbr}/bridge" ]
   then
      bridge="eth${bridge#xenbr}"
   fi
fi
ifconfig $1 0.0.0.0 up
brctl addif $bridge $1 || true

/etc/xen/xend-config.sxp 3d85692b796dff7dc33ebcb7d62dbb93 [Errno 2] Aucun fichier ou dossier de ce type: u'/etc/xen/xend-config.sxp 3d85692b796dff7dc33ebcb7d62dbb93'
/etc/xen/xend-pci-permissive.sxp 729a07fd8785b4aee8d4518a767bc7e7 [Errno 2] Aucun fichier ou dossier de ce type: u'/etc/xen/xend-pci-permissive.sxp 729a07fd8785b4aee8d4518a767bc7e7'
/etc/xen/xend-pci-quirks.sxp 88c052ad9a8de50b10905d41ad81e735 [Errno 2] Aucun fichier ou dossier de ce type: u'/etc/xen/xend-pci-quirks.sxp 88c052ad9a8de50b10905d41ad81e735'

-- no debconf information



More information about the Pkg-xen-devel mailing list