diff --git a/workbooks/derive_params.yaml b/workbooks/derive_params.yaml index 1bbcaaf46..feb18ad7d 100644 --- a/workbooks/derive_params.yaml +++ b/workbooks/derive_params.yaml @@ -218,10 +218,13 @@ workflows: # Establish an empty dictionary of derived_parameters prior to # invoking the individual "feature" algorithms derived_parameters: <% dict() %> + on-success: handle_dpdk_feature + on-error: set_status_failed_get_introspection_data + + handle_dpdk_feature: on-success: - get_dpdk_derive_params: <% $.role_features.contains('DPDK') %> - - get_hci_derive_params: <% not $.role_features.contains('DPDK') and $.role_features.contains('HCI') %> - on-error: set_status_failed_get_introspection_data + - handle_sriov_feature: <% not $.role_features.contains('DPDK') %> get_dpdk_derive_params: workflow: tripleo.derive_params_formulas.v1.dpdk_derive_params @@ -232,9 +235,30 @@ workflows: user_inputs: <% $.user_inputs %> publish: derived_parameters: <% task().result.get('derived_parameters', {}) %> - on-success: get_host_derive_params + on-success: handle_sriov_feature on-error: set_status_failed_get_dpdk_derive_params + handle_sriov_feature: + on-success: + - get_sriov_derive_params: <% $.role_features.contains('SRIOV') %> + - handle_host_feature: <% not $.role_features.contains('SRIOV') %> + + get_sriov_derive_params: + workflow: tripleo.derive_params_formulas.v1.sriov_derive_params + input: + role_name: <% $.role_name %> + hw_data: <% $.hw_data %> + derived_parameters: <% $.derived_parameters %> + publish: + derived_parameters: <% task().result.get('derived_parameters', {}) %> + on-success: handle_host_feature + on-error: set_status_failed_get_sriov_derive_params + + handle_host_feature: + on-success: + - get_host_derive_params: <% $.role_features.contains('HOST') %> + - handle_hci_feature: <% not $.role_features.contains('HOST') %> + get_host_derive_params: workflow: tripleo.derive_params_formulas.v1.host_derive_params input: @@ -244,9 +268,12 @@ workflows: derived_parameters: <% $.derived_parameters %> publish: derived_parameters: <% task().result.get('derived_parameters', {}) %> + on-success: handle_hci_feature + on-error: set_status_failed_get_host_derive_params + + handle_hci_feature: on-success: - get_hci_derive_params: <% $.role_features.contains('HCI') %> - on-error: set_status_failed_get_host_derive_params get_hci_derive_params: workflow: tripleo.derive_params_formulas.v1.hci_derive_params @@ -311,6 +338,13 @@ workflows: message: <% task(get_dpdk_derive_params).result %> on-success: fail + set_status_failed_get_sriov_derive_params: + publish: + role_name: <% $.role_name %> + status: FAILED + message: <% task(get_sriov_derive_params).result %> + on-success: fail + set_status_failed_get_host_derive_params: publish: role_name: <% $.role_name %> @@ -376,13 +410,16 @@ workflows: # The role supports the DPDK feature in ODL if the OvsEnableDpdk parameter value is true in role parameters. odl_dpdk: <% let(role => $.role_name) -> $.heat_resource_tree.parameters.get(concat($role, 'Parameters'), {}).get('default', {}).get('OvsEnableDpdk', false) %> + # The role supports the SRIOV feature if it includes NeutronSriovAgent services. + sriov: <% $.role_services.any($.get('type', '').endsWith('::NeutronSriovAgent')) %> + # The role supports the HCI feature if it includes both NovaCompute and CephOSD services. hci: <% $.role_services.any($.get('type', '').endsWith('::NovaCompute')) and $.role_services.any($.get('type', '').endsWith('::CephOSD')) %> build_feature_dict: on-success: filter_features publish: - feature_dict: <% dict(DPDK => ($.dpdk or $.odl_dpdk), HCI => $.hci) %> + feature_dict: <% dict(DPDK => ($.dpdk or $.odl_dpdk), SRIOV => $.sriov, HOST => ($.dpdk or $.odl_dpdk or $.sriov), HCI => $.hci) %> filter_features: publish: diff --git a/workbooks/derive_params_formulas.yaml b/workbooks/derive_params_formulas.yaml index ff5811994..9261f2d64 100644 --- a/workbooks/derive_params_formulas.yaml +++ b/workbooks/derive_params_formulas.yaml @@ -98,22 +98,14 @@ workflows: on-error: set_status_failed_get_pmd_cpus_range_list get_host_cpus: - action: tripleo.derive_params.get_host_cpus_list inspect_data=<% $.hw_data %> - publish: - host_cpus: <% task().result %> - on-success: - - get_host_cpus_range_list: <% $.host_cpus %> - - set_status_failed_get_host_cpus: <% not $.host_cpus %> - on-error: set_status_failed_on_error_get_host_cpus - - get_host_cpus_range_list: - action: tripleo.derive_params.convert_number_to_range_list + workflow: tripleo.derive_params_formulas.v1.get_host_cpus input: - num_list: <% $.host_cpus %> + role_name: <% $.role_name %> + hw_data: <% $.hw_data %> publish: - host_cpus: <% task().result %> + host_cpus: <% task().result.get('host_cpus', '') %> on-success: get_sock_mem - on-error: set_status_failed_get_host_cpus_range_list + on-error: set_status_failed_get_host_cpus get_sock_mem: action: tripleo.derive_params.get_dpdk_socket_memory @@ -196,19 +188,7 @@ workflows: set_status_failed_get_host_cpus: publish: status: FAILED - message: 'Unable to determine OvsDpdkCoreList parameter' - on-success: fail - - set_status_failed_on_error_get_host_cpus: - publish: - status: FAILED - message: <% task(get_host_cpus).result %> - on-success: fail - - set_status_failed_get_host_cpus_range_list: - publish: - status: FAILED - message: <% task(get_host_cpus_range_list).result %> + message: <% task(get_host_cpus).result.get('message', '') %> on-success: fail set_status_failed_get_sock_mem: @@ -224,6 +204,94 @@ workflows: on-success: fail + sriov_derive_params: + description: > + This workflow derives parameters for the SRIOV feature. + + input: + - role_name + - hw_data # introspection data + - derived_parameters: {} + + output: + derived_parameters: <% $.derived_parameters.mergeWith($.get('sriov_parameters', {})) %> + + tags: + - tripleo-common-managed + + tasks: + get_host_cpus: + workflow: tripleo.derive_params_formulas.v1.get_host_cpus + input: + role_name: <% $.role_name %> + hw_data: <% $.hw_data %> + publish: + host_cpus: <% task().result.get('host_cpus', '') %> + on-success: get_sriov_parameters + on-error: set_status_failed_get_host_cpus + + get_sriov_parameters: + publish: + # SriovHostCpusList parameter is added temporarily and it's removed later from derived parameters result. + sriov_parameters: <% dict(concat($.role_name, 'Parameters') => dict('SriovHostCpusList' => $.get('host_cpus', ''))) %> + + set_status_failed_get_host_cpus: + publish: + status: FAILED + message: <% task(get_host_cpus).result.get('message', '') %> + on-success: fail + + + get_host_cpus: + description: > + Fetching the host CPU list from the introspection data, and then converting the raw list into a range list. + + input: + - hw_data # introspection data + + output: + host_cpus: <% $.get('host_cpus', '') %> + + tags: + - tripleo-common-managed + + tasks: + get_host_cpus: + action: tripleo.derive_params.get_host_cpus_list inspect_data=<% $.hw_data %> + publish: + host_cpus: <% task().result %> + on-success: + - get_host_cpus_range_list: <% $.host_cpus %> + - set_status_failed_get_host_cpus: <% not $.host_cpus %> + on-error: set_status_failed_on_error_get_host_cpus + + get_host_cpus_range_list: + action: tripleo.derive_params.convert_number_to_range_list + input: + num_list: <% $.host_cpus %> + publish: + host_cpus: <% task().result %> + on-error: set_status_failed_get_host_cpus_range_list + + set_status_failed_get_host_cpus: + publish: + status: FAILED + message: 'Unable to determine host cpus' + on-success: fail + + set_status_failed_on_error_get_host_cpus: + publish: + status: FAILED + message: <% task(get_host_cpus).result %> + on-success: fail + + set_status_failed_get_host_cpus_range_list: + publish: + status: FAILED + message: <% task(get_host_cpus_range_list).result %> + on-success: fail + + host_derive_params: description: > This workflow derives parameters for the Host process, and is mainly associated with CPU pinning and huge memory pages. @@ -242,7 +310,6 @@ workflows: - tripleo-common-managed tasks: - get_cpus: publish: cpus: <% $.hw_data.numa_topology.cpus %> @@ -253,11 +320,23 @@ workflows: get_role_derive_params: publish: role_derive_params: <% $.derived_parameters.get(concat($.role_name, 'Parameters'), {}) %> + # removing the role parameters (eg. ComputeParameters) in derived_parameters dictionary since already copied in role_derive_params. + derived_parameters: <% $.derived_parameters.delete(concat($.role_name, 'Parameters')) %> + on-success: get_host_cpus + + get_host_cpus: + publish: + host_cpus: <% $.role_derive_params.get('OvsDpdkCoreList', '') or $.role_derive_params.get('SriovHostCpusList', '') %> + # SriovHostCpusList parameter is added temporarily for host_cpus and not needed in derived_parameters result. + # SriovHostCpusList parameter is deleted in derived_parameters list and adding the updated role parameters + # back in the derived_parameters. + derived_parameters: <% $.derived_parameters + dict(concat($.role_name, 'Parameters') => $.role_derive_params.delete('SriovHostCpusList')) %> on-success: get_host_dpdk_combined_cpus get_host_dpdk_combined_cpus: publish: - host_dpdk_combined_cpus: <% concat($.role_derive_params.get('OvsPmdCoreList', ''), ',', $.role_derive_params.get('OvsDpdkCoreList', '')) %> + host_dpdk_combined_cpus: <% let(pmd_cpus => $.role_derive_params.get('OvsPmdCoreList', '')) -> switch($pmd_cpus => concat($pmd_cpus, ',', $.host_cpus), not $pmd_cpus => $.host_cpus) %> + reserved_cpus: [] on-success: - get_host_dpdk_combined_cpus_num_list: <% $.host_dpdk_combined_cpus %> - set_status_failed_get_host_dpdk_combined_cpus: <% not $.host_dpdk_combined_cpus %> @@ -268,12 +347,13 @@ workflows: range_list: <% $.host_dpdk_combined_cpus %> publish: host_dpdk_combined_cpus: <% task().result %> + reserved_cpus: <% task().result.split(',') %> on-success: get_nova_cpus on-error: set_status_failed_get_host_dpdk_combined_cpus_num_list get_nova_cpus: publish: - nova_cpus: <% let(reserved_cpus => $.host_dpdk_combined_cpus.split(',')) -> $.cpus.select($.thread_siblings).flatten().where(not (str($) in $reserved_cpus)).join(',') %> + nova_cpus: <% let(reserved_cpus => $.reserved_cpus) -> $.cpus.select($.thread_siblings).flatten().where(not (str($) in $reserved_cpus)).join(',') %> on-success: - get_isol_cpus: <% $.nova_cpus %> - set_status_failed_get_nova_cpus: <% not $.nova_cpus %> @@ -282,7 +362,7 @@ workflows: # example: concatinates '12-15,19' and 16-18' ranges '12-15,19,16-18' get_isol_cpus: publish: - isol_cpus: <% concat($.role_derive_params.get('OvsPmdCoreList',''), ',', $.nova_cpus) %> + isol_cpus: <% let(pmd_cpus => $.role_derive_params.get('OvsPmdCoreList','')) -> switch($pmd_cpus => concat($pmd_cpus, ',', $.nova_cpus), not $pmd_cpus => $.nova_cpus) %> on-success: get_isol_cpus_num_list # Gets the isol_cpus in the number list