* modifies stack.sh to run nova-cert and nova-objectstore
* adds exercises/bundle.sh to test for bundling
* requires https://review.openstack.org/#change,3200
Change-Id: I850891948fbdfdf5890225f94df755e5dbc733d0
| 1 | 1 |
new file mode 100755 |
| ... | ... |
@@ -0,0 +1,48 @@ |
| 0 |
+#!/usr/bin/env bash |
|
| 1 |
+ |
|
| 2 |
+# we will use the ``euca2ools`` cli tool that wraps the python boto |
|
| 3 |
+# library to test ec2 compatibility |
|
| 4 |
+# |
|
| 5 |
+ |
|
| 6 |
+# This script exits on an error so that errors don't compound and you see |
|
| 7 |
+# only the first error that occured. |
|
| 8 |
+set -o errexit |
|
| 9 |
+ |
|
| 10 |
+# Print the commands being run so that we can see the command that triggers |
|
| 11 |
+# an error. It is also useful for following allowing as the install occurs. |
|
| 12 |
+set -o xtrace |
|
| 13 |
+ |
|
| 14 |
+# Settings |
|
| 15 |
+# ======== |
|
| 16 |
+ |
|
| 17 |
+# Use openrc + stackrc + localrc for settings |
|
| 18 |
+pushd $(cd $(dirname "$0")/.. && pwd) |
|
| 19 |
+source ./openrc |
|
| 20 |
+ |
|
| 21 |
+# Remove old certificates |
|
| 22 |
+rm -f cacert.pem |
|
| 23 |
+rm -f cert.pem |
|
| 24 |
+rm -f pk.pem |
|
| 25 |
+ |
|
| 26 |
+# Get Certificates |
|
| 27 |
+nova x509-get-root-cert |
|
| 28 |
+nova x509-create-cert |
|
| 29 |
+popd |
|
| 30 |
+ |
|
| 31 |
+# Max time to wait for image to be registered |
|
| 32 |
+REGISTER_TIMEOUT=${REGISTER_TIMEOUT:-15}
|
|
| 33 |
+ |
|
| 34 |
+BUCKET=testbucket |
|
| 35 |
+IMAGE=bundle.img |
|
| 36 |
+truncate -s 5M /tmp/$IMAGE |
|
| 37 |
+euca-bundle-image -i /tmp/$IMAGE |
|
| 38 |
+ |
|
| 39 |
+ |
|
| 40 |
+euca-upload-bundle -b $BUCKET -m /tmp/$IMAGE.manifest.xml |
|
| 41 |
+AMI=`euca-register $BUCKET/$IMAGE.manifest.xml | cut -f2` |
|
| 42 |
+ |
|
| 43 |
+# Wait for the image to become available |
|
| 44 |
+if ! timeout $REGISTER_TIMEOUT sh -c "while euca-describe-images | grep '$AMI' | grep 'available'; do sleep 1; done"; then |
|
| 45 |
+ echo "Image $AMI not available within $REGISTER_TIMEOUT seconds" |
|
| 46 |
+ exit 1 |
|
| 47 |
+fi |
| ... | ... |
@@ -49,6 +49,20 @@ export EC2_ACCESS_KEY=${USERNAME:-demo}
|
| 49 | 49 |
# Secret key is set in the initial keystone data to the admin password |
| 50 | 50 |
export EC2_SECRET_KEY=${ADMIN_PASSWORD:-secrete}
|
| 51 | 51 |
|
| 52 |
+# Euca2ools Certificate stuff for uploading bundles |
|
| 53 |
+# You can get your certs using ./tools/get_certs.sh |
|
| 54 |
+NOVARC=$(readlink -f "${BASH_SOURCE:-${0}}" 2>/dev/null) ||
|
|
| 55 |
+ NOVARC=$(python -c 'import os,sys; print os.path.abspath(os.path.realpath(sys.argv[1]))' "${BASH_SOURCE:-${0}}")
|
|
| 56 |
+NOVA_KEY_DIR=${NOVARC%/*}
|
|
| 57 |
+export S3_URL=http://$SERVICE_HOST:3333 |
|
| 58 |
+export EC2_USER_ID=42 # nova does not use user id, but bundling requires it |
|
| 59 |
+export EC2_PRIVATE_KEY=${NOVA_KEY_DIR}/pk.pem
|
|
| 60 |
+export EC2_CERT=${NOVA_KEY_DIR}/cert.pem
|
|
| 61 |
+export NOVA_CERT=${NOVA_KEY_DIR}/cacert.pem
|
|
| 62 |
+export EUCALYPTUS_CERT=${NOVA_CERT} # euca-bundle-image seems to require this set
|
|
| 63 |
+alias ec2-bundle-image="ec2-bundle-image --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}"
|
|
| 64 |
+alias ec2-upload-bundle="ec2-upload-bundle -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}"
|
|
| 65 |
+ |
|
| 52 | 66 |
# set log level to DEBUG (helps debug issues) |
| 53 | 67 |
# export NOVACLIENT_DEBUG=1 |
| 54 | 68 |
|
| ... | ... |
@@ -193,7 +193,7 @@ Q_PORT=${Q_PORT:-9696}
|
| 193 | 193 |
Q_HOST=${Q_HOST:-localhost}
|
| 194 | 194 |
|
| 195 | 195 |
# Specify which services to launch. These generally correspond to screen tabs |
| 196 |
-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}
|
|
| 196 |
+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}
|
|
| 197 | 197 |
|
| 198 | 198 |
# Name of the lvm volume group to use/create for iscsi volumes |
| 199 | 199 |
VOLUME_GROUP=${VOLUME_GROUP:-nova-volumes}
|
| ... | ... |
@@ -1143,6 +1143,9 @@ add_nova_flag "--allow_admin_api" |
| 1143 | 1143 |
add_nova_flag "--scheduler_driver=$SCHEDULER" |
| 1144 | 1144 |
add_nova_flag "--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf" |
| 1145 | 1145 |
add_nova_flag "--fixed_range=$FIXED_RANGE" |
| 1146 |
+if [[ "$ENABLED_SERVICES" =~ "n-obj" ]]; then |
|
| 1147 |
+ add_nova_flag "--s3_host=$SERVICE_HOST" |
|
| 1148 |
+fi |
|
| 1146 | 1149 |
if [[ "$ENABLED_SERVICES" =~ "quantum" ]]; then |
| 1147 | 1150 |
add_nova_flag "--network_manager=nova.network.quantum.manager.QuantumManager" |
| 1148 | 1151 |
add_nova_flag "--quantum_connection_host=$Q_HOST" |
| ... | ... |
@@ -1418,6 +1421,8 @@ fi |
| 1418 | 1418 |
# within the context of our original shell (so our groups won't be updated). |
| 1419 | 1419 |
# Use 'sg' to execute nova-compute as a member of the libvirtd group. |
| 1420 | 1420 |
screen_it n-cpu "cd $NOVA_DIR && sg libvirtd $NOVA_DIR/bin/nova-compute" |
| 1421 |
+screen_it n-crt "cd $NOVA_DIR && $NOVA_DIR/bin/nova-cert" |
|
| 1422 |
+screen_it n-obj "cd $NOVA_DIR && $NOVA_DIR/bin/nova-objectstore" |
|
| 1421 | 1423 |
screen_it n-vol "cd $NOVA_DIR && $NOVA_DIR/bin/nova-volume" |
| 1422 | 1424 |
screen_it n-net "cd $NOVA_DIR && $NOVA_DIR/bin/nova-network" |
| 1423 | 1425 |
screen_it n-sch "cd $NOVA_DIR && $NOVA_DIR/bin/nova-scheduler" |