Scripts update to run rubbos on compass4nfv env
[bottlenecks.git] / utils / infra_setup / vm_dev_setup / setup_env.sh
index bd0ffb5..cef76f8 100755 (executable)
@@ -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
@@ -20,7 +20,7 @@ wait_vm_ok() {
 
 bottlenecks_prepare_env()
 {
-    echo "Bottlenecks prepare env in VMs"
+    echo "Bottlenecks prepare env"
 
     # configue rubbos control ssh key
     generate_ssh_key
@@ -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 \
@@ -55,18 +55,22 @@ bottlenecks_download_repo()
 {
     echo "Bottlenecks: download bottlenecks repo"
 
+    sudo git config --global http.sslVerify false
     if [ -d $BOTTLENECKS_REPO_DIR/.git ]; then
         cd $BOTTLENECKS_REPO_DIR
         sudo git pull origin master
         if [ x"$GERRIT_REFSPEC_DEBUG" != x ]; then
-            sudo git fetch $BOTTLENECKS_REPO $GERRIT_REFSPEC_DEBUG && git checkout FETCH_HEAD
+            sudo git fetch $BOTTLENECKS_REPO $GERRIT_REFSPEC_DEBUG && sudo git checkout FETCH_HEAD
         fi
         cd -
     else
         sudo rm -rf $BOTTLENECKS_REPO_DIR
         sudo git clone $BOTTLENECKS_REPO $BOTTLENECKS_REPO_DIR
         if [ x"$GERRIT_REFSPEC_DEBUG" != x ]; then
-            sudo git fetch $BOTTLENECKS_REPO $GERRIT_REFSPEC_DEBUG && git checkout FETCH_HEAD
+            cd $BOTTLENECKS_REPO_DIR
+            echo "fetch $GERRIT_REFSPEC_DEBUG"
+            sudo git fetch $BOTTLENECKS_REPO $GERRIT_REFSPEC_DEBUG && sudo git checkout FETCH_HEAD
+            cd -
         fi
 
     fi
@@ -104,8 +108,6 @@ bottlenecks_rubbos_install_exe()
 
     cd $RUBBOS_RUN_DIR
     sudo ./run.sh
-    cd $RUBBOS_EXE_DIR
-    sudo ./CONTROL_rubbos_exec.sh
 }
 
 main()
@@ -113,11 +115,12 @@ 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
+    set -x
     bottlenecks_download_repo
     bottlenecks_config_hosts_ip
     bottlenecks_download_packages