#!/bin/bash set -eux INTROSPECTION_SLEEP=${INTROSPECTION_SLEEP:-30} nodes=$(ironic node-list | tail -n +4 | head -n -1 | tr '|' ' ' | awk '{ print $1; }') if [ -z "$nodes" ]; then echo "No nodes found in Ironic" exit 1 fi for uuid in $nodes; do for p in cpus cpu_arch memory_mb local_gb; do ironic node-update $uuid remove properties/$p > /dev/null done done for uuid in $nodes; do # TODO(dtantsur): use Ironic API instead openstack baremetal introspection start $uuid done current_nodes=$nodes temp_nodes= while true; do sleep $INTROSPECTION_SLEEP for uuid in $current_nodes; do finished=$(openstack baremetal introspection status $uuid -f value -c finished) if [ "$finished" = "True" ]; then error=$(openstack baremetal introspection status $uuid -f value -c error) if [ "$error" != "None" ]; then echo "Introspection for $uuid failed: $error" exit 1 fi else temp_nodes="$temp_nodes $uuid" fi done if [ "$temp_nodes" = "" ]; then echo "Introspection done" break else current_nodes=$temp_nodes temp_nodes= fi done # TODO(dtantsur): check results