#!/bin/bash set -eux if [ -d /etc/tripleo ]; then TRIPLEO_ROOT=/etc/tripleo else TRIPLEO_ROOT=$INSTACK_ROOT/tripleo-incubator fi OS_AUTH_URL=${OS_AUTH_URL:-""} if [ -z "$OS_AUTH_URL" ]; then echo "You must source a stackrc file for the Undercloud." exit 1 fi export NODES_JSON=${NODES_JSON:-"instackenv.json"} export TE_DATAFILE=$NODES_JSON echo "Sourcing answers file from instack.answers..." source ~/instack.answers source tripleo-overcloud-passwords export OVERCLOUD_IP=$(nova list | grep controller0.*ctlplane | sed -e "s/.*=\\([0-9.]*\\).*/\1/") source $TRIPLEO_ROOT/overcloudrc export no_proxy=${no_proxy:-""} export no_proxy=$no_proxy,$OVERCLOUD_IP # tripleo os-adduser -p $OVERCLOUD_DEMO_PASSWORD demo demo@example.com if ! glance image-show user 2>&1 1>/dev/null; then glance image-create --name user --public --disk-format qcow2 \ --container-format bare --file $IMAGE_PATH/fedora-user.qcow2 fi tripleo wait_for 30 10 nova service-list --binary nova-compute 2\>/dev/null \| grep 'enabled.*\ up\ ' tripleo wait_for 30 10 neutron agent-list -f csv -c alive -c agent_type -c host \| grep "\":-).*Open vSwitch agent.*novacompute\"" # source $TRIPLEO_ROOT/overcloudrc-user NET_ID=$(neutron net-list -f csv --quote none | grep default-net | cut -d, -f1) if ! nova keypair-show default 2>&1 1>/dev/null; then tripleo user-config fi nova boot --poll --key-name default --flavor m1.demo --image user --nic net-id=$NET_ID demo sleep 3 PRIVATEIP=$(nova list | grep demo | awk -F"default-net=" '{print $2}' | awk '{print $1}') tripleo wait_for 10 5 neutron port-list -f csv -c id --quote none \| grep id PORT=$(neutron port-list | grep $PRIVATEIP | cut -d'|' -f2) FLOATINGIP=$(neutron floatingip-create ext-net --port-id "${PORT//[[:space:]]/}" | awk '$2=="floating_ip_address" {print $4}') SECGROUPID=$(nova secgroup-list | grep default | cut -d ' ' -f2) neutron security-group-rule-create $SECGROUPID --protocol icmp \ --direction ingress --port-range-min 8 || true neutron security-group-rule-create $SECGROUPID --protocol tcp \ --direction ingress --port-range-min 22 --port-range-max 22 || true # Must use sudo when calling ping # See https://bugzilla.redhat.com/show_bug.cgi?id=1144149 tripleo wait_for 30 10 sudo -E ping -c 1 $FLOATINGIP tripleo wait_for 10 10 nova list \| grep ACTIVE ssh-keygen -R $FLOATINGIP tripleo wait_for 30 10 ssh -o BatchMode=yes -o StrictHostKeyChecking=no fedora@$FLOATINGIP ls tripleo wait_for 30 10 ssh -o BatchMode=yes -o StrictHostKeyChecking=no -tt fedora@$FLOATINGIP systemctl status cloud-final echo Compute test successful! CINDER_VOLUME_ID=$(cinder create 1 | grep " id " | awk '{print $4}') tripleo wait_for 10 3 cinder list \| grep available nova volume-attach demo $CINDER_VOLUME_ID tripleo wait_for 30 10 ssh -o StrictHostKeyChecking=no fedora@$FLOATINGIP ls /dev/vdb ssh -tt fedora@$FLOATINGIP sudo fdisk /dev/vdb < $tmpfile swift upload test $tmpfile swiftfile=$(swift list test) swift download --output $tmpfile-1 test $swiftfile if [ ! "$(cat $tmpfile-1)" == "SWIFTTEST" ]; then echo Swift test failed! fi swift delete test echo Swift test successful!