blob: d9e7c92e49befb96ba1cf79aeec4009a3809031c [file] [log] [blame]
Anthony Young6ab10d42011-10-20 10:24:50 -07001#!/usr/bin/env bash
Dean Troyer4807df82012-02-24 10:44:18 -06002#
3# source openrc [username] [tenantname]
4#
5# Configure a set of credentials for $TENANT/$USERNAME:
6# Set TENANT to override the default tenant 'demo'
7# Set USERNAME to override the default user name 'demo'
8# Set ADMIN_PASSWORD to set the password for 'admin' and 'demo'
9
10# NOTE: support for the old NOVA_* novaclient environment variables has
11# been removed.
12
13if [[ -n "$1" ]]; then
14 USERNAME=$1
15fi
16if [[ -n "$2" ]]; then
17 TENANT=$2
18fi
Anthony Young6ab10d42011-10-20 10:24:50 -070019
20# Load local configuration
21source ./stackrc
22
Dean Troyer4807df82012-02-24 10:44:18 -060023# The introduction of Keystone to the OpenStack ecosystem has standardized the
24# term **tenant** as the entity that owns resources. In some places references
25# still exist to the original Nova term **project** for this use. Also,
26# **tenant_name** is prefered to **tenant_id**.
27export OS_TENANT_NAME=${TENANT:-demo}
28
29# In addition to the owning entity (tenant), nova stores the entity performing
30# the action as the **user**.
31export OS_USERNAME=${USERNAME:-demo}
32
33# With Keystone you pass the keystone password instead of an api key.
34# Recent versions of novaclient use OS_PASSWORD instead of NOVA_API_KEYs
35# or NOVA_PASSWORD.
36export OS_PASSWORD=${ADMIN_PASSWORD:-secrete}
37
Anthony Young1097c7c2011-12-27 23:22:14 -080038# Set api HOST_IP endpoint. SERVICE_HOST may also be used to specify the endpoint,
39# which is convenient for some localrc configurations.
Jesse Andrewsf75d8482011-10-24 13:38:52 -070040HOST_IP=${HOST_IP:-127.0.0.1}
Anthony Young1097c7c2011-12-27 23:22:14 -080041SERVICE_HOST=${SERVICE_HOST:-$HOST_IP}
Anthony Young6ab10d42011-10-20 10:24:50 -070042
Adam Gandelmance05e032012-01-30 14:43:14 -080043# Some exercises call glance directly. On a single-node installation, Glance
44# should be listening on HOST_IP. If its running elsewhere, it can be set here
45GLANCE_HOST=${GLANCE_HOST:-$HOST_IP}
46
Dean Troyer4807df82012-02-24 10:44:18 -060047# Authenticating against an Openstack cloud using Keystone returns a **Token**
48# and **Service Catalog**. The catalog contains the endpoints for all services
49# the user/tenant has access to - including nova, glance, keystone, swift, ...
50# We currently recommend using the 2.0 *identity api*.
Anthony Young6ab10d42011-10-20 10:24:50 -070051#
Dean Troyer4807df82012-02-24 10:44:18 -060052# *NOTE*: Using the 2.0 *identity api* does not mean that compute api is 2.0. We
Jesse Andrews9c853732011-10-21 19:05:40 -070053# will use the 1.1 *compute api*
Dean Troyer4807df82012-02-24 10:44:18 -060054export OS_AUTH_URL=http://$SERVICE_HOST:5000/v2.0
Anthony Young6ab10d42011-10-20 10:24:50 -070055
56# Currently novaclient needs you to specify the *compute api* version. This
57# needs to match the config of your catalog returned by Keystone.
Anthony Youngd81ed032011-10-20 13:09:39 -070058export NOVA_VERSION=${NOVA_VERSION:-1.1}
Dean Troyer4807df82012-02-24 10:44:18 -060059# In the future this will change names:
60export COMPUTE_API_VERSION=${COMPUTE_API_VERSION:-$NOVA_VERSION}
Anthony Young6ab10d42011-10-20 10:24:50 -070061
Vishvananda Ishayaf56e3952011-10-24 16:05:57 -070062# Set the ec2 url so euca2ools works
Anthony Young1097c7c2011-12-27 23:22:14 -080063export EC2_URL=${EC2_URL:-http://$SERVICE_HOST:8773/services/Cloud}
Vishvananda Ishayaf56e3952011-10-24 16:05:57 -070064
65# Access key is set in the initial keystone data to be the same as username
Vishvananda Ishaya658ac7a2012-02-06 22:56:37 +000066export EC2_ACCESS_KEY=${DEMO_ACCESS}
Vishvananda Ishayaf56e3952011-10-24 16:05:57 -070067
68# Secret key is set in the initial keystone data to the admin password
Vishvananda Ishaya658ac7a2012-02-06 22:56:37 +000069export EC2_SECRET_KEY=${DEMO_SECRET}
Vishvananda Ishayaf56e3952011-10-24 16:05:57 -070070
Vishvananda Ishaya75bbd752012-01-19 23:28:46 +000071# Euca2ools Certificate stuff for uploading bundles
Vishvananda Ishaya112a3602012-02-26 17:14:58 -080072# See exercises/bundle.sh to see how to get certs using nova cli
Vishvananda Ishaya75bbd752012-01-19 23:28:46 +000073NOVARC=$(readlink -f "${BASH_SOURCE:-${0}}" 2>/dev/null) ||
74 NOVARC=$(python -c 'import os,sys; print os.path.abspath(os.path.realpath(sys.argv[1]))' "${BASH_SOURCE:-${0}}")
75NOVA_KEY_DIR=${NOVARC%/*}
76export S3_URL=http://$SERVICE_HOST:3333
77export EC2_USER_ID=42 # nova does not use user id, but bundling requires it
78export EC2_PRIVATE_KEY=${NOVA_KEY_DIR}/pk.pem
79export EC2_CERT=${NOVA_KEY_DIR}/cert.pem
80export NOVA_CERT=${NOVA_KEY_DIR}/cacert.pem
81export EUCALYPTUS_CERT=${NOVA_CERT} # euca-bundle-image seems to require this set
82alias ec2-bundle-image="ec2-bundle-image --cert ${EC2_CERT} --privatekey ${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}"
83alias ec2-upload-bundle="ec2-upload-bundle -a ${EC2_ACCESS_KEY} -s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}"
84
Anthony Young6ab10d42011-10-20 10:24:50 -070085# set log level to DEBUG (helps debug issues)
Jesse Andrewsf1bfba22011-10-24 10:56:10 -070086# export NOVACLIENT_DEBUG=1
Vishvananda Ishayaf56e3952011-10-24 16:05:57 -070087
Todd Willey2599b312011-11-04 10:31:37 -040088# Max time till the vm is bootable
Dean Troyer751c1522012-01-10 15:34:34 -060089export BOOT_TIMEOUT=${BOOT_TIMEOUT:-30}
Todd Willey2599b312011-11-04 10:31:37 -040090
91# Max time to wait while vm goes from build to active state
Dean Troyer751c1522012-01-10 15:34:34 -060092export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30}
Todd Willey2599b312011-11-04 10:31:37 -040093
Todd Willey9a3066f2011-11-05 11:02:34 -040094# Max time from run instance command until it is running
95export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))}
96
Todd Willey2599b312011-11-04 10:31:37 -040097# Max time to wait for proper IP association and dis-association.
Dean Troyer751c1522012-01-10 15:34:34 -060098export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
Russell Bryant243b26a2012-02-22 11:19:32 -050099
100# Max time to wait for a vm to terminate
101export TERMINATE_TIMEOUT=${TERMINATE_TIMEOUT:-30}