ansible/roles/copr/backend/files/resalloc_provision/vm-aarch64-delete
Pavel Raiskup 3c03c66514 copr: aarch64 terminator shouldn't depend on bc
/bin/bc isn't installed, and depending on it just for this use-case
doesn't make sense.
2020-04-24 21:34:15 +02:00

26 lines
629 B
Bash
Executable file

#! /bin/sh -x
die(){ echo >&2 "!! $*"; exit 1; }
test -z "$RESALLOC_NAME" && die "no vm specified, empty \$RESALLOC_NAME variable"
case "$RESALLOC_POOL_ID" in
*aarch64_01*)
conn=qemu+ssh://copr@virthost-aarch64-os01.fedorainfracloud.org/system
;;
*aarch64_02*)
conn=qemu+ssh://copr@virthost-aarch64-os02.fedorainfracloud.org/system
;;
*) die "unknown RESALLOC_POOL_ID=$RESALLOC_POOL_ID" ;;
esac
repeat()
{
for _ in a b c; do
"$@" && break
sleep 15
done
}
repeat virsh -c "$conn" destroy "$RESALLOC_NAME"
repeat virsh -c "$conn" undefine "$RESALLOC_NAME" --remove-all-storage --nvram