0411fecdb4
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>
27 lines
929 B
Bash
Executable File
27 lines
929 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
|
|
|
|
source ${SCRIPT_DIR}/functions.sh
|
|
|
|
BRIDGE_INTERFACE=${BRIDGE_INTERFACE:-stxbr}
|
|
CONTROLLER=${CONTROLLER:-controller-allinone}
|
|
DOMAIN_DIRECTORY=vms
|
|
|
|
for i in {0..1}; do
|
|
CONTROLLER_NODE=${CONTROLLER}-${i}
|
|
DOMAIN_FILE=$DOMAIN_DIRECTORY/$CONTROLLER_NODE.xml
|
|
if virsh list --all --name | grep ${CONTROLLER_NODE}; then
|
|
STATUS=$(virsh list --all | grep ${CONTROLLER_NODE} | awk '{ print $3}')
|
|
if ([ "$STATUS" == "running" ])
|
|
then
|
|
sudo virsh destroy ${CONTROLLER_NODE}
|
|
fi
|
|
sudo virsh undefine ${CONTROLLER_NODE}
|
|
delete_disk /var/lib/libvirt/images/${CONTROLLER_NODE}-0.img
|
|
delete_disk /var/lib/libvirt/images/${CONTROLLER_NODE}-1.img
|
|
delete_disk /var/lib/libvirt/images/${CONTROLLER_NODE}-2.img
|
|
[ -e ${DOMAIN_FILE} ] && delete_xml ${DOMAIN_FILE}
|
|
fi
|
|
done
|