summaryrefslogtreecommitdiffstats
path: root/utils/infra_setup/heat_template/HOT_create_instance.sh
diff options
context:
space:
mode:
Diffstat (limited to 'utils/infra_setup/heat_template/HOT_create_instance.sh')
-rwxr-xr-xutils/infra_setup/heat_template/HOT_create_instance.sh49
1 files changed, 43 insertions, 6 deletions
diff --git a/utils/infra_setup/heat_template/HOT_create_instance.sh b/utils/infra_setup/heat_template/HOT_create_instance.sh
index bcd9f048..753dd4d7 100755
--- a/utils/infra_setup/heat_template/HOT_create_instance.sh
+++ b/utils/infra_setup/heat_template/HOT_create_instance.sh
@@ -14,7 +14,9 @@ bottlenecks_env_prepare()
git config --global http.sslVerify false
git clone ${BOTTLENECKS_REPO} ${BOTTLENECKS_REPO_DIR}
if [ x"$GERRIT_REFSPEC_DEBUG" != x ]; then
+ cd ${BOTTLENECKS_REPO_DIR}
git fetch $BOTTLENECKS_REPO $GERRIT_REFSPEC_DEBUG && git checkout FETCH_HEAD
+ cd -
fi
source $BOTTLENECKS_REPO_DIR/rubbos/rubbos_scripts/1-1-1/scripts/env_preparation.sh
@@ -29,13 +31,26 @@ wait_heat_stack_complete() {
if [ x$status = x"CREATE_COMPLETE" ]; then
echo "bottlenecks stacke create complete"
heat stack-show bottlenecks
+ nova list | grep rubbos_
break;
+ elif [ x$status = x"CREATE_FAILED" ]; then
+ echo "bottlenecks stacke create failed !!!"
+ heat stack-show bottlenecks
+ exit 1
+ fi
+
+ if [ $BOTTLENECKS_DEBUG = True ]; then
+ heat stack-show bottlenecks
+ nova list | grep rubbos_
+ for i in $(nova list | grep rubbos_ | grep ERROR | awk '{print $2}')
+ do
+ nova show $i
+ done
fi
- echo "bottlenecks stack status $status"
sleep 1
let retry+=1
if [[ $retry -ge $1 ]];then
- echo "Heat stack create timeout!!!"
+ echo "Heat stack create timeout, status $status !!!"
exit 1
fi
done
@@ -45,7 +60,7 @@ wait_rubbos_control_ok() {
control_ip=$(nova list | grep rubbos_control | awk '{print $13}')
retry=0
- until timeout 1s ssh $ssh_args ec2-user@$control_ip "exit" >/dev/null 2>&1
+ until timeout 3s ssh $ssh_args ec2-user@$control_ip "exit" >/dev/null 2>&1
do
echo "retry connect rubbos control $retry"
sleep 1
@@ -65,6 +80,27 @@ bottlenecks_check_instance_ok()
wait_heat_stack_complete 120
wait_rubbos_control_ok 300
nova list | grep rubbos_
+ if [ $BOTTLENECKS_DEBUG = True ]; then
+ date
+ while true
+ do
+ for i in rubbos_benchmark rubbos_client1 rubbos_client2 rubbos_client3 \
+ rubbos_client4 rubbos_control rubbos_httpd rubbos_mysql1 rubbos_tomcat1
+ do
+ echo "logging $i"
+ nova console-log $i | tail -n 2 | grep Cloud-init | grep finished
+ if [ $? != 0 ]; then
+ break
+ fi
+ if [ $i = rubbos_tomcat1 ]; then
+ echo "all vm Cloud-init finished!"
+ date
+ return
+ fi
+ done
+ sleep 10
+ done
+ fi
}
bottlenecks_create_instance()
@@ -75,7 +111,7 @@ bottlenecks_create_instance()
nova keypair-add --pub_key $KEY_PATH/bottlenecks_key.pub $KEY_NAME
echo "create flavor"
- nova flavor-create $FLAVOR_NAME 200 2048 10 1
+ nova flavor-create $FLAVOR_NAME 200 4096 20 4
echo "use heat template to create stack"
cd $HOT_PATH
@@ -172,10 +208,11 @@ main()
{
echo "create instances with heat template"
+ BOTTLENECKS_DEBUG=True
BOTTLENECKS_REPO=https://gerrit.opnfv.org/gerrit/bottlenecks
BOTTLENECKS_REPO_DIR=/tmp/opnfvrepo/bottlenecks
- #IMAGE_URL=http://artifacts.opnfv.org/bottlenecks/rubbos/bottlenecks-trusty-server.img
- IMAGE_URL=https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img
+ IMAGE_URL=http://artifacts.opnfv.org/bottlenecks/rubbos/bottlenecks-trusty-server.img
+ #IMAGE_URL=https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img
IMAGE_NAME=bottlenecks-trusty-server
KEY_PATH=$BOTTLENECKS_REPO_DIR/utils/infra_setup/bottlenecks_key
HOT_PATH=$BOTTLENECKS_REPO_DIR/utils/infra_setup/heat_template