From c029ffd91c254b778bb5967a3935922309f19e66 Mon Sep 17 00:00:00 2001 From: "Jingzhao.Ni" Date: Mon, 8 Jul 2019 11:11:25 +0800 Subject: [PATCH] Fix the error when deploying VM by compass 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 Change-Id: I74ef712d19cf5fe6161a58725b474421739777cb --- jjb/iec/iec-compass-build.sh | 2 +- jjb/iec/iec-compass-deploy.sh | 48 +++++++++++++++++++++++++++++-------------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/jjb/iec/iec-compass-build.sh b/jjb/iec/iec-compass-build.sh index 96ce02e..b403230 100755 --- a/jjb/iec/iec-compass-build.sh +++ b/jjb/iec/iec-compass-build.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -e +set -ex check_env(){ #Checking python-pip software status. If failed, reinstall it. diff --git a/jjb/iec/iec-compass-deploy.sh b/jjb/iec/iec-compass-deploy.sh index b5e0c58..dbb1c1e 100755 --- a/jjb/iec/iec-compass-deploy.sh +++ b/jjb/iec/iec-compass-deploy.sh @@ -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 -- 2.16.6