Files
ironic/devstack/tools/ironic/scripts/cleanup-node
Lucas Alvares Gomes 49e273b1a5 Fix syntax errors in the shell scripts under devstack/tools
This patch is fixing the syntax errors/warnings in the shell scripts
under devstack/tools and add that directory to the tox bashate command.

Change-Id: I957a88f5b7009fe92078eb3d53e225943d28a539
Partial-Bug: #1526518
2015-12-17 17:26:48 +00:00

26 lines
724 B
Bash
Executable File

#!/usr/bin/env bash
# **cleanup-nodes**
# Cleans up baremetal poseur nodes and volumes created during ironic setup
# Assumes calling user has proper libvirt group membership and access.
set -exu
LIBVIRT_STORAGE_POOL=${LIBVIRT_STORAGE_POOL:-"default"}
LIBVIRT_CONNECT_URI=${LIBVIRT_CONNECT_URI:-"qemu:///system"}
NAME=$1
NETWORK_BRIDGE=$2
export VIRSH_DEFAULT_CONNECT_URI=$LIBVIRT_CONNECT_URI
VOL_NAME="$NAME.qcow2"
virsh list | grep -q $NAME && virsh destroy $NAME
virsh list --inactive | grep -q $NAME && virsh undefine $NAME
if virsh pool-list | grep -q $LIBVIRT_STORAGE_POOL ; then
virsh vol-list $LIBVIRT_STORAGE_POOL | grep -q $VOL_NAME &&
virsh vol-delete $VOL_NAME --pool $LIBVIRT_STORAGE_POOL
fi