tools/deployment/libvirt/cleanup_network.sh
Dean Troyer 0411fecdb4 Remove working dir issues from deploy scripts
This lets the deployment scripts not care about the current working
dir.  It also puts the vms directory in wherever the current working
directory actually is, allowing more than one set of stx VMs to be
controlled at a time.

Change-Id: I21ae6f4e7ea327c62cf04fc877161032daf1223e
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-10-09 19:31:21 -05:00

22 lines
676 B
Bash
Executable File

#!/usr/bin/env bash
#
# cleanup_network.sh - Cleans up network interfaces - not safe to run blindly!
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
source ${SCRIPT_DIR}/functions.sh
NETWORK_DEFAULT=${NETWORK_DEFAULT:-default}
BRIDGE_INTERFACE=${BRIDGE_INTERFACE=stxbr0}
if virsh net-list --name | grep ${NETWORK_DEFAULT} ; then
sudo virsh net-destroy ${NETWORK_DEFAULT}
sudo virsh net-undefine ${NETWORK_DEFAULT}
delete_xml /etc/libvirt/qemu/networks/autostart/${NETWORK_DEFAULT}.xml
fi
if [ -d "/sys/class/net/${BRIDGE_INTERFACE}" ]; then
sudo ifconfig ${BRIDGE_INTERFACE} down || true
sudo brctl delbr ${BRIDGE_INTERFACE} || true
fi