blob: 9b3d7ba8e74867cd96b5b0d5190c6e83f68bbc1c [file] [log] [blame]
Anthony Young6ab10d42011-10-20 10:24:50 -07001#!/usr/bin/env bash
2
3# Load local configuration
4source ./stackrc
5
Anthony Young1097c7c2011-12-27 23:22:14 -08006# Set api HOST_IP endpoint. SERVICE_HOST may also be used to specify the endpoint,
7# which is convenient for some localrc configurations.
Jesse Andrewsf75d8482011-10-24 13:38:52 -07008HOST_IP=${HOST_IP:-127.0.0.1}
Anthony Young1097c7c2011-12-27 23:22:14 -08009SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
Anthony Young6ab10d42011-10-20 10:24:50 -070010
Adam Gandelmance05e032012-01-30 14:43:14 -080011# 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
13GLANCE_HOST=${GLANCE_HOST:-$HOST_IP}
14
Dean Troyer10670d12012-01-24 11:26:15 -060015# novaclient now supports the new OS_* configuration variables in addition to
16# the older NOVA_* variables. Set them both for now...
17
Anthony Young6ab10d42011-10-20 10:24:50 -070018# 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.
23export NOVA_PROJECT_ID=${TENANT:-demo}
Dean Troyer10670d12012-01-24 11:26:15 -060024export OS_TENANT_NAME=${NOVA_PROJECT_ID}
Anthony Young6ab10d42011-10-20 10:24:50 -070025
26# In addition to the owning entity (tenant), nova stores the entity performing
27# the action as the **user**.
28export NOVA_USERNAME=${USERNAME:-demo}
Dean Troyer10670d12012-01-24 11:26:15 -060029export OS_USERNAME=${NOVA_USERNAME}
Anthony Young6ab10d42011-10-20 10:24:50 -070030
31# With Keystone you pass the keystone password instead of an api key.
Dean Troyer10670d12012-01-24 11:26:15 -060032# 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 Andrews38df1222011-11-20 09:55:44 -080034export NOVA_PASSWORD=${ADMIN_PASSWORD:-secrete}
Dean Troyer10670d12012-01-24 11:26:15 -060035export OS_PASSWORD=${NOVA_PASSWORD}
Anthony Young6ab10d42011-10-20 10:24:50 -070036
Anthony Youngd4ddf3d2011-10-20 11:37:53 -070037# 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 Young6ab10d42011-10-20 10:24:50 -070042#
Vishvananda Ishayaf56e3952011-10-24 16:05:57 -070043# *NOTE*: Using the 2.0 *auth api* does not mean that compute api is 2.0. We
Jesse Andrews9c853732011-10-21 19:05:40 -070044# will use the 1.1 *compute api*
Vishvananda Ishayad1f52432012-02-09 03:50:57 +000045export NOVA_URL=${NOVA_URL:-http://$SERVICE_HOST:5000/v2.0}
Dean Troyer10670d12012-01-24 11:26:15 -060046export OS_AUTH_URL=${NOVA_URL}
Anthony Young6ab10d42011-10-20 10:24:50 -070047
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 Youngd81ed032011-10-20 13:09:39 -070050export NOVA_VERSION=${NOVA_VERSION:-1.1}
Anthony Young6ab10d42011-10-20 10:24:50 -070051
52# FIXME - why does this need to be specified?
Anthony Youngd81ed032011-10-20 13:09:39 -070053export NOVA_REGION_NAME=${NOVA_REGION_NAME:-RegionOne}
Anthony Young6ab10d42011-10-20 10:24:50 -070054
Vishvananda Ishayaf56e3952011-10-24 16:05:57 -070055# Set the ec2 url so euca2ools works
Anthony Young1097c7c2011-12-27 23:22:14 -080056export EC2_URL=${EC2_URL:-http://$SERVICE_HOST:8773/services/Cloud}
Vishvananda Ishayaf56e3952011-10-24 16:05:57 -070057
58# Access key is set in the initial keystone data to be the same as username
Vishvananda Ishaya658ac7a2012-02-06 22:56:37 +000059export EC2_ACCESS_KEY=${DEMO_ACCESS}
Vishvananda Ishayaf56e3952011-10-24 16:05:57 -070060
61# Secret key is set in the initial keystone data to the admin password
Vishvananda Ishaya658ac7a2012-02-06 22:56:37 +000062export EC2_SECRET_KEY=${DEMO_SECRET}
Vishvananda Ishayaf56e3952011-10-24 16:05:57 -070063
Vishvananda Ishaya75bbd752012-01-19 23:28:46 +000064# Euca2ools Certificate stuff for uploading bundles
Vishvananda Ishaya112a3602012-02-26 17:14:58 -080065# See exercises/bundle.sh to see how to get certs using nova cli
Vishvananda Ishaya75bbd752012-01-19 23:28:46 +000066NOVARC=$(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}}")
68NOVA_KEY_DIR=${NOVARC%/*}
69export S3_URL=http://$SERVICE_HOST:3333
70export EC2_USER_ID=42 # nova does not use user id, but bundling requires it
71export EC2_PRIVATE_KEY=${NOVA_KEY_DIR}/pk.pem
72export EC2_CERT=${NOVA_KEY_DIR}/cert.pem
73export NOVA_CERT=${NOVA_KEY_DIR}/cacert.pem
74export EUCALYPTUS_CERT=${NOVA_CERT} # euca-bundle-image seems to require this set
75alias ec2-bundle-image="ec2-bundle-image --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}"
76alias ec2-upload-bundle="ec2-upload-bundle -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}"
77
Anthony Young6ab10d42011-10-20 10:24:50 -070078# set log level to DEBUG (helps debug issues)
Jesse Andrewsf1bfba22011-10-24 10:56:10 -070079# export NOVACLIENT_DEBUG=1
Vishvananda Ishayaf56e3952011-10-24 16:05:57 -070080
Todd Willey2599b312011-11-04 10:31:37 -040081# Max time till the vm is bootable
Dean Troyer751c1522012-01-10 15:34:34 -060082export BOOT_TIMEOUT=${BOOT_TIMEOUT:-30}
Todd Willey2599b312011-11-04 10:31:37 -040083
84# Max time to wait while vm goes from build to active state
Dean Troyer751c1522012-01-10 15:34:34 -060085export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30}
Todd Willey2599b312011-11-04 10:31:37 -040086
Todd Willey9a3066f2011-11-05 11:02:34 -040087# Max time from run instance command until it is running
88export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))}
89
Todd Willey2599b312011-11-04 10:31:37 -040090# Max time to wait for proper IP association and dis-association.
Dean Troyer751c1522012-01-10 15:34:34 -060091export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
Russell Bryant243b26a2012-02-22 11:19:32 -050092
93# Max time to wait for a vm to terminate
94export TERMINATE_TIMEOUT=${TERMINATE_TIMEOUT:-30}