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

[Xen-devel] [PATCH v4 02/15] xencommons: use the retry limit instead of implementing our own timeout



From: "Luis R. Rodriguez" <mcgrof@xxxxxxxx>

xenstore-read now has support to retry opening the xenstored unix domain
socket a certain amount of times, once each second, use that instead of
implementing our own timeout.

For systemd we'll be using socket activation. Details for that will follow.

Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Jan RÄkorajski <baggins@xxxxxxxxxxxxx>
Cc: M A Young <m.a.young@xxxxxxxxxxxx>
Cc: Jacek Konieczny <jajcus@xxxxxxxxxx>
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxx>
---
 tools/hotplug/Linux/init.d/xencommons | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/tools/hotplug/Linux/init.d/xencommons 
b/tools/hotplug/Linux/init.d/xencommons
index 4ebd636..7195413 100644
--- a/tools/hotplug/Linux/init.d/xencommons
+++ b/tools/hotplug/Linux/init.d/xencommons
@@ -54,9 +54,6 @@ if test -f /proc/xen/capabilities && \
 fi
 
 do_start () {
-        local time=0
-       local timeout=30
-
        modprobe xen-evtchn 2>/dev/null
        modprobe xen-gntdev 2>/dev/null
        modprobe xen-gntalloc 2>/dev/null
@@ -93,17 +90,11 @@ do_start () {
                    echo "No xenstored found"
                    exit 1
                fi
-
-               # Wait for xenstored to actually come up, timing out after 30 
seconds
-                while [ $time -lt $timeout ] && ! `${BINDIR}/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
+               # We try opening the xenstored socket every second up to the
+               # limit specified, if it hasn't opened by then assume
+               # failure.
+                ${BINDIR}/xenstore-read --retries 30 -s / >/dev/null 2>&1
+               if [ $? -ne 0 ] ; then
                    echo Could not start xenstored
                    exit 1
                fi
-- 
1.9.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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