Merge "Wait for hypervisor-stats to reflect ironic nodes"
This commit is contained in:
commit
e750f9c1c6
23
lib/ironic
23
lib/ironic
@ -500,9 +500,23 @@ function create_bridge_and_vms {
|
||||
create_ovs_taps
|
||||
}
|
||||
|
||||
function wait_for_nova_resources {
|
||||
# After nodes have been enrolled, we need to wait for n-cpu's periodic
|
||||
# task populate the resource tracker with available nodes. Wait for 2
|
||||
# minutes before timing out.
|
||||
local expected_count=$1
|
||||
echo_summary "Waiting 2 minutes for Nova resource tracker to pick up $expected_count Ironic nodes"
|
||||
for i in $(seq 1 120); do
|
||||
if [ $(nova hypervisor-stats | grep " count " | get_field 2) -ge $expected_count ]; then
|
||||
return 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
die $LINENO "Nova hypervisor-stats did not register at least $expected_count nodes"
|
||||
}
|
||||
|
||||
function enroll_nodes {
|
||||
local chassis_id=$(ironic chassis-create -d "ironic test chassis" | grep " uuid " | get_field 2)
|
||||
local idx=0
|
||||
|
||||
if [[ "$IRONIC_DEPLOY_DRIVER" == "pxe_ssh" ]] ; then
|
||||
local _IRONIC_DEPLOY_KERNEL_KEY=pxe_deploy_kernel
|
||||
@ -536,6 +550,7 @@ function enroll_nodes {
|
||||
fi
|
||||
fi
|
||||
|
||||
local total_nodes=0
|
||||
while read hardware_info; do
|
||||
if ! is_ironic_hardware; then
|
||||
local mac_address=$hardware_info
|
||||
@ -566,7 +581,7 @@ function enroll_nodes {
|
||||
|
||||
ironic port-create --address $mac_address --node_uuid $node_id
|
||||
|
||||
idx=$((idx+1))
|
||||
total_nodes=$((total_nodes+1))
|
||||
done < $ironic_hwinfo_file
|
||||
|
||||
# create the nova flavor
|
||||
@ -581,6 +596,10 @@ function enroll_nodes {
|
||||
# from the flavor after the completion of
|
||||
# https://blueprints.launchpad.net/ironic/+spec/add-node-instance-info
|
||||
nova flavor-key baremetal set "cpu_arch"="x86_64" "baremetal:deploy_kernel_id"="$IRONIC_DEPLOY_KERNEL_ID" "baremetal:deploy_ramdisk_id"="$IRONIC_DEPLOY_RAMDISK_ID"
|
||||
|
||||
if [ "$VIRT_DRIVER" == "ironic" ]; then
|
||||
wait_for_nova_resources $total_nodes
|
||||
fi
|
||||
}
|
||||
|
||||
function configure_iptables {
|
||||
|
Loading…
Reference in New Issue
Block a user