ansible/roles/copr/backend/files/resalloc_provision/vm-aarch64-delete

27 lines
629 B
Text
Raw Normal View History

#! /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