66function usage {
77 echo " $0 - Build config.ini for openstack-integration-tests"
88 echo " "
9- echo " Usage: $0 configfile "
9+ echo " Usage: $0 configdir "
1010 exit 1
1111}
1212
1313if [ ! " $# " -eq " 1" ]; then
1414 usage
1515fi
1616
17- CONFIG_FILE=$1
17+ CONFIG_DIR=$1
18+ CONFIG_CONF=$CONFIG_DIR /storm.conf
19+ CONFIG_INI=$CONFIG_DIR /config.ini
1820
1921# Clean up any resources that may be in use
2022cleanup () {
2123 set +o errexit
2224
2325 # Mop up temporary files
24- if [ -n " $CONFIG_FILE_TMP " -a -e " $CONFIG_FILE_TMP " ]; then
25- rm -f $CONFIG_FILE_TMP
26+ if [ -n " $CONFIG_CONF_TMP " -a -e " $CONFIG_CONF_TMP " ]; then
27+ rm -f $CONFIG_CONF_TMP
28+ fi
29+ if [ -n " $CONFIG_INI_TMP " -a -e " $CONFIG_INI_TMP " ]; then
30+ rm -f $CONFIG_INI_TMP
2631 fi
2732
2833 # Kill ourselves to signal any calling process
2934 trap 2; kill -2 $$
3035}
3136
32- trap cleanup SIGHUP SIGINT SIGTERM
37+ trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
3338
3439# Keep track of the current directory
3540TOOLS_DIR=$( cd $( dirname " $0 " ) && pwd)
@@ -50,17 +55,19 @@ DEST=${DEST:-/opt/stack}
5055
5156DIST_NAME=${DIST_NAME:- oneiric}
5257
53- # Process network configuration vars
54- GUEST_NETWORK=${GUEST_NETWORK:- 1}
55- GUEST_RECREATE_NET=${GUEST_RECREATE_NET:- yes}
56-
57- GUEST_IP=${GUEST_IP:- 192.168.$GUEST_NETWORK .50}
58- GUEST_CIDR=${GUEST_CIDR:- $GUEST_IP / 24}
59- GUEST_NETMASK=${GUEST_NETMASK:- 255.255.255.0}
60- GUEST_GATEWAY=${GUEST_GATEWAY:- 192.168.$GUEST_NETWORK .1}
61- GUEST_MAC=${GUEST_MAC:- " 02:16:3e:07:69:` printf ' %02X' $GUEST_NETWORK ` " }
62- GUEST_RAM=${GUEST_RAM:- 1524288}
63- GUEST_CORES=${GUEST_CORES:- 1}
58+ if [ ! -f $DEST /.ramdisk ]; then
59+ # Process network configuration vars
60+ GUEST_NETWORK=${GUEST_NETWORK:- 1}
61+ GUEST_RECREATE_NET=${GUEST_RECREATE_NET:- yes}
62+
63+ GUEST_IP=${GUEST_IP:- 192.168.$GUEST_NETWORK .50}
64+ GUEST_CIDR=${GUEST_CIDR:- $GUEST_IP / 24}
65+ GUEST_NETMASK=${GUEST_NETMASK:- 255.255.255.0}
66+ GUEST_GATEWAY=${GUEST_GATEWAY:- 192.168.$GUEST_NETWORK .1}
67+ GUEST_MAC=${GUEST_MAC:- " 02:16:3e:07:69:` printf ' %02X' $GUEST_NETWORK ` " }
68+ GUEST_RAM=${GUEST_RAM:- 1524288}
69+ GUEST_CORES=${GUEST_CORES:- 1}
70+ fi
6471
6572# Use the GUEST_IP unless an explicit IP is set by ``HOST_IP``
6673HOST_IP=${HOST_IP:- $GUEST_IP }
@@ -77,34 +84,75 @@ set `echo $GLANCE_HOSTPORT | tr ':' ' '`
7784GLANCE_HOST=$1
7885GLANCE_PORT=$2
7986
80- CONFIG_FILE_TMP=$( mktemp $CONFIG_FILE .XXXXXX)
87+ # Create storm.conf
88+
89+ CONFIG_CONF_TMP=$( mktemp $CONFIG_CONF .XXXXXX)
90+ cat > $CONFIG_CONF_TMP << EOF
91+ [nova]
92+ auth_url=http://$HOST_IP :5000/v2.0/tokens
93+ user=admin
94+ api_key=$ADMIN_PASSWORD
95+ tenant_name=admin
96+ ssh_timeout=300
97+ build_interval=10
98+ build_timeout=600
99+
100+ [environment]
101+ image_ref=3
102+ image_ref_alt=4
103+ flavor_ref=1
104+ flavor_ref_alt=2
105+ create_image_enabled=true
106+ resize_available=true
107+ authentication=keystone_v2
108+ EOF
109+ mv $CONFIG_CONF_TMP $CONFIG_CONF
110+ CONFIG_CONF_TMP=" "
111+
112+ # Create config.ini
113+
114+ CONFIG_INI_TMP=$( mktemp $CONFIG_INI .XXXXXX)
81115if [ " $UPLOAD_LEGACY_TTY " ]; then
82- cat > $CONFIG_FILE_TMP << EOF
116+ cat > $CONFIG_INI_TMP << EOF
83117[environment]
84118aki_location = $DEST /devstack/files/images/aki-tty/image
85119ari_location = $DEST /devstack/files/images/ari-tty/image
86120ami_location = $DEST /devstack/files/images/ami-tty/image
87- image_ref = 1
121+ image_ref = 3
122+ image_ref_alt = 3
88123flavor_ref = 1
124+ flavor_ref_alt = 2
125+
126+ [glance]
127+ host = $GLANCE_HOST
128+ apiver = v1
129+ port = $GLANCE_PORT
130+ image_id = 3
131+ image_id_alt = 3
132+ tenant_id = 1
89133EOF
90134else
91- cat > $CONFIG_FILE_TMP << EOF
135+ cat > $CONFIG_INI_TMP << EOF
92136[environment]
93137aki_location = $DEST /openstack-integration-tests/include/sample_vm/$DIST_NAME -server-cloudimg-amd64-vmlinuz-virtual
94138#ari_location = $DEST /openstack-integration-tests/include/sample_vm/$DIST_NAME -server-cloudimg-amd64-loader
95139ami_location = $DEST /openstack-integration-tests/include/sample_vm/$DIST_NAME -server-cloudimg-amd64.img
96- image_ref = 1
140+ image_ref = 2
141+ image_ref_alt = 2
97142flavor_ref = 1
98- EOF
99- fi
143+ flavor_ref_alt = 2
100144
101- cat >> $CONFIG_FILE_TMP << EOF
102145[glance]
103146host = $GLANCE_HOST
104147apiver = v1
105148port = $GLANCE_PORT
106149image_id = 1
150+ image_id_alt = 1
107151tenant_id = 1
152+ EOF
153+ fi
154+
155+ cat >> $CONFIG_INI_TMP << EOF
108156
109157[keystone]
110158service_host = $HOST_IP
@@ -125,6 +173,7 @@ ssh_timeout = 300
125173build_timeout = 300
126174flavor_ref = 1
127175flavor_ref_alt = 2
176+ multi_node = no
128177
129178[rabbitmq]
130179host = $RABBIT_HOST
@@ -141,4 +190,7 @@ username = root
141190password = password
142191
143192EOF
144- mv $CONFIG_FILE_TMP $CONFIG_FILE
193+ mv $CONFIG_INI_TMP $CONFIG_INI
194+ CONFIG_INI_TMP=" "
195+
196+ trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT
0 commit comments