Browse code

Merge "Poll resource tracker for ironic cpus as well as count" into stable/juno

Jenkins authored on 2015/01/17 17:25:30
Showing 1 changed files
... ...
@@ -463,18 +463,20 @@ function create_bridge_and_vms {
463 463
 }
464 464
 
465 465
 function wait_for_nova_resources {
466
-    # After nodes have been enrolled, we need to wait for n-cpu's periodic
467
-    # task populate the resource tracker with available nodes.  Wait for 2
468
-    # minutes before timing out.
469
-    local expected_count=$1
470
-    echo_summary "Waiting 2 minutes for Nova resource tracker to pick up $expected_count Ironic nodes"
466
+    # After nodes have been enrolled, we need to wait for both ironic and
467
+    # nova's periodic tasks to populate the resource tracker with available
468
+    # nodes and resources. Wait up to 2 minutes for a given resource before
469
+    # timing out.
470
+    local resource=$1
471
+    local expected_count=$2
472
+    echo_summary "Waiting 2 minutes for Nova resource tracker to pick up $resource >= $expected_count"
471 473
     for i in $(seq 1 120); do
472
-        if [ $(nova hypervisor-stats | grep " count " | get_field 2) -ge $expected_count ]; then
474
+        if [ $(nova hypervisor-stats | grep " $resource " | get_field 2) -ge $expected_count ]; then
473 475
             return 0
474 476
         fi
475 477
         sleep 1
476 478
     done
477
-    die $LINENO "Nova hypervisor-stats did not register at least $expected_count nodes"
479
+    die $LINENO "Timed out waiting for Nova hypervisor-stats $resource >= $expected_count"
478 480
 }
479 481
 
480 482
 function enroll_vms {
... ...
@@ -489,6 +491,7 @@ function enroll_vms {
489 489
     fi
490 490
 
491 491
     local total_nodes=0
492
+    local total_cpus=0
492 493
     while read MAC; do
493 494
 
494 495
         local node_id=$(ironic node-create --chassis_uuid $chassis_id \
... ...
@@ -509,6 +512,7 @@ function enroll_vms {
509 509
         ironic port-create --address $MAC --node_uuid $node_id
510 510
 
511 511
         total_nodes=$((total_nodes+1))
512
+        total_cpus=$((total_cpus+$IRONIC_VM_SPECS_CPU))
512 513
     done < $IRONIC_VM_MACS_CSV_FILE
513 514
 
514 515
     # create the nova flavor
... ...
@@ -525,7 +529,8 @@ function enroll_vms {
525 525
     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"
526 526
 
527 527
     if [ "$VIRT_DRIVER" == "ironic" ]; then
528
-        wait_for_nova_resources $total_nodes
528
+        wait_for_nova_resources "count" $total_nodes
529
+        wait_for_nova_resources "vcpus" $total_cpus
529 530
     fi
530 531
 }
531 532