direct-io.hg

changeset 15448:356bd2f3b9d8

xendomains: Better sanity checking of potetntial save records.
Signed-off-by: Gawain Lynch <gawain.lynch@gmail.com>
author kfraser@localhost.localdomain
date Tue Jul 03 10:12:22 2007 +0100 (2007-07-03)
parents a836f4bc86fd
children 1e04c4be12aa 296ffa18524a
files tools/examples/init.d/xendomains
line diff
     1.1 --- a/tools/examples/init.d/xendomains	Tue Jul 03 10:08:34 2007 +0100
     1.2 +++ b/tools/examples/init.d/xendomains	Tue Jul 03 10:12:22 2007 +0100
     1.3 @@ -221,22 +221,26 @@ start()
     1.4      if [ "$XENDOMAINS_RESTORE" = "true" ] &&
     1.5         contains_something "$XENDOMAINS_SAVE"
     1.6      then
     1.7 -	XENDOMAINS_SAVED=`/bin/ls $XENDOMAINS_SAVE/* | grep -v 'lost+found'`
     1.8  	mkdir -p $(dirname "$LOCKFILE")
     1.9  	touch $LOCKFILE
    1.10  	echo -n "Restoring Xen domains:"
    1.11  	saved_domains=`ls $XENDOMAINS_SAVE`
    1.12 -	for dom in $XENDOMAINS_SAVED; do
    1.13 -	    echo -n " ${dom##*/}"
    1.14 -	    xm restore $dom
    1.15 -	    if [ $? -ne 0 ]; then
    1.16 -		rc_failed $?
    1.17 -		echo -n '!'
    1.18 -	    else
    1.19 -		# mv $dom ${dom%/*}/.${dom##*/}
    1.20 -		rm $dom
    1.21 -	    fi
    1.22 -	done
    1.23 +        for dom in $XENDOMAINS_SAVE/*; do
    1.24 +            if [ -f $dom ] ; then
    1.25 +                HEADER=`head -c 16 $dom | head -n 1 2> /dev/null`
    1.26 +                if [ $HEADER = "LinuxGuestRecord" ]; then
    1.27 +                    echo -n " ${dom##*/}"
    1.28 +                    xm restore $dom
    1.29 +                    if [ $? -ne 0 ]; then
    1.30 +                        rc_failed $?
    1.31 +                        echo -n '!'
    1.32 +                    else
    1.33 +                        # mv $dom ${dom%/*}/.${dom##*/}
    1.34 +                        rm $dom
    1.35 +                    fi
    1.36 +                fi
    1.37 +            fi
    1.38 +        done
    1.39  	echo .
    1.40      fi
    1.41  
    1.42 @@ -260,7 +264,6 @@ start()
    1.43  	    if [ $? -eq 0 ] || is_running $dom; then
    1.44  		echo -n "(skip)"
    1.45  	    else
    1.46 -		echo "(booting)"
    1.47  		xm create --quiet --defconfig $dom
    1.48  		if [ $? -ne 0 ]; then
    1.49  		    rc_failed $?