From bf91a8fca47e653e3923d93a4397a3819ff64406 Mon Sep 17 00:00:00 2001 From: Vasyl Saienko Date: Tue, 1 Aug 2017 01:00:24 +0300 Subject: [PATCH] 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 --- devstack/upgrade/resources.sh | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/devstack/upgrade/resources.sh b/devstack/upgrade/resources.sh index 9682b753b6..eec1a34938 100755 --- a/devstack/upgrade/resources.sh +++ b/devstack/upgrade/resources.sh @@ -31,6 +31,29 @@ NEUTRON_NET=ironic_grenade 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 { # We need these steps only in case of flat-network @@ -125,6 +148,8 @@ function destroy { # Dispatcher case $1 in "early_create") + wait_for_ironic_resources + wait_for_nova_resources "vcpus" $total_cpus early_create ;; "create") @@ -139,9 +164,5 @@ case $1 in "destroy") destroy ;; - "force_destroy") - set +o errexit - destroy - ;; esac