Skip to content

Commit 8e99829

Browse files
author
Dean Troyer
committed
Only download UEC image if UPLOAD_LEGACY_TTY is unset; bind mount /dev for oneiric openssl
1 parent 39c2efc commit 8e99829

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

tools/build_libvirt.sh

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ cleanup() {
1717
set +o errexit
1818
unmount_images
1919

20+
if [ -n "$COPY_DIR" ]; then
21+
umount $COPY_DIR/dev
22+
umount $COPY_DIR
23+
fi
24+
2025
if [ -n "$ROOTFS" ]; then
2126
umount $ROOTFS/dev
2227
umount $ROOTFS
@@ -31,7 +36,7 @@ cleanup() {
3136
trap 2; kill -2 $$
3237
}
3338

34-
trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT
39+
trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
3540

3641
# Echo commands
3742
set -o xtrace
@@ -127,6 +132,7 @@ DEST=${DEST:-/opt/stack}
127132
# Mount the file system
128133
# For some reason, UEC-based images want 255 heads * 63 sectors * 512 byte sectors = 8225280
129134
mount -t ext4 -o loop,offset=8225280 $VM_IMAGE $COPY_DIR
135+
mount -o bind /dev $COPY_DIR/dev
130136

131137
# git clone only if directory doesn't exist already. Since ``DEST`` might not
132138
# 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
149155
chroot $COPY_DIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1`
150156
chroot $COPY_DIR pip install `cat files/pips/*`
151157

158+
umount $COPY_DIR/dev
159+
152160
# Clean out code repos if directed to do so
153161
if [ "$CLEAN" = "1" ]; then
154162
rm -rf $COPY_DIR/$DEST
@@ -167,13 +175,15 @@ git_clone $KEYSTONE_REPO $COPY_DIR/$DEST/keystone $KEYSTONE_BRANCH
167175
git_clone $NOVNC_REPO $COPY_DIR/$DEST/noVNC $NOVNC_BRANCH
168176
git_clone $CITEST_REPO $COPY_DIR/$DEST/openstack-integration-tests $CITEST_BRANCH
169177

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;)
178+
if [ -z "$UPLOAD_LEGACY_TTY" =; then
179+
# Pre-load an image for testing
180+
UEC_NAME=$DIST_NAME-server-cloudimg-amd64
181+
CIVMDIR=${COPY_DIR}${DEST}/openstack-integration-tests/include/sample_vm
182+
if [ ! -e $CIVMDIR/$UEC_NAME.tar.gz ]; then
183+
mkdir -p $CIVMDIR
184+
(cd $CIVMDIR && wget -N http://uec-images.ubuntu.com/$DIST_NAME/current/$UEC_NAME.tar.gz;
185+
tar xzf $UEC_NAME.tar.gz;)
186+
fi
177187
fi
178188

179189
# Back to devstack
@@ -413,18 +423,20 @@ echo 'GRUB_DISABLE_OS_PROBER=true' >>$ROOTFS/etc/default/grub
413423
echo "GRUB_DEVICE_UUID=$G_DEV_UUID" >>$ROOTFS/etc/default/grub
414424

415425
chroot $ROOTFS update-grub
416-
umount $ROOTFS/dev
417426

418427
# Pre-generate ssh host keys and allow password login
419428
chroot $ROOTFS dpkg-reconfigure openssh-server
420429
sed -e 's/^PasswordAuthentication.*$/PasswordAuthentication yes/' -i $ROOTFS/etc/ssh/sshd_config
421430

422431
# Unmount
432+
umount $ROOTFS/dev
423433
umount $ROOTFS || echo 'ok'
424434
ROOTFS=""
425435
qemu-nbd -d $NBD
426436
NBD=""
427437

438+
trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT
439+
428440
# Create the instance
429441
cd $VM_DIR && virsh create libvirt.xml
430442

0 commit comments

Comments
 (0)