did some cleanupm job. 91/27591/3
authorNarinder Gupta <narinder.gupta@canonical.com>
Thu, 26 Jan 2017 06:21:35 +0000 (00:21 -0600)
committerNarinder Gupta <narinder.gupta@canonical.com>
Thu, 26 Jan 2017 06:30:23 +0000 (00:30 -0600)
Change-Id: I998482d0cba2bf6eb774d68124d2383ba869a08b
Signed-off-by: Narinder Gupta <narinder.gupta@canonical.com>
ci/03-maasdeploy.sh
ci/clean.sh
ci/cleanvm.sh
ci/deploy.sh

index 63d637a..bd106fa 100755 (executable)
@@ -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 `
index 079828a..3b0ab34 100755 (executable)
@@ -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`
index f7f062a..73c61c4 100755 (executable)
@@ -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 ..."
index 4d79ec8..f92f503 100755 (executable)
@@ -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