From 5393a8a75ed56443af366bae9565bce6a7d47391 Mon Sep 17 00:00:00 2001 From: Zhijiang Hu Date: Mon, 25 Sep 2017 23:27:00 -0400 Subject: securelab parameter bug fix This is a bug fix of 02e1f1c8ab3f3857ca2370f98575ccbf41f12a01 Change-Id: I628c5e33a76bc28e0af139e338b29a7393700525 Signed-off-by: Zhijiang Hu (cherry picked from commit 15405530cd0b27f7e2f27d5c889b561569057057) --- ci/deploy/deploy.sh | 49 +++++++++++++++++++--------------- docs/release/installation/bmdeploy.rst | 9 ++++++- docs/release/installation/vmdeploy.rst | 3 ++- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/ci/deploy/deploy.sh b/ci/deploy/deploy.sh index b04cf713..6de400be 100755 --- a/ci/deploy/deploy.sh +++ b/ci/deploy/deploy.sh @@ -18,15 +18,13 @@ cat << EOF xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx `basename $0`: Deploys the Daisy4NFV -usage: `basename $0` -d dha_conf -l lab_name -p pod_name +usage: `basename $0` -l lab_name -p pod_name -r remote_workspace -w workdir OPTIONS: - -b Base configuration path, necessary -B PXE Bridge for booting Daisy Master, optional - -d Configuration yaml file of DHA, optional, will be deleted later -D Dry-run, does not perform deployment, will be deleted later - -L Securelab repo dir + -L Securelab repo absolute path, optional -l LAB name, necessary -p POD name, necessary -r Remote workspace in target server, optional @@ -39,9 +37,7 @@ Description: Deploys the Daisy4NFV on the indicated lab resource Examples: -sudo `basename $0` -b base_path - -l zte -p pod2 -B pxebr - -d ./deploy/config/vm_environment/zte-virtual1/deploy.yml +sudo `basename $0` -l zte -p pod2 -B pxebr -r /opt/daisy -w /opt/daisy -s os-nosdn-nofeature-noha xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx EOF @@ -77,7 +73,7 @@ VALID_DEPLOY_SCENARIO=("os-nosdn-nofeature-noha" "os-nosdn-nofeature-ha" "os-odl ############################################################################ # BEGIN of main # -while getopts "b:B:Dd:n:L:l:p:r:w:s:Sh" OPTION +while getopts "b:B:Dn:L:l:p:r:w:s:Sh" OPTION do case $OPTION in b) @@ -86,9 +82,6 @@ do B) BRIDGE=${OPTARG} ;; - d) - DHA_CONF=${OPTARG} - ;; D) DRY_RUN=1 ;; @@ -125,9 +118,11 @@ do esac done -if [ -z $BASE_PATH ] || [ ! -d $BASE_PATH ] || [ -z LAB_NAME ] || [ -z $POD_NAME ] ; then +SECURELABDIR=${SECURELABDIR:-${WORKSPACE}/securedlab} + +if [[ ! "$SECURELABDIR" = /* ]] || [ -z $LAB_NAME ] || [ -z $POD_NAME ] ; then echo """Please check - BASE_PATH: $BASE_PATH + SECURELABDIR: $SECURELABDIR LAB_NAME: $LAB_NAME POD_NAME: $POD_NAME """ @@ -140,10 +135,12 @@ DEPLOY_SCENARIO=${DEPLOY_SCENARIO:-"os-nosdn-nofeature-noha"} BRIDGE=${BRIDGE:-pxebr} -# read parameters from lab configuration file -DHA_CONF=$BASE_PATH/labs/$LAB_NAME/$POD_NAME/daisy/config/deploy.yml +# these two config files (should be absolute path) should be copied to +# daisy node and names as ${DHA} and ${NETWORK}, see below. +DHA_CONF=$SECURELABDIR/labs/$LAB_NAME/$POD_NAME/daisy/config/deploy.yml +NETWORK_CONF=$SECURELABDIR/labs/$LAB_NAME/$POD_NAME/daisy/config/network.yml -# set work space in daisy master node +# work space and config files' path(absolute) in daisy node REMOTE_SPACE=${REMOTE_SPACE:-/home/daisy} DHA=$REMOTE_SPACE/labs/$LAB_NAME/$POD_NAME/daisy/config/deploy.yml NETWORK=$REMOTE_SPACE/labs/$LAB_NAME/$POD_NAME/daisy/config/network.yml @@ -151,7 +148,6 @@ NETWORK=$REMOTE_SPACE/labs/$LAB_NAME/$POD_NAME/daisy/config/network.yml # set temporay workdir WORKDIR=${WORKDIR:-/tmp/workdir/daisy} -SECURELABDIR=${SECURELABDIR:-./securedlab} [[ $POD_NAME =~ (virtual) ]] && IS_BARE=0 @@ -184,11 +180,12 @@ done BMDEPLOY_DAISY_SERVER_NET=$WORKSPACE/templates/physical_environment/networks/daisy.xml BMDEPLOY_DAISY_SERVER_VM=$WORKSPACE/templates/physical_environment/vms/daisy.xml +# Note: This function must be exectuted in ${SECURELABDIR} function update_dha_by_pdf() { - local pdf_yaml=${SECURELABDIR}/labs/$LAB_NAME/${POD_NAME}.yaml - local jinja2_template=${SECURELABDIR}/installers/daisy/pod_config.yaml.j2 - local generate_config=${SECURELABDIR}/utils/generate_config.py + local pdf_yaml=labs/$LAB_NAME/${POD_NAME}.yaml + local jinja2_template=installers/daisy/pod_config.yaml.j2 + local generate_config=utils/generate_config.py if [ ! -f ${generate_config} ] || [ ! -f ${pdf_yaml} ] || [ ! -f ${jinja2_template} ]; then return fi @@ -214,11 +211,12 @@ function update_dha_by_pdf() } if [[ ! -z $INSTALLER_IP ]]; then - pushd ${WORKSPACE} + pushd ${SECURELABDIR} update_dha_by_pdf popd fi +# read parameters from $DHA_CONF PARAS_FROM_DEPLOY=`python $WORKSPACE/deploy/get_conf.py --dha $DHA_CONF` TARGET_HOSTS_NUM=`echo $PARAS_FROM_DEPLOY | cut -d " " -f 1` DAISY_IP=`echo $PARAS_FROM_DEPLOY | cut -d " " -f 2` @@ -228,7 +226,6 @@ PARAS_IMAGE=${PARAS_FROM_DEPLOY#* * * } if [ $DRY_RUN -eq 1 ]; then echo """ - BASE_PATH: $BASE_PATH LAB_NAME: $LAB_NAME POD_NAME: $POD_NAME IS_BARE: $IS_BARE @@ -412,6 +409,13 @@ function install_daisy() $DEPLOY_PATH/trustme.sh $DAISY_IP $DAISY_PASSWD ssh $SSH_PARAS $DAISY_IP "if [[ -f ${REMOTE_SPACE} || -d ${REMOTE_SPACE} ]]; then rm -fr ${REMOTE_SPACE}; fi" scp -r $WORKSPACE root@$DAISY_IP:${REMOTE_SPACE} + + ssh $SSH_PARAS $DAISY_IP "mkdir -p $(dirname ${DHA})" + scp -q ${DHA_CONF} root@$DAISY_IP:${DHA} + + ssh $SSH_PARAS $DAISY_IP "mkdir -p $(dirname ${NETWORK})" + scp -q ${NETWORK_CONF} root@$DAISY_IP:${NETWORK} + ssh $SSH_PARAS $DAISY_IP "mkdir -p /home/daisy_install" update_config $WORKSPACE/deploy/daisy.conf daisy_management_ip $DAISY_IP scp $WORKSPACE/deploy/daisy.conf root@$DAISY_IP:/home/daisy_install @@ -477,6 +481,7 @@ function get_mac_addresses_for_virtual() done fi + # update DHA file in daisy node scp -q $tmpfile root@$DAISY_IP:$DHA rm $tmpfile } diff --git a/docs/release/installation/bmdeploy.rst b/docs/release/installation/bmdeploy.rst index ddb30f22..cbdf62e5 100644 --- a/docs/release/installation/bmdeploy.rst +++ b/docs/release/installation/bmdeploy.rst @@ -165,7 +165,14 @@ ifconfig br7 10.20.7.1 netmask 255.255.255.0 up service network restart (7) Run the script deploy.sh in daisy/ci/deploy/ with command: -sudo ./ci/deploy/deploy.sh -b ../daisy -l zte -p pod2 -s os-nosdn-nofeature-noha +sudo ./ci/deploy/deploy.sh -L $(cd ./;pwd) -l zte -p pod2 -s os-nosdn-nofeature-noha + +Note: +The value after -L should be a absolute path which points to the directory which contents labs/zte/pod2/daisy/config directory. +The value after -p parameter(pod2) comes from path "labs/zte/pod2" +The value after -l parameter(zte) comes from path "labs/zte" +The value after -s "os-nosdn-nofeature-ha" used for deploy multinode openstack +The value after -s "os-nosdn-nofeature-noha" used for deploy all-in-one openstack (8) When deploy successfully,the floating ip of openstack is 10.20.7.11, the login account is "admin" and the password is "keystone" diff --git a/docs/release/installation/vmdeploy.rst b/docs/release/installation/vmdeploy.rst index 64d16a96..12aa9ba8 100644 --- a/docs/release/installation/vmdeploy.rst +++ b/docs/release/installation/vmdeploy.rst @@ -166,9 +166,10 @@ If selinux is disabled on the host, please delete all xml files section of below (6) Run the script deploy.sh in daisy/ci/deploy/ with command: -sudo ./ci/deploy/deploy.sh -b ./ -l zte -p virtual1 -s os-nosdn-nofeature-ha +sudo ./ci/deploy/deploy.sh -L $(cd ./;pwd) -l zte -p virtual1 -s os-nosdn-nofeature-ha Note: +The value after -L should be a absolute path which points to the directory which contents labs/zte/virtual1/daisy/config directory. The value after -p parameter(virtual1) is get from labs/zte/virtual1/daisy/config/ The value after -l parameter(zte) is get from labs/ The value after -s "os-nosdn-nofeature-ha" used for deploy multinode openstack -- cgit 1.2.3-korg