}
-function reserve_testbed () {
+function reserve_and_cleanup_testbed () {
set -exuo pipefail
# Reserve physical testbed, perform cleanup, register trap to unreserve.
+ # When cleanup fails, remove from topologies and keep retrying
+ # until all topologies are removed.
#
# Variables read:
# - TOPOLOGIES - Array of paths to topology yaml to attempt reservation on.
# - PYTHON_SCRIPTS_DIR - Path to directory holding the reservation script.
# Variables set:
+ # - TOPOLOGIES - Array of paths to topologies, with failed cleanups removed.
# - WORKING_TOPOLOGY - Path to topology yaml file of the reserved testbed.
# Functions called:
# - die - Print to stderr and exit.
# Traps registered:
# - EXIT - Calls cancel_all for ${WORKING_TOPOLOGY}.
- while true; do
+ while [[ ${TOPOLOGIES[@]} ]]; do
for topo in "${TOPOLOGIES[@]}"; do
set +e
python "${PYTHON_SCRIPTS_DIR}/topo_reservation.py" -t "${topo}"
result="$?"
set -e
if [[ "${result}" == "0" ]]; then
+ # Trap unreservation before cleanup check,
+ # so multiple jobs showing failed cleanup improve chances
+ # of humans to notice and fix.
WORKING_TOPOLOGY="${topo}"
echo "Reserved: ${WORKING_TOPOLOGY}"
trap "untrap_and_unreserve_testbed" EXIT || {
}
die "Trap attempt failed, unreserve succeeded. Aborting."
}
- cleanup_topo || {
- die "Testbed cleanup failed."
- }
+ # Cleanup check.
+ set +e
+ cleanup_topo
+ result="$?"
+ set -e
+ if [[ "${result}" == "0" ]]; then
+ break
+ fi
+ warn "Testbed cleanup failed: ${topo}"
+ untrap_and_unreserve_testbed "Fail of unreserve after cleanup."
+ # WORKING_TOPOLOGY is now empty again.
+ # Build new topology array.
+ # TOPOLOGIES=("${TOPOLOGIES[@]/$topo}")
+ # does not really work, see:
+ # https://stackoverflow.com/questions/16860877/remove-an-element-from-a-bash-array
+ new_topologies=()
+ for item in "${TOPOLOGIES[@]}"; do
+ if [[ "${item}" != "${topo}" ]]; then
+ new_topologies+=("${item}")
+ fi
+ done
+ TOPOLOGIES=("${new_topologies[@]}")
break
fi
done
echo "Sleeping ${sleep_time}"
sleep "${sleep_time}" || die "Sleep failed."
done
+ die "Run out of operational testbeds!"
}
test_tag_array+=("!vts")
;;
*"3n-hsw"*)
+ # TODO: Introduce NOIOMMU version of AVF tests.
+ # TODO: Make (both) AVF tests work on Haswell,
+ # or document why (some of) it is not possible.
+ # https://github.com/FDio/vpp/blob/master/src/plugins/avf/README.md
test_tag_array+=("!drv_avf")
+ # All cards have access to QAT. But only one card (xl710)
+ # resides in same NUMA as QAT. Other cards must go over QPI
+ # which we do not want to even run.
test_tag_array+=("!ipsechwNOTnic_intel-xl710")
;;
*)