summaryrefslogtreecommitdiffstats
path: root/utils/infra_setup/vm_dev_setup
diff options
context:
space:
mode:
Diffstat (limited to 'utils/infra_setup/vm_dev_setup')
-rw-r--r--utils/infra_setup/vm_dev_setup/common.sh51
-rwxr-xr-xutils/infra_setup/vm_dev_setup/setup_env.sh21
-rw-r--r--utils/infra_setup/vm_dev_setup/vm_prepare_setup.sh3
3 files changed, 65 insertions, 10 deletions
diff --git a/utils/infra_setup/vm_dev_setup/common.sh b/utils/infra_setup/vm_dev_setup/common.sh
index 625a447e..027081f4 100644
--- a/utils/infra_setup/vm_dev_setup/common.sh
+++ b/utils/infra_setup/vm_dev_setup/common.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+set -ex
+
generate_ssh_key() {
if [ ! -d ~/.ssh ]; then
mkdir ~/.ssh
@@ -39,15 +41,60 @@ EOF
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwmx8/86Vc1yqqplMPkm/w6wB2r5Yl6CjON85Ko5SzPEpnysJwO5ygbMClQTbzCUztIpFeO8D6xdWlhPmhMEJIWtRh+Dx0swB+ByMraGTP92xxKo2ukWzYI6eu25LmJX+a1lmVPmewQq+6dPzIwgCZvwD8UVe5L+d0EP2rb3iniQVoBzksUmhL3N6jp2Lgpscfi1yXFgjFdLpDsCcFcM+Q6wQUC2+qGBYa5RxqercWzISSbvAsYwC7UepmjFpcj3W/WX2QcOCDIlAzeURvC8PbOdzCtgeMhuhH2499BcIUSzPMpjzvpRiHr5SeF/zrPeW+2Ei1MfHi1qrBCxS8JBqt bottlenecks@bottlenecks.opnfv.org
EOF
chmod 600 ~/.ssh/id_rsa
+
+ if [ ! -d /root/.ssh ]; then
+ mkdir /root/.ssh
+ fi
+
+ sudo cat << EOF > /root/.ssh/id_rsa
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAsJsfP/OlXNcqqqZTD5Jv8OsAdq+WJegozjfOSqOUszxKZ8rC
+cDucoGzApUE28wlM7SKRXjvA+sXVpYT5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iGwANVfI
+pGvsmzO2mtYdABtTYeWGzR/qGJxYgl2iDwM3vODZDye8clEZzQ+M7HZyeAEIXTy8
+8bcUM9yC54PQWEOwjD8uFQKBgCzIAnftur5K4uj83pEHSt2taCr9Jryy7xiriq08
+JlesJRneCN5CIKy0JIiOZCXcZ5hKSHyqQZHaracVK84rk3OvJl8AR2kU2ncAgDcL
+1WMolUJoAHOfF0w19gjhfXYeXx4iYvTj1of9YU8sNUKJz9oeLxZy0D0BpUu83FJZ
+TPVhAoGBAMhFV9+VrZJSXaAw0NlZx2k2/Hq2lmUc30UZYXDW8k77qgF3EJHi3ZSl
+PBjN5vmoGcf7d7xRjAIMjsNINPdtzHJCca16lsVRc20qG1RqMiCKcqveExqpMqn1
+oV2vefV/XJtj43/jrlrGfCoI+RNVImsvp4dwKzr7YOI8Fcqf1e3G
+-----END RSA PRIVATE KEY-----
+EOF
+
+ sudo cat << EOF > /root/.ssh/id_rsa.pub
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwmx8/86Vc1yqqplMPkm/w6wB2r5Yl6CjON85Ko5SzPEpnysJwO5ygbMClQTbzCUztIpFeO8D6xdWlhPmhMEJIWtRh+Dx0swB+ByMraGTP92xxKo2ukWzYI6eu25LmJX+a1lmVPmewQq+6dPzIwgCZvwD8UVe5L+d0EP2rb3iniQVoBzksUmhL3N6jp2Lgpscfi1yXFgjFdLpDsCcFcM+Q6wQUC2+qGBYa5RxqercWzISSbvAsYwC7UepmjFpcj3W/WX2QcOCDIlAzeURvC8PbOdzCtgeMhuhH2499BcIUSzPMpjzvpRiHr5SeF/zrPeW+2Ei1MfHi1qrBCxS8JBqt bottlenecks@bottlenecks.opnfv.org
+EOF
+ sudo chmod 600 /root/.ssh/id_rsa
+
+ sudo sed -ie 's/ssh-rsa/\n&/g' /root/.ssh/authorized_keys
+ sudo sed -ie '/echo/d' /root/.ssh/authorized_keys
}
configue_nameserver()
{
echo "Bottlenecks: configue nameserver"
sudo rm /etc/resolv.conf
- sudo echo "nameserver $1" > /etc/resolv.conf
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
}
install_packages()
@@ -63,3 +110,5 @@ install_packages()
done
}
+set +ex
+
diff --git a/utils/infra_setup/vm_dev_setup/setup_env.sh b/utils/infra_setup/vm_dev_setup/setup_env.sh
index 8ba76600..d09bc774 100755
--- a/utils/infra_setup/vm_dev_setup/setup_env.sh
+++ b/utils/infra_setup/vm_dev_setup/setup_env.sh
@@ -6,14 +6,14 @@ wait_vm_ok() {
ip=$1
retry=0
- until timeout 1s ssh $ssh_args ec2-user@$ip "exit" >/dev/null 2>&1
+ until timeout 10s ssh $ssh_args ec2-user@$ip "exit" >/dev/null 2>&1
do
echo "retry connect rubbos vm ip $ip $retry"
sleep 1
let retry+=1
if [[ $retry -ge $2 ]];then
echo "rubbos control start timeout !!!"
- exit 1
+ #exit 1
fi
done
}
@@ -29,19 +29,26 @@ bottlenecks_prepare_env()
for i in $rubbos_benchmark $rubbos_client1 $rubbos_client2 \
$rubbos_client3 $rubbos_client4 $rubbos_httpd $rubbos_mysql1 $rubbos_tomcat1
do
- wait_vm_ok $i 120
+ wait_vm_ok $i 360
done
- # asynchronous configue other VMs
+ # configue other VMs
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:$SCRIPT_DIR
- ssh $ssh_args ec2-user@$i "sudo bash $SCRIPT_DIR/vm_prepare_setup.sh" &
+ ssh $ssh_args ec2-user@$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"
+
+ # test root access
+ for i in $rubbos_control $rubbos_benchmark $rubbos_client1 $rubbos_client2 \
+ $rubbos_client3 $rubbos_client4 $rubbos_httpd $rubbos_mysql1 $rubbos_tomcat1
+ do
+ ssh $ssh_args root@$i "uname -a"
+ done
}
bottlenecks_download_repo()
@@ -84,10 +91,10 @@ bottlenecks_download_packages()
echo "Bottlenecks: download rubbos dependent packages from artifacts"
curl --connect-timeout 10 -o /tmp/app_tools.tar.gz $RUBBOS_APP_TOOLS_URL 2>/dev/null
- sudo tar zxvf /tmp/app_tools.tar.gz -C $RUBBOS_DIR
+ sudo tar zxf /tmp/app_tools.tar.gz -C $RUBBOS_DIR
rm -rf /tmp/app_tools.tar.gz
curl --connect-timeout 10 -o /tmp/rubbosMulini6.tar.gz $RUBBOS_MULINI6_URL 2>/dev/null
- sudo tar zxvf /tmp/rubbosMulini6.tar.gz -C $RUBBOS_MULINI6_DIR
+ sudo tar zxf /tmp/rubbosMulini6.tar.gz -C $RUBBOS_MULINI6_DIR
rm -rf /tmp/rubbosMulini6.tar.gz
}
diff --git a/utils/infra_setup/vm_dev_setup/vm_prepare_setup.sh b/utils/infra_setup/vm_dev_setup/vm_prepare_setup.sh
index cb7b6dfd..8fb995b8 100644
--- a/utils/infra_setup/vm_dev_setup/vm_prepare_setup.sh
+++ b/utils/infra_setup/vm_dev_setup/vm_prepare_setup.sh
@@ -10,8 +10,7 @@ main()
generate_ssh_key
configue_nameserver $nameserver_ip
- install_packages $PreInstall_Packages
-
+ #install_packages $PreInstall_Packages
}
main