add vm env setup and run script after instance creation 59/5359/1
authorMatthewLi <matthew.lijun@huawei.com>
Wed, 30 Dec 2015 02:52:15 +0000 (02:52 +0000)
committerMatthewLi <matthew.lijun@huawei.com>
Wed, 30 Dec 2015 02:52:15 +0000 (02:52 +0000)
JIRA: BOTTLENECK-35

Change-Id: I9d96821779a148a38c4fea27163b49face80afb7
Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
utils/infra_setup/heat_template/HOT_create_instance.sh
utils/infra_setup/vm_dev_setup/setup_env.sh

index 8745510..3c96ce1 100755 (executable)
@@ -34,11 +34,23 @@ bottlenecks_create_instance()
    heat stack-show bottlenecks
    nova list
    nova list | grep rubbos_control
+}
+
+bottlenecks_rubbos_run()
+{
+   echo "Run Rubbos"
    control_ip=$(nova list | grep rubbos_control | awk '{print $13}')
+   chmod 600 $KEY_PATH/bottlenecks_key
    ssh -i $KEY_PATH/bottlenecks_key \
        -o StrictHostKeyChecking=no \
        -o BatchMode=yes root@$control_ip "uname -a"
-   heat stack-delete bottlenecks
+   scp -r -i $KEY_PATH/bottlenecks_key \
+       -o StrictHostKeyChecking=no -o BatchMode=yes \
+       $BOTTLENECKS_REPO_DIR/utils/infra_setup/vm_dev_setup \
+       root@$control_ip:/tmp
+   ssh -i $KEY_PATH/bottlenecks_key \
+       -o StrictHostKeyChecking=no \
+       -o BatchMode=yes root@$control_ip "bash /tmp/vm_dev_setup/setup_env.sh"
 }
 
 bottlenecks_cleanup()
@@ -80,7 +92,7 @@ bottlenecks_load_bottlenecks_image()
    echo "load bottlenecks image"
 
    curl --connect-timeout 10 -o /tmp/bottlenecks-trusty-server.img $IMAGE_URL -v
-   if [ $?!=0 ]; then
+   if [ $? != 0 ]; then
         wget http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img -O \
              /tmp/bottlenecks-trusty-server.img
    fi
@@ -122,6 +134,7 @@ main()
    bottlenecks_cleanup
    bottlenecks_load_bottlenecks_image
    bottlenecks_create_instance
+   bottlenecks_rubbos_run
    bottlenecks_cleanup
 }
 
index 9eba07c..e7b8c30 100755 (executable)
@@ -52,7 +52,7 @@ bottlenecks_rubbos_install_exe()
 
 main()
 {
-    PreInstall_Packages="gcc gettext g++ libaio1 libaio-dev make"
+    PreInstall_Packages="git gcc gettext g++ libaio1 libaio-dev make"
     SCRIPT_DIR=`cd ${BASH_SOURCE[0]%/*};pwd`
 
     source $SCRIPT_DIR/package.conf