Browse code

Add SERVICE_TIMEOUT

Dean Troyer authored on 2011/11/06 06:19:03
Showing 1 changed files
... ...
@@ -175,6 +175,9 @@ if [ ! -n "$HOST_IP" ]; then
175 175
     HOST_IP=`LC_ALL=C /sbin/ifconfig  | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
176 176
 fi
177 177
 
178
+# Service startup timeout
179
+SERVICE_TIMEOUT=${SERVICE_TIMEOUT:-60}
180
+
178 181
 # Generic helper to configure passwords
179 182
 function read_password {
180 183
     set +o xtrace
... ...
@@ -926,7 +929,7 @@ fi
926 926
 if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
927 927
     screen_it g-api "cd $GLANCE_DIR; bin/glance-api --config-file=etc/glance-api.conf"
928 928
     echo "Waiting for g-api ($GLANCE_HOSTPORT) to start..."
929
-    if ! timeout 60 sh -c "while ! wget -q -O- http://$GLANCE_HOSTPORT; do sleep 1; done"; then
929
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget -q -O- http://$GLANCE_HOSTPORT; do sleep 1; done"; then
930 930
       echo "g-api did not start"
931 931
       exit 1
932 932
     fi
... ...
@@ -936,7 +939,7 @@ fi
936 936
 if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
937 937
     screen_it key "cd $KEYSTONE_DIR && $KEYSTONE_DIR/bin/keystone --config-file $KEYSTONE_CONF -d"
938 938
     echo "Waiting for keystone to start..."
939
-    if ! timeout 60 sh -c "while ! wget -q -O- http://127.0.0.1:5000; do sleep 1; done"; then
939
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget -q -O- http://127.0.0.1:5000; do sleep 1; done"; then
940 940
       echo "keystone did not start"
941 941
       exit 1
942 942
     fi
... ...
@@ -946,7 +949,7 @@ fi
946 946
 if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
947 947
     screen_it n-api "cd $NOVA_DIR && $NOVA_DIR/bin/nova-api"
948 948
     echo "Waiting for nova-api to start..."
949
-    if ! timeout 60 sh -c "while ! wget -q -O- http://127.0.0.1:8774; do sleep 1; done"; then
949
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget -q -O- http://127.0.0.1:8774; do sleep 1; done"; then
950 950
       echo "nova-api did not start"
951 951
       exit 1
952 952
     fi