diff options
author | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2019-05-16 17:49:04 +0200 |
---|---|---|
committer | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2019-06-05 13:27:37 +0000 |
commit | 559a47f31475bb660c21a7efba0fa4207adb378a (patch) | |
tree | ef1c216a86a3eb51964be2f1ed85e2c04f4652df /mcp/scripts | |
parent | fa2a3e158fa22058e2a8e9c71febcc3b11219d8f (diff) |
[lib] Add uninstall/cleanup option
When multiple installers are used on the same jumpserver, it is
useful to have the ability of automatic cleanup after a previous
deploy.
Change-Id: Ib3249f53ee9d6b1ba2409dd71bd13480536faedc
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
(cherry picked from commit 4a9051284f69ded7bfadfb3a113513b6301c6a45)
Diffstat (limited to 'mcp/scripts')
-rw-r--r-- | mcp/scripts/lib_jump_deploy.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mcp/scripts/lib_jump_deploy.sh b/mcp/scripts/lib_jump_deploy.sh index a96becadd..a8444b8cf 100644 --- a/mcp/scripts/lib_jump_deploy.sh +++ b/mcp/scripts/lib_jump_deploy.sh @@ -327,6 +327,27 @@ function create_networks { sudo systemctl restart opnfv-fuel-vetha } +function cleanup_all { + local image_dir=$1; shift + local all_vnode_networks=("$@") + [ ! -e "${image_dir}/docker-compose" ] || COMPOSE_PREFIX="${image_dir}/" + + cleanup_uefi + __cleanup_vms + sudo ip link del veth_mcp0 || true + sudo ip link del veth_mcp2 || true + for net in "mcpcontrol" "${all_vnode_networks[@]}"; do + if ${VIRSH} net-info "${net}" >/dev/null 2>&1; then + ${VIRSH} net-destroy "${net}" || true + ${VIRSH} net-undefine "${net}" + fi + done + sudo rm -f "/etc/systemd/system/multi-user.target.wants/opnfv-fuel"* \ + "/etc/systemd/system/opnfv-fuel"* + sudo systemctl daemon-reload + "${COMPOSE_PREFIX}docker-compose" -f docker-compose/docker-compose.yaml down +} + function create_vms { local image_dir=$1; shift local image=base_image_opnfv_fuel.img |