Skip to content
Newer
Older
100755 35 lines (29 sloc) 751 Bytes
f77e728 Initial import of hg.uk.xensource.com/carbon/trunk/api.hg c/s 9691:9a…
Xen hg user authored Jun 6, 2009
1 #! /bin/bash
2 #
3 # Copyright (c) Citrix Systems 2008. All rights reserved.
4 #
5 # wait (given specified timeout) for xapi to complete all
6 # initialisation (including storage initialisation)
7 #
8
9 [ -e /proc/xen ] || exit 0
10
11 usage () {
12 echo Usage: $0 \<timeout\> \(seconds\)
13 echo Poll for xapi to complete initialisation, for up to \<timeout\> seconds
14 exit 1
15 }
16
17 XAPI_INIT_COMPLETE_COOKIE=/var/run/xapi_init_complete.cookie
18
19 if [ -z "$1" ]; then
20 usage
21 else
22 RETRIES=$1
23 fi
24
25 while [ ${RETRIES} -ne 0 ]; do
26 if [ -e ${XAPI_INIT_COMPLETE_COOKIE} ]; then
27 # success; xapi has completed initialisation
28 exit 0
29 fi
30 sleep 1
31 RETRIES=$(( ${RETRIES} - 1 ))
32 done
33
34 # xapi did not complete initialisation during specified timeout interval
35 exit 1
Something went wrong with that request. Please try again.