All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: George Dunlap <george.dunlap@eu.citrix.com>
Cc: xen-devel@lists.xensource.com,
	Vincent Hanquez <Vincent.Hanquez@eu.citrix.com>
Subject: Re: [PATCH 2 of 2] xencommons: Wait for xenstored to start	before setting dom0 name
Date: Tue, 29 Jun 2010 16:37:38 +0200	[thread overview]
Message-ID: <4C2A0532.2040602@goop.org> (raw)
In-Reply-To: <dc49f02fc463ab48c82a.1277819806@gdunlap-desktop>

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@eu.citrix.com>
>
> 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@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
>   

  parent reply	other threads:[~2010-06-29 14:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-29 13:56 [PATCH 0 of 2] xencommons init script improvements George Dunlap
2010-06-29 13:56 ` [PATCH 1 of 2] xencommons: Make init script more verbose George Dunlap
2010-06-29 13:56 ` [PATCH 2 of 2] xencommons: Wait for xenstored to start before setting dom0 name George Dunlap
2010-06-29 14:10   ` Ian Campbell
2010-06-29 14:37   ` Jeremy Fitzhardinge [this message]
2010-06-29 15:02     ` Ian Campbell
2010-06-29 15:06       ` Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C2A0532.2040602@goop.org \
    --to=jeremy@goop.org \
    --cc=Vincent.Hanquez@eu.citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.