[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Re: [Xen-staging] [xen-unstable] xendomains: Better sanity checking of potetntial save records.



Just a couple of comments below.

Xen staging patchbot-unstable wrote:  [Tue Jul 03 2007, 05:14:20AM EDT]
> # HG changeset patch
> # User kfraser@xxxxxxxxxxxxxxxxxxxxx
> # Date 1183453942 -3600
> # Node ID 356bd2f3b9d805df5c59d1758832369183d2ddda
> # Parent  a836f4bc86fdfa84a169b0135486a8a6b0c1d516
> xendomains: Better sanity checking of potetntial save records.
> Signed-off-by: Gawain Lynch <gawain.lynch@xxxxxxxxx>
> ---
>  tools/examples/init.d/xendomains |   29 ++++++++++++++++-------------
>  1 files changed, 16 insertions(+), 13 deletions(-)
> 
> diff -r a836f4bc86fd -r 356bd2f3b9d8 tools/examples/init.d/xendomains
> --- a/tools/examples/init.d/xendomains        Tue Jul 03 10:08:34 2007 +0100
> +++ b/tools/examples/init.d/xendomains        Tue Jul 03 10:12:22 2007 +0100
> @@ -221,22 +221,26 @@ start()
>      if [ "$XENDOMAINS_RESTORE" = "true" ] &&
>         contains_something "$XENDOMAINS_SAVE"
>      then
> -     XENDOMAINS_SAVED=`/bin/ls $XENDOMAINS_SAVE/* | grep -v 'lost+found'`
>       mkdir -p $(dirname "$LOCKFILE")
>       touch $LOCKFILE
>       echo -n "Restoring Xen domains:"
>       saved_domains=`ls $XENDOMAINS_SAVE`
> -     for dom in $XENDOMAINS_SAVED; do
> -         echo -n " ${dom##*/}"
> -         xm restore $dom
> -         if [ $? -ne 0 ]; then
> -             rc_failed $?
> -             echo -n '!'
> -         else
> -             # mv $dom ${dom%/*}/.${dom##*/}
> -             rm $dom
> -         fi
> -     done
> +        for dom in $XENDOMAINS_SAVE/*; do
> +            if [ -f $dom ] ; then
> +                HEADER=`head -c 16 $dom | head -n 1 2> /dev/null`

You're never going to get error output from the second head operating
on stdin.  This should be:
                   HEADER=`head -c 16 $dom 2>/dev/null | head -n 1`
                    
> +                if [ $HEADER = "LinuxGuestRecord" ]; then

$HEADER should be quoted.  There's no guarantee it won't be something
bogus that contains spaces.
                   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
>       echo .
>      fi
>  
> @@ -260,7 +264,6 @@ start()
>           if [ $? -eq 0 ] || is_running $dom; then
>               echo -n "(skip)"
>           else
> -             echo "(booting)"
>               xm create --quiet --defconfig $dom
>               if [ $? -ne 0 ]; then
>                   rc_failed $?
> 
> _______________________________________________
> Xen-staging mailing list
> Xen-staging@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-staging
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.