From ac59ce053f972a28b20c0a5c22e7d073d0bb7202 Mon Sep 17 00:00:00 2001 From: Alan Bishop Date: Thu, 17 Aug 2017 17:20:59 -0400 Subject: [PATCH] Use NovaVcpuPinSet when deriving HCI parameters When deriving deployment parameters for HCI (hyperconverged Nova compute and Ceph OSD nodes), use NovaVcpuPinSet to determine the number of CPU cores available for Nova and Ceph. When NovaVcpuPinSet isn't set, use all of the cores identified in the baremetal introspection data. Closes-Bug: #1711462 Change-Id: I6e0a0004d3df1f7acbb15b014cc2fe5fb139c2aa (cherry picked from commit 813e12ab9f3f49cef4dad477b15d53af9030bdf5) --- workbooks/derive_params.yaml | 3 +++ workbooks/derive_params_formulas.yaml | 36 +++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/workbooks/derive_params.yaml b/workbooks/derive_params.yaml index 735d3f80e..4a157a03a 100644 --- a/workbooks/derive_params.yaml +++ b/workbooks/derive_params.yaml @@ -64,7 +64,10 @@ workflows: container: <% $.plan %> key: 'derived_parameters' on-success: + # Add the derived parameters to the deployment plan only when $.result + # (the derived parameters) is non-empty. Otherwise, we're done. - update_derive_parameters_in_plan: <% $.result %> + - send_message: <% not $.result %> on-error: set_status_failed_reset_derive_parameters_in_plan update_derive_parameters_in_plan: diff --git a/workbooks/derive_params_formulas.yaml b/workbooks/derive_params_formulas.yaml index 1e00f29b5..00c6c0a86 100644 --- a/workbooks/derive_params_formulas.yaml +++ b/workbooks/derive_params_formulas.yaml @@ -501,6 +501,8 @@ workflows: publish: extra_config: <% $.environment_parameters.get('ExtraConfig', {}) %> role_extra_config: <% $.environment_parameters.get(concat($.role_name, 'ExtraConfig'), {}) %> + role_env_params: <% $.environment_parameters.get(concat($.role_name, 'Parameters'), {}) %> + role_derive_params: <% $.derived_parameters.get(concat($.role_name, 'Parameters'), {}) %> on-success: get_num_osds get_num_osds: @@ -514,12 +516,37 @@ workflows: publish: memory_mb: <% $.introspection_data.get('memory_mb', 0) %> on-success: - - get_num_cores: <% $.memory_mb %> + - get_nova_vcpu_pin_set: <% $.memory_mb %> - set_failed_get_memory_mb: <% not $.memory_mb %> + # Determine the number of CPU cores available to Nova and Ceph. If + # NovaVcpuPinSet is defined then use the number of vCPUs in the set, + # otherwise use all of the cores identified in the introspection data. + + get_nova_vcpu_pin_set: + publish: + # NovaVcpuPinSet can be defined in multiple locations, and it's + # important to select the value in order of precedence: + # + # 1) User specified value for this role + # 2) User specified default value for all roles + # 3) Value derived by another derived parameters workflow + nova_vcpu_pin_set: <% $.role_env_params.get('NovaVcpuPinSet', $.environment_parameters.get('NovaVcpuPinSet', $.role_derive_params.get('NovaVcpuPinSet', ''))) %> + on-success: + - get_nova_vcpu_count: <% $.nova_vcpu_pin_set %> + - get_num_cores: <% not $.nova_vcpu_pin_set %> + + get_nova_vcpu_count: + action: tripleo.derive_params.convert_range_to_number_list + input: + range_list: <% $.nova_vcpu_pin_set %> + publish: + num_cores: <% task().result.split(',').count() %> + on-success: calculate_nova_parameters + on-error: set_failed_get_nova_vcpu_count + get_num_cores: publish: - # TODO(abishop): If NovaVcpuPinSet is defined then use it to determine num_cores num_cores: <% $.introspection_data.get('cpus', 0) %> on-success: - calculate_nova_parameters: <% $.num_cores %> @@ -634,6 +661,11 @@ workflows: message: "Unable to determine the amount of physical memory (no 'memory_mb' found in introspection_data)." on-success: fail + set_failed_get_nova_vcpu_count: + publish: + message: <% task(get_nova_vcpu_count).result %> + on-success: fail + set_failed_get_num_cores: publish: message: "Unable to determine the number of CPU cores (no 'cpus' found in introspection_data)."