Browse code

Merge "Allow euca-upload-bundle to work with devstack"

Jenkins authored on 2012/01/26 10:22:31
Showing 3 changed files
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
 
... ...
@@ -194,7 +194,7 @@ Q_PORT=${Q_PORT:-9696}
194 194
 Q_HOST=${Q_HOST:-localhost}
195 195
 
196 196
 # Specify which services to launch.  These generally correspond to screen tabs
197
-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}
197
+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}
198 198
 
199 199
 # Name of the lvm volume group to use/create for iscsi volumes
200 200
 VOLUME_GROUP=${VOLUME_GROUP:-nova-volumes}
... ...
@@ -1153,6 +1153,9 @@ add_nova_flag "--allow_admin_api"
1153 1153
 add_nova_flag "--scheduler_driver=$SCHEDULER"
1154 1154
 add_nova_flag "--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf"
1155 1155
 add_nova_flag "--fixed_range=$FIXED_RANGE"
1156
+if [[ "$ENABLED_SERVICES" =~ "n-obj" ]]; then
1157
+    add_nova_flag "--s3_host=$SERVICE_HOST"
1158
+fi
1156 1159
 if [[ "$ENABLED_SERVICES" =~ "quantum" ]]; then
1157 1160
     add_nova_flag "--network_manager=nova.network.quantum.manager.QuantumManager"
1158 1161
     add_nova_flag "--quantum_connection_host=$Q_HOST"
... ...
@@ -1428,6 +1431,8 @@ fi
1428 1428
 # within the context of our original shell (so our groups won't be updated).
1429 1429
 # Use 'sg' to execute nova-compute as a member of the libvirtd group.
1430 1430
 screen_it n-cpu "cd $NOVA_DIR && sg libvirtd $NOVA_DIR/bin/nova-compute"
1431
+screen_it n-crt "cd $NOVA_DIR && $NOVA_DIR/bin/nova-cert"
1432
+screen_it n-obj "cd $NOVA_DIR && $NOVA_DIR/bin/nova-objectstore"
1431 1433
 screen_it n-vol "cd $NOVA_DIR && $NOVA_DIR/bin/nova-volume"
1432 1434
 screen_it n-net "cd $NOVA_DIR && $NOVA_DIR/bin/nova-network"
1433 1435
 screen_it n-sch "cd $NOVA_DIR && $NOVA_DIR/bin/nova-scheduler"