Browse code

Only download UEC image if UPLOAD_LEGACY_TTY is unset; bind mount /dev for oneiric openssl

Dean Troyer authored on 2011/11/08 07:41:47
Showing 1 changed files
... ...
@@ -17,6 +17,11 @@ cleanup() {
17 17
     set +o errexit
18 18
     unmount_images
19 19
 
20
+    if [ -n "$COPY_DIR" ]; then
21
+        umount $COPY_DIR/dev
22
+        umount $COPY_DIR
23
+    fi
24
+
20 25
     if [ -n "$ROOTFS" ]; then
21 26
         umount $ROOTFS/dev
22 27
         umount $ROOTFS
... ...
@@ -31,7 +36,7 @@ cleanup() {
31 31
     trap 2; kill -2 $$
32 32
 }
33 33
 
34
-trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT
34
+trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
35 35
 
36 36
 # Echo commands
37 37
 set -o xtrace
... ...
@@ -127,6 +132,7 @@ DEST=${DEST:-/opt/stack}
127 127
 # Mount the file system
128 128
 # For some reason, UEC-based images want 255 heads * 63 sectors * 512 byte sectors = 8225280
129 129
 mount -t ext4 -o loop,offset=8225280 $VM_IMAGE $COPY_DIR
130
+mount -o bind /dev $COPY_DIR/dev
130 131
 
131 132
 # git clone only if directory doesn't exist already.  Since ``DEST`` might not
132 133
 # be owned by the installation user, we create the directory and change the
... ...
@@ -149,6 +155,8 @@ chroot $COPY_DIR apt-get install -y --download-only `cat files/apts/* | grep NOP
149 149
 chroot $COPY_DIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1`
150 150
 chroot $COPY_DIR pip install `cat files/pips/*`
151 151
 
152
+umount $COPY_DIR/dev
153
+
152 154
 # Clean out code repos if directed to do so
153 155
 if [ "$CLEAN" = "1" ]; then
154 156
     rm -rf $COPY_DIR/$DEST
... ...
@@ -167,13 +175,15 @@ git_clone $KEYSTONE_REPO $COPY_DIR/$DEST/keystone $KEYSTONE_BRANCH
167 167
 git_clone $NOVNC_REPO $COPY_DIR/$DEST/noVNC $NOVNC_BRANCH
168 168
 git_clone $CITEST_REPO $COPY_DIR/$DEST/openstack-integration-tests $CITEST_BRANCH
169 169
 
170
-# Pre-load an image for testing
171
-UEC_NAME=$DIST_NAME-server-cloudimg-amd64
172
-CIVMDIR=${COPY_DIR}${DEST}/openstack-integration-tests/include/sample_vm
173
-if [ ! -e $CIVMDIR/$UEC_NAME.tar.gz ]; then
174
-    mkdir -p $CIVMDIR
175
-    (cd $CIVMDIR && wget -N http://uec-images.ubuntu.com/$DIST_NAME/current/$UEC_NAME.tar.gz;
176
-        tar xzf $UEC_NAME.tar.gz;)
170
+if [ -z "$UPLOAD_LEGACY_TTY" =; then
171
+    # Pre-load an image for testing
172
+    UEC_NAME=$DIST_NAME-server-cloudimg-amd64
173
+    CIVMDIR=${COPY_DIR}${DEST}/openstack-integration-tests/include/sample_vm
174
+    if [ ! -e $CIVMDIR/$UEC_NAME.tar.gz ]; then
175
+        mkdir -p $CIVMDIR
176
+        (cd $CIVMDIR && wget -N http://uec-images.ubuntu.com/$DIST_NAME/current/$UEC_NAME.tar.gz;
177
+            tar xzf $UEC_NAME.tar.gz;)
178
+    fi
177 179
 fi
178 180
 
179 181
 # Back to devstack
... ...
@@ -413,18 +423,20 @@ echo 'GRUB_DISABLE_OS_PROBER=true' >>$ROOTFS/etc/default/grub
413 413
 echo "GRUB_DEVICE_UUID=$G_DEV_UUID" >>$ROOTFS/etc/default/grub
414 414
 
415 415
 chroot $ROOTFS update-grub
416
-umount $ROOTFS/dev
417 416
 
418 417
 # Pre-generate ssh host keys and allow password login
419 418
 chroot $ROOTFS dpkg-reconfigure openssh-server
420 419
 sed -e 's/^PasswordAuthentication.*$/PasswordAuthentication yes/' -i $ROOTFS/etc/ssh/sshd_config
421 420
 
422 421
 # Unmount
422
+umount $ROOTFS/dev
423 423
 umount $ROOTFS || echo 'ok'
424 424
 ROOTFS=""
425 425
 qemu-nbd -d $NBD
426 426
 NBD=""
427 427
 
428
+trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT
429
+
428 430
 # Create the instance
429 431
 cd $VM_DIR && virsh create libvirt.xml
430 432