From f6705491868494fb3b78139dad23f35cd99f12c7 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Tue, 1 Nov 2011 16:04:14 -0700 Subject: [PATCH 01/30] move from exercise.sh to exercises/.. --- exercises/euca.sh | 37 ++++++++++++++++++++++++ exercise.sh => exercises/floating_ips.sh | 5 ---- 2 files changed, 37 insertions(+), 5 deletions(-) create mode 100755 exercises/euca.sh rename exercise.sh => exercises/floating_ips.sh (97%) diff --git a/exercises/euca.sh b/exercises/euca.sh new file mode 100755 index 0000000..faeffcf --- /dev/null +++ b/exercises/euca.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# **exercise.sh** - using the cloud can be fun + +# we will use the ``nova`` cli tool provided by the ``python-novaclient`` +# package +# + + +# This script exits on an error so that errors don't compound and you see +# only the first error that occured. +set -o errexit + +# Print the commands being run so that we can see the command that triggers +# an error. It is also useful for following allowing as the install occurs. +set -o xtrace + + +# Settings +# ======== + +# Use openrc + stackrc + localrc for settings +source ./openrc + +# Max time till the vm is bootable +BOOT_TIMEOUT=${BOOT_TIMEOUT:-15} + +IMAGE=`euca-describe-images | grep machine | cut -f2` + +INSTANCE=`euca-run-instance $IMAGE | grep INSTANCE | cut -f2` + +if ! timeout $BOOT_TIMEOUT sh -c "while euca-describe-instances $INSTANCE | grep -q running; do sleep 1; done"; then + echo "server didn't become active within $BOOT_TIMEOUT seconds" + exit 1 +fi + +euca-terminate-instances $INSTANCE diff --git a/exercise.sh b/exercises/floating_ips.sh similarity index 97% rename from exercise.sh rename to exercises/floating_ips.sh index 99b0f3b..06a2cd4 100755 --- a/exercise.sh +++ b/exercises/floating_ips.sh @@ -186,8 +186,3 @@ nova secgroup-delete $SECGROUP # FIXME: validate shutdown within 5 seconds # (nova show $NAME returns 1 or status != ACTIVE)? -# Testing Euca2ools -# ================== - -# make sure that we can describe instances -euca-describe-instances From 9f1863450e71e19bb8ff42e9a7c182c3f5f67c3d Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Tue, 1 Nov 2011 16:05:40 -0700 Subject: [PATCH 02/30] docs --- exercises/euca.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exercises/euca.sh b/exercises/euca.sh index faeffcf..fc81af8 100755 --- a/exercises/euca.sh +++ b/exercises/euca.sh @@ -1,12 +1,9 @@ #!/usr/bin/env bash -# **exercise.sh** - using the cloud can be fun - -# we will use the ``nova`` cli tool provided by the ``python-novaclient`` -# package +# we will use the ``euca2ools`` cli tool that wraps the python boto +# library to test ec2 compatibility # - # This script exits on an error so that errors don't compound and you see # only the first error that occured. set -o errexit @@ -25,10 +22,13 @@ source ./openrc # Max time till the vm is bootable BOOT_TIMEOUT=${BOOT_TIMEOUT:-15} +# find a machine image to boot IMAGE=`euca-describe-images | grep machine | cut -f2` +# launch it INSTANCE=`euca-run-instance $IMAGE | grep INSTANCE | cut -f2` +# assure it has booted within a reasonable time if ! timeout $BOOT_TIMEOUT sh -c "while euca-describe-instances $INSTANCE | grep -q running; do sleep 1; done"; then echo "server didn't become active within $BOOT_TIMEOUT seconds" exit 1 From 787af01bddbaace8f83c65c273da6a62a9658a06 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Tue, 1 Nov 2011 16:44:19 -0700 Subject: [PATCH 03/30] fix sourcing of openrc --- exercises/euca.sh | 2 ++ exercises/floating_ips.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/exercises/euca.sh b/exercises/euca.sh index fc81af8..0cb5fea 100755 --- a/exercises/euca.sh +++ b/exercises/euca.sh @@ -17,7 +17,9 @@ set -o xtrace # ======== # Use openrc + stackrc + localrc for settings +pushd $(cd $(dirname "$0")/.. && pwd) source ./openrc +popd # Max time till the vm is bootable BOOT_TIMEOUT=${BOOT_TIMEOUT:-15} diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh index 06a2cd4..edf784c 100755 --- a/exercises/floating_ips.sh +++ b/exercises/floating_ips.sh @@ -20,7 +20,9 @@ set -o xtrace # ======== # Use openrc + stackrc + localrc for settings +pushd $(cd $(dirname "$0")/.. && pwd) source ./openrc +popd # Get a token for clients that don't support service catalog # ========================================================== From 2599b3165ad35c9c62b5bfa543c03f2a3aecb4cd Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Fri, 4 Nov 2011 10:31:37 -0400 Subject: [PATCH 04/30] Wrap exercises with master script, with logs, and move common variables. --- exercise.sh | 24 ++++++++++++++++++++++++ exercises/euca.sh | 3 --- exercises/floating_ips.sh | 9 --------- openrc | 8 ++++++++ 4 files changed, 32 insertions(+), 12 deletions(-) create mode 100755 exercise.sh diff --git a/exercise.sh b/exercise.sh new file mode 100755 index 0000000..de906f2 --- /dev/null +++ b/exercise.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# Run everything in the exercises/ directory that isn't explicitly disabled + +# comma separated list of script basenames to skip +# to refrain from exercising euca.sh use SKIP_EXERCISES=euca +SKIP_EXERCISES=${SKIP_EXERCISES:-""} + +EXERCISE_DIR=$(dirname "$0")/exercises +basenames=$(for b in `ls $EXERCISE_DIR/*.sh` ; do basename $b .sh ; done) + +for script in $basenames ; do + if [[ "$SKIP_EXERCISES" =~ $script ]] ; then + echo SKIPPING $script + else + echo Running $script + $EXERCISE_DIR/$script.sh 2> $script.log + if [[ $? -ne 0 ]] ; then + echo FAILED. See $script.log + else + rm $script.log + fi + fi +done diff --git a/exercises/euca.sh b/exercises/euca.sh index 0cb5fea..0d48c93 100755 --- a/exercises/euca.sh +++ b/exercises/euca.sh @@ -21,9 +21,6 @@ pushd $(cd $(dirname "$0")/.. && pwd) source ./openrc popd -# Max time till the vm is bootable -BOOT_TIMEOUT=${BOOT_TIMEOUT:-15} - # find a machine image to boot IMAGE=`euca-describe-images | grep machine | cut -f2` diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh index edf784c..5c38430 100755 --- a/exercises/floating_ips.sh +++ b/exercises/floating_ips.sh @@ -84,15 +84,6 @@ nova boot --flavor $FLAVOR --image $IMAGE $NAME --security_groups=$SECGROUP # Waiting for boot # ---------------- -# Max time to wait while vm goes from build to active state -ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-10} - -# Max time till the vm is bootable -BOOT_TIMEOUT=${BOOT_TIMEOUT:-15} - -# Max time to wait for proper association and dis-association. -ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-10} - # check that the status is active within ACTIVE_TIMEOUT seconds if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova show $NAME | grep status | grep -q ACTIVE; do sleep 1; done"; then echo "server didn't become active!" diff --git a/openrc b/openrc index 324780b..db1a7d1 100644 --- a/openrc +++ b/openrc @@ -49,3 +49,11 @@ export EC2_SECRET_KEY=${ADMIN_PASSWORD:-secrete} # set log level to DEBUG (helps debug issues) # export NOVACLIENT_DEBUG=1 +# Max time till the vm is bootable +export BOOT_TIMEOUT=${BOOT_TIMEOUT:-15} + +# Max time to wait while vm goes from build to active state +export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-10} + +# Max time to wait for proper IP association and dis-association. +export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-10} From 9e9132ddaf77a4b858352e827da29ce214a6848d Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Fri, 4 Nov 2011 12:09:54 -0400 Subject: [PATCH 05/30] Exercises: euca bugfix, output cleanup. Don't log stderr per-exercise, because stdout is barfy anyway. Move the state of skip/pass/fail to the end of the exercise run. --- exercise.sh | 30 ++++++++++++++++++++++++++---- exercises/euca.sh | 2 +- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/exercise.sh b/exercise.sh index de906f2..d776385 100755 --- a/exercise.sh +++ b/exercise.sh @@ -6,19 +6,41 @@ # to refrain from exercising euca.sh use SKIP_EXERCISES=euca SKIP_EXERCISES=${SKIP_EXERCISES:-""} +# Locate the scripts we should run EXERCISE_DIR=$(dirname "$0")/exercises basenames=$(for b in `ls $EXERCISE_DIR/*.sh` ; do basename $b .sh ; done) +# Track the state of each script +passes="" +failures="" +skips="" + +# Loop over each possible script (by basename) for script in $basenames ; do if [[ "$SKIP_EXERCISES" =~ $script ]] ; then - echo SKIPPING $script + skips="$skips $script" else + echo ========================= echo Running $script - $EXERCISE_DIR/$script.sh 2> $script.log + echo ========================= + $EXERCISE_DIR/$script.sh if [[ $? -ne 0 ]] ; then - echo FAILED. See $script.log + failures="$failures $script" else - rm $script.log + passes="$passes $script" fi fi done + +# output status of exercise run +echo ========================= +echo ========================= +for script in $skips ; do + echo SKIP $script +done +for script in $passes ; do + echo PASS $script +done +for script in $failures ; do + echo FAILED $script +done diff --git a/exercises/euca.sh b/exercises/euca.sh index 0d48c93..bf6910d 100755 --- a/exercises/euca.sh +++ b/exercises/euca.sh @@ -25,7 +25,7 @@ popd IMAGE=`euca-describe-images | grep machine | cut -f2` # launch it -INSTANCE=`euca-run-instance $IMAGE | grep INSTANCE | cut -f2` +INSTANCE=`euca-run-instances $IMAGE | grep INSTANCE | cut -f2` # assure it has booted within a reasonable time if ! timeout $BOOT_TIMEOUT sh -c "while euca-describe-instances $INSTANCE | grep -q running; do sleep 1; done"; then From 3e6ec236f01abaf80fe7dc8db73ecbfdf3532e89 Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Fri, 4 Nov 2011 12:23:35 -0400 Subject: [PATCH 06/30] Pull in swift testing from master. --- exercises/swift.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 exercises/swift.sh diff --git a/exercises/swift.sh b/exercises/swift.sh new file mode 100644 index 0000000..f7be099 --- /dev/null +++ b/exercises/swift.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# Test swift via the command line tools that ship with it. + +# This script exits on an error so that errors don't compound and you see +# only the first error that occured. +set -o errexit + +# Print the commands being run so that we can see the command that triggers +# an error. It is also useful for following allowing as the install occurs. +set -o xtrace + + +# Settings +# ======== + +# Use openrc + stackrc + localrc for settings +pushd $(cd $(dirname "$0")/.. && pwd) +source ./openrc +popd + + +# Testing Swift +# ============= + +# Check if we have to swift via keystone +swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD stat + +# We start by creating a test container +swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD post testcontainer + +# add some files into it. +swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD upload testcontainer /etc/issue + +# list them +swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD list testcontainer + +# And we may want to delete them now that we have tested that +# everything works. +swift --auth-version 2 -A http://${HOST_IP}:5000/v2.0 -U admin -K $ADMIN_PASSWORD delete testcontainer From 0367cf1585eb7359a6bc741aab06dc3a3750575a Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Sat, 5 Nov 2011 10:46:56 -0400 Subject: [PATCH 07/30] remove spacicolons. --- exercise.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exercise.sh b/exercise.sh index d776385..7703f40 100755 --- a/exercise.sh +++ b/exercise.sh @@ -8,7 +8,7 @@ SKIP_EXERCISES=${SKIP_EXERCISES:-""} # Locate the scripts we should run EXERCISE_DIR=$(dirname "$0")/exercises -basenames=$(for b in `ls $EXERCISE_DIR/*.sh` ; do basename $b .sh ; done) +basenames=$(for b in `ls $EXERCISE_DIR/*.sh`; do basename $b .sh; done) # Track the state of each script passes="" @@ -16,7 +16,7 @@ failures="" skips="" # Loop over each possible script (by basename) -for script in $basenames ; do +for script in $basenames; do if [[ "$SKIP_EXERCISES" =~ $script ]] ; then skips="$skips $script" else @@ -35,12 +35,12 @@ done # output status of exercise run echo ========================= echo ========================= -for script in $skips ; do +for script in $skips; do echo SKIP $script done -for script in $passes ; do +for script in $passes; do echo PASS $script done -for script in $failures ; do +for script in $failures; do echo FAILED $script done From 9a3066f9fd4efae4ec838a673fe1517554e0e531 Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Sat, 5 Nov 2011 11:02:34 -0400 Subject: [PATCH 08/30] RUNNING_TIMEOUT = BOOT_TIMEOUT + ACTIVE_TIMEOUT --- exercises/euca.sh | 4 ++-- openrc | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/exercises/euca.sh b/exercises/euca.sh index bf6910d..9605ace 100755 --- a/exercises/euca.sh +++ b/exercises/euca.sh @@ -28,8 +28,8 @@ IMAGE=`euca-describe-images | grep machine | cut -f2` INSTANCE=`euca-run-instances $IMAGE | grep INSTANCE | cut -f2` # assure it has booted within a reasonable time -if ! timeout $BOOT_TIMEOUT sh -c "while euca-describe-instances $INSTANCE | grep -q running; do sleep 1; done"; then - echo "server didn't become active within $BOOT_TIMEOUT seconds" +if ! timeout $RUNNING_TIMEOUT sh -c "while euca-describe-instances $INSTANCE | grep -q running; do sleep 1; done"; then + echo "server didn't become active within $RUNNING_TIMEOUT seconds" exit 1 fi diff --git a/openrc b/openrc index db1a7d1..4b36112 100644 --- a/openrc +++ b/openrc @@ -55,5 +55,8 @@ export BOOT_TIMEOUT=${BOOT_TIMEOUT:-15} # Max time to wait while vm goes from build to active state export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-10} +# Max time from run instance command until it is running +export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))} + # Max time to wait for proper IP association and dis-association. export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-10} From 8957fead2e17766ebecf293189a6ad65675d0690 Mon Sep 17 00:00:00 2001 From: Jay Pipes Date: Mon, 7 Nov 2011 14:06:15 -0500 Subject: [PATCH 09/30] Comment out log_file options in glance configs Comment out log_file options in glance config files to make log output appear in g-api and g-reg screen windows, like the other server daemons... --- files/glance-api.conf | 2 +- files/glance-registry.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/glance-api.conf b/files/glance-api.conf index 3499ff7..bb758af 100644 --- a/files/glance-api.conf +++ b/files/glance-api.conf @@ -24,7 +24,7 @@ registry_port = 9191 # Log to this file. Make sure you do not set the same log # file for both the API and registry servers! -log_file = %DEST%/glance/api.log +#log_file = %DEST%/glance/api.log # Send logs to syslog (/dev/log) instead of to file specified by `log_file` use_syslog = %SYSLOG% diff --git a/files/glance-registry.conf b/files/glance-registry.conf index 351b09f..1e04186 100644 --- a/files/glance-registry.conf +++ b/files/glance-registry.conf @@ -13,7 +13,7 @@ bind_port = 9191 # Log to this file. Make sure you do not set the same log # file for both the API and registry servers! -log_file = %DEST%/glance/registry.log +#log_file = %DEST%/glance/registry.log # Where to store images filesystem_store_datadir = %DEST%/glance/images From e7fa90934d3d0f1dc0a89fbf6f498e927f041d39 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 7 Nov 2011 16:10:59 -0600 Subject: [PATCH 10/30] script to warm apts/pips on a base image, to speed up performace of build_ scripts --- tools/warm_apts_and_pips.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tools/warm_apts_and_pips.sh diff --git a/tools/warm_apts_and_pips.sh b/tools/warm_apts_and_pips.sh new file mode 100644 index 0000000..c0b02b9 --- /dev/null +++ b/tools/warm_apts_and_pips.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# Keep track of the current directory +TOOLS_DIR=$(cd $(dirname "$0") && pwd) +TOP_DIR=`cd $TOOLS_DIR/..; pwd` + +# cd to top of devstack +cd $TOP_DIR + +# Echo usage +usage() { + echo "Cache OpenStack dependencies on a uec image to speed up performance." + echo "" + echo "Usage: $0 [full path to raw uec base image]" +} + +# Make sure this is a raw image +if ! qemu-img info $1 | grep -q "file format: raw"; then + usage + exit 1 +fi + +# Mount the image +STAGING_DIR=`mktemp -d uec.XXXXXXXXXX` +mkdir -p $STAGING_DIR +mount -t ext4 -o loop $1 $STAGING_DIR + +# Make sure that base requirements are installed +cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf + +# Perform caching on the base image to speed up subsequent runs +chroot $STAGING_DIR apt-get update +chroot $STAGING_DIR apt-get install -y --download-only `cat files/apts/* | grep NOPRIME | cut -d\# -f1` +chroot $STAGING_DIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1` +chroot $STAGING_DIR pip install `cat files/pips/*` +umount $STAGING_DIR && rm -rf $STAGING_DIR From 069f2f7a534b8ace5e9a6e68143c7951b65d4046 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 7 Nov 2011 16:13:03 -0600 Subject: [PATCH 11/30] +x --- tools/warm_apts_and_pips.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tools/warm_apts_and_pips.sh diff --git a/tools/warm_apts_and_pips.sh b/tools/warm_apts_and_pips.sh old mode 100644 new mode 100755 From 8655bf0e6efdd3d87a5ed149be2ee5e3aa8473db Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 7 Nov 2011 16:37:00 -0600 Subject: [PATCH 12/30] more checks to make sure script is run as intended --- tools/warm_apts_and_pips.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/warm_apts_and_pips.sh b/tools/warm_apts_and_pips.sh index c0b02b9..b20519f 100755 --- a/tools/warm_apts_and_pips.sh +++ b/tools/warm_apts_and_pips.sh @@ -1,5 +1,11 @@ #!/usr/bin/env bash +# echo commands +set -o xtrace + +# exit on error to stop unexpected errors +set -o errexit + # Keep track of the current directory TOOLS_DIR=$(cd $(dirname "$0") && pwd) TOP_DIR=`cd $TOOLS_DIR/..; pwd` @@ -20,6 +26,12 @@ if ! qemu-img info $1 | grep -q "file format: raw"; then exit 1 fi +# Make sure we are in the correct dir +if [ ! -d files/apts ]; then + echo "Please run this script from devstack/tools/" + exit 1 +fi + # Mount the image STAGING_DIR=`mktemp -d uec.XXXXXXXXXX` mkdir -p $STAGING_DIR From 208ae2f6aa0bf5dbc669c6fd4f2e4649c04ed039 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 7 Nov 2011 16:38:03 -0600 Subject: [PATCH 13/30] fix some comments --- tools/warm_apts_and_pips.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/warm_apts_and_pips.sh b/tools/warm_apts_and_pips.sh index b20519f..10bd4af 100755 --- a/tools/warm_apts_and_pips.sh +++ b/tools/warm_apts_and_pips.sh @@ -1,16 +1,16 @@ #!/usr/bin/env bash -# echo commands +# Echo commands set -o xtrace -# exit on error to stop unexpected errors +# Exit on error to stop unexpected errors set -o errexit # Keep track of the current directory TOOLS_DIR=$(cd $(dirname "$0") && pwd) TOP_DIR=`cd $TOOLS_DIR/..; pwd` -# cd to top of devstack +# Change dir to top of devstack cd $TOP_DIR # Echo usage From 7e436c212ea2ac7fe60bddedf49548729675111e Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Wed, 9 Nov 2011 00:12:00 -0800 Subject: [PATCH 14/30] use dhcp_release --- files/apts/nova | 1 + stack.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/files/apts/nova b/files/apts/nova index 405d53b..9eefed7 100644 --- a/files/apts/nova +++ b/files/apts/nova @@ -1,4 +1,5 @@ dnsmasq-base +dnsmasq-utils # for dhcp_release kpartx parted arping # used for send_arp_for_ha option in nova-network diff --git a/stack.sh b/stack.sh index 841cbb4..78851b9 100755 --- a/stack.sh +++ b/stack.sh @@ -826,6 +826,7 @@ add_nova_flag "--ec2_dmz_host=$EC2_DMZ_HOST" add_nova_flag "--rabbit_host=$RABBIT_HOST" add_nova_flag "--rabbit_password=$RABBIT_PASSWORD" add_nova_flag "--glance_api_servers=$GLANCE_HOSTPORT" +add_nova_flag "--force_dhcp_release" if [ -n "$INSTANCES_PATH" ]; then add_nova_flag "--instances_path=$INSTANCES_PATH" fi From e28f77565d0dd214db5fa01bdea41c88e52dbafc Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Wed, 9 Nov 2011 11:48:09 -0800 Subject: [PATCH 15/30] install cloud-utils, so that we have resize-part-image --- tools/build_uec.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/build_uec.sh b/tools/build_uec.sh index 6bab526..a15a18a 100755 --- a/tools/build_uec.sh +++ b/tools/build_uec.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -# Make sure that we have the proper version of ubuntu (only works on natty/oneiric) -if ! egrep -q "oneiric|natty" /etc/lsb-release; then +# Make sure that we have the proper version of ubuntu (only works on oneiric) +if ! egrep -q "oneiric" /etc/lsb-release; then echo "This script only works with ubuntu oneiric and natty" exit 1 fi @@ -33,7 +33,7 @@ if [ ! -e $TOP_DIR/localrc ]; then fi # Install deps if needed -DEPS="kvm libvirt-bin kpartx" +DEPS="kvm libvirt-bin kpartx cloud-utils" dpkg -l $DEPS || apt-get install -y --force-yes $DEPS # Where to store files and instances From 5605ec11446d70e466f4ff0a4a50292b8c3f633f Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Wed, 9 Nov 2011 12:40:01 -0800 Subject: [PATCH 16/30] now that we are using apt-get download this file doesn't speed things up that much --- files/apts/preseed | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 files/apts/preseed diff --git a/files/apts/preseed b/files/apts/preseed deleted file mode 100644 index 8712d5d..0000000 --- a/files/apts/preseed +++ /dev/null @@ -1,18 +0,0 @@ -# a collection of packages that speed up installation as they are dependencies -# of packages we can't install during bootstraping (rabbitmq-server, -# mysql-server, libvirt-bin) -# -# NOTE: only add packages to this file that aren't needed directly -mysql-common -mysql-client-5.1 -erlang-base -erlang-ssl -erlang-nox -erlang-inets -erlang-mnesia -libhtml-template-perl -gettext-base -libavahi-client3 -libxml2-utils -libpciaccess0 -libparted0debian1 From 593e9aa87a2f81b4e1ff03ca8b8ee1789164890b Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Wed, 9 Nov 2011 12:42:08 -0800 Subject: [PATCH 17/30] fix message - no natty support --- tools/build_uec.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build_uec.sh b/tools/build_uec.sh index a15a18a..d57cb29 100755 --- a/tools/build_uec.sh +++ b/tools/build_uec.sh @@ -2,7 +2,7 @@ # Make sure that we have the proper version of ubuntu (only works on oneiric) if ! egrep -q "oneiric" /etc/lsb-release; then - echo "This script only works with ubuntu oneiric and natty" + echo "This script only works with ubuntu oneiric." exit 1 fi From c1024d8987a9b35ef41f5a5615f9827d4b4e4468 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Wed, 9 Nov 2011 18:58:07 -0800 Subject: [PATCH 18/30] tweaks to warm script, add script to configure stack user --- tools/setup_stack_user.sh | 66 +++++++++++++++++++++++++++++++++++++ tools/warm_apts_and_pips.sh | 11 ++++--- 2 files changed, 73 insertions(+), 4 deletions(-) create mode 100755 tools/setup_stack_user.sh diff --git a/tools/setup_stack_user.sh b/tools/setup_stack_user.sh new file mode 100755 index 0000000..85d418e --- /dev/null +++ b/tools/setup_stack_user.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash + +# Echo commands +set -o xtrace + +# Exit on error to stop unexpected errors +set -o errexit + +# Keep track of the current directory +TOOLS_DIR=$(cd $(dirname "$0") && pwd) +TOP_DIR=`cd $TOOLS_DIR/..; pwd` + +# Change dir to top of devstack +cd $TOP_DIR + +# Echo usage +usage() { + echo "Add stack user and keys" + echo "" + echo "Usage: $0 [full path to raw uec base image]" +} + +# Make sure this is a raw image +if ! qemu-img info $1 | grep -q "file format: raw"; then + usage + exit 1 +fi + +# Mount the image +DEST=/opt/stack +STAGING_DIR=/tmp/`echo $1 | sed "s/\//_/g"`.stage.user +mkdir -p $STAGING_DIR +umount $STAGING_DIR || true +sleep 1 +mount -t ext4 -o loop $1 $STAGING_DIR +mkdir -p $STAGING_DIR/$DEST + +# Create a stack user that is a member of the libvirtd group so that stack +# is able to interact with libvirt. +chroot $STAGING_DIR groupadd libvirtd || true +chroot $STAGING_DIR useradd stack -s /bin/bash -d $DEST -G libvirtd || true + +# a simple password - pass +echo stack:pass | chroot $STAGING_DIR chpasswd + +# and has sudo ability (in the future this should be limited to only what +# stack requires) +echo "stack ALL=(ALL) NOPASSWD: ALL" >> $STAGING_DIR/etc/sudoers + +# Gracefully cp only if source file/dir exists +function cp_it { + if [ -e $1 ] || [ -d $1 ]; then + cp -pRL $1 $2 + fi +} + +# Copy over your ssh keys and env if desired +cp_it ~/.ssh $STAGING_DIR/$DEST/.ssh +cp_it ~/.ssh/id_rsa.pub $STAGING_DIR/$DEST/.ssh/authorized_keys +cp_it ~/.gitconfig $STAGING_DIR/$DEST/.gitconfig +cp_it ~/.vimrc $STAGING_DIR/$DEST/.vimrc +cp_it ~/.bashrc $STAGING_DIR/$DEST/.bashrc + +# Give stack ownership over $DEST so it may do the work needed +chroot $STAGING_DIR chown -R stack $DEST + diff --git a/tools/warm_apts_and_pips.sh b/tools/warm_apts_and_pips.sh index 10bd4af..854a938 100755 --- a/tools/warm_apts_and_pips.sh +++ b/tools/warm_apts_and_pips.sh @@ -33,8 +33,10 @@ if [ ! -d files/apts ]; then fi # Mount the image -STAGING_DIR=`mktemp -d uec.XXXXXXXXXX` +STAGING_DIR=/tmp/`echo $1 | sed "s/\//_/g"`.stage mkdir -p $STAGING_DIR +umount $STAGING_DIR || true +sleep 1 mount -t ext4 -o loop $1 $STAGING_DIR # Make sure that base requirements are installed @@ -43,6 +45,7 @@ cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf # Perform caching on the base image to speed up subsequent runs chroot $STAGING_DIR apt-get update chroot $STAGING_DIR apt-get install -y --download-only `cat files/apts/* | grep NOPRIME | cut -d\# -f1` -chroot $STAGING_DIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1` -chroot $STAGING_DIR pip install `cat files/pips/*` -umount $STAGING_DIR && rm -rf $STAGING_DIR +chroot $STAGING_DIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1` || true +mkdir -p $STAGING_DIR/var/cache/pip +PIP_DOWNLOAD_CACHE=/var/cache/pip chroot $STAGING_DIR pip install `cat files/pips/*` || true +umount $STAGING_DIR From e228093ecda9300428a399600758580eff3b44fe Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Wed, 9 Nov 2011 22:29:22 -0800 Subject: [PATCH 19/30] some cleanup for utility scripts --- tools/setup_stack_user.sh | 10 +++++++++- tools/warm_apts_and_pips.sh | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/setup_stack_user.sh b/tools/setup_stack_user.sh index 85d418e..231a20f 100755 --- a/tools/setup_stack_user.sh +++ b/tools/setup_stack_user.sh @@ -40,9 +40,15 @@ mkdir -p $STAGING_DIR/$DEST chroot $STAGING_DIR groupadd libvirtd || true chroot $STAGING_DIR useradd stack -s /bin/bash -d $DEST -G libvirtd || true -# a simple password - pass +# Add a simple password - pass echo stack:pass | chroot $STAGING_DIR chpasswd +# Configure sudo +grep -q "^#includedir.*/etc/sudoers.d" $STAGING_DIR/etc/sudoers || + echo "#includedir /etc/sudoers.d" | sudo tee -a $STAGING_DIR/etc/sudoers +cp $TOP_DIR/files/sudo/* $STAGING_DIR/etc/sudoers.d/ +sed -e "s,%USER%,$USER,g" -i $STAGING_DIR/etc/sudoers.d/* + # and has sudo ability (in the future this should be limited to only what # stack requires) echo "stack ALL=(ALL) NOPASSWD: ALL" >> $STAGING_DIR/etc/sudoers @@ -64,3 +70,5 @@ cp_it ~/.bashrc $STAGING_DIR/$DEST/.bashrc # Give stack ownership over $DEST so it may do the work needed chroot $STAGING_DIR chown -R stack $DEST +# Unmount +umount $STAGING_DIR diff --git a/tools/warm_apts_and_pips.sh b/tools/warm_apts_and_pips.sh index 854a938..ec7e916 100755 --- a/tools/warm_apts_and_pips.sh +++ b/tools/warm_apts_and_pips.sh @@ -48,4 +48,6 @@ chroot $STAGING_DIR apt-get install -y --download-only `cat files/apts/* | grep chroot $STAGING_DIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1` || true mkdir -p $STAGING_DIR/var/cache/pip PIP_DOWNLOAD_CACHE=/var/cache/pip chroot $STAGING_DIR pip install `cat files/pips/*` || true + +# Unmount umount $STAGING_DIR From ce1b4a24da7bf149e9a5551bde2e754565b945d2 Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Thu, 10 Nov 2011 19:36:14 +0100 Subject: [PATCH 20/30] Admin group is Member. This is not the admin group per-se but the group where users can create/delete containers. This is will be fixed properly when the swift-keystone2 middleware would be commited in keystone (should be sometime soon). --- files/swift/proxy-server.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/files/swift/proxy-server.conf b/files/swift/proxy-server.conf index fe7e39b..2db6d32 100644 --- a/files/swift/proxy-server.conf +++ b/files/swift/proxy-server.conf @@ -16,6 +16,7 @@ account_autocreate = true use = egg:swiftkeystone2#keystone2 keystone_admin_token = %SERVICE_TOKEN% keystone_url = http://localhost:35357/v2.0 +keystone_admin_group = Member [filter:tempauth] use = egg:swift#tempauth From 904b0d7d1d3fa68b940c82da5cedd171408f71ae Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Thu, 10 Nov 2011 19:44:58 +0100 Subject: [PATCH 21/30] Install memcached with swift+keystone midleware. --- stack.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stack.sh b/stack.sh index 78851b9..5e22be9 100755 --- a/stack.sh +++ b/stack.sh @@ -704,6 +704,11 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then # configured keystone it will checkout the directory. if [[ "$ENABLED_SERVICES" =~ "key" ]]; then swift_auth_server=keystone + + # We install the memcache server as this is will be used by the + # middleware to cache the tokens auths for a long this is needed. + apt_get install memcached + # We need a special version of bin/swift which understand the # OpenStack api 2.0, we download it until this is getting # integrated in swift. From b74b74a2b321adfc976590a58685b6a506e5db64 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Thu, 10 Nov 2011 11:47:34 -0800 Subject: [PATCH 22/30] permissions --- exercises/floating_ips.sh | 0 exercises/swift.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 exercises/floating_ips.sh mode change 100644 => 100755 exercises/swift.sh diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh old mode 100644 new mode 100755 diff --git a/exercises/swift.sh b/exercises/swift.sh old mode 100644 new mode 100755 From 2f2160eac2be76d778abe1c8d85147799f7186cc Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Thu, 10 Nov 2011 23:46:08 +0100 Subject: [PATCH 23/30] Force creation of the symlink. It would allow to not fail when we run stack.sh again. --- stack.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack.sh b/stack.sh index 78851b9..2577d14 100755 --- a/stack.sh +++ b/stack.sh @@ -691,7 +691,7 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then # swift-init has a bug using /etc/swift until bug #885595 is fixed # we have to create a link - sudo ln -s ${SWIFT_CONFIG_LOCATION} /etc/swift + sudo ln -sf ${SWIFT_CONFIG_LOCATION} /etc/swift # Swift use rsync to syncronize between all the different # partitions (which make more sense when you have a multi-node From ec74eef1870112478a2593bcaa622efbc260bd94 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Fri, 11 Nov 2011 13:51:55 -0800 Subject: [PATCH 24/30] build pxe env tweaks --- tools/{build_pxe_boot.sh => build_pxe_env.sh} | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) rename tools/{build_pxe_boot.sh => build_pxe_env.sh} (93%) diff --git a/tools/build_pxe_boot.sh b/tools/build_pxe_env.sh similarity index 93% rename from tools/build_pxe_boot.sh rename to tools/build_pxe_env.sh index ab64098..1ab51f8 100755 --- a/tools/build_pxe_boot.sh +++ b/tools/build_pxe_env.sh @@ -1,11 +1,14 @@ #!/bin/bash -e -# build_pxe_boot.sh - Create a PXE boot environment +# build_pxe_env.sh - Create a PXE boot environment # -# build_pxe_boot.sh destdir +# build_pxe_env.sh destdir +# +# Requires Ubuntu Oneiric # -# Assumes syslinux is installed # Only needs to run as root if the destdir permissions require it +dpkg -l syslinux || apt-get install -y syslinux + DEST_DIR=${1:-/tmp}/tftpboot PXEDIR=${PXEDIR:-/var/cache/devstack/pxe} OPWD=`pwd` From 2679303c89334cbd0c79cd143e22c807788fcde3 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Fri, 11 Nov 2011 13:56:29 -0800 Subject: [PATCH 25/30] build_uec requires libvirt --- tools/build_uec.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build_uec.sh b/tools/build_uec.sh index d57cb29..80373dc 100755 --- a/tools/build_uec.sh +++ b/tools/build_uec.sh @@ -33,7 +33,7 @@ if [ ! -e $TOP_DIR/localrc ]; then fi # Install deps if needed -DEPS="kvm libvirt-bin kpartx cloud-utils" +DEPS="kvm libvirt-bin kpartx cloud-utils curl" dpkg -l $DEPS || apt-get install -y --force-yes $DEPS # Where to store files and instances From c20428241ad8f6d034436b1bc3507d5e56b28631 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Fri, 11 Nov 2011 13:59:05 -0800 Subject: [PATCH 26/30] always check deps --- tools/build_uec.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build_uec.sh b/tools/build_uec.sh index 80373dc..d95ba77 100755 --- a/tools/build_uec.sh +++ b/tools/build_uec.sh @@ -34,7 +34,7 @@ fi # Install deps if needed DEPS="kvm libvirt-bin kpartx cloud-utils curl" -dpkg -l $DEPS || apt-get install -y --force-yes $DEPS +apt-get install -y --force-yes $DEPS # Where to store files and instances WORK_DIR=${WORK_DIR:-/opt/kvmstack} From d02b7b7bd36115f66521d90079b1660210063def Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Mon, 14 Nov 2011 08:59:05 -0800 Subject: [PATCH 27/30] allow name of volumes group to be set --- stack.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/stack.sh b/stack.sh index 1c51fbc..967dd7c 100755 --- a/stack.sh +++ b/stack.sh @@ -159,6 +159,9 @@ Q_PLUGIN=${Q_PLUGIN:-openvswitch} # Specify which services to launch. These generally correspond to screen tabs ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,horizon,mysql,rabbit} +# Name of the lvm volume group to use/create for iscsi volumes +VOLUME_GROUP=${VOLUME_GROUP:-nova-volumes} + # Nova hypervisor configuration. We default to libvirt whth **kvm** but will # drop back to **qemu** if we are unable to load the kvm module. Stack.sh can # also install an **LXC** based system. @@ -783,12 +786,12 @@ if [[ "$ENABLED_SERVICES" =~ "n-vol" ]]; then # # By default, the backing file is 2G in size, and is stored in /opt/stack. # - if ! sudo vgdisplay | grep -q nova-volumes; then + if ! sudo vgdisplay | grep -q $VOLUME_GROUP; then VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE:-$DEST/nova-volumes-backing-file} VOLUME_BACKING_FILE_SIZE=${VOLUME_BACKING_FILE_SIZE:-2052M} truncate -s $VOLUME_BACKING_FILE_SIZE $VOLUME_BACKING_FILE DEV=`sudo losetup -f --show $VOLUME_BACKING_FILE` - sudo vgcreate nova-volumes $DEV + sudo vgcreate $VOLUME_GROUP $DEV fi # Configure iscsitarget @@ -817,6 +820,9 @@ if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then else add_nova_flag "--network_manager=nova.network.manager.$NET_MAN" fi +if [[ "$ENABLED_SERVICES" =~ "n-vol" ]]; then + add_nova_flag "--volume_group=$VOLUME_GROUP" +fi add_nova_flag "--my_ip=$HOST_IP" add_nova_flag "--public_interface=$PUBLIC_INTERFACE" add_nova_flag "--vlan_interface=$VLAN_INTERFACE" From 1f7011926406fde7462132281d3b281e54a872c8 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Mon, 14 Nov 2011 09:48:29 -0800 Subject: [PATCH 28/30] need iscsitarget-dkms for iscsi to work on oneiric --- files/apts/nova | 1 + 1 file changed, 1 insertion(+) diff --git a/files/apts/nova b/files/apts/nova index 9eefed7..77622a8 100644 --- a/files/apts/nova +++ b/files/apts/nova @@ -39,4 +39,5 @@ python-boto # Stuff for diablo volumes iscsitarget +iscsitarget-dkms lvm2 From 9bb1a3c5c55af00f27ea986bcdfc676ce9a6bdd5 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Mon, 14 Nov 2011 10:05:56 -0800 Subject: [PATCH 29/30] allow pip to use mirrors (pypi is down) --- stack.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack.sh b/stack.sh index 967dd7c..4c378ff 100755 --- a/stack.sh +++ b/stack.sh @@ -371,7 +371,7 @@ apt_get update apt_get install `cat $FILES/apts/* | cut -d\# -f1 | grep -Ev "mysql-server|rabbitmq-server|memcached"` # install python requirements -sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install `cat $FILES/pips/*` +sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install --use-mirrors `cat $FILES/pips/*` # 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 From 6b8855cd4f7143e9d7e489bb57c008be9b84fc8c Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Mon, 14 Nov 2011 10:51:17 -0800 Subject: [PATCH 30/30] Fix the reclone to actually remove *.pyc --- stack.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack.sh b/stack.sh index 841cbb4..2b6980f 100755 --- a/stack.sh +++ b/stack.sh @@ -394,7 +394,7 @@ function git_clone { # remove the existing ignored files (like pyc) as they cause breakage # (due to the py files having older timestamps than our pyc, so python # thinks the pyc files are correct using them) - sudo git clean -f -d + find $GIT_DEST -name '*.pyc' -delete git checkout -f origin/$GIT_BRANCH # a local branch might not exist git branch -D $GIT_BRANCH || true