Wait for cleaning is completed after base smoke tests

Nova do not wait for cleaning is completed when deleting instance
as result after destroy phase ironic may still perform cleaning.
This patch ensures all nodes are available again after base smoke tests
finished and hypervisor stats are updated.

We still need to wait for resources after destroy phase which will be
done in separate patch as changes to grenade workflow are needed.

Change-Id: Ib6c5a0543533893664cb3e895286d0e226e364d2
This commit is contained in:
Vasyl Saienko 2017-08-01 01:00:24 +03:00 committed by Vladyslav Drok
parent 6f69fe7631
commit bf91a8fca4

View File

@ -31,6 +31,29 @@ NEUTRON_NET=ironic_grenade
set -o xtrace set -o xtrace
function wait_for_ironic_resources {
local i
local nodes_count
nodes_count=$(openstack baremetal node list -f value -c "Provisioning State" | wc -l)
echo_summary "Waiting 5 minutes for Ironic resources become available again"
for i in $(seq 1 30); do
if openstack baremetal node list -f value -c "Provisioning State" | grep -qi failed; then
die $LINENO "One of nodes is in failed state."
fi
if [[ $(openstack baremetal node list -f value -c "Provisioning State" | grep -ci available) == $nodes_count ]]; then
return 0
fi
sleep 10
done
openstack baremetal node list
die $LINENO "Timed out waiting for Ironic nodes are available again."
}
total_cpus=$(( $IRONIC_VM_SPECS_CPU * $IRONIC_VM_COUNT ))
if [[ "${HOST_TOPOLOGY}" == "multinode" ]]; then
total_cpus=$(( 2 * $total_cpus ))
fi
function early_create { function early_create {
# We need these steps only in case of flat-network # We need these steps only in case of flat-network
@ -125,6 +148,8 @@ function destroy {
# Dispatcher # Dispatcher
case $1 in case $1 in
"early_create") "early_create")
wait_for_ironic_resources
wait_for_nova_resources "vcpus" $total_cpus
early_create early_create
;; ;;
"create") "create")
@ -139,9 +164,5 @@ case $1 in
"destroy") "destroy")
destroy destroy
;; ;;
"force_destroy")
set +o errexit
destroy
;;
esac esac