From: Ewan Mellor Date: Thu, 7 Dec 2006 12:23:35 +0000 (+0000) Subject: This patch checks the contents of XENDOMAINS_SAVE before the restore X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15493^2~25^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a1aafcf306ab3daecc10e56fd1e857417403960c;p=xen.git 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 --- diff --git a/tools/examples/init.d/xendomains b/tools/examples/init.d/xendomains index b3722882d6..7aca157bc9 100644 --- a/tools/examples/init.d/xendomains +++ b/tools/examples/init.d/xendomains @@ -204,12 +204,14 @@ start() 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 echo -n " ${dom##*/}" xm restore $dom @@ -234,9 +236,14 @@ start() # 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##*/}" - if is_running $dom; then + 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 xm create --quiet --defconfig $dom