Fix the error when deploying VM by compass 33/1133/3
authorJingzhao.Ni <Jingzhao.Ni@arm.com>
Mon, 8 Jul 2019 03:11:25 +0000 (11:11 +0800)
committerJingzhao.Ni <Jingzhao.Ni@arm.com>
Tue, 9 Jul 2019 13:46:48 +0000 (21:46 +0800)
When deploying the VM by compass, the absolute file path is too long
to find the correct file. It results in the deployment failure.
In this patch, we create a soft-link which pointed to the work file.
By this way, it could walk around this problem.

Signed-off-by: Jingzhao.Ni <Jingzhao.Ni@arm.com>
Change-Id: I74ef712d19cf5fe6161a58725b474421739777cb

jjb/iec/iec-compass-build.sh
jjb/iec/iec-compass-deploy.sh

index 96ce02e..b403230 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
-set -e
+set -ex
 
 check_env(){
   #Checking python-pip software status. If failed, reinstall it.
index b5e0c58..dbb1c1e 100755 (executable)
@@ -1,26 +1,44 @@
 #!/bin/bash
-set -e
+set -ex
 
 cd compass4nfv
 
-# Create 3 virtual machine
-echo -e "  - name: host3\n    roles:\n      - kube_node" >> deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml
-# Remove useless code
-# The ansible-kubernetes.yml file contains the list of softwares which will
-# be installed on VM. But for IEC projects, some parts are not essnetial. So
-# useless part will be removed.
-# Delete some contents from line 28 to end.
-sed -i '28,$d' deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml
+config_vm(){
+  # Create 3 virtual machine
+  echo -e "  - name: host3\n    roles:\n      - kube_node" >> deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml
+  # Remove useless code
+  # The ansible-kubernetes.yml file contains the list of softwares which will
+  # be installed on VM. But for IEC projects, some parts are not essnetial. So
+  # useless part will be removed.
+  # Delete some contents from line 28 to end.
+  sed -i '28,$d' deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml
 
-export ADAPTER_OS_PATTERN='(?i)ubuntu-16.04.*arm.*'
-export OS_VERSION="xenial"
-export KUBERNETES_VERSION="v1.13.0"
+  export ADAPTER_OS_PATTERN='(?i)ubuntu-16.04.*arm.*'
+  export OS_VERSION="xenial"
+  export KUBERNETES_VERSION="v1.13.0"
 
-export DHA="deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml"
-export NETWORK="deploy/conf/vm_environment/network.yml"
-export VIRT_NUMBER=3 VIRT_CPUS=4 VIRT_MEM=12288 VIRT_DISK=50G
+  export DHA="deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml"
+  export NETWORK="deploy/conf/vm_environment/network.yml"
+  export VIRT_NUMBER=3 VIRT_CPUS=4 VIRT_MEM=12288 VIRT_DISK=50G
+}
+
+modify_workdir(){
+  # When deploying the OS by compass, long path will cause the deploying system failed.
+  # we will create a soft link to walk around this problem.
+  COMPASS_WORK_DIR=${HOME}/compass-work
+
+  ln -sfn $(pwd)/work $COMPASS_WORK_DIR
+
+  sed -i "s#\$COMPASS_DIR/work#$COMPASS_WORK_DIR#g" deploy/launch.sh
+}
+
+config_vm
+
+modify_workdir
 
 ./deploy.sh
 
 echo "Compass Deploy successful"
+
+rm -rf "$COMPASS_WORK_DIR"
 exit 0