diff options
author | Ian Jackson <Ian.Jackson@eu.citrix.com> | 2010-06-29 15:07:17 +0100 |
---|---|---|
committer | Ian Jackson <Ian.Jackson@eu.citrix.com> | 2010-06-29 15:07:17 +0100 |
commit | f706d9e9af66284a22cc9be5708b1ba28c083831 (patch) | |
tree | 620479246b76cc55c339319f9836891f7ace2f3e /tools/hotplug | |
parent | 8209429099cae5c23297e0d486a9651d3ee1d6f9 (diff) | |
download | xen-f706d9e9af66284a22cc9be5708b1ba28c083831.tar.gz xen-f706d9e9af66284a22cc9be5708b1ba28c083831.tar.bz2 xen-f706d9e9af66284a22cc9be5708b1ba28c083831.zip |
tools: init.d/xencommons: Wait for xenstored to start before setting dom0 name
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>
Diffstat (limited to 'tools/hotplug')
-rw-r--r-- | tools/hotplug/Linux/init.d/xencommons | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/hotplug/Linux/init.d/xencommons b/tools/hotplug/Linux/init.d/xencommons index cc52ce8820..08fa09bbc7 100644 --- a/tools/hotplug/Linux/init.d/xencommons +++ b/tools/hotplug/Linux/init.d/xencommons @@ -37,14 +37,32 @@ if ! grep -q "control_d" /proc/xen/capabilities ; then 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 + + # 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 |