Merge "Fix introspection with retries edge case"

This commit is contained in:
Jenkins 2017-06-20 21:38:43 +00:00 committed by Gerrit Code Review
commit de897ff61e
1 changed files with 9 additions and 3 deletions

View File

@ -164,13 +164,19 @@ introspect()
sleep 30s
done
manageable_count=1
on_count=0
while [ $on_count -eq 0 ] && [ $manageable_count -gt 0 ]; do
manageable_count=$(ironic --json node-list | jq -r '.[]| select(.["provision_state"] == "manageable")| .["uuid"]' | wc -l)
on_count=$(ironic --json node-list|jq -r '.[]| select(.["power_state"] == "power on")| .["uuid"]' | wc -l)
sleep 30
done
set +e
timeout $1 bash -c -- 'source $HOME/stackrc; \
node_count=$(ironic --json node-list|jq -r ".| length") ; \
on_count=$(ironic --json node-list|jq -r ".[]| select(.[\"power_state\"] == \"power on\")| .[\"uuid\"]" | wc -l) ; \
while [ $node_count != $on_count ] && [ $on_count -gt 0 ]; do \
while [ $on_count -gt 0 ]; do \
sleep 30s; \
node_count=$(ironic --json node-list|jq -r ".| length") ; \
on_count=$(ironic --json node-list|jq -r ".[]| select(.[\"power_state\"] == \"power on\")| .[\"uuid\"]" | wc -l) ; \
done'
set -e