ia64/xen-unstable

changeset 12849:a330509abb20

This patch checks the contents of XENDOMAINS_SAVE before the restore
process begins, and prevents xendomains from attempting to start any
domain that appears there, whether the domain started successfully or
not.

Signed off by: Hugh Brock <hbrock@redhat.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Dec 07 12:23:35 2006 +0000 (2006-12-07)
parents e98c84468b72
children e843c1fde3c2
files tools/examples/init.d/xendomains
line diff
     1.1 --- a/tools/examples/init.d/xendomains	Thu Dec 07 12:15:30 2006 +0000
     1.2 +++ b/tools/examples/init.d/xendomains	Thu Dec 07 12:23:35 2006 +0000
     1.3 @@ -204,12 +204,14 @@ start()
     1.4  	return; 
     1.5      fi
     1.6  
     1.7 +    saved_domains=" "
     1.8      if [ "$XENDOMAINS_RESTORE" = "true" ] &&
     1.9         contains_something "$XENDOMAINS_SAVE"
    1.10      then
    1.11          mkdir -p $(dirname "$LOCKFILE")
    1.12  	touch $LOCKFILE
    1.13  	echo -n "Restoring Xen domains:"
    1.14 +	saved_domains=`ls $XENDOMAINS_SAVE`
    1.15  	for dom in $XENDOMAINS_SAVE/*; do
    1.16  	    echo -n " ${dom##*/}"
    1.17  	    xm restore $dom
    1.18 @@ -234,9 +236,14 @@ start()
    1.19  	# Create all domains with config files in XENDOMAINS_AUTO.
    1.20  	# TODO: We should record which domain name belongs 
    1.21  	# so we have the option to selectively shut down / migrate later
    1.22 +	# If a domain statefile from $XENDOMAINS_SAVE matches a domain name
    1.23 +	# in $XENDOMAINS_AUTO, do not try to start that domain; if it didn't 
    1.24 +	# restore correctly it requires administrative attention.
    1.25  	for dom in $XENDOMAINS_AUTO/*; do
    1.26  	    echo -n " ${dom##*/}"
    1.27 -	    if is_running $dom; then
    1.28 +	    shortdom=$(echo $dom | sed -n 's/^.*\/\(.*\)$/\1/p')
    1.29 +	    echo $saved_domains | grep -w $shortdom > /dev/null
    1.30 +	    if [ $? -eq 0 ] || is_running $dom; then
    1.31  		echo -n "(skip)"
    1.32  	    else
    1.33  		xm create --quiet --defconfig $dom