tools/deployment/libvirt/destroy_configuration.sh
Abraham Arce ce407f198e [Doc] Check and Include Configuration Names
In preparation to support more configurations, use existing allinone
and standardcontroller configurations names to:

- check if configuration is available via a function before it is
  created.
- to identify what configuration the compute node belongs to.

Additional:

- Fix linters issues

Story: 2004780
Task: 28996

Change-Id: I94ca268760c2cf12072de676dbd19413ef96a1ab
Signed-off-by: Abraham Arce <abraham.arce.moreno@intel.com>
2019-01-21 04:26:38 -06:00

41 lines
885 B
Bash
Executable File

#!/usr/bin/env bash
SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )"
source ${SCRIPT_DIR}/functions.sh
while getopts "c:" o; do
case "${o}" in
c)
CONFIGURATION=${OPTARG}
;;
*)
usage_destroy
exit 1
;;
esac
done
shift $((OPTIND-1))
if [[ -z ${CONFIGURATION} ]]; then
usage_destroy
exit -1
fi
configuration_check ${CONFIGURATION}
CONFIGURATION=${CONFIGURATION:-allinone}
CONTROLLER=${CONTROLLER:-controller}
DOMAIN_DIRECTORY=vms
destroy_controller ${CONFIGURATION} ${CONTROLLER}
if ([ "$CONFIGURATION" == "standardcontroller" ]); then
COMPUTE=${COMPUTE:-compute}
COMPUTE_NODES_NUMBER=${COMPUTE_NODES_NUMBER:-1}
for ((i=0; i<=$COMPUTE_NODES_NUMBER; i++)); do
COMPUTE_NODE=${CONFIGURATION}-${COMPUTE}-${i}
destroy_compute $COMPUTE_NODE
done
fi