Merge "Poll resource tracker for ironic cpus as well as count"
This commit is contained in:
commit
3e6fe6fd47
21
lib/ironic
21
lib/ironic
@ -496,18 +496,20 @@ function create_bridge_and_vms {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function wait_for_nova_resources {
|
function wait_for_nova_resources {
|
||||||
# After nodes have been enrolled, we need to wait for n-cpu's periodic
|
# After nodes have been enrolled, we need to wait for both ironic and
|
||||||
# task populate the resource tracker with available nodes. Wait for 2
|
# nova's periodic tasks to populate the resource tracker with available
|
||||||
# minutes before timing out.
|
# nodes and resources. Wait up to 2 minutes for a given resource before
|
||||||
local expected_count=$1
|
# timing out.
|
||||||
echo_summary "Waiting 2 minutes for Nova resource tracker to pick up $expected_count Ironic nodes"
|
local resource=$1
|
||||||
|
local expected_count=$2
|
||||||
|
echo_summary "Waiting 2 minutes for Nova resource tracker to pick up $resource >= $expected_count"
|
||||||
for i in $(seq 1 120); do
|
for i in $(seq 1 120); do
|
||||||
if [ $(nova hypervisor-stats | grep " count " | get_field 2) -ge $expected_count ]; then
|
if [ $(nova hypervisor-stats | grep " $resource " | get_field 2) -ge $expected_count ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
die $LINENO "Nova hypervisor-stats did not register at least $expected_count nodes"
|
die $LINENO "Timed out waiting for Nova hypervisor-stats $resource >= $expected_count"
|
||||||
}
|
}
|
||||||
|
|
||||||
function enroll_nodes {
|
function enroll_nodes {
|
||||||
@ -546,6 +548,7 @@ function enroll_nodes {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local total_nodes=0
|
local total_nodes=0
|
||||||
|
local total_cpus=0
|
||||||
while read hardware_info; do
|
while read hardware_info; do
|
||||||
if ! is_ironic_hardware; then
|
if ! is_ironic_hardware; then
|
||||||
local mac_address=$hardware_info
|
local mac_address=$hardware_info
|
||||||
@ -575,6 +578,7 @@ function enroll_nodes {
|
|||||||
ironic port-create --address $mac_address --node_uuid $node_id
|
ironic port-create --address $mac_address --node_uuid $node_id
|
||||||
|
|
||||||
total_nodes=$((total_nodes+1))
|
total_nodes=$((total_nodes+1))
|
||||||
|
total_cpus=$((total_cpus+$ironic_node_cpu))
|
||||||
done < $ironic_hwinfo_file
|
done < $ironic_hwinfo_file
|
||||||
|
|
||||||
# create the nova flavor
|
# create the nova flavor
|
||||||
@ -587,7 +591,8 @@ function enroll_nodes {
|
|||||||
nova flavor-key baremetal set "cpu_arch"="x86_64"
|
nova flavor-key baremetal set "cpu_arch"="x86_64"
|
||||||
|
|
||||||
if [ "$VIRT_DRIVER" == "ironic" ]; then
|
if [ "$VIRT_DRIVER" == "ironic" ]; then
|
||||||
wait_for_nova_resources $total_nodes
|
wait_for_nova_resources "count" $total_nodes
|
||||||
|
wait_for_nova_resources "vcpus" $total_cpus
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user