2 ##############################################################################
3 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
17 until timeout 10s ssh $ssh_args ubuntu@$ip "exit" >/dev/null 2>&1
19 echo "retry connect rubbos vm ip $ip $retry"
22 if [[ $retry -ge $2 ]];then
23 echo "rubbos control start timeout !!!"
29 bottlenecks_prepare_env()
31 echo "Bottlenecks prepare env"
33 # configue rubbos control ssh key
36 # wait all other VMs ok
37 for i in $rubbos_benchmark $rubbos_client1 $rubbos_client2 \
38 $rubbos_client3 $rubbos_client4 $rubbos_httpd $rubbos_mysql1 $rubbos_tomcat1
44 for i in $rubbos_benchmark $rubbos_client1 $rubbos_client2 \
45 $rubbos_client3 $rubbos_client4 $rubbos_httpd $rubbos_mysql1 $rubbos_tomcat1
47 scp $ssh_args -r $SCRIPT_DIR ubuntu@$i:/tmp
48 ssh $ssh_args ubuntu@$i "sudo bash $SCRIPT_DIR/vm_prepare_setup.sh" &
51 # ugly use ssh execute script to fix ubuntu previlege issue
52 ssh $ssh_args ubuntu@$rubbos_control "sudo bash $SCRIPT_DIR/vm_prepare_setup.sh"
55 for i in $rubbos_control $rubbos_benchmark $rubbos_client1 $rubbos_client2 \
56 $rubbos_client3 $rubbos_client4 $rubbos_httpd $rubbos_mysql1 $rubbos_tomcat1
58 ssh $ssh_args root@$i "uname -a"
64 if sudo git cat-file -e $1^{commit} 2>/dev/null; then
65 # branch, tag or sha1 object
69 sudo git fetch --tags --progress $2 $1
70 sudo git checkout FETCH_HEAD
74 bottlenecks_download_repo()
76 echo "Bottlenecks: download bottlenecks repo"
78 sudo git config --global http.sslVerify false
79 if [ ! -d $BOTTLENECKS_REPO_DIR ]; then
80 sudo git clone $BOTTLENECKS_REPO $BOTTLENECKS_REPO_DIR
82 cd $BOTTLENECKS_REPO_DIR
83 sudo git checkout master && sudo git pull
84 git_checkout $BOTTLENECKS_BRANCH $BOTTLENECKS_REPO
88 bottlenecks_config_hosts_ip()
90 sudo sed -i -e "s/REPLACE_CONTROL_HOST/$rubbos_control/g" \
91 -e "s/REPLACE_HTTPD_HOST/$rubbos_httpd/g" \
92 -e "s/REPLACE_MYSQL1_HOST/$rubbos_mysql1/g" \
93 -e "s/REPLACE_TOMCAT1_HOST/$rubbos_tomcat1/g" \
94 -e "s/REPLACE_CLIENT1_HOST/$rubbos_client1/g" \
95 -e "s/REPLACE_CLIENT2_HOST/$rubbos_client2/g" \
96 -e "s/REPLACE_CLIENT3_HOST/$rubbos_client3/g" \
97 -e "s/REPLACE_CLIENT4_HOST/$rubbos_client4/g" \
98 -e "s/REPLACE_BENCHMARK_HOST/$rubbos_benchmark/g" \
99 $BOTTLENECKS_REPO_DIR/rubbos/rubbos_scripts/1-1-1/set_bottlenecks_rubbos_env.sh
102 bottlenecks_download_packages()
104 echo "Bottlenecks: download rubbos dependent packages from artifacts"
106 curl --connect-timeout 10 -o /tmp/app_tools.tar.gz $RUBBOS_APP_TOOLS_URL 2>/dev/null
107 sudo tar zxf /tmp/app_tools.tar.gz -C $RUBBOS_DIR
108 rm -rf /tmp/app_tools.tar.gz
109 curl --connect-timeout 10 -o /tmp/rubbosMulini6.tar.gz $RUBBOS_MULINI6_URL 2>/dev/null
110 sudo tar zxf /tmp/rubbosMulini6.tar.gz -C $RUBBOS_MULINI6_DIR
111 rm -rf /tmp/rubbosMulini6.tar.gz
114 bottlenecks_rubbos_install_exe()
116 echo "Bottlenecks: install and run rubbos"
124 SCRIPT_DIR=`cd ${BASH_SOURCE[0]%/*};pwd`
126 ssh_args="-o StrictHostKeyChecking=no -o BatchMode=yes"
127 source $SCRIPT_DIR/hosts.conf
128 source $SCRIPT_DIR/package.conf
129 source $SCRIPT_DIR/common.sh
131 bottlenecks_prepare_env
133 bottlenecks_download_repo
134 bottlenecks_config_hosts_ip
135 bottlenecks_download_packages
136 bottlenecks_rubbos_install_exe