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

This commit is contained in:
Dean Troyer 2011-11-07 16:41:47 -06:00
parent 39c2efcd23
commit 8e99829ae3

View file

@ -17,6 +17,11 @@ cleanup() {
set +o errexit set +o errexit
unmount_images unmount_images
if [ -n "$COPY_DIR" ]; then
umount $COPY_DIR/dev
umount $COPY_DIR
fi
if [ -n "$ROOTFS" ]; then if [ -n "$ROOTFS" ]; then
umount $ROOTFS/dev umount $ROOTFS/dev
umount $ROOTFS umount $ROOTFS
@ -31,7 +36,7 @@ cleanup() {
trap 2; kill -2 $$ trap 2; kill -2 $$
} }
trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
# Echo commands # Echo commands
set -o xtrace set -o xtrace
@ -127,6 +132,7 @@ DEST=${DEST:-/opt/stack}
# Mount the file system # Mount the file system
# For some reason, UEC-based images want 255 heads * 63 sectors * 512 byte sectors = 8225280 # For some reason, UEC-based images want 255 heads * 63 sectors * 512 byte sectors = 8225280
mount -t ext4 -o loop,offset=8225280 $VM_IMAGE $COPY_DIR mount -t ext4 -o loop,offset=8225280 $VM_IMAGE $COPY_DIR
mount -o bind /dev $COPY_DIR/dev
# git clone only if directory doesn't exist already. Since ``DEST`` might not # git clone only if directory doesn't exist already. Since ``DEST`` might not
# be owned by the installation user, we create the directory and change the # 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
chroot $COPY_DIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1` chroot $COPY_DIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1`
chroot $COPY_DIR pip install `cat files/pips/*` chroot $COPY_DIR pip install `cat files/pips/*`
umount $COPY_DIR/dev
# Clean out code repos if directed to do so # Clean out code repos if directed to do so
if [ "$CLEAN" = "1" ]; then if [ "$CLEAN" = "1" ]; then
rm -rf $COPY_DIR/$DEST rm -rf $COPY_DIR/$DEST
@ -167,13 +175,15 @@ git_clone $KEYSTONE_REPO $COPY_DIR/$DEST/keystone $KEYSTONE_BRANCH
git_clone $NOVNC_REPO $COPY_DIR/$DEST/noVNC $NOVNC_BRANCH git_clone $NOVNC_REPO $COPY_DIR/$DEST/noVNC $NOVNC_BRANCH
git_clone $CITEST_REPO $COPY_DIR/$DEST/openstack-integration-tests $CITEST_BRANCH git_clone $CITEST_REPO $COPY_DIR/$DEST/openstack-integration-tests $CITEST_BRANCH
# Pre-load an image for testing if [ -z "$UPLOAD_LEGACY_TTY" =; then
UEC_NAME=$DIST_NAME-server-cloudimg-amd64 # Pre-load an image for testing
CIVMDIR=${COPY_DIR}${DEST}/openstack-integration-tests/include/sample_vm UEC_NAME=$DIST_NAME-server-cloudimg-amd64
if [ ! -e $CIVMDIR/$UEC_NAME.tar.gz ]; then CIVMDIR=${COPY_DIR}${DEST}/openstack-integration-tests/include/sample_vm
mkdir -p $CIVMDIR if [ ! -e $CIVMDIR/$UEC_NAME.tar.gz ]; then
(cd $CIVMDIR && wget -N http://uec-images.ubuntu.com/$DIST_NAME/current/$UEC_NAME.tar.gz; mkdir -p $CIVMDIR
tar xzf $UEC_NAME.tar.gz;) (cd $CIVMDIR && wget -N http://uec-images.ubuntu.com/$DIST_NAME/current/$UEC_NAME.tar.gz;
tar xzf $UEC_NAME.tar.gz;)
fi
fi fi
# Back to devstack # Back to devstack
@ -413,18 +423,20 @@ echo 'GRUB_DISABLE_OS_PROBER=true' >>$ROOTFS/etc/default/grub
echo "GRUB_DEVICE_UUID=$G_DEV_UUID" >>$ROOTFS/etc/default/grub echo "GRUB_DEVICE_UUID=$G_DEV_UUID" >>$ROOTFS/etc/default/grub
chroot $ROOTFS update-grub chroot $ROOTFS update-grub
umount $ROOTFS/dev
# Pre-generate ssh host keys and allow password login # Pre-generate ssh host keys and allow password login
chroot $ROOTFS dpkg-reconfigure openssh-server chroot $ROOTFS dpkg-reconfigure openssh-server
sed -e 's/^PasswordAuthentication.*$/PasswordAuthentication yes/' -i $ROOTFS/etc/ssh/sshd_config sed -e 's/^PasswordAuthentication.*$/PasswordAuthentication yes/' -i $ROOTFS/etc/ssh/sshd_config
# Unmount # Unmount
umount $ROOTFS/dev
umount $ROOTFS || echo 'ok' umount $ROOTFS || echo 'ok'
ROOTFS="" ROOTFS=""
qemu-nbd -d $NBD qemu-nbd -d $NBD
NBD="" NBD=""
trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT
# Create the instance # Create the instance
cd $VM_DIR && virsh create libvirt.xml cd $VM_DIR && virsh create libvirt.xml