2 virtualenv $WORKSPACE/.venv-openstack
3 source $WORKSPACE/.venv-openstack/bin/activate
4 pip install --upgrade pip
5 pip install --upgrade python-openstackclient python-heatclient
8 cd /builder/openstack-hot
10 JOB_SUM=`echo $JOB_NAME | sum | awk '{{ print $1 }}'`
11 VM_NAME="$JOB_SUM-$BUILD_NUMBER"
13 # seq X refers to waiting for X minutes for OpenStack to return
14 # a status that is not CREATE_IN_PROGRESS before giving up.
15 OS_TIMEOUT=15 # Minutes to wait for OpenStack VM to come online
16 openstack --os-cloud rackspace stack create --timeout $OS_TIMEOUT -t {stack-template} -e $WORKSPACE/opendaylight-infra-environment.yaml --parameter "job_name=$VM_NAME" --parameter "silo=$SILO" $STACK_NAME
17 echo "Waiting for $OS_TIMEOUT minutes to create $STACK_NAME."
18 for i in `seq $OS_TIMEOUT`; do
20 OS_STATUS=`openstack --os-cloud rackspace stack show -f json -c stack_status $STACK_NAME | jq -r '.stack_status'`
21 if [ "$OS_STATUS" == "CREATE_COMPLETE" ]; then
22 echo "Stack initialized on infrastructure successful."
24 elif [ "$OS_STATUS" == "CREATE_FAILED" ]; then
25 echo "ERROR: Failed to initialize infrastructure. Quitting..."
27 elif [ "$OS_STATUS" == "CREATE_IN_PROGRESS" ]; then
28 echo "Waiting to initialize infrastructure."
31 echo "Unexpected status: $OS_STATUS"