From 44fa06d65eafdcfce9671bdc09f2c8a6d7115982 Mon Sep 17 00:00:00 2001 From: QiLiang Date: Fri, 15 Jan 2016 11:29:40 +0000 Subject: Scripts update to run rubbos on compass4nfv env JIRA: - Change-Id: Ic2b9f09d4d059e1db3b06abb5f36df2c06f4a8b8 Signed-off-by: QiLiang --- ci/rubbos_docker_run.sh | 2 +- .../1-1-1/scripts/CONTROL_rubbos_exec.sh | 4 +- .../1-1-1/scripts/env_preparation.sh | 4 +- utils/dashboard/dashboard.yaml | 2 +- utils/dispatcher/http.py | 2 +- .../heat_template/HOT_create_instance.sh | 53 ++++++++++++++++------ utils/infra_setup/vm_dev_setup/common.sh | 4 +- utils/infra_setup/vm_dev_setup/setup_env.sh | 12 ++--- 8 files changed, 54 insertions(+), 29 deletions(-) diff --git a/ci/rubbos_docker_run.sh b/ci/rubbos_docker_run.sh index d170c00d..afc8493c 100755 --- a/ci/rubbos_docker_run.sh +++ b/ci/rubbos_docker_run.sh @@ -10,7 +10,7 @@ else opts="--privileged=true --rm" fi -envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NETWORK=${EXTERNAL_NETWORK} -e BOTTLENECKS_BRANCH=${GIT_BRANCH##origin/} -e GERRIT_REFSPEC_DEBUG=${GERRIT_REFSPEC_DEBUG}" +envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NETWORK=${EXTERNAL_NETWORK} -e BOTTLENECKS_BRANCH=${GIT_BRANCH##origin/} -e GERRIT_REFSPEC_DEBUG=${GERRIT_REFSPEC_DEBUG} -e BOTTLENECKS_DB_TARGET=${BOTTLENECKS_DB_TARGET} -e PACKAGE_URL=${PACKAGE_URL} -e EXTERNAL_NET=${EXTERNAL_NET}" volumes="-v ${BOTTLENECKS_TOP_DIR}:${BOTTLENECKS_TOP_DIR}" create_instance=${BOTTLENECKS_TOP_DIR}/utils/infra_setup/heat_template/HOT_create_instance.sh diff --git a/rubbos/rubbos_scripts/1-1-1/scripts/CONTROL_rubbos_exec.sh b/rubbos/rubbos_scripts/1-1-1/scripts/CONTROL_rubbos_exec.sh index d1b8c165..565a5b70 100755 --- a/rubbos/rubbos_scripts/1-1-1/scripts/CONTROL_rubbos_exec.sh +++ b/rubbos/rubbos_scripts/1-1-1/scripts/CONTROL_rubbos_exec.sh @@ -18,7 +18,7 @@ ssh $BENCHMARK_HOST " " # run test rubbos.properties from 200 to 3200 -for i in {2..32..5} +for i in {2..7..5} do echo "Start Browsing Only with rubbos.properties_$((100*i)) $(date)" @@ -123,7 +123,7 @@ ls $RUBBOS_RESULTS_DIR_NAME echo "Fetch POD env parameters" source /tmp/vm_dev_setup/hosts.conf -sed -i -e "s/REPLACE_POD_NAME/$POD_NAME/g" \ +sed -i -e "s/REPLACE_NODE_NAME/$NODE_NAME/g" \ -e "s/REPLACE_INSTALLER_TYPE/$INSTALLER_TYPE/g" \ -e "s/REPLACE_VERSION/$BOTTLENECKS_VERSION/g" \ -e "s#REPLACE_BOTTLENECKS_DB_TARGET#$BOTTLENECKS_DB_TARGET#g" \ diff --git a/rubbos/rubbos_scripts/1-1-1/scripts/env_preparation.sh b/rubbos/rubbos_scripts/1-1-1/scripts/env_preparation.sh index 692af416..6ecf4832 100755 --- a/rubbos/rubbos_scripts/1-1-1/scripts/env_preparation.sh +++ b/rubbos/rubbos_scripts/1-1-1/scripts/env_preparation.sh @@ -17,7 +17,7 @@ RELENG_REPO_DIR=/tmp/opnfvrepo/releng INSTALLER_TYPE=fuel INSTALLER_IP=10.20.0.2 -POD_NAME=opnfv-jump-2 +NODE_NAME=opnfv-jump-2 EXTERNAL_NET=net04_ext echo "INFO: Creating openstack credentials .." @@ -46,5 +46,5 @@ if [ "$INSTALLER_TYPE" == "fuel" ]; then fi fi -export EXTERNAL_NET INSTALLER_TYPE POD_NAME +export EXTERNAL_NET INSTALLER_TYPE NODE_NAME set +ex diff --git a/utils/dashboard/dashboard.yaml b/utils/dashboard/dashboard.yaml index 56607701..0668e370 100644 --- a/utils/dashboard/dashboard.yaml +++ b/utils/dashboard/dashboard.yaml @@ -1,6 +1,6 @@ --- -pod_name: REPLACE_POD_NAME +pod_name: REPLACE_NODE_NAME installer: REPLACE_INSTALLER_TYPE version: REPLACE_VERSION target: http://REPLACE_BOTTLENECKS_DB_TARGET/results diff --git a/utils/dispatcher/http.py b/utils/dispatcher/http.py index d78f77fa..b06c5a54 100644 --- a/utils/dispatcher/http.py +++ b/utils/dispatcher/http.py @@ -49,7 +49,7 @@ class HttpDispatcher(DispatchBase): self.result = { "project_name": "bottlenecks", "description": "bottlenecks test cases result", - "pod_name": os.environ.get('POD_NAME', 'unknown'), + "pod_name": os.environ.get('NODE_NAME', 'unknown'), "installer": os.environ.get('INSTALLER_TYPE', 'unknown'), "version": os.environ.get('BOTTLENECKS_VERSION', 'unknown') } diff --git a/utils/infra_setup/heat_template/HOT_create_instance.sh b/utils/infra_setup/heat_template/HOT_create_instance.sh index 55198beb..1c0fe17e 100755 --- a/utils/infra_setup/heat_template/HOT_create_instance.sh +++ b/utils/infra_setup/heat_template/HOT_create_instance.sh @@ -19,7 +19,24 @@ bottlenecks_env_prepare() cd - fi - source $BOTTLENECKS_REPO_DIR/rubbos/rubbos_scripts/1-1-1/scripts/env_preparation.sh + echo "Creating openstack credentials .." + set -e + + if [ -d $RELENG_REPO_DIR ]; then + rm -rf ${RELENG_REPO_DIR} + fi + mkdir -p ${RELENG_REPO_DIR} + git config --global http.sslVerify false + git clone ${RELENG_REPO} ${RELENG_REPO_DIR} + + # Create openstack credentials + $RELENG_REPO_DIR/utils/fetch_os_creds.sh \ + -d /tmp/openrc \ + -i ${INSTALLER_TYPE} -a ${INSTALLER_IP} + + source /tmp/openrc + set +e + chmod 600 $KEY_PATH/bottlenecks_key echo "Bottlenecks env prepare end $(date)" @@ -63,7 +80,7 @@ wait_rubbos_control_ok() { control_ip=$(nova list | grep rubbos_control | awk '{print $13}') retry=0 - until timeout 3s ssh $ssh_args ec2-user@$control_ip "exit" >/dev/null 2>&1 + until timeout 3s ssh $ssh_args ubuntu@$control_ip "exit" >/dev/null 2>&1 do echo "retry connect rubbos control $retry" sleep 1 @@ -73,7 +90,7 @@ wait_rubbos_control_ok() { exit 1 fi done - ssh $ssh_args ec2-user@$control_ip "uname -a" + ssh $ssh_args ubuntu@$control_ip "uname -a" } bottlenecks_check_instance_ok() @@ -116,12 +133,12 @@ bottlenecks_create_instance() nova keypair-add --pub_key $KEY_PATH/bottlenecks_key.pub $KEY_NAME echo "create flavor" - nova flavor-create $FLAVOR_NAME 200 4096 20 4 + nova flavor-create $FLAVOR_NAME 200 4096 20 1 echo "use heat template to create stack" 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" + -P "image=$IMAGE_NAME;key_name=$KEY_NAME;public_net=$EXTERNAL_NET;flavor=$FLAVOR_NAME" echo "Bottlenecks create instance using heat template end $(date)" } @@ -132,7 +149,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 ubuntu@$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 @@ -165,19 +182,26 @@ bottlenecks_rubbos_run() echo "GERRIT_REFSPEC_DEBUG=$GERRIT_REFSPEC_DEBUG" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf - echo "POD_NAME=$POD_NAME" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf + echo "NODE_NAME=$NODE_NAME" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf echo "INSTALLER_TYPE=$INSTALLER_TYPE" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf echo "BOTTLENECKS_VERSION=$BOTTLENECKS_VERSION" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf echo "BOTTLENECKS_DB_TARGET=$BOTTLENECKS_DB_TARGET" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf + echo "PACKAGE_URL=$PACKAGE_URL" >> $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf scp $ssh_args -r \ $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup \ - ec2-user@$control_ip:/tmp + ubuntu@$control_ip:/tmp ssh $ssh_args \ - ec2-user@$control_ip "bash /tmp/vm_dev_setup/setup_env.sh" & + ubuntu@$control_ip "bash /tmp/vm_dev_setup/setup_env.sh" & bottlenecks_rubbos_wait_finish 200 + if [ x"$GERRIT_REFSPEC_DEBUG" != x ]; then + # TODO fix hard coded path + scp $ssh_args \ + ubuntu@$control_ip:"/bottlenecks/rubbos/rubbos_results/2015-01-20T081237-0700.tgz" /tmp + fi + rm -rf $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup/hosts.conf } @@ -248,20 +272,23 @@ main() 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 + RELENG_REPO=https://gerrit.opnfv.org/gerrit/releng + RELENG_REPO_DIR=/tmp/opnfvrepo/releng 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 KEY_NAME=bottlenecks-key FLAVOR_NAME=bottlenecks-flavor TEMPLATE_NAME=bottlenecks_rubbos_hot.yaml - PUBLIC_NET_NAME=net04_ext ssh_args="-o StrictHostKeyChecking=no -o BatchMode=yes -i $KEY_PATH/bottlenecks_key" - : ${POD_NAME:='opnfv-jump-2'} + : ${EXTERNAL_NET:='net04_ext'} + : ${PACKAGE_URL:='http://artifacts.opnfv.org/bottlenecks'} + : ${NODE_NAME:='opnfv-jump-2'} : ${INSTALLER_TYPE:='fuel'} + : ${INSTALLER_IP:='10.20.0.2'} : ${BOTTLENECKS_VERSION:='master'} : ${BOTTLENECKS_DB_TARGET:='213.77.62.197'} + IMAGE_URL=${PACKAGE_URL}/rubbos/bottlenecks-trusty-server.img bottlenecks_env_prepare set -x diff --git a/utils/infra_setup/vm_dev_setup/common.sh b/utils/infra_setup/vm_dev_setup/common.sh index d45345d6..12925326 100644 --- a/utils/infra_setup/vm_dev_setup/common.sh +++ b/utils/infra_setup/vm_dev_setup/common.sh @@ -94,9 +94,7 @@ configue_nameserver() sudo echo "nameserver 8.8.8.8" >> /etc/resolv.conf sudo echo "nameserver 8.8.4.4" >> /etc/resolv.conf - sudo ifconfig - sudo cat /etc/resolv.conf - ping -c 5 www.google.com + ping -c 1 www.google.com } install_packages() diff --git a/utils/infra_setup/vm_dev_setup/setup_env.sh b/utils/infra_setup/vm_dev_setup/setup_env.sh index 7a69e83c..cef76f8e 100755 --- a/utils/infra_setup/vm_dev_setup/setup_env.sh +++ b/utils/infra_setup/vm_dev_setup/setup_env.sh @@ -6,7 +6,7 @@ wait_vm_ok() { ip=$1 retry=0 - until timeout 10s ssh $ssh_args ec2-user@$ip "exit" >/dev/null 2>&1 + until timeout 10s ssh $ssh_args ubuntu@$ip "exit" >/dev/null 2>&1 do echo "retry connect rubbos vm ip $ip $retry" sleep 1 @@ -36,12 +36,12 @@ bottlenecks_prepare_env() for i in $rubbos_benchmark $rubbos_client1 $rubbos_client2 \ $rubbos_client3 $rubbos_client4 $rubbos_httpd $rubbos_mysql1 $rubbos_tomcat1 do - scp $ssh_args -r $SCRIPT_DIR ec2-user@$i:/tmp - ssh $ssh_args ec2-user@$i "sudo bash $SCRIPT_DIR/vm_prepare_setup.sh" & + scp $ssh_args -r $SCRIPT_DIR ubuntu@$i:/tmp + ssh $ssh_args ubuntu@$i "sudo bash $SCRIPT_DIR/vm_prepare_setup.sh" & done - # ugly use ssh execute script to fix ec2-user previlege issue - ssh $ssh_args ec2-user@$rubbos_control "sudo bash $SCRIPT_DIR/vm_prepare_setup.sh" + # ugly use ssh execute script to fix ubuntu previlege issue + ssh $ssh_args ubuntu@$rubbos_control "sudo bash $SCRIPT_DIR/vm_prepare_setup.sh" # test root access for i in $rubbos_control $rubbos_benchmark $rubbos_client1 $rubbos_client2 \ @@ -115,8 +115,8 @@ main() SCRIPT_DIR=`cd ${BASH_SOURCE[0]%/*};pwd` ssh_args="-o StrictHostKeyChecking=no -o BatchMode=yes" - source $SCRIPT_DIR/package.conf source $SCRIPT_DIR/hosts.conf + source $SCRIPT_DIR/package.conf source $SCRIPT_DIR/common.sh bottlenecks_prepare_env -- cgit 1.2.3-korg