diff options
author | 2017-08-24 17:07:50 +0800 | |
---|---|---|
committer | 2017-08-26 02:24:07 +0000 | |
commit | 9eb2005c087a6c064fd2880edd253028e3ea1513 (patch) | |
tree | f08671811e0c70e5c29173ea4ef4ea2aea37332b /tests/ci/storperf/start_job.sh | |
parent | 73f6ca735e00902f9b71a9110eb97c7b008d8e94 (diff) |
Refactor storperf testing scripts into ansible role
Change-Id: Ifbfe0818a528dbd9b2c176acf39450ca480e931a
Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
Diffstat (limited to 'tests/ci/storperf/start_job.sh')
-rwxr-xr-x | tests/ci/storperf/start_job.sh | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/tests/ci/storperf/start_job.sh b/tests/ci/storperf/start_job.sh deleted file mode 100755 index 15785036..00000000 --- a/tests/ci/storperf/start_job.sh +++ /dev/null @@ -1,110 +0,0 @@ -#! /bin/bash -############################################################################## -# Copyright (c) 2017 ZTE and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -usage(){ - echo "usage: $0 -s <stack_json_path> -j <job_json_path>" >&2 -} - -#Get options -while getopts ":s:j:he" optchar; do - case "${optchar}" in - s) stack_json=${OPTARG} ;; - j) job_json=${OPTARG} ;; - h) usage - exit 0 - ;; - *) echo "Non-option argument: '-${OPTARG}'" >&2 - usage - exit 2 - ;; - esac -done - -# See https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within -script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -stack_json=${stack_json:-"$script_dir/default_stack.json"} -job_json=${job_json:-"$script_dir/default_job.json"} - -if [[ -z $WORKSPACE ]];then - WORKSPACE=`pwd` -fi - -nova_vm_mapping() -{ - rm $WORKSPACE/nova_vm.json - openstack server list --name storperf-agent -c ID -c Host --long -f json > $WORKSPACE/nova_vm.json - - echo ========================================================================== - echo "Vms vs. Compute nodes" - cat $WORKSPACE/nova_vm.json - echo ========================================================================== -} - -echo ========================================================================== -echo "Start to create storperf stack" -cat ${stack_json} 1>&2 -echo ========================================================================== - -curl -X POST --header 'Content-Type: application/json' \ - --header 'Accept: application/json' -d @${stack_json} \ - 'http://storperf-httpfrontend:5000/api/v1.0/configurations' - -nova_vm_mapping - -echo -echo ========================================================================== -echo "Start to run storperf test" -cat ${job_json} 1>&2 -echo ========================================================================== - -JOB=$(curl -s -X POST --header 'Content-Type: application/json' \ - --header 'Accept: application/json' \ - -d @${job_json} 'http://storperf-httpfrontend:5000/api/v1.0/jobs' | \ - awk '/job_id/ {print $2}' | sed 's/"//g') - -echo "JOB ID: $JOB" -if [[ -z "$JOB" ]]; then - echo "Oops, JOB ID is empty!" -else - echo "checking job status..." - curl -s -X GET "http://storperf-httpfrontend:5000/api/v1.0/jobs?id=$JOB&type=status" \ - -o $WORKSPACE/status.json - - cat $WORKSPACE/status.json - - JOB_STATUS=`cat $WORKSPACE/status.json | awk '/Status/ {print $2}' | cut -d\" -f2` - - while [ "$JOB_STATUS" != "Completed" ] - do - sleep 180 - mv $WORKSPACE/status.json $WORKSPACE/old-status.json - curl -s -X GET "http://storperf-httpfrontend:5000/api/v1.0/jobs?id=$JOB&type=status" \ - -o $WORKSPACE/status.json - JOB_STATUS=`cat $WORKSPACE/status.json | awk '/Status/ {print $2}' | cut -d\" -f2` - diff $WORKSPACE/status.json $WORKSPACE/old-status.json >/dev/null - if [ $? -eq 1 ] - then - cat $WORKSPACE/status.json - fi - done - - echo - echo "Storperf test completed!" - - echo ========================================================================== - echo Final report - echo ========================================================================== - curl -s -X GET "http://storperf-httpfrontend:5000/api/v1.0/jobs?id=$JOB&type=metadata" \ - -o $WORKSPACE/report.json - cat $WORKSPACE/report.json -fi - -echo "Deleting stack for cleanup" -curl -s -X DELETE --header 'Accept: application/json' 'http://storperf-httpfrontend:5000/api/v1.0/configurations'
\ No newline at end of file |