diff options
Diffstat (limited to 'bifrost')
-rwxr-xr-x | bifrost/scripts/destroy-env.sh | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/bifrost/scripts/destroy-env.sh b/bifrost/scripts/destroy-env.sh index 87f792a5..f6eca4e3 100755 --- a/bifrost/scripts/destroy-env.sh +++ b/bifrost/scripts/destroy-env.sh @@ -19,12 +19,17 @@ rm -rf /opt/stack # HOME is normally set by sudo -H rm -rf ${HOME}/.config/openstack -# Delete all libvirt VMs and hosts from vbmc (look for a port number) -for vm in $(vbmc list | awk '/[0-9]/{{ print $2 }}'); do - virsh destroy $vm || true - virsh undefine $vm || true - vbmc delete $vm -done +# bifrost installs everything on venv so we need to look there if virtualbmc is not installed on the host. +if which vbmc &>/dev/null || { [[ -e /opt/stack/bifrost/bin/activate ]] && source /opt/stack/bifrost/bin/activate; }; then + # Delete all libvirt VMs and hosts from vbmc (look for a port number) + for vm in $(vbmc list | awk '/[0-9]/{{ print $2 }}'); do + virsh destroy $vm || true + virsh undefine $vm || true + vbmc delete $vm + done + which vbmc &>/dev/null || { [[ -e /opt/stack/bifrost/bin/activate ]] && deactivate; } +fi + # Destroy all XCI VMs if the previous operation failed [[ -n ${XCI_FLAVOR} ]] && \ for vm in ${TEST_VM_NODE_NAMES}; do |