openstack-virtual-baremetal/bin/test-job
Ben Nemec d7ec4eaf8d Update test-job to reflect current status
Some things have changed and broke the test-job script.
2016-07-14 17:44:18 -05:00

67 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# Edit these to match your environment
AUTH_URL=http://11.1.1.78:5000/v2.0
USER=admin
PASSWORD=password
TENANT=admin
BMC_IMAGE=bmc-base
KEY_NAME=default
UNDERCLOUD_IMAGE=centos7-base
UNDERCLOUD_FLAVOR=undercloud-12
BAREMETAL_FLAVOR=baremetal
set -ex
date
start_seconds=$(date +%s)
BIN_DIR=$(cd $(dirname $0); pwd -P)
MY_ID=$1
BMC_PREFIX=bmc-$MY_ID
BAREMETAL_PREFIX=baremetal-$MY_ID
UNDERCLOUD_NAME=undercloud-$MY_ID
PUBLIC_NET=public-$MY_ID
PROVISION_NET=provision-$MY_ID
# NOTE(bnemec): I'm intentionally not adding a trap to clean this up because
# if something fails it may be helpful to look at the contents of the tempdir.
TEMPDIR=$(mktemp -d)
echo "Working in $TEMPDIR"
cd $TEMPDIR
cp -r $BIN_DIR/../templates .
cp templates/env.yaml.example ./env.yaml
sed -i "s|os_auth_url: .*|os_auth_url: $AUTH_URL|" env.yaml
sed -i "s|os_user: .*|os_user: $USER|" env.yaml
sed -i "s|os_password: .*|os_password: $PASSWORD|" env.yaml
sed -i "s|os_tenant: .*|os_tenant: $TENANT|" env.yaml
sed -i "s/bmc_image: .*/bmc_image: $BMC_IMAGE/" env.yaml
sed -i "s/key_name: .*/key_name: $KEY_NAME/" env.yaml
sed -i "s/baremetal_flavor: .*/baremetal_flavor: $BAREMETAL_FLAVOR/" env.yaml
sed -i "s/undercloud_image: .*/undercloud_image: $UNDERCLOUD_IMAGE/" env.yaml
sed -i "s/undercloud_flavor: .*/undercloud_flavor: $UNDERCLOUD_FLAVOR/" env.yaml
echo 'resource_registry:' >> env.yaml
echo ' OS::OVB::UndercloudFloating: templates/undercloud-floating.yaml' >> env.yaml
cp -r $BIN_DIR ./bin
cp -r $BIN_DIR/../openstack_virtual_baremetal .
STACK_NAME=$MY_ID
$BIN_DIR/deploy.py --quintupleo --id $MY_ID --name $STACK_NAME
sleep 60
UNDERCLOUD_IP=$(heat output-show $STACK_NAME undercloud_host_floating_ip | sed -e 's/"//g')
#bin/build-nodes-json --env env.yaml #--bmc_prefix $BMC_PREFIX --baremetal_prefix $BAREMETAL_PREFIX --provision_net $PROVISION_NET_NAME
bin/build-nodes-json --bmc_prefix $BMC_PREFIX --baremetal_prefix $BAREMETAL_PREFIX --provision_net $PROVISION_NET
SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
scp $SSH_OPTS bin/ovb-instack centos@$UNDERCLOUD_IP:/tmp
scp $SSH_OPTS nodes.json centos@$UNDERCLOUD_IP:~/instackenv.json
ssh -t -t $SSH_OPTS centos@$UNDERCLOUD_IP /tmp/ovb-instack
heat stack-delete -y $STACK_NAME
date
end_seconds=$(date +%s)
elapsed_seconds=$(($end_seconds - $start_seconds))
echo "Finished in $elapsed_seconds seconds"
rm -rf $TEMPDIR