| 1 | 1 |
new file mode 100755 |
| ... | ... |
@@ -0,0 +1,126 @@ |
| 0 |
+#!/usr/bin/env bash |
|
| 1 |
+# |
|
| 2 |
+# build_ci_config.sh - Build a config.ini for openstack-integration-tests |
|
| 3 |
+# (https://github.com/openstack/openstack-integration-tests) |
|
| 4 |
+ |
|
| 5 |
+function usage {
|
|
| 6 |
+ echo "$0 - Build config.ini for openstack-integration-tests" |
|
| 7 |
+ echo "" |
|
| 8 |
+ echo "Usage: $0 configfile" |
|
| 9 |
+ exit 1 |
|
| 10 |
+} |
|
| 11 |
+ |
|
| 12 |
+if [ ! "$#" -eq "1" ]; then |
|
| 13 |
+ usage |
|
| 14 |
+fi |
|
| 15 |
+ |
|
| 16 |
+CONFIG_FILE=$1 |
|
| 17 |
+ |
|
| 18 |
+# Clean up any resources that may be in use |
|
| 19 |
+cleanup() {
|
|
| 20 |
+ set +o errexit |
|
| 21 |
+ |
|
| 22 |
+ # Mop up temporary files |
|
| 23 |
+ if [ -n "$CONFIG_FILE_TMP" -a -e "$CONFIG_FILE_TMP" ]; then |
|
| 24 |
+ rm -f $CONFIG_FILE_TMP |
|
| 25 |
+ fi |
|
| 26 |
+ |
|
| 27 |
+ # Kill ourselves to signal any calling process |
|
| 28 |
+ trap 2; kill -2 $$ |
|
| 29 |
+} |
|
| 30 |
+ |
|
| 31 |
+trap cleanup SIGHUP SIGINT SIGTERM |
|
| 32 |
+ |
|
| 33 |
+# Keep track of the current directory |
|
| 34 |
+TOOLS_DIR=$(cd $(dirname "$0") && pwd) |
|
| 35 |
+TOP_DIR=`cd $TOOLS_DIR/..; pwd` |
|
| 36 |
+ |
|
| 37 |
+# Abort if localrc is not set |
|
| 38 |
+if [ ! -e $TOP_DIR/localrc ]; then |
|
| 39 |
+ echo "You must have a localrc with ALL necessary passwords and configuration defined before proceeding." |
|
| 40 |
+ echo "See stack.sh for required passwords." |
|
| 41 |
+ exit 1 |
|
| 42 |
+fi |
|
| 43 |
+ |
|
| 44 |
+# Source params |
|
| 45 |
+source ./stackrc |
|
| 46 |
+ |
|
| 47 |
+# Where Openstack code lives |
|
| 48 |
+DEST=${DEST:-/opt/stack}
|
|
| 49 |
+ |
|
| 50 |
+# Process network configuration vars |
|
| 51 |
+GUEST_NETWORK=${GUEST_NETWORK:-1}
|
|
| 52 |
+GUEST_RECREATE_NET=${GUEST_RECREATE_NET:-yes}
|
|
| 53 |
+ |
|
| 54 |
+GUEST_IP=${GUEST_IP:-192.168.$GUEST_NETWORK.50}
|
|
| 55 |
+GUEST_CIDR=${GUEST_CIDR:-$GUEST_IP/24}
|
|
| 56 |
+GUEST_NETMASK=${GUEST_NETMASK:-255.255.255.0}
|
|
| 57 |
+GUEST_GATEWAY=${GUEST_GATEWAY:-192.168.$GUEST_NETWORK.1}
|
|
| 58 |
+GUEST_MAC=${GUEST_MAC:-"02:16:3e:07:69:`printf '%02X' $GUEST_NETWORK`"}
|
|
| 59 |
+GUEST_RAM=${GUEST_RAM:-1524288}
|
|
| 60 |
+GUEST_CORES=${GUEST_CORES:-1}
|
|
| 61 |
+ |
|
| 62 |
+# Use the GUEST_IP unless an explicit IP is set by ``HOST_IP`` |
|
| 63 |
+HOST_IP=${HOST_IP:-$GUEST_IP}
|
|
| 64 |
+# Use the first IP if HOST_IP still is not set |
|
| 65 |
+if [ ! -n "$HOST_IP" ]; then |
|
| 66 |
+ HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
|
|
| 67 |
+fi |
|
| 68 |
+ |
|
| 69 |
+RABBIT_HOST=${RABBIT_HOST:-localhost}
|
|
| 70 |
+ |
|
| 71 |
+# Glance connection info. Note the port must be specified. |
|
| 72 |
+GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292}
|
|
| 73 |
+set `echo $GLANCE_HOSTPORT | tr ':' ' '` |
|
| 74 |
+GLANCE_HOST=$1 |
|
| 75 |
+GLANCE_PORT=$2 |
|
| 76 |
+ |
|
| 77 |
+CONFIG_FILE_TMP=$(mktemp $CONFIG_FILE.XXXXXX) |
|
| 78 |
+cat >$CONFIG_FILE_TMP <<EOF |
|
| 79 |
+[environment] |
|
| 80 |
+aki_location = include/sample_vm/natty-server-cloudimg-amd64-vmlinuz-virtual |
|
| 81 |
+#ari_location = include/sample_vm/natty-server-cloudimg-amd64-loader |
|
| 82 |
+ami_location = include/sample_vm/natty-server-cloudimg-amd64.img |
|
| 83 |
+ |
|
| 84 |
+[glance] |
|
| 85 |
+host = $GLANCE_HOST |
|
| 86 |
+apiver = v1.0 |
|
| 87 |
+port = $GLANCE_PORT |
|
| 88 |
+image_id = 1 |
|
| 89 |
+ |
|
| 90 |
+[keystone] |
|
| 91 |
+service_host = $HOST_IP |
|
| 92 |
+service_port = 5000 |
|
| 93 |
+apiver = v1.1 |
|
| 94 |
+user = admin |
|
| 95 |
+password = $ADMIN_PASSWORD |
|
| 96 |
+tenant_id = 1 |
|
| 97 |
+ |
|
| 98 |
+[nova] |
|
| 99 |
+host = $HOST_IP |
|
| 100 |
+port = 8774 |
|
| 101 |
+apiver = v1.1 |
|
| 102 |
+project = admin |
|
| 103 |
+user = admin |
|
| 104 |
+key = $SERVICE_TOKEN |
|
| 105 |
+ssh_timeout = 300 |
|
| 106 |
+build_timeout = 300 |
|
| 107 |
+flavor_ref = 1 |
|
| 108 |
+flavor_ref_alt = 2 |
|
| 109 |
+ |
|
| 110 |
+[rabbitmq] |
|
| 111 |
+host = $RABBIT_HOST |
|
| 112 |
+user = guest |
|
| 113 |
+password = $RABBIT_PASSWORD |
|
| 114 |
+ |
|
| 115 |
+[swift] |
|
| 116 |
+auth_host = $HOST_IP |
|
| 117 |
+auth_port = 443 |
|
| 118 |
+auth_prefix = /auth/ |
|
| 119 |
+auth_ssl = yes |
|
| 120 |
+account = system |
|
| 121 |
+username = root |
|
| 122 |
+password = password |
|
| 123 |
+ |
|
| 124 |
+EOF |
|
| 125 |
+mv $CONFIG_FILE_TMP $CONFIG_FILE |
|
| 0 | 126 |
\ No newline at end of file |