aboutsummaryrefslogtreecommitdiffstats
path: root/integration/storperf/launch_containers.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/launch_containers.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/launch_containers.sh')
-rwxr-xr-xintegration/storperf/launch_containers.sh100
1 files changed, 100 insertions, 0 deletions
diff --git a/integration/storperf/launch_containers.sh b/integration/storperf/launch_containers.sh
new file mode 100755
index 00000000..3fcf8052
--- /dev/null
+++ b/integration/storperf/launch_containers.sh
@@ -0,0 +1,100 @@
+#! /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 -t <installer_type> -n <node_name>" >&2
+}
+
+#Get options
+while getopts ":t:n:he" optchar; do
+ case "${optchar}" in
+ t) installer_type=${OPTARG} ;;
+ n) node_name=${OPTARG} ;;
+ h) usage
+ exit 0
+ ;;
+ *) echo "Non-option argument: '-${OPTARG}'" >&2
+ usage
+ exit 2
+ ;;
+ esac
+done
+
+
+#set vars from env if not provided by user as options
+installer_type=${installer_type:-$INSTALLER_TYPE}
+node_name=${node_name:-$NODE_NAME}
+
+case $installer_type in
+ apex)
+ installer_ip=`sudo virsh domifaddr undercloud | grep ipv4 | awk '{print $4}' | cut -d/ -f1`
+ ;;
+ *)
+
+ echo "Unsupported $installer_type. Cannot continue!"
+ exit 1
+esac
+
+if [[ -z $WORKSPACE ]];then
+ WORKSPACE=`pwd`
+fi
+
+git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng $WORKSPACE/releng
+
+$WORKSPACE/releng/utils/fetch_os_creds.sh -i ${installer_type} -a ${installer_ip} -d $WORKSPACE/openrc
+
+grep "export" $WORKSPACE/openrc | sed "s/export //" > $WORKSPACE/admin.rc
+echo "INSTALLER_TYPE=${installer_type}" >> $WORKSPACE/admin.rc
+echo "INSTALLER_IP=${installer_ip}" >> $WORKSPACE/admin.rc
+echo "NODE_NAME=${node_name}" >> $WORKSPACE/admin.rc
+export ENV_FILE=$WORKSPACE/admin.rc
+
+export CARBON_DIR=$WORKSPACE/carbon/
+WWW_DATA_UID=33
+WWW_DATA_GID=33
+sudo install --owner=${WWW_DATA_UID} --group=${WWW_DATA_GID} -d "${CARBON_DIR}"
+
+clean_storperf_container()
+{
+ docker-compose -f docker-compose.yaml down
+
+ for name in qtip storperf-master storperf-swaggerui storperf-httpfrontend storperf-reporting
+ do
+ container=`docker ps -a -q -f name=$name`
+ if [[ ! -z $container ]];then
+ echo "Stopping any existing $name container"
+ docker rm -fv $container
+ fi
+
+ image=`docker images opnfv/$name`
+ if [[ ! -z $image ]];then
+ echo "Deleteing any existing opnfv/$name image"
+ docker rmi -f opnfv/$container_name
+ fi
+ done
+}
+
+launch_storperf_container()
+{
+ docker-compose pull
+ docker-compose -f docker-compose.yaml up -d
+
+ echo "Waiting for StorPerf to become active"
+
+ while [ $(curl -s -o /dev/null -I -w "%{http_code}" -X GET http://127.0.0.1:5000/api/v1.0/configurations) != "200" ]
+ do
+ sleep 1
+ done
+}
+
+echo "Clean existing storperf containers"
+clean_storperf_container
+
+echo "Launch new storperf containers"
+launch_storperf_container \ No newline at end of file