aboutsummaryrefslogtreecommitdiffstats
path: root/integration/storperf/start_job.sh
diff options
context:
space:
mode:
authorzhihui wu <wu.zhihui1@zte.com.cn>2017-08-09 16:34:30 +0800
committerzhihui wu <wu.zhihui1@zte.com.cn>2017-08-11 16:39:03 +0800
commit3b440fba4ca0781bcf1283baaa5c44704d745017 (patch)
treeda383bb914f002eaee620406b0ad930386bc2a26 /integration/storperf/start_job.sh
parent8c1e9c553cc6b4b8b78c31e7f5f48836c0d945e1 (diff)
refactor: run storperf scripts in qtip container
The preious storperf scripts can only be run based on the host. This patch will make them run in qtip container. JIRA: QTIP-248 README.md will tell you how to use these scripts. Change-Id: I4d2d51f859499e6e56ae8692d880cbde27297b82 Signed-off-by: zhihui wu <wu.zhihui1@zte.com.cn>
Diffstat (limited to 'integration/storperf/start_job.sh')
-rwxr-xr-xintegration/storperf/start_job.sh39
1 files changed, 25 insertions, 14 deletions
diff --git a/integration/storperf/start_job.sh b/integration/storperf/start_job.sh
index e94356e5..672dabef 100755
--- a/integration/storperf/start_job.sh
+++ b/integration/storperf/start_job.sh
@@ -29,11 +29,22 @@ 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
-source $script_dir/openstack.sh
+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 ==========================================================================
+ cat $WORKSPACE/nova_vm.json
+ echo ==========================================================================
+}
echo ==========================================================================
echo "Start to create storperf stack"
@@ -42,7 +53,7 @@ echo ==========================================================================
curl -X POST --header 'Content-Type: application/json' \
--header 'Accept: application/json' -d @${stack_json} \
- 'http://127.0.0.1:5000/api/v1.0/configurations'
+ 'http://storperf-httpfrontend:5000/api/v1.0/configurations'
nova_vm_mapping
@@ -54,23 +65,26 @@ echo ==========================================================================
JOB=$(curl -s -X POST --header 'Content-Type: application/json' \
--header 'Accept: application/json' \
- -d @${job_json} 'http://127.0.0.1:5000/api/v1.0/jobs' | \
+ -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 "Loop: check job status"
- curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \
+ 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 30
+ sleep 180
mv $WORKSPACE/status.json $WORKSPACE/old-status.json
- curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \
+ 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
@@ -80,19 +94,16 @@ else
fi
done
- echo ==========================================================================
+ echo
echo "Storperf test completed!"
- echo ==========================================================================
-
- curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=metadata" \
- -o $WORKSPACE/report.json
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://127.0.0.1:5000/api/v1.0/configurations'
-
+curl -s -X DELETE --header 'Accept: application/json' 'http://storperf-httpfrontend:5000/api/v1.0/configurations' \ No newline at end of file