From eab8a2b3bb2d8e6f992e4c288fed4275a675f082 Mon Sep 17 00:00:00 2001 From: Narinder Gupta Date: Thu, 26 Jan 2017 00:21:35 -0600 Subject: did some cleanupm job. Change-Id: I998482d0cba2bf6eb774d68124d2383ba869a08b Signed-off-by: Narinder Gupta --- ci/03-maasdeploy.sh | 52 +++++++++++++++++++++++----------------------------- ci/clean.sh | 20 ++++++++++++-------- ci/cleanvm.sh | 4 ++-- ci/deploy.sh | 35 +++++++++++++++++------------------ 4 files changed, 54 insertions(+), 57 deletions(-) diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index 63d637a3..bd106fa0 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -68,6 +68,10 @@ case "$labname" in fi if [ ! -e ./labconfig.yaml ]; then virtinstall=1 + labname="default" + cp ../labconfig/default/deployment.yaml ./ + cp ../labconfig/default/labconfig.yaml ./ + cp ../labconfig/default/deployconfig.yaml ./ else python genMAASConfig.py -l labconfig.yaml > deployment.yaml python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml @@ -76,6 +80,10 @@ case "$labname" in ;; * ) virtinstall=1 + labname="default" + cp ../labconfig/default/deployment.yaml ./ + cp ../labconfig/default/labconfig.yaml ./ + cp ../labconfig/default/deployconfig.yaml ./ ;; esac @@ -98,17 +106,28 @@ VLAN_TAG="untagged" # In the case of a virtual deployment get deployment.yaml and deployconfig.yaml if [ "$virtinstall" -eq 1 ]; then - labname="default" MAAS_IP="192.168.122.1" API_SERVER="http://$MAAS_IP/MAAS/api/2.0" API_SERVERMAAS="http://$MAAS_IP/MAAS/" PRIMARY_RACK_CONTROLLER="$MAAS_IP" ./cleanvm.sh || true - cp ../labconfig/default/deployment.yaml ./ - cp ../labconfig/default/labconfig.yaml ./ - cp ../labconfig/default/deployconfig.yaml ./ fi +#create backup directory +mkdir ~/joid_config/ || true + +# Backup deployment.yaml and deployconfig.yaml in joid_config folder + +if [ -e ./deployconfig.yaml ]; then + cp ./deployconfig.yaml ~/joid_config/ + cp ./labconfig.yaml ~/joid_config/ +fi + +if [ -e ./deployment.yaml ]; then + cp ./deployment.yaml ~/joid_config/ +fi + + # # Prepare local environment to avoid password asking # @@ -161,9 +180,6 @@ if [ $(pip list |grep google-api-python-client |wc -l) == 1 ]; then sudo pip uninstall google-api-python-client fi -#create backup directory -mkdir ~/joid_config/ || true -mkdir ~/.juju/ || true if [ ! -e ~maas/.ssh/id_rsa.pub ]; then sudo su - $USER -c "echo |ssh-keygen -t rsa -f $HOME/id_rsa_maas" @@ -405,23 +421,6 @@ addnodes echo "... Deployment of maas finish ...." -# Backup deployment.yaml and deployconfig.yaml in .juju folder - -#cp ./environments.yaml ~/.juju/ -#cp ./environments.yaml ~/joid_config/ - -if [ -e ./deployconfig.yaml ]; then - cp ./deployconfig.yaml ~/.juju/ - cp ./labconfig.yaml ~/.juju/ - cp ./deployconfig.yaml ~/joid_config/ - cp ./labconfig.yaml ~/joid_config/ -fi - -if [ -e ./deployment.yaml ]; then - cp ./deployment.yaml ~/.juju/ - cp ./deployment.yaml ~/joid_config/ -fi - #Added the Qtip public to run the Qtip test after install on bare metal nodes. #maas $PROFILE sshkeys new key="`cat ./maas/sshkeys/QtipKey.pub`" #maas $PROFILE sshkeys new key="`cat ./maas/sshkeys/DominoKey.pub`" @@ -537,11 +536,6 @@ esac # #read interface needed in Auto mode and enable it. Will be rmeoved once auto enablement will be implemented in the maas-deployer. -if [ -e ~/joid_config/deployconfig.yaml ]; then - cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml -elif [ -e ~/.juju/deployconfig.yaml ]; then - cp ~/.juju/deployconfig.yaml ./deployconfig.yaml -fi if [ -e ./deployconfig.yaml ]; then enableiflist=`grep "interface-enable" deployconfig.yaml | cut -d ' ' -f 4 ` diff --git a/ci/clean.sh b/ci/clean.sh index 079828a0..3b0ab34f 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -2,17 +2,21 @@ set -ex -if [ ! -d environments.yaml ]; then - cp ~/joid_config/environments.yaml ./environments.yaml || true - cp ~/.juju/environments.yaml ./environments.yaml || true -fi +jujuver=`juju --version` -if [ ! -d deployment.yaml ]; then - cp ~/joid_config/deployment.yaml ./deployment.yaml || true - cp ~/.juju/deployment.yaml ./deployment.yaml || true +if [[ "$jujuver" > "2" ]]; then + if [ ! -d labconfig.yaml ]; then + cp ~/joid_config/deployment.yaml ./deployment.yaml || true + cp ~/joid_config/labconfig.yaml ./labconfig.yaml || true + cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml || true + fi +else + if [ ! -d environments.yaml ]; then + cp ~/joid_config/environments.yaml ./environments.yaml || true + cp ~/.juju/environments.yaml ./environments.yaml || true + fi fi -jujuver=`juju --version` if [[ "$jujuver" > "2" ]]; then controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployment.yaml` diff --git a/ci/cleanvm.sh b/ci/cleanvm.sh index f7f062a6..73c61c4b 100755 --- a/ci/cleanvm.sh +++ b/ci/cleanvm.sh @@ -20,12 +20,12 @@ sudo virsh undefine node3-control || true sudo virsh undefine node4-control || true sudo virsh undefine node2-compute || true sudo virsh undefine node5-compute || true -sudo rm -rf /var/lib/libvirt/images/node1-control.img /var/lib/libvirt/images/node2-compute.img /var/lib/libvirt/images/node3-control.img /var/lib/libvirt/images/node4-control.img /var/lib/libvirt/images/node5-compute.img || true +sudo rm -rf /var/lib/libvirt/images/node1-control.qcow2 /var/lib/libvirt/images/node2-compute.qcow2 /var/lib/libvirt/images/node3-control.qcow2 /var/lib/libvirt/images/node4-control.qcow2 /var/lib/libvirt/images/node5-compute.qcow2 || true if [[ "$maasver" > "2" ]]; then sudo virsh destroy bootstrap || true sudo virsh undefine bootstrap || true - sudo rm -rf /var/lib/libvirt/images/bootstrap.img || true + sudo rm -rf /var/lib/libvirt/images/bootstrap.qcow2 || true fi echo " Cleanup Finished ..." diff --git a/ci/deploy.sh b/ci/deploy.sh index 4d79ec8d..f92f5032 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -105,28 +105,25 @@ createresource() { #copy the files and create extra resources needed for HA deployment # in case of default VM labs. deploy() { - + if [ ! -f ./deployment.yaml ] && [ -e ~/.juju/deployment.yaml ]; then + cp ~/.juju/deployment.yaml ./deployment.yaml + elif [ ! -f ./deployment.yaml ] && [ -e ~/joid_config/deployment.yaml ]; then + cp ~/joid_config/deployment.yaml ./deployment.yaml + fi + + if [[ "$jujuver" > "2" ]]; then + if [ ! -f ./labconfig.yaml ] && [ -e ~/joid_config/labconfig.yaml ]; then + cp ~/joid_config/labconfig.yaml ./labconfig.yaml + fi + if [ ! -f ./deployconfig.yaml ] && [ -e ~/joid_config/deployconfig.yaml ]; then + cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml + fi + else if [ ! -f ./environments.yaml ] && [ -e ~/.juju/environments.yaml ]; then cp ~/.juju/environments.yaml ./environments.yaml elif [ ! -f ./environments.yaml ] && [ -e ~/joid_config/environments.yaml ]; then cp ~/joid_config/environments.yaml ./environments.yaml fi - if [ ! -f ./deployment.yaml ] && [ -e ~/.juju/deployment.yaml ]; then - cp ~/.juju/deployment.yaml ./deployment.yaml - elif [ ! -f ./deployment.yaml ] && [ -e ~/joid_config/deployment.yaml ]; then - cp ~/joid_config/deployment.yaml ./deployment.yaml - fi - if [ ! -f ./labconfig.yaml ] && [ -e ~/.juju/labconfig.yaml ]; then - cp ~/.juju/labconfig.yaml ./labconfig.yaml - elif [ ! -f ./labconfig.yaml ] && [ -e ~/joid_config/labconfig.yaml ]; then - cp ~/joid_config/labconfig.yaml ./labconfig.yaml - fi - if [ ! -f ./deployconfig.yaml ] && [ -e ~/.juju/deployconfig.yaml ]; then - cp ~/.juju/deployconfig.yaml ./deployconfig.yaml - elif [ ! -f ./deployconfig.yaml ] && [ -e ~/joid_config/deployconfig.yaml ]; then - cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml - fi - #copy the script which needs to get deployed as part of ofnfv release echo "...... deploying now ......" echo " " >> environments.yaml @@ -134,9 +131,11 @@ deploy() { echo " enable-os-upgrade: false" >> environments.yaml echo " admin-secret: admin" >> environments.yaml echo " default-series: $opnfvdistro" >> environments.yaml - cp environments.yaml ~/.juju/ cp environments.yaml ~/joid_config/ + fi + + if [[ "$opnfvtype" = "ha" && "$opnfvlab" = "default" ]]; then createresource -- cgit 1.2.3-korg