WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 2 of 2] xencommons: Wait for xenstored to start b

To: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 2 of 2] xencommons: Wait for xenstored to start before setting dom0 name
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Tue, 29 Jun 2010 16:37:38 +0200
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Vincent Hanquez <Vincent.Hanquez@xxxxxxxxxxxxx>
Delivery-date: Tue, 29 Jun 2010 07:38:43 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <dc49f02fc463ab48c82a.1277819806@gdunlap-desktop>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1277819804@gdunlap-desktop> <dc49f02fc463ab48c82a.1277819806@gdunlap-desktop>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc12 Lightning/1.0b2pre Thunderbird/3.0.4
On 06/29/2010 03:56 PM, George Dunlap wrote:
> On one of my boxes, the xenstore-write setting dom0's name starts
> before xenstored is actually ready to handle the connection properly,
> resulting in the name set failing.  Wait for xenstored to be up and
> responding to reads before continuing, timing out after 30 seconds.
>
> Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
>
> diff -r ad0f9cc72415 -r dc49f02fc463 tools/hotplug/Linux/init.d/xencommons
> --- a/tools/hotplug/Linux/init.d/xencommons   Tue Jun 29 14:56:28 2010 +0100
> +++ b/tools/hotplug/Linux/init.d/xencommons   Tue Jun 29 14:56:28 2010 +0100
> @@ -37,14 +37,32 @@
>  fi
>  
>  do_start () {
> +        local time=0
> +     local timeout=30
> +
>       if ! `xenstore-read -s / >/dev/null 2>&1`
>       then
>               test -z "$XENSTORED_ROOTDIR" || 
> XENSTORED_ROOTDIR="/var/lib/xenstored"
>               rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null
>               test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T 
> /var/log/xen/xenstored-trace.log"
>  
> -             echo Starting xenstored...
> +             echo -n Starting xenstored...
>               xenstored --pid-file=/var/run/xenstore.pid $XENSTORED_ARGS
>   

Why isn't xenstored ready by the time the main process exits?  Seems
like a bug in xenstored. Does oxenstored get this right?

    J


> +
> +             # Wait for xenstored to actually come up, timing out after 30 
> seconds
> +                while [ $time -lt $timeout ] && ! `xenstore-read -s / 
> >/dev/null 2>&1` ; do
> +                    echo -n .
> +                 time=$(($time+1))
> +                    sleep 1
> +                done
> +             echo
> +
> +             # Exit if we timed out
> +             if ! [ $time -lt $timeout ] ; then
> +                 echo Could not start xenstored
> +                 exit 1
> +             fi
> +
>               echo Setting domain 0 name...
>               xenstore-write "/local/domain/0/name" "Domain-0"
>       fi
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
>
>   


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