aboutsummaryrefslogtreecommitdiffstats
path: root/mcp/config/states/virtual_control_plane
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2017-11-18 20:46:05 +0100
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2017-11-22 14:58:02 +0000
commit544fa286cf4397941ca8627117479d7f4c6d9f28 (patch)
treebd23cad6163637b1c063d3fc9a74b45368d92bc5 /mcp/config/states/virtual_control_plane
parent9b5bffe65199af34cb089c7a782e5e4234610768 (diff)
ci/deploy.sh: Add new `-E` arg for env erase
NOTE: In order to undefine VCP VMs with NVRAM (e.g. AArch64 VMs using AAVMF), an additional parameter should be passed to libvirt by Salt virt core module (equivalent to `virsh undefine --nvram`). While at it, pass CI_DEBUG, ERASE_ENV enviroment variables to state execution, and stop force-applying patches. Also refactor the rsync between foundation node and Salt master, so the whole git repo is copied as </root/opnfv>, and <root/fuel> becomes a link to it; useful for Armband, where 'fuel' is a git submodule. Fix .git paths after rsync, so git submodules work as expected in cfg01 repos. JIRA: FUEL-307 Change-Id: Ic62f03e786581c019168c50ccc50107238021d7f Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com> (cherry picked from commit 77942178b3aff6adc83b5f83645acfff467fa76a)
Diffstat (limited to 'mcp/config/states/virtual_control_plane')
-rwxr-xr-xmcp/config/states/virtual_control_plane15
1 files changed, 15 insertions, 0 deletions
diff --git a/mcp/config/states/virtual_control_plane b/mcp/config/states/virtual_control_plane
index cfd5e421c..c355126f7 100755
--- a/mcp/config/states/virtual_control_plane
+++ b/mcp/config/states/virtual_control_plane
@@ -8,10 +8,25 @@
##############################################################################
CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
+ERASE_ENV=${ERASE_ENV:-0}
# shellcheck disable=SC1090
source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh"
+# Optionally destroy VCP VMs from a previous run
+if [ "${ERASE_ENV}" -eq 1 ]; then
+ kvm_vms=$(salt --out yaml 'kvm*' virt.list_domains | \
+ sed -e 's/- //g' -e 's/:.*$//g')
+ for line in ${kvm_vms}; do
+ if [[ "${line}" =~ ^kvm ]]; then
+ kvm_node=${line}
+ elif [ -n "${kvm_node}" ]; then
+ salt "${kvm_node}" virt.purge dirs=True "${line}" || true
+ fi
+ done
+fi
+
+# KVM, compute node prereqs (libvirt first), VCP deployment
# patch the networking module for Debian based distros
debian_ip_source=/usr/lib/python2.7/dist-packages/salt/modules/debian_ip.py
salt -C 'kvm* or cmp*' file.line $debian_ip_source \