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 | |
Dean Troyer | 10670d1 | 2012-01-24 11:26:15 -0600 | [diff] [blame] | 15 | # novaclient now supports the new OS_* configuration variables in addition to |
| 16 | # the older NOVA_* variables. Set them both for now... |
| 17 | |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 18 | # Nova original used project_id as the *account* that owned resources (servers, |
| 19 | # ip address, ...) With the addition of Keystone we have standardized on the |
| 20 | # term **tenant** as the entity that owns the resources. **novaclient** still |
| 21 | # uses the old deprecated terms project_id. Note that this field should now be |
| 22 | # set to tenant_name, not tenant_id. |
| 23 | export NOVA_PROJECT_ID=${TENANT:-demo} |
Dean Troyer | 10670d1 | 2012-01-24 11:26:15 -0600 | [diff] [blame] | 24 | export OS_TENANT_NAME=${NOVA_PROJECT_ID} |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 25 | |
| 26 | # In addition to the owning entity (tenant), nova stores the entity performing |
| 27 | # the action as the **user**. |
| 28 | export NOVA_USERNAME=${USERNAME:-demo} |
Dean Troyer | 10670d1 | 2012-01-24 11:26:15 -0600 | [diff] [blame] | 29 | export OS_USERNAME=${NOVA_USERNAME} |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 30 | |
| 31 | # With Keystone you pass the keystone password instead of an api key. |
Dean Troyer | 10670d1 | 2012-01-24 11:26:15 -0600 | [diff] [blame] | 32 | # Recent versions of novaclient use NOVA_PASSWORD instead of NOVA_API_KEY |
| 33 | # The most recent versions of novaclient use OS_PASSWORD in addition to NOVA_PASSWORD |
Jesse Andrews | 38df122 | 2011-11-20 09:55:44 -0800 | [diff] [blame] | 34 | export NOVA_PASSWORD=${ADMIN_PASSWORD:-secrete} |
Dean Troyer | 10670d1 | 2012-01-24 11:26:15 -0600 | [diff] [blame] | 35 | export OS_PASSWORD=${NOVA_PASSWORD} |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 36 | |
Anthony Young | d4ddf3d | 2011-10-20 11:37:53 -0700 | [diff] [blame] | 37 | # With the addition of Keystone, to use an openstack cloud you should |
| 38 | # authenticate against keystone, which returns a **Token** and **Service |
| 39 | # Catalog**. The catalog contains the endpoint for all services the user/tenant |
| 40 | # has access to - including nova, glance, keystone, swift, ... We currently |
| 41 | # recommend using the 2.0 *auth api*. |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 42 | # |
Vishvananda Ishaya | f56e395 | 2011-10-24 16:05:57 -0700 | [diff] [blame] | 43 | # *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] | 44 | # will use the 1.1 *compute api* |
Vishvananda Ishaya | d1f5243 | 2012-02-09 03:50:57 +0000 | [diff] [blame] | 45 | export NOVA_URL=${NOVA_URL:-http://$SERVICE_HOST:5000/v2.0} |
Dean Troyer | 10670d1 | 2012-01-24 11:26:15 -0600 | [diff] [blame] | 46 | export OS_AUTH_URL=${NOVA_URL} |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 47 | |
| 48 | # Currently novaclient needs you to specify the *compute api* version. This |
| 49 | # needs to match the config of your catalog returned by Keystone. |
Anthony Young | d81ed03 | 2011-10-20 13:09:39 -0700 | [diff] [blame] | 50 | export NOVA_VERSION=${NOVA_VERSION:-1.1} |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 51 | |
| 52 | # FIXME - why does this need to be specified? |
Anthony Young | d81ed03 | 2011-10-20 13:09:39 -0700 | [diff] [blame] | 53 | export NOVA_REGION_NAME=${NOVA_REGION_NAME:-RegionOne} |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 54 | |
Vishvananda Ishaya | f56e395 | 2011-10-24 16:05:57 -0700 | [diff] [blame] | 55 | # Set the ec2 url so euca2ools works |
Anthony Young | 1097c7c | 2011-12-27 23:22:14 -0800 | [diff] [blame] | 56 | export EC2_URL=${EC2_URL:-http://$SERVICE_HOST:8773/services/Cloud} |
Vishvananda Ishaya | f56e395 | 2011-10-24 16:05:57 -0700 | [diff] [blame] | 57 | |
| 58 | # Access key is set in the initial keystone data to be the same as username |
Vishvananda Ishaya | 658ac7a | 2012-02-06 22:56:37 +0000 | [diff] [blame] | 59 | export EC2_ACCESS_KEY=${DEMO_ACCESS} |
Vishvananda Ishaya | f56e395 | 2011-10-24 16:05:57 -0700 | [diff] [blame] | 60 | |
| 61 | # Secret key is set in the initial keystone data to the admin password |
Vishvananda Ishaya | 658ac7a | 2012-02-06 22:56:37 +0000 | [diff] [blame] | 62 | export EC2_SECRET_KEY=${DEMO_SECRET} |
Vishvananda Ishaya | f56e395 | 2011-10-24 16:05:57 -0700 | [diff] [blame] | 63 | |
Vishvananda Ishaya | 75bbd75 | 2012-01-19 23:28:46 +0000 | [diff] [blame] | 64 | # Euca2ools Certificate stuff for uploading bundles |
Vishvananda Ishaya | 112a360 | 2012-02-26 17:14:58 -0800 | [diff] [blame^] | 65 | # See exercises/bundle.sh to see how to get certs using nova cli |
Vishvananda Ishaya | 75bbd75 | 2012-01-19 23:28:46 +0000 | [diff] [blame] | 66 | NOVARC=$(readlink -f "${BASH_SOURCE:-${0}}" 2>/dev/null) || |
| 67 | NOVARC=$(python -c 'import os,sys; print os.path.abspath(os.path.realpath(sys.argv[1]))' "${BASH_SOURCE:-${0}}") |
| 68 | NOVA_KEY_DIR=${NOVARC%/*} |
| 69 | export S3_URL=http://$SERVICE_HOST:3333 |
| 70 | export EC2_USER_ID=42 # nova does not use user id, but bundling requires it |
| 71 | export EC2_PRIVATE_KEY=${NOVA_KEY_DIR}/pk.pem |
| 72 | export EC2_CERT=${NOVA_KEY_DIR}/cert.pem |
| 73 | export NOVA_CERT=${NOVA_KEY_DIR}/cacert.pem |
| 74 | export EUCALYPTUS_CERT=${NOVA_CERT} # euca-bundle-image seems to require this set |
| 75 | alias ec2-bundle-image="ec2-bundle-image --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}" |
| 76 | alias ec2-upload-bundle="ec2-upload-bundle -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}" |
| 77 | |
Anthony Young | 6ab10d4 | 2011-10-20 10:24:50 -0700 | [diff] [blame] | 78 | # set log level to DEBUG (helps debug issues) |
Jesse Andrews | f1bfba2 | 2011-10-24 10:56:10 -0700 | [diff] [blame] | 79 | # export NOVACLIENT_DEBUG=1 |
Vishvananda Ishaya | f56e395 | 2011-10-24 16:05:57 -0700 | [diff] [blame] | 80 | |
Todd Willey | 2599b31 | 2011-11-04 10:31:37 -0400 | [diff] [blame] | 81 | # Max time till the vm is bootable |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 82 | export BOOT_TIMEOUT=${BOOT_TIMEOUT:-30} |
Todd Willey | 2599b31 | 2011-11-04 10:31:37 -0400 | [diff] [blame] | 83 | |
| 84 | # Max time to wait while vm goes from build to active state |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 85 | export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30} |
Todd Willey | 2599b31 | 2011-11-04 10:31:37 -0400 | [diff] [blame] | 86 | |
Todd Willey | 9a3066f | 2011-11-05 11:02:34 -0400 | [diff] [blame] | 87 | # Max time from run instance command until it is running |
| 88 | export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))} |
| 89 | |
Todd Willey | 2599b31 | 2011-11-04 10:31:37 -0400 | [diff] [blame] | 90 | # Max time to wait for proper IP association and dis-association. |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 91 | export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15} |
Russell Bryant | 243b26a | 2012-02-22 11:19:32 -0500 | [diff] [blame] | 92 | |
| 93 | # Max time to wait for a vm to terminate |
| 94 | export TERMINATE_TIMEOUT=${TERMINATE_TIMEOUT:-30} |