diff --git a/exercises/bundle.sh b/exercises/bundle.sh new file mode 100755 index 0000000000..ca35c9afa3 --- /dev/null +++ b/exercises/bundle.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +# 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 + +# 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 + +# Remove old certificates +rm -f cacert.pem +rm -f cert.pem +rm -f pk.pem + +# Get Certificates +nova x509-get-root-cert +nova x509-create-cert +popd + +# Max time to wait for image to be registered +REGISTER_TIMEOUT=${REGISTER_TIMEOUT:-15} + +BUCKET=testbucket +IMAGE=bundle.img +truncate -s 5M /tmp/$IMAGE +euca-bundle-image -i /tmp/$IMAGE + + +euca-upload-bundle -b $BUCKET -m /tmp/$IMAGE.manifest.xml +AMI=`euca-register $BUCKET/$IMAGE.manifest.xml | cut -f2` + +# Wait for the image to become available +if ! timeout $REGISTER_TIMEOUT sh -c "while euca-describe-images | grep '$AMI' | grep 'available'; do sleep 1; done"; then + echo "Image $AMI not available within $REGISTER_TIMEOUT seconds" + exit 1 +fi diff --git a/openrc b/openrc index 0f327d26d7..9c94141356 100644 --- a/openrc +++ b/openrc @@ -49,6 +49,20 @@ export EC2_ACCESS_KEY=${USERNAME:-demo} # Secret key is set in the initial keystone data to the admin password export EC2_SECRET_KEY=${ADMIN_PASSWORD:-secrete} +# Euca2ools Certificate stuff for uploading bundles +# You can get your certs using ./tools/get_certs.sh +NOVARC=$(readlink -f "${BASH_SOURCE:-${0}}" 2>/dev/null) || + NOVARC=$(python -c 'import os,sys; print os.path.abspath(os.path.realpath(sys.argv[1]))' "${BASH_SOURCE:-${0}}") +NOVA_KEY_DIR=${NOVARC%/*} +export S3_URL=http://$SERVICE_HOST:3333 +export EC2_USER_ID=42 # nova does not use user id, but bundling requires it +export EC2_PRIVATE_KEY=${NOVA_KEY_DIR}/pk.pem +export EC2_CERT=${NOVA_KEY_DIR}/cert.pem +export NOVA_CERT=${NOVA_KEY_DIR}/cacert.pem +export EUCALYPTUS_CERT=${NOVA_CERT} # euca-bundle-image seems to require this set +alias ec2-bundle-image="ec2-bundle-image --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}" +alias ec2-upload-bundle="ec2-upload-bundle -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}" + # set log level to DEBUG (helps debug issues) # export NOVACLIENT_DEBUG=1 diff --git a/stack.sh b/stack.sh index d6a786961b..32813a9b63 100755 --- a/stack.sh +++ b/stack.sh @@ -193,7 +193,7 @@ Q_PORT=${Q_PORT:-9696} Q_HOST=${Q_HOST:-localhost} # 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-novnc,n-xvnc,n-cauth,horizon,mysql,rabbit,openstackx} +ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-sch,n-novnc,n-xvnc,n-cauth,horizon,mysql,rabbit,openstackx} # Name of the lvm volume group to use/create for iscsi volumes VOLUME_GROUP=${VOLUME_GROUP:-nova-volumes} @@ -1143,6 +1143,9 @@ add_nova_flag "--allow_admin_api" add_nova_flag "--scheduler_driver=$SCHEDULER" add_nova_flag "--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf" add_nova_flag "--fixed_range=$FIXED_RANGE" +if [[ "$ENABLED_SERVICES" =~ "n-obj" ]]; then + add_nova_flag "--s3_host=$SERVICE_HOST" +fi if [[ "$ENABLED_SERVICES" =~ "quantum" ]]; then add_nova_flag "--network_manager=nova.network.quantum.manager.QuantumManager" add_nova_flag "--quantum_connection_host=$Q_HOST" @@ -1418,6 +1421,8 @@ fi # within the context of our original shell (so our groups won't be updated). # Use 'sg' to execute nova-compute as a member of the libvirtd group. screen_it n-cpu "cd $NOVA_DIR && sg libvirtd $NOVA_DIR/bin/nova-compute" +screen_it n-crt "cd $NOVA_DIR && $NOVA_DIR/bin/nova-cert" +screen_it n-obj "cd $NOVA_DIR && $NOVA_DIR/bin/nova-objectstore" screen_it n-vol "cd $NOVA_DIR && $NOVA_DIR/bin/nova-volume" screen_it n-net "cd $NOVA_DIR && $NOVA_DIR/bin/nova-network" screen_it n-sch "cd $NOVA_DIR && $NOVA_DIR/bin/nova-scheduler"