Add dynamic concurrency values

This change computes the concurrency values against the execution workload
allow the playbook to adjust the concurrency value to whatever the user has
defined when that value makes sense. If the concurrency value is greater
than the expected workload the value will be adjusted down as needed. While
this change is not 100% required it will ensure that the execution of our
playbooks is more programatically efficient.

Change-Id: I368187f142560108fe66a59f9acc2d9a6fac97d3
Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
Kevin Carter 2020-03-24 13:23:11 -05:00
parent 782efb215b
commit 2ad073e38b
6 changed files with 61 additions and 8 deletions

View File

@ -41,6 +41,15 @@
set_fact:
node_uuids_apply: "{{ node_uuids }}"
# NOTE(cloudnull): This limits the concurrency so that we're not adding
# more threads than needed.
- name: Set concurrency fact
set_fact:
runtime_concurrency: "{{
((concurrency | int) > (node_uuids_apply | length)) |
ternary((node_uuids_apply | length), (concurrency | int))
}}"
- name: exit if nothing to do
block:
- name: Notice
@ -57,11 +66,11 @@
msg: >-
Running raid config on the following nodes, {{ node_uuids_apply }}.
- name: Start baremetal bios aaply
- name: Start baremetal bios apply
os_baremetal_clean_node:
cloud: undercloud
node_uuid: "{{ node_uuids_apply }}"
concurrency: "{{ concurrency }}"
concurrency: "{{ runtime_concurrency }}"
timeout: "{{ node_timeout }}"
clean_steps:
- interface: bios

View File

@ -40,6 +40,15 @@
set_fact:
node_uuids_reset: "{{ node_uuids }}"
# NOTE(cloudnull): This limits the concurrency so that we're not adding
# more threads than needed.
- name: Set concurrency fact
set_fact:
runtime_concurrency: "{{
((concurrency | int) > (node_uuids_reset | length)) |
ternary((node_uuids_reset | length), (concurrency | int))
}}"
- name: exit if nothing to do
block:
- name: Notice
@ -60,7 +69,7 @@
os_baremetal_clean_node:
cloud: undercloud
node_uuid: "{{ node_uuids_reset }}"
concurrency: "{{ concurrency }}"
concurrency: "{{ runtime_concurrency }}"
timeout: "{{ node_timeout }}"
clean_steps:
- interface: bios

View File

@ -45,6 +45,15 @@
set_fact:
node_uuids_clean: "{{ node_uuids }}"
# NOTE(cloudnull): This limits the concurrency so that we're not adding
# more threads than needed.
- name: Set concurrency fact
set_fact:
runtime_concurrency: "{{
((concurrency | int) > (node_uuids_clean | length)) |
ternary((node_uuids_clean | length), (concurrency | int))
}}"
- name: exit if nothing to do
when:
- (node_uuids_clean | length) < 1
@ -66,7 +75,7 @@
os_baremetal_clean_node:
cloud: undercloud
node_uuid: "{{ node_uuids_clean }}"
concurrency: "{{ concurrency }}"
concurrency: "{{ runtime_concurrency }}"
# max_retries: "{{ max_retries }}" NotImplemented
timeout: "{{ node_timeout }}"
clean_steps:

View File

@ -47,6 +47,15 @@
when:
- node_uuids_intro == []
# NOTE(cloudnull): This limits the concurrency so that we're not adding
# more threads than needed.
- name: Set concurrency fact
set_fact:
runtime_concurrency: "{{
((concurrency | int) > (node_uuids_intro | length)) |
ternary((node_uuids_intro | length), (concurrency | int))
}}"
# Pre-introspection validation
- name: Run Validations
command: >
@ -60,7 +69,7 @@
auth_type: password
cloud: undercloud
node_uuids: "{{ node_uuids_intro }}"
concurrency: "{{ concurrency }}"
concurrency: "{{ runtime_concurrency }}"
max_retries: "{{ max_retries }}"
node_timeout: "{{ node_timeout }}"
register: baremetal_introspection_result

View File

@ -41,6 +41,15 @@
set_fact:
node_uuids_raid: "{{ node_uuids }}"
# NOTE(cloudnull): This limits the concurrency so that we're not adding
# more threads than needed.
- name: Set concurrency fact
set_fact:
runtime_concurrency: "{{
((concurrency | int) > (node_uuids_raid | length)) |
ternary((node_uuids_raid | length), (concurrency | int))
}}"
- name: exit if nothing to do
block:
- name: Notice
@ -61,7 +70,7 @@
os_baremetal_clean_node:
cloud: undercloud
node_uuid: "{{ node_uuids_raid }}"
concurrency: "{{ concurrency }}"
concurrency: "{{ runtime_concurrency }}"
raid_config: "{{ raid_configuration }}"
timeout: "{{ node_timeout }}"
clean_steps:

View File

@ -39,7 +39,6 @@
- baremetal_deployed_path is undefined
tasks:
- name: Detect default overcloud-full image
block:
- name: stat overcloud-full.qcow2
@ -103,6 +102,15 @@
clean_up: true
register: baremetal_reserved
# NOTE(cloudnull): This limits the concurrency so that we're not adding
# more threads than needed.
- name: Set concurrency fact
set_fact:
runtime_concurrency: "{{
((concurrency | int) > (baremetal_reserved.instances | length)) |
ternary((baremetal_reserved.instances | length), (concurrency | int))
}}"
- name: Provision instances
metalsmith_instances:
instances: "{{ baremetal_reserved.instances }}"
@ -110,7 +118,7 @@
wait: true
clean_up: false
timeout: "{{ node_timeout }}"
concurrency: "{{ concurrency }}"
concurrency: "{{ runtime_concurrency }}"
register: baremetal_provisioned
- name: Populate environment