Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Load local configuration |
| 4 | source ./stackrc |
| 5 | |
Anthony Young | 1097c7c | 2011-12-27 23:22:14 -0800 | [diff] [blame] | 6 | # Set api HOST_IP endpoint. SERVICE_HOST may also be used to specify the endpoint, |
| 7 | # which is convenient for some localrc configurations. |
Jesse Andrews | f75d848 | 2011-10-24 13:38:52 -0700 | [diff] [blame] | 8 | HOST_IP=${HOST_IP:-127.0.0.1} |
Anthony Young | 1097c7c | 2011-12-27 23:22:14 -0800 | [diff] [blame] | 9 | SERVICE_HOST=${SERVICE_HOST:-$HOST_IP} |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 10 | |
Adam Gandelman | ce05e03 | 2012-01-30 14:43:14 -0800 | [diff] [blame^] | 11 | # Some exercises call glance directly. On a single-node installation, Glance |
| 12 | # should be listening on HOST_IP. If its running elsewhere, it can be set here |
| 13 | GLANCE_HOST=${GLANCE_HOST:-$HOST_IP} |
| 14 | |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 15 | # Nova original used project_id as the *account* that owned resources (servers, |
| 16 | # ip address, ...) With the addition of Keystone we have standardized on the |
| 17 | # term **tenant** as the entity that owns the resources. **novaclient** still |
| 18 | # uses the old deprecated terms project_id. Note that this field should now be |
| 19 | # set to tenant_name, not tenant_id. |
| 20 | export NOVA_PROJECT_ID=${TENANT:-demo} |
| 21 | |
| 22 | # In addition to the owning entity (tenant), nova stores the entity performing |
| 23 | # the action as the **user**. |
| 24 | export NOVA_USERNAME=${USERNAME:-demo} |
| 25 | |
| 26 | # With Keystone you pass the keystone password instead of an api key. |
Jesse Andrews | 38df122 | 2011-11-20 09:55:44 -0800 | [diff] [blame] | 27 | # The most recent versions of novaclient use NOVA_PASSWORD instead of NOVA_API_KEY |
| 28 | export NOVA_PASSWORD=${ADMIN_PASSWORD:-secrete} |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 29 | |
Anthony Young | d4ddf3d | 2011-10-20 11:37:53 -0700 | [diff] [blame] | 30 | # With the addition of Keystone, to use an openstack cloud you should |
| 31 | # authenticate against keystone, which returns a **Token** and **Service |
| 32 | # Catalog**. The catalog contains the endpoint for all services the user/tenant |
| 33 | # has access to - including nova, glance, keystone, swift, ... We currently |
| 34 | # recommend using the 2.0 *auth api*. |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 35 | # |
Vishvananda Ishaya | f56e395 | 2011-10-24 16:05:57 -0700 | [diff] [blame] | 36 | # *NOTE*: Using the 2.0 *auth api* does not mean that compute api is 2.0. We |
Jesse Andrews | 9c85373 | 2011-10-21 19:05:40 -0700 | [diff] [blame] | 37 | # will use the 1.1 *compute api* |
Anthony Young | 1097c7c | 2011-12-27 23:22:14 -0800 | [diff] [blame] | 38 | export NOVA_URL=${NOVA_URL:-http://$SERVICE_HOST:5000/v2.0/} |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 39 | |
| 40 | # Currently novaclient needs you to specify the *compute api* version. This |
| 41 | # needs to match the config of your catalog returned by Keystone. |
Anthony Young | d81ed03 | 2011-10-20 13:09:39 -0700 | [diff] [blame] | 42 | export NOVA_VERSION=${NOVA_VERSION:-1.1} |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 43 | |
| 44 | # FIXME - why does this need to be specified? |
Anthony Young | d81ed03 | 2011-10-20 13:09:39 -0700 | [diff] [blame] | 45 | export NOVA_REGION_NAME=${NOVA_REGION_NAME:-RegionOne} |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 46 | |
Vishvananda Ishaya | f56e395 | 2011-10-24 16:05:57 -0700 | [diff] [blame] | 47 | # Set the ec2 url so euca2ools works |
Anthony Young | 1097c7c | 2011-12-27 23:22:14 -0800 | [diff] [blame] | 48 | export EC2_URL=${EC2_URL:-http://$SERVICE_HOST:8773/services/Cloud} |
Vishvananda Ishaya | f56e395 | 2011-10-24 16:05:57 -0700 | [diff] [blame] | 49 | |
| 50 | # Access key is set in the initial keystone data to be the same as username |
| 51 | export EC2_ACCESS_KEY=${USERNAME:-demo} |
| 52 | |
| 53 | # Secret key is set in the initial keystone data to the admin password |
| 54 | export EC2_SECRET_KEY=${ADMIN_PASSWORD:-secrete} |
| 55 | |
Vishvananda Ishaya | 75bbd75 | 2012-01-19 23:28:46 +0000 | [diff] [blame] | 56 | # Euca2ools Certificate stuff for uploading bundles |
| 57 | # You can get your certs using ./tools/get_certs.sh |
| 58 | NOVARC=$(readlink -f "${BASH_SOURCE:-${0}}" 2>/dev/null) || |
| 59 | NOVARC=$(python -c 'import os,sys; print os.path.abspath(os.path.realpath(sys.argv[1]))' "${BASH_SOURCE:-${0}}") |
| 60 | NOVA_KEY_DIR=${NOVARC%/*} |
| 61 | export S3_URL=http://$SERVICE_HOST:3333 |
| 62 | export EC2_USER_ID=42 # nova does not use user id, but bundling requires it |
| 63 | export EC2_PRIVATE_KEY=${NOVA_KEY_DIR}/pk.pem |
| 64 | export EC2_CERT=${NOVA_KEY_DIR}/cert.pem |
| 65 | export NOVA_CERT=${NOVA_KEY_DIR}/cacert.pem |
| 66 | export EUCALYPTUS_CERT=${NOVA_CERT} # euca-bundle-image seems to require this set |
| 67 | alias ec2-bundle-image="ec2-bundle-image --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}" |
| 68 | alias ec2-upload-bundle="ec2-upload-bundle -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}" |
| 69 | |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 70 | # set log level to DEBUG (helps debug issues) |
Jesse Andrews | f1bfba2 | 2011-10-24 10:56:10 -0700 | [diff] [blame] | 71 | # export NOVACLIENT_DEBUG=1 |
Vishvananda Ishaya | f56e395 | 2011-10-24 16:05:57 -0700 | [diff] [blame] | 72 | |
Todd Willey | 2599b31 | 2011-11-04 10:31:37 -0400 | [diff] [blame] | 73 | # Max time till the vm is bootable |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 74 | export BOOT_TIMEOUT=${BOOT_TIMEOUT:-30} |
Todd Willey | 2599b31 | 2011-11-04 10:31:37 -0400 | [diff] [blame] | 75 | |
| 76 | # Max time to wait while vm goes from build to active state |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 77 | export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30} |
Todd Willey | 2599b31 | 2011-11-04 10:31:37 -0400 | [diff] [blame] | 78 | |
Todd Willey | 9a3066f | 2011-11-05 11:02:34 -0400 | [diff] [blame] | 79 | # Max time from run instance command until it is running |
| 80 | export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))} |
| 81 | |
Todd Willey | 2599b31 | 2011-11-04 10:31:37 -0400 | [diff] [blame] | 82 | # Max time to wait for proper IP association and dis-association. |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 83 | export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15} |