nova/roles/run-evacuate-hook/files/test_negative_evacuate.sh
Amit Uniyal c486cc89dc Make our nova-ovs-hybrid-plug job omit cinder
modifies nova-ovs-hybrid-plug job to disable cinder and swift to
ensure we test for this going forward.

Change-Id: I52046e6f7acdfb20eeba67dda59cbb5169e5d17e
2023-09-13 12:23:43 -07:00

39 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Source tempest to determine the build timeout configuration.
source /opt/stack/devstack/lib/tempest
source /opt/stack/devstack/openrc admin
set -x
set -e
# Now force the evacuation to the controller; we have to force to bypass the
# scheduler since we killed libvirtd which will trigger the libvirt compute
# driver to auto-disable the nova-compute service and then the ComputeFilter
# would filter out this host and we'd get NoValidHost. Normally forcing a host
# during evacuate and bypassing the scheduler is a very bad idea, but we're
# doing a negative test here.
function evacuate_and_wait_for_error() {
local server="$1"
echo "Forcing evacuate of ${server} to local host"
openstack --os-compute-api-version 2.67 server evacuate --host ${CONTROLLER_HOSTNAME} ${server}
# Wait for the instance to go into ERROR state from the failed evacuate.
count=0
status=$(openstack server show ${server} -f value -c status)
while [ "${status}" != "ERROR" ]
do
sleep 1
count=$((count+1))
if [ ${count} -eq ${BUILD_TIMEOUT} ]; then
echo "Timed out waiting for server ${server} to go to ERROR status"
exit 4
fi
status=$(openstack server show ${server} -f value -c status)
done
}
evacuate_and_wait_for_error evacuate-test
if openstack endpoint list | grep cinder; then
evacuate_and_wait_for_error evacuate-bfv-test
fi