diff options
Diffstat (limited to 'utils/infra_setup/heat_template')
-rwxr-xr-x | utils/infra_setup/heat_template/HOT_create_instance.sh | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/utils/infra_setup/heat_template/HOT_create_instance.sh b/utils/infra_setup/heat_template/HOT_create_instance.sh index 8266229b..eadaac2b 100755 --- a/utils/infra_setup/heat_template/HOT_create_instance.sh +++ b/utils/infra_setup/heat_template/HOT_create_instance.sh @@ -6,6 +6,8 @@ GERRIT_REFSPEC_DEBUG=$1 bottlenecks_env_prepare() { + echo "Bottlenecks env prepare start $(date)" + if [ -d $BOTTLENECKS_REPO_DIR ]; then rm -rf ${BOTTLENECKS_REPO_DIR} fi @@ -21,6 +23,8 @@ bottlenecks_env_prepare() source $BOTTLENECKS_REPO_DIR/rubbos/rubbos_scripts/1-1-1/scripts/env_preparation.sh chmod 600 $KEY_PATH/bottlenecks_key + + echo "Bottlenecks env prepare end $(date)" } wait_heat_stack_complete() { @@ -39,7 +43,8 @@ wait_heat_stack_complete() { exit 1 fi - if [ $BOTTLENECKS_DEBUG = True ]; then + #if [ $BOTTLENECKS_DEBUG = True ]; then + if false; then heat stack-show bottlenecks nova list | grep rubbos_ for i in $(nova list | grep rubbos_ | grep ERROR | awk '{print $2}') @@ -75,7 +80,7 @@ wait_rubbos_control_ok() { bottlenecks_check_instance_ok() { - echo "check instance" + echo "Bottlenecks check instance ok start $(date)" wait_heat_stack_complete 120 wait_rubbos_control_ok 300 @@ -101,11 +106,13 @@ bottlenecks_check_instance_ok() sleep 10 done fi + + echo "Bottlenecks check instance ok end $(date)" } bottlenecks_create_instance() { - echo "create bottlenecks instance using heat template" + echo "Bottlenecks create instance using heat template start $(date)" echo "upload keypair" nova keypair-add --pub_key $KEY_PATH/bottlenecks_key.pub $KEY_NAME @@ -117,6 +124,8 @@ bottlenecks_create_instance() cd $HOT_PATH heat stack-create bottlenecks -f ${TEMPLATE_NAME} \ -P "image=$IMAGE_NAME;key_name=$KEY_NAME;public_net=$PUBLIC_NET_NAME;flavor=$FLAVOR_NAME" + + echo "Bottlenecks create instance using heat template end $(date)" } bottlenecks_rubbos_wait_finish() @@ -125,14 +134,7 @@ bottlenecks_rubbos_wait_finish() retry=0 while true do - ssh $ssh_args ec2-user@$control_ip " - FILE=/tmp/rubbos_finished - if [ -f \$FILE ]; then - exit 0 - else - exit 1 - fi - " + ssh $ssh_args ec2-user@$control_ip "FILE=/tmp/rubbos_finished; if [ -f \$FILE ]; then exit 0; else exit 1; fi" if [ $? = 0 ]; then echo "Rubbos test case successfully finished :)" return 0 @@ -171,14 +173,14 @@ bottlenecks_rubbos_run() ssh $ssh_args \ ec2-user@$control_ip "bash /tmp/vm_dev_setup/setup_env.sh" & - bottlenecks_rubbos_wait_finish 240 + bottlenecks_rubbos_wait_finish 80 rm -rf $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf } bottlenecks_cleanup() { - echo "clean up bottlenecks images and keys" + echo "Bottlenecks cleanup start $(date)" if heat stack-list; then for stack in $(heat stack-list | grep -e bottlenecks | awk '{print $2}'); do @@ -208,11 +210,13 @@ bottlenecks_cleanup() nova flavor-delete $flavor || true done fi + + echo "Bottlenecks cleanup end $(date)" } bottlenecks_load_bottlenecks_image() { - echo "load bottlenecks image" + echo "Bottlenecks load image start $(date)" curl --connect-timeout 10 -o /tmp/bottlenecks-trusty-server.img $IMAGE_URL -v @@ -231,12 +235,12 @@ bottlenecks_load_bottlenecks_image() exit 1 fi - echo "bottlenecks image id: $IMAGE_ID_BOTTLENECKS" + echo "bottlenecks image end id: $IMAGE_ID_BOTTLENECKS $(date)" } main() { - echo "create instances with heat template" + echo "main start $(date)" BOTTLENECKS_DEBUG=True BOTTLENECKS_REPO=https://gerrit.opnfv.org/gerrit/bottlenecks @@ -253,12 +257,14 @@ main() ssh_args="-o StrictHostKeyChecking=no -o BatchMode=yes -i $KEY_PATH/bottlenecks_key" bottlenecks_env_prepare + set -x bottlenecks_cleanup bottlenecks_load_bottlenecks_image bottlenecks_create_instance bottlenecks_check_instance_ok bottlenecks_rubbos_run bottlenecks_cleanup + echo "main end $(date)" } main |