From fda65b83f465ad372ac3d9088ebf17c97cff4a3a Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Wed, 2 Nov 2011 12:13:33 -0500 Subject: [PATCH 01/10] New build_ci_config.sh --- tools/build_ci_config.sh | 126 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100755 tools/build_ci_config.sh diff --git a/tools/build_ci_config.sh b/tools/build_ci_config.sh new file mode 100755 index 0000000..c6e3cb4 --- /dev/null +++ b/tools/build_ci_config.sh @@ -0,0 +1,126 @@ +#!/usr/bin/env bash +# +# build_ci_config.sh - Build a config.ini for openstack-integration-tests +# (https://github.com/openstack/openstack-integration-tests) + +function usage { + echo "$0 - Build config.ini for openstack-integration-tests" + echo "" + echo "Usage: $0 configfile" + exit 1 +} + +if [ ! "$#" -eq "1" ]; then + usage +fi + +CONFIG_FILE=$1 + +# Clean up any resources that may be in use +cleanup() { + set +o errexit + + # Mop up temporary files + if [ -n "$CONFIG_FILE_TMP" -a -e "$CONFIG_FILE_TMP" ]; then + rm -f $CONFIG_FILE_TMP + fi + + # Kill ourselves to signal any calling process + trap 2; kill -2 $$ +} + +trap cleanup SIGHUP SIGINT SIGTERM + +# Keep track of the current directory +TOOLS_DIR=$(cd $(dirname "$0") && pwd) +TOP_DIR=`cd $TOOLS_DIR/..; pwd` + +# Abort if localrc is not set +if [ ! -e $TOP_DIR/localrc ]; then + echo "You must have a localrc with ALL necessary passwords and configuration defined before proceeding." + echo "See stack.sh for required passwords." + exit 1 +fi + +# Source params +source ./stackrc + +# Where Openstack code lives +DEST=${DEST:-/opt/stack} + +# Process network configuration vars +GUEST_NETWORK=${GUEST_NETWORK:-1} +GUEST_RECREATE_NET=${GUEST_RECREATE_NET:-yes} + +GUEST_IP=${GUEST_IP:-192.168.$GUEST_NETWORK.50} +GUEST_CIDR=${GUEST_CIDR:-$GUEST_IP/24} +GUEST_NETMASK=${GUEST_NETMASK:-255.255.255.0} +GUEST_GATEWAY=${GUEST_GATEWAY:-192.168.$GUEST_NETWORK.1} +GUEST_MAC=${GUEST_MAC:-"02:16:3e:07:69:`printf '%02X' $GUEST_NETWORK`"} +GUEST_RAM=${GUEST_RAM:-1524288} +GUEST_CORES=${GUEST_CORES:-1} + +# Use the GUEST_IP unless an explicit IP is set by ``HOST_IP`` +HOST_IP=${HOST_IP:-$GUEST_IP} +# Use the first IP if HOST_IP still is not set +if [ ! -n "$HOST_IP" ]; then + HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'` +fi + +RABBIT_HOST=${RABBIT_HOST:-localhost} + +# Glance connection info. Note the port must be specified. +GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292} +set `echo $GLANCE_HOSTPORT | tr ':' ' '` +GLANCE_HOST=$1 +GLANCE_PORT=$2 + +CONFIG_FILE_TMP=$(mktemp $CONFIG_FILE.XXXXXX) +cat >$CONFIG_FILE_TMP < Date: Wed, 2 Nov 2011 21:21:36 -0500 Subject: [PATCH 02/10] Keystone uses api v2.0 --- tools/build_ci_config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build_ci_config.sh b/tools/build_ci_config.sh index c6e3cb4..48f2a82 100755 --- a/tools/build_ci_config.sh +++ b/tools/build_ci_config.sh @@ -91,7 +91,7 @@ image_id = 1 [keystone] service_host = $HOST_IP service_port = 5000 -apiver = v1.1 +apiver = v2.0 user = admin password = $ADMIN_PASSWORD tenant_id = 1 @@ -123,4 +123,4 @@ username = root password = password EOF -mv $CONFIG_FILE_TMP $CONFIG_FILE \ No newline at end of file +mv $CONFIG_FILE_TMP $CONFIG_FILE From b0e57cf38f90a005f057fc88e7ee112cb54bba53 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Fri, 4 Nov 2011 12:13:43 -0500 Subject: [PATCH 03/10] Add CI tests --- stackrc | 4 ++++ tools/build_ci_config.sh | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/stackrc b/stackrc index b541711..ba98f15 100644 --- a/stackrc +++ b/stackrc @@ -39,6 +39,10 @@ OPENSTACKX_BRANCH=diablo QUANTUM_REPO=https://github.com/openstack/quantum QUANTUM_BRANCH=stable/diablo +# CI test suite +CITEST_REPO=https://github.com/openstack/openstack-integration-tests.git +CITEST_BRANCH=master + # Specify a comma-separated list of uec images to download and install into glance. IMAGE_URLS=http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-11.2_2.6.35-15_1.tar.gz diff --git a/tools/build_ci_config.sh b/tools/build_ci_config.sh index 48f2a82..aecbd80 100755 --- a/tools/build_ci_config.sh +++ b/tools/build_ci_config.sh @@ -48,6 +48,8 @@ source ./stackrc # Where Openstack code lives DEST=${DEST:-/opt/stack} +DIST_NAME=${DIST_NAME:-natty} + # Process network configuration vars GUEST_NETWORK=${GUEST_NETWORK:-1} GUEST_RECREATE_NET=${GUEST_RECREATE_NET:-yes} @@ -78,9 +80,9 @@ GLANCE_PORT=$2 CONFIG_FILE_TMP=$(mktemp $CONFIG_FILE.XXXXXX) cat >$CONFIG_FILE_TMP < Date: Fri, 4 Nov 2011 13:22:09 -0500 Subject: [PATCH 04/10] Checkout tests and download image file --- tools/build_libvirt.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/build_libvirt.sh b/tools/build_libvirt.sh index d192879..f82399d 100755 --- a/tools/build_libvirt.sh +++ b/tools/build_libvirt.sh @@ -31,7 +31,7 @@ cleanup() { trap 2; kill -2 $$ } -trap cleanup SIGHUP SIGINT SIGTERM +trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT # Echo commands set -o xtrace @@ -165,6 +165,7 @@ git_clone $NOVACLIENT_REPO $COPY_DIR/$DEST/python-novaclient $NOVACLIENT_BRANCH git_clone $OPENSTACKX_REPO $COPY_DIR/$DEST/openstackx $OPENSTACKX_BRANCH git_clone $KEYSTONE_REPO $COPY_DIR/$DEST/keystone $KEYSTONE_BRANCH git_clone $NOVNC_REPO $COPY_DIR/$DEST/noVNC $NOVNC_BRANCH +git_clone $CITEST_REPO $COPY_DIR/$DEST/openstack-integration-tests $CITEST_BRANCH # Back to devstack cd $TOP_DIR @@ -409,6 +410,15 @@ umount $ROOTFS/dev chroot $ROOTFS dpkg-reconfigure openssh-server sed -e 's/^PasswordAuthentication.*$/PasswordAuthentication yes/' -i $ROOTFS/etc/ssh/sshd_config +# Pre-load an image for testing +UEC_NAME=$DIST_NAME-server-cloudimg-amd64 +CIVMDIR=${ROOTFS}${DEST}/openstack-integration-tests/include/sample_vm +if [ ! -e $CIVMDIR/$UEC_NAME.tar.gz ]; then + mkdir -p $CIVMDIR + (cd $CIVMDIR && wget -N http://uec-images.ubuntu.com/$DIST_NAME/current/$UEC_NAME.tar.gz; + tar xzf $UEC_NAME.tar.gz;) +fi + # Unmount umount $ROOTFS || echo 'ok' ROOTFS="" From a0e294852fd44fd2a1920319baf9f02a5c8c858a Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Fri, 4 Nov 2011 19:44:06 -0500 Subject: [PATCH 05/10] Change glance apiver --- tools/build_ci_config.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/build_ci_config.sh b/tools/build_ci_config.sh index aecbd80..78ebcd6 100755 --- a/tools/build_ci_config.sh +++ b/tools/build_ci_config.sh @@ -86,9 +86,10 @@ ami_location = $DEST/openstack-integration-tests/include/sample_vm/$DIST_NAME-se [glance] host = $GLANCE_HOST -apiver = v1.0 +apiver = v1 port = $GLANCE_PORT image_id = 1 +tenant_id = 1 [keystone] service_host = $HOST_IP From ff0ed1db2732d88c056fb864b8e10fce20497ac8 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Sat, 5 Nov 2011 16:15:11 -0500 Subject: [PATCH 06/10] Support UPLOAD_LEGACY_TTY --- tools/build_ci_config.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/build_ci_config.sh b/tools/build_ci_config.sh index 78ebcd6..ca77ccf 100755 --- a/tools/build_ci_config.sh +++ b/tools/build_ci_config.sh @@ -78,12 +78,27 @@ GLANCE_HOST=$1 GLANCE_PORT=$2 CONFIG_FILE_TMP=$(mktemp $CONFIG_FILE.XXXXXX) -cat >$CONFIG_FILE_TMP <$CONFIG_FILE_TMP <$CONFIG_FILE_TMP <>$CONFIG_FILE_TMP < Date: Sat, 5 Nov 2011 16:16:54 -0500 Subject: [PATCH 07/10] Cache UEC image earlier --- tools/build_libvirt.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/build_libvirt.sh b/tools/build_libvirt.sh index f82399d..e2c33c6 100755 --- a/tools/build_libvirt.sh +++ b/tools/build_libvirt.sh @@ -167,6 +167,15 @@ git_clone $KEYSTONE_REPO $COPY_DIR/$DEST/keystone $KEYSTONE_BRANCH git_clone $NOVNC_REPO $COPY_DIR/$DEST/noVNC $NOVNC_BRANCH git_clone $CITEST_REPO $COPY_DIR/$DEST/openstack-integration-tests $CITEST_BRANCH +# Pre-load an image for testing +UEC_NAME=$DIST_NAME-server-cloudimg-amd64 +CIVMDIR=${COPY_DIR}${DEST}/openstack-integration-tests/include/sample_vm +if [ ! -e $CIVMDIR/$UEC_NAME.tar.gz ]; then + mkdir -p $CIVMDIR + (cd $CIVMDIR && wget -N http://uec-images.ubuntu.com/$DIST_NAME/current/$UEC_NAME.tar.gz; + tar xzf $UEC_NAME.tar.gz;) +fi + # Back to devstack cd $TOP_DIR @@ -410,15 +419,6 @@ umount $ROOTFS/dev chroot $ROOTFS dpkg-reconfigure openssh-server sed -e 's/^PasswordAuthentication.*$/PasswordAuthentication yes/' -i $ROOTFS/etc/ssh/sshd_config -# Pre-load an image for testing -UEC_NAME=$DIST_NAME-server-cloudimg-amd64 -CIVMDIR=${ROOTFS}${DEST}/openstack-integration-tests/include/sample_vm -if [ ! -e $CIVMDIR/$UEC_NAME.tar.gz ]; then - mkdir -p $CIVMDIR - (cd $CIVMDIR && wget -N http://uec-images.ubuntu.com/$DIST_NAME/current/$UEC_NAME.tar.gz; - tar xzf $UEC_NAME.tar.gz;) -fi - # Unmount umount $ROOTFS || echo 'ok' ROOTFS="" From 39c2efcd235b88d214bf65c93268ecd05df8f5da Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Mon, 7 Nov 2011 16:40:35 -0600 Subject: [PATCH 08/10] Change default build to oneiric --- tools/build_ci_config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build_ci_config.sh b/tools/build_ci_config.sh index ca77ccf..9112471 100755 --- a/tools/build_ci_config.sh +++ b/tools/build_ci_config.sh @@ -48,7 +48,7 @@ source ./stackrc # Where Openstack code lives DEST=${DEST:-/opt/stack} -DIST_NAME=${DIST_NAME:-natty} +DIST_NAME=${DIST_NAME:-oneiric} # Process network configuration vars GUEST_NETWORK=${GUEST_NETWORK:-1} From 8e99829ae33aaec89dac141ed9102211a6323d87 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Mon, 7 Nov 2011 16:41:47 -0600 Subject: [PATCH 09/10] Only download UEC image if UPLOAD_LEGACY_TTY is unset; bind mount /dev for oneiric openssl --- tools/build_libvirt.sh | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/tools/build_libvirt.sh b/tools/build_libvirt.sh index e2c33c6..585f5af 100755 --- a/tools/build_libvirt.sh +++ b/tools/build_libvirt.sh @@ -17,6 +17,11 @@ cleanup() { set +o errexit unmount_images + if [ -n "$COPY_DIR" ]; then + umount $COPY_DIR/dev + umount $COPY_DIR + fi + if [ -n "$ROOTFS" ]; then umount $ROOTFS/dev umount $ROOTFS @@ -31,7 +36,7 @@ cleanup() { trap 2; kill -2 $$ } -trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT +trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT # Echo commands set -o xtrace @@ -127,6 +132,7 @@ DEST=${DEST:-/opt/stack} # Mount the file system # 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 -o bind /dev $COPY_DIR/dev # 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 @@ -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 pip install `cat files/pips/*` +umount $COPY_DIR/dev + # Clean out code repos if directed to do so if [ "$CLEAN" = "1" ]; then 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 $CITEST_REPO $COPY_DIR/$DEST/openstack-integration-tests $CITEST_BRANCH -# Pre-load an image for testing -UEC_NAME=$DIST_NAME-server-cloudimg-amd64 -CIVMDIR=${COPY_DIR}${DEST}/openstack-integration-tests/include/sample_vm -if [ ! -e $CIVMDIR/$UEC_NAME.tar.gz ]; then - mkdir -p $CIVMDIR - (cd $CIVMDIR && wget -N http://uec-images.ubuntu.com/$DIST_NAME/current/$UEC_NAME.tar.gz; - tar xzf $UEC_NAME.tar.gz;) +if [ -z "$UPLOAD_LEGACY_TTY" =; then + # Pre-load an image for testing + UEC_NAME=$DIST_NAME-server-cloudimg-amd64 + CIVMDIR=${COPY_DIR}${DEST}/openstack-integration-tests/include/sample_vm + if [ ! -e $CIVMDIR/$UEC_NAME.tar.gz ]; then + mkdir -p $CIVMDIR + (cd $CIVMDIR && wget -N http://uec-images.ubuntu.com/$DIST_NAME/current/$UEC_NAME.tar.gz; + tar xzf $UEC_NAME.tar.gz;) + fi fi # 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 chroot $ROOTFS update-grub -umount $ROOTFS/dev # Pre-generate ssh host keys and allow password login chroot $ROOTFS dpkg-reconfigure openssh-server sed -e 's/^PasswordAuthentication.*$/PasswordAuthentication yes/' -i $ROOTFS/etc/ssh/sshd_config # Unmount +umount $ROOTFS/dev umount $ROOTFS || echo 'ok' ROOTFS="" qemu-nbd -d $NBD NBD="" +trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT + # Create the instance cd $VM_DIR && virsh create libvirt.xml From af95a4775ad01364b53a4fd6d2bcfda95dfcfa70 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Mon, 7 Nov 2011 17:01:05 -0600 Subject: [PATCH 10/10] Install pika for CI tests --- files/pips/openstack-integration-tests | 1 + 1 file changed, 1 insertion(+) create mode 100644 files/pips/openstack-integration-tests diff --git a/files/pips/openstack-integration-tests b/files/pips/openstack-integration-tests new file mode 100644 index 0000000..df7f423 --- /dev/null +++ b/files/pips/openstack-integration-tests @@ -0,0 +1 @@ +pika