Browse code

Changes to make exercise.sh work with xen

Anthony Young authored on 2011/11/02 04:19:18
Showing 3 changed files
... ...
@@ -164,11 +164,14 @@ ping -c1 -w1 $IP
164 164
 # dis-allow icmp traffic (ping)
165 165
 nova secgroup-delete-rule $SECGROUP icmp -1 -1 0.0.0.0/0
166 166
 
167
-# test we can aren't able to ping our floating ip within ASSOCIATE_TIMEOUT seconds
168
-if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ping -c1 -w1 $FLOATING_IP; do sleep 1; done"; then
169
-    print "Security group failure - ping should not be allowed!"
170
-    echo "Couldn't ping server with floating ip"
171
-    exit 1
167
+# FIXME (anthony): make xs support security groups
168
+if [ "$VIRT_DRIVER" != "xenserver"]; then
169
+    # test we can aren't able to ping our floating ip within ASSOCIATE_TIMEOUT seconds
170
+    if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ping -c1 -w1 $FLOATING_IP; do sleep 1; done"; then
171
+        print "Security group failure - ping should not be allowed!"
172
+        echo "Couldn't ping server with floating ip"
173
+        exit 1
174
+    fi
172 175
 fi
173 176
 
174 177
 # de-allocate the floating ip
... ...
@@ -46,6 +46,12 @@ Of course, use real passwords if this machine is exposed.
46 46
     XENAPI_PASSWORD=my_super_secret
47 47
     # Do not download the usual images yet!
48 48
     IMAGE_URLS=""
49
+    # Explicitly set virt driver here
50
+    VIRT_DRIVER=xenserver
51
+    # Explicitly set multi-host
52
+    MULTI_HOST=1
53
+    # Give extra time for boot
54
+    ACTIVE_TIMEOUT=45
49 55
     EOF
50 56
 
51 57
 Step 4: Run ./build_domU.sh
... ...
@@ -298,14 +298,63 @@ fi
298 298
 # Start guest
299 299
 $TOP_DIR/scripts/install-os-vpx.sh -f $XVA -v $VM_BR -m $MGT_BR -p $PUB_BR
300 300
 
301
-echo "################################################################################"
302
-echo ""
303
-echo "All Finished!"
304
-echo "Now, you can monitor the progress of the stack.sh installation by "
305
-echo "tailing /opt/stack/run.sh.log from within your domU."
306
-echo ""
307
-echo "ssh into your domU now: 'ssh stack@$PUB_IP' using your password"
308
-echo "and then do: 'tail -f /opt/stack/run.sh.log'"
309
-echo ""
310
-echo "When the script completes, you can then visit the OpenStack Dashboard"
311
-echo "at http://$PUB_IP, and contact other services at the usual ports."
301
+# If we have copied our ssh credentials, use ssh to monitor while the installation runs
302
+WAIT_TILL_LAUNCH=${WAIT_TILL_LAUNCH:-1}
303
+if [ "$WAIT_TILL_LAUNCH" = "1" ]  && [ -e ~/.ssh/id_rsa.pub  ] && [ "$COPYENV" = "1" ]; then
304
+    # Done creating the container, let's tail the log
305
+    echo
306
+    echo "============================================================="
307
+    echo "                          -- YAY! --"
308
+    echo "============================================================="
309
+    echo
310
+    echo "We're done launching the vm, about to start tailing the"
311
+    echo "stack.sh log. It will take a second or two to start."
312
+    echo
313
+    echo "Just CTRL-C at any time to stop tailing."
314
+
315
+    set +o xtrace
316
+
317
+    while ! ssh -q stack@$PUB_IP "[ -e run.sh.log ]"; do
318
+      sleep 1
319
+    done
320
+
321
+    ssh stack@$PUB_IP 'tail -f run.sh.log' &
322
+
323
+    TAIL_PID=$!
324
+
325
+    function kill_tail() {
326
+        kill $TAIL_PID
327
+        exit 1
328
+    }
329
+
330
+    # Let Ctrl-c kill tail and exit
331
+    trap kill_tail SIGINT
332
+
333
+    echo "Waiting stack.sh to finish..."
334
+    while ! ssh -q stack@$PUB_IP "grep -q 'stack.sh completed in' run.sh.log" ; do
335
+        sleep 1
336
+    done
337
+
338
+    kill $TAIL_PID
339
+
340
+    if ! ssh -q stack@$PUB_IP "grep -q 'stack.sh failed' run.sh.log" ; then
341
+        exit 1
342
+    fi
343
+    echo ""
344
+    echo "Finished - Zip-a-dee Doo-dah!"
345
+    echo "You can then visit the OpenStack Dashboard"
346
+    echo "at http://$PUB_IP, and contact other services at the usual ports."
347
+else
348
+    echo "################################################################################"
349
+    echo ""
350
+    echo "All Finished!"
351
+    echo "Now, you can monitor the progress of the stack.sh installation by "
352
+    echo "tailing /opt/stack/run.sh.log from within your domU."
353
+    echo ""
354
+    echo "ssh into your domU now: 'ssh stack@$PUB_IP' using your password"
355
+    echo "and then do: 'tail -f /opt/stack/run.sh.log'"
356
+    echo ""
357
+    echo "When the script completes, you can then visit the OpenStack Dashboard"
358
+    echo "at http://$PUB_IP, and contact other services at the usual ports."
359
+
360
+fi