Browse code

Merge "Poll resource tracker for ironic cpus as well as count"

Jenkins authored on 2014/12/13 08:52:48
Showing 1 changed files
... ...
@@ -496,18 +496,20 @@ function create_bridge_and_vms {
496 496
 }
497 497
 
498 498
 function wait_for_nova_resources {
499
-    # After nodes have been enrolled, we need to wait for n-cpu's periodic
500
-    # task populate the resource tracker with available nodes.  Wait for 2
501
-    # minutes before timing out.
502
-    local expected_count=$1
503
-    echo_summary "Waiting 2 minutes for Nova resource tracker to pick up $expected_count Ironic nodes"
499
+    # After nodes have been enrolled, we need to wait for both ironic and
500
+    # nova's periodic tasks to populate the resource tracker with available
501
+    # nodes and resources. Wait up to 2 minutes for a given resource before
502
+    # timing out.
503
+    local resource=$1
504
+    local expected_count=$2
505
+    echo_summary "Waiting 2 minutes for Nova resource tracker to pick up $resource >= $expected_count"
504 506
     for i in $(seq 1 120); do
505
-        if [ $(nova hypervisor-stats | grep " count " | get_field 2) -ge $expected_count ]; then
507
+        if [ $(nova hypervisor-stats | grep " $resource " | get_field 2) -ge $expected_count ]; then
506 508
             return 0
507 509
         fi
508 510
         sleep 1
509 511
     done
510
-    die $LINENO "Nova hypervisor-stats did not register at least $expected_count nodes"
512
+    die $LINENO "Timed out waiting for Nova hypervisor-stats $resource >= $expected_count"
511 513
 }
512 514
 
513 515
 function enroll_nodes {
... ...
@@ -546,6 +548,7 @@ function enroll_nodes {
546 546
     fi
547 547
 
548 548
     local total_nodes=0
549
+    local total_cpus=0
549 550
     while read hardware_info; do
550 551
         if ! is_ironic_hardware; then
551 552
             local mac_address=$hardware_info
... ...
@@ -575,6 +578,7 @@ function enroll_nodes {
575 575
         ironic port-create --address $mac_address --node_uuid $node_id
576 576
 
577 577
         total_nodes=$((total_nodes+1))
578
+        total_cpus=$((total_cpus+$ironic_node_cpu))
578 579
     done < $ironic_hwinfo_file
579 580
 
580 581
     # create the nova flavor
... ...
@@ -587,7 +591,8 @@ function enroll_nodes {
587 587
     nova flavor-key baremetal set "cpu_arch"="x86_64"
588 588
 
589 589
     if [ "$VIRT_DRIVER" == "ironic" ]; then
590
-        wait_for_nova_resources $total_nodes
590
+        wait_for_nova_resources "count" $total_nodes
591
+        wait_for_nova_resources "vcpus" $total_cpus
591 592
     fi
592 593
 }
593 594