Browse code

Merge branch 'master' of github.com:cloudbuilders/devstack into uec-image

Dean Troyer authored on 2011/10/27 05:55:43
Showing 4 changed files
... ...
@@ -93,7 +93,7 @@ IP=`nova show $NAME | grep "private network" | cut -d"|" -f3`
93 93
 
94 94
 # for single node deployments, we can ping private ips
95 95
 MULTI_HOST=${MULTI_HOST:-0}
96
-if [ "$MULTI_HOST" = "0"]; then
96
+if [ "$MULTI_HOST" = "0" ]; then
97 97
     # ping it once (timeout of a second)
98 98
     ping -c1 -w1 $IP || true
99 99
 
... ...
@@ -302,20 +302,31 @@ sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install `cat $FILES/pips/*`
302 302
 # be owned by the installation user, we create the directory and change the
303 303
 # ownership to the proper user.
304 304
 function git_clone {
305
-    # if there is an existing checkout, move it out of the way
306
-    if [[ "$RECLONE" == "yes" ]]; then
307
-        # FIXME(ja): if we were smarter we could speed up RECLONE by
308
-        # using the old git repo as the basis of our new clone...
309
-        if [ -d $2 ]; then
310
-            mv $2 /tmp/stack.`date +%s`
311
-        fi
312
-    fi
313 305
 
314
-    if [ ! -d $2 ]; then
315
-        git clone $1 $2
306
+    GIT_REMOTE=$1
307
+    GIT_DEST=$2
308
+    GIT_BRANCH=$3
309
+
310
+    # do a full clone only if the directory doesn't exist
311
+    if [ ! -d $GIT_DEST ]; then
312
+        git clone $GIT_REMOTE $GIT_DEST
316 313
         cd $2
317 314
         # This checkout syntax works for both branches and tags
318
-        git checkout $3
315
+        git checkout $GIT_BRANCH
316
+    elif [[ "$RECLONE" == "yes" ]]; then
317
+        # if it does exist then simulate what clone does if asked to RECLONE
318
+        cd $GIT_DEST
319
+        # set the url to pull from and fetch
320
+        git remote set-url origin $GIT_REMOTE
321
+        git fetch origin
322
+        # remove the existing ignored files (like pyc) as they cause breakage
323
+        # (due to the py files having older timestamps than our pyc, so python
324
+        # thinks the pyc files are correct using them)
325
+        sudo git clean -f -d
326
+        git checkout -f origin/$GIT_BRANCH
327
+        # a local branch might not exist
328
+        git branch -D $GIT_BRANCH || true
329
+        git checkout -b $GIT_BRANCH
319 330
     fi
320 331
 }
321 332
 
... ...
@@ -470,11 +481,15 @@ fi
470 470
 # Nova
471 471
 # ----
472 472
 
473
-# We are going to use the sample http middleware configuration from the keystone
474
-# project to launch nova.  This paste config adds the configuration required
475
-# for nova to validate keystone tokens - except we need to switch the config
476
-# to use our service token instead (instead of the invalid token 999888777666).
477
-sudo sed -e "s,999888777666,$SERVICE_TOKEN,g" -i $KEYSTONE_DIR/examples/paste/nova-api-paste.ini
473
+if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
474
+    # We are going to use the sample http middleware configuration from the
475
+    # keystone project to launch nova.  This paste config adds the configuration
476
+    # required for nova to validate keystone tokens - except we need to switch
477
+    # the config to use our service token instead (instead of the invalid token
478
+    # 999888777666).
479
+    cp $KEYSTONE_DIR/examples/paste/nova-api-paste.ini $NOVA_DIR/bin
480
+    sed -e "s,999888777666,$SERVICE_TOKEN,g" -i $NOVA_DIR/bin/nova-api-paste.ini
481
+fi
478 482
 
479 483
 if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then
480 484
 
... ...
@@ -591,7 +606,7 @@ add_nova_flag "--libvirt_type=$LIBVIRT_TYPE"
591 591
 add_nova_flag "--osapi_extensions_path=$OPENSTACKX_DIR/extensions"
592 592
 add_nova_flag "--vncproxy_url=http://$HOST_IP:6080"
593 593
 add_nova_flag "--vncproxy_wwwroot=$NOVNC_DIR/"
594
-add_nova_flag "--api_paste_config=$KEYSTONE_DIR/examples/paste/nova-api-paste.ini"
594
+add_nova_flag "--api_paste_config=$NOVA_DIR/bin/nova-api-paste.ini"
595 595
 add_nova_flag "--image_service=nova.image.glance.GlanceImageService"
596 596
 add_nova_flag "--ec2_dmz_host=$EC2_DMZ_HOST"
597 597
 add_nova_flag "--rabbit_host=$RABBIT_HOST"
... ...
@@ -19,9 +19,6 @@ set -o xtrace
19 19
 TOOLS_DIR=$(cd $(dirname "$0") && pwd)
20 20
 TOP_DIR=$TOOLS_DIR/..
21 21
 
22
-# Configure the root password of the vm
23
-ROOT_PASSWORD=${ROOT_PASSWORD:-password}
24
-
25 22
 # Where to store files and instances
26 23
 KVMSTACK_DIR=${KVMSTACK_DIR:-/opt/kvmstack}
27 24
 
... ...
@@ -44,6 +41,10 @@ fi
44 44
 # Source params
45 45
 source ./stackrc
46 46
 
47
+# Configure the root password of the vm to be the same as ``ADMIN_PASSWORD``
48
+ROOT_PASSWORD=${ADMIN_PASSWORD:-password}
49
+
50
+
47 51
 # Base image (natty by default)
48 52
 DIST_NAME=${DIST_NAME:-natty}
49 53
 IMAGE_FNAME=$DIST_NAME.raw
... ...
@@ -260,7 +261,7 @@ iface eth0 inet static
260 260
 EOF
261 261
 
262 262
 # User configuration for the instance
263
-chroot $ROOTFS groupadd libvirtd
263
+chroot $ROOTFS groupadd libvirtd || true
264 264
 chroot $ROOTFS useradd stack -s /bin/bash -d $DEST -G libvirtd
265 265
 cp -pr $TOOLS_DIR/.. $ROOTFS/$DEST/devstack
266 266
 echo "root:$ROOT_PASSWORD" | chroot $ROOTFS chpasswd
... ...
@@ -284,6 +285,15 @@ if [ "$COPYENV" = "1" ]; then
284 284
     cp_it ~/.bashrc $ROOTFS/$DEST/.bashrc
285 285
 fi
286 286
 
287
+# pre-cache uec images
288
+for image_url in ${IMAGE_URLS//,/ }; do
289
+    IMAGE_FNAME=`basename "$image_url"`
290
+    if [ ! -f $IMAGES_DIR/$IMAGE_FNAME ]; then
291
+        wget -c $image_url -O $IMAGES_DIR/$IMAGE_FNAME
292
+    fi
293
+    cp $IMAGES_DIR/$IMAGE_FNAME $ROOTFS/$DEST/devstack/files
294
+done
295
+
287 296
 # Configure the runner
288 297
 RUN_SH=$ROOTFS/$DEST/run.sh
289 298
 cat > $RUN_SH <<EOF
... ...
@@ -301,6 +301,11 @@ if [ "$WAIT_TILL_LAUNCH" = "1" ]; then
301 301
     done
302 302
 
303 303
     kill $TAIL_PID
304
+
305
+    if grep -q "stack.sh failed" $ROOTFS/$DEST/run.sh.log; then
306
+        exit 1
307
+    fi
308
+
304 309
     echo ""
305 310
     echo "Finished - Zip-a-dee Doo-dah!"
306 311
 fi