diff options
author | Ryota MIBU <r-mibu@cq.jp.nec.com> | 2017-01-27 04:44:48 +0000 |
---|---|---|
committer | Ryota MIBU <r-mibu@cq.jp.nec.com> | 2017-01-27 04:48:17 +0000 |
commit | 50e1c44f64585abe63bd40982cb379412045fa33 (patch) | |
tree | 885484b9ccf27f0e0a18fc208e1d769c989df7e2 | |
parent | 59f0f3aa4b49425e19369b2d5fe7b55688b23f7f (diff) |
improvements for default virtual pod creation
This patch includes the following improvements:
- deprecate ci/00-maasdeploy.sh
- refactor cleaner sctipts
- fix MAAS_IP in default configs
Change-Id: I60f77e18ce41573a744d79b8cf468c23a7dd3385
Signed-off-by: Ryota MIBU <r-mibu@cq.jp.nec.com>
-rwxr-xr-x | ci/00-maasdeploy.sh | 6 | ||||
-rwxr-xr-x | ci/03-maasdeploy.sh | 13 | ||||
-rwxr-xr-x | ci/clean.sh | 3 | ||||
-rwxr-xr-x | ci/cleanmaas.sh | 11 | ||||
-rwxr-xr-x | ci/cleanvm.sh | 33 | ||||
-rw-r--r-- | labconfig/default/deployment.yaml | 2 | ||||
-rw-r--r-- | labconfig/default/labconfig.yaml | 2 |
7 files changed, 35 insertions, 35 deletions
diff --git a/ci/00-maasdeploy.sh b/ci/00-maasdeploy.sh index f87e2d3d..38bf3537 100755 --- a/ci/00-maasdeploy.sh +++ b/ci/00-maasdeploy.sh @@ -2,6 +2,12 @@ #placeholder for deployment script. set -ex +echo "Note: This script is deprecated. Use 03-maasdeploy.sh instead." +echo "Are you sure you want to execute this script? [y/N] " +read a +[[ "$a" = "y" ]] || exit + + virtinstall=0 labname=$1 diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index 8bafea5b..2dd0c269 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -2,14 +2,6 @@ #placeholder for deployment script. set -ex -maasver=`apt-cache policy maas | grep Installed | cut -d ':' -f 2 | sed -e 's/ //'` - -if [[ "$maasver" > "2" ]]; then - echo "removing existing maas ..." - #sudo apt-get purge maas maas-cli maas-common maas-dhcp maas-dns maas-proxy maas-rack-controller maas-region-api maas-region-controller -y - #sudo rm -rf /var/lib/maas -fi - virtinstall=0 labname=$1 @@ -182,7 +174,10 @@ fi if [ ! -e ~maas/.ssh/id_rsa.pub ]; then - sudo su - $USER -c "echo |ssh-keygen -t rsa -f $HOME/id_rsa_maas" + if [ ! -e $HOME/id_rsa_maas.pub ]; then + [ -e $HOME/id_rsa_maas ] && rm -f $HOME/id_rsa_maas + sudo su - $USER -c "echo |ssh-keygen -t rsa -f $HOME/id_rsa_maas" + fi sudo -u maas mkdir ~maas/.ssh/ || true sudo cp $HOME/id_rsa_maas ~maas/.ssh/id_rsa sudo cp $HOME/id_rsa_maas.pub ~maas/.ssh/id_rsa.pub diff --git a/ci/clean.sh b/ci/clean.sh index 3b0ab34f..aa14fe76 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -46,6 +46,3 @@ elif [ -d $HOME/.juju/environments ]; then rm -rf $HOME/.juju/ssh sudo sysctl -w vm.drop_caches=3 fi - -#sudo apt-get purge maas maas-cli maas-common maas-dhcp maas-dns maas-proxy maas-rack-controller maas-region-api maas-region-controller -y -#sudo rm -rf /var/lib/maas diff --git a/ci/cleanmaas.sh b/ci/cleanmaas.sh new file mode 100755 index 00000000..40961359 --- /dev/null +++ b/ci/cleanmaas.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -ex + +maasver=$(apt-cache policy maas | grep Installed | cut -d ':' -f 2 | sed -e 's/^.*: //') + +if [[ "$maasver" > "2" ]]; then + echo "removing existing maas ..." + sudo apt-get purge maas maas-cli maas-common maas-dhcp maas-dns maas-proxy maas-rack-controller maas-region-api maas-region-controller -y + sudo rm -rf /var/lib/maas +fi diff --git a/ci/cleanvm.sh b/ci/cleanvm.sh index 73c61c4b..d4f1f3bd 100755 --- a/ci/cleanvm.sh +++ b/ci/cleanvm.sh @@ -2,30 +2,21 @@ set -ex +echo " Cleanup Started ..." + #use the below commands if you needs to delete the virtual machine # also along with envuronment destroy. - -echo " Cleanup Started ..." ./clean.sh || true - -maasver=`apt-cache policy maas | grep Installed | cut -d ':' -f 2 | sed -e 's/ //'` -sudo virsh destroy node1-control || true -sudo virsh destroy node3-control || true -sudo virsh destroy node4-control || true -sudo virsh destroy node2-compute || true -sudo virsh destroy node5-compute || true -sudo virsh undefine node1-control || true -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.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.qcow2 || true -fi +vm_list=$(sudo virsh list --all) + +for vm in node1-control node2-compute node3-control node4-control \ + node5-compute bootstrap +do + echo "$vm_list" | grep -q " $vm " || continue + sudo virsh destroy $vm + sudo virsh undefine $vm + sudo rm -f /var/lib/libvirt/images/${vm}.qcow2 +done echo " Cleanup Finished ..." diff --git a/labconfig/default/deployment.yaml b/labconfig/default/deployment.yaml index f56a9b2b..849f28cf 100644 --- a/labconfig/default/deployment.yaml +++ b/labconfig/default/deployment.yaml @@ -59,7 +59,7 @@ demo-maas: # Defines the IP Address that the configuration script will use to # to access the MAAS controller via SSH. - ip_address: 192.168.122.5 + ip_address: 192.168.122.1 # This section allows the user to set a series of options on the # MAAS server itself. The list of config options can be found in diff --git a/labconfig/default/labconfig.yaml b/labconfig/default/labconfig.yaml index 59a78569..ee35f651 100644 --- a/labconfig/default/labconfig.yaml +++ b/labconfig/default/labconfig.yaml @@ -59,7 +59,7 @@ demo-maas: # Defines the IP Address that the configuration script will use to # to access the MAAS controller via SSH. - ip_address: 192.168.122.2 + ip_address: 192.168.122.1 # This section allows the user to set a series of options on the # MAAS server itself. The list of config options can be found in |