diff --git a/environments/host-config-and-reboot.j2.yaml b/environments/host-config-and-reboot.j2.yaml new file mode 100644 index 0000000000..c16627dbb3 --- /dev/null +++ b/environments/host-config-and-reboot.j2.yaml @@ -0,0 +1,18 @@ +resource_registry: +{% for role in roles %} + OS::TripleO::{{role.name}}::PreNetworkConfig: ../extraconfig/pre_network/host_config_and_reboot.yaml +{% endfor %} + +#parameter_defaults: + # Note: There are no global parameters which can be applied to all roles as + # these configuration have to be specific to role. + + # Sample parameters for Compute and ComputeOvsDpdk roles + #ComputeParameters: + #KernelArgs: "" + #TunedProfileName: "" + #IsolCpusList: "" + #ComputeOvsDpdkParameters: + #KernelArgs: "intel_iommu=on iommu=pt default_hugepagesz=1GB hugepagesz=1G hugepages=60" + #TunedProfileName: "cpu-partitioning" + #IsolCpusList: "" diff --git a/extraconfig/pre_network/host_config_and_reboot.yaml b/extraconfig/pre_network/host_config_and_reboot.yaml new file mode 100644 index 0000000000..06b138abf4 --- /dev/null +++ b/extraconfig/pre_network/host_config_and_reboot.yaml @@ -0,0 +1,347 @@ +# DEPRECATED: The following template is deprecated in Queens in favor of +# extraconfig/pre_network/boot-params-service.yaml. This template does not work +# with config-download and will be removed during the Stein release. + +heat_template_version: rocky + +description: > + All configurations which require reboot should be initiated via PreNetworkConfig. After + this configuration is completed, the corresponding node will be rebooted. + +parameters: + server: + type: string + RoleParameters: + type: json + description: Parameters specific to the role + default: {} + ServiceNames: + type: comma_delimited_list + default: [] + OvsEnableDpdk: + default: false + description: Whether or not to configure enable DPDK in OVS + type: boolean + tags: + - role_specific + OvsDpdkCoreList: + description: > + List of cores to be used for DPDK lcore threads. Note, these threads + are used by the OVS control path for validator and handling functions. + type: string + constraints: + - allowed_pattern: "[0-9,-]*" + default: "" + tags: + - role_specific + OvsDpdkMemoryChannels: + description: Number of memory channels per socket to be used for DPDK + type: string + constraints: + - allowed_pattern: "[0-9]*" + default: "4" + tags: + - role_specific + OvsDpdkSocketMemory: + default: "" + description: > + Sets the amount of hugepage memory to assign per NUMA node. It is + recommended to use the socket closest to the PCIe slot used for the + desired DPDK NIC. The format should be in ", , ", where the value is specified in MB. For example: + "1024,0". + type: string + tags: + - role_specific + OvsPmdCoreList: + description: > + A list or range of CPU cores for PMD threads to be pinned to. Note, NIC + location to cores on socket, number of hyper-threaded logical cores, and + desired number of PMD threads can all play a role in configuring this + setting. These cores should be on the same socket where + OvsDpdkSocketMemory is assigned. If using hyperthreading then specify + both logical cores that would equal the physical core. Also, specifying + more than one core will trigger multiple PMD threads to be spawned which + may improve dataplane performance. + constraints: + - allowed_pattern: "[0-9,-]*" + type: string + default: "" + tags: + - role_specific + deployment_actions: + default: ['CREATE', 'UPDATE'] + type: comma_delimited_list + description: > + List of stack actions that will trigger any deployments in this + templates. The actions will be an empty list of the server is in the + toplevel DeploymentServerBlacklist parameter's value. + EnableDpdkDeploymentActions: + default: ['CREATE'] + type: comma_delimited_list + description: > + Exposing the DPDK deployment action, it may be required to run DPDK + config during an upgrade. By default DPDK will be enabled during the + CREATE action only. But on cases when it requires for certain migration, + it may be required to run it for UPDATE action too. + KernelArgs: + default: "" + type: string + description: Kernel Args to apply to the host + tags: + - role_specific + TunedProfileName: + default: "" + type: string + description: Tuned Profile to apply to the host + tags: + - role_specific + IsolCpusList: + default: "" + type: string + description: > + List of logical CPU ids whic need to be isolated from the host processes. + This input is provided to the tuned profile cpu-partitioning to configure + systemd and repin interrupts (IRQ repinning). + tags: + - role_specific + +conditions: + is_host_config_required: {not: {equals: [{get_param: [RoleParameters, KernelArgs]}, ""]}} + is_dpdk_config_required: + or: + - yaql: + expression: $.data.service_names.contains('neutron_ovs_dpdk_agent') + data: + service_names: {get_param: ServiceNames} + - {equals: [{get_param: [RoleParameters, OvsEnableDpdk]}, true]} + is_reboot_config_required: + or: + - is_host_config_required + - is_dpdk_config_required + deployment_actions_empty: + equals: + - {get_param: deployment_actions} + - [] + +resources: + RoleParametersValue: + type: OS::Heat::Value + properties: + type: json + value: + map_replace: + - map_replace: + - OvsDpdkCoreList: OvsDpdkCoreList + OvsDpdkMemoryChannels: OvsDpdkMemoryChannels + OvsDpdkSocketMemory: OvsDpdkSocketMemory + OvsPmdCoreList: OvsPmdCoreList + - values: {get_param: [RoleParameters]} + - values: + OvsDpdkCoreList: {get_param: OvsDpdkCoreList} + OvsDpdkMemoryChannels: {get_param: OvsDpdkMemoryChannels} + OvsDpdkSocketMemory: {get_param: OvsDpdkSocketMemory} + OvsPmdCoreList: {get_param: OvsPmdCoreList} + + HostParametersConfig: + type: OS::Heat::SoftwareConfig + condition: is_host_config_required + properties: + group: ansible + inputs: + - name: _KERNEL_ARGS_ + - name: _TUNED_PROFILE_NAME_ + - name: _TUNED_CORES_ + outputs: + - name: result + config: + str_replace: + template: | + --- + - name: Configuration to be applied before rebooting the node + connection: local + hosts: localhost + tasks: + _HOST_CONFIG_TASKS_ + params: + _HOST_CONFIG_TASKS_: + get_file: boot_param_tasks.yaml + + HostParametersDeployment: + type: OS::TripleO::Reboot::SoftwareDeployment + condition: is_host_config_required + properties: + name: HostParametersDeployment + server: {get_param: server} + config: {get_resource: HostParametersConfig} + actions: + if: + - deployment_actions_empty + - [] + - ['CREATE'] # Only do this on CREATE + input_values: + _KERNEL_ARGS_: {get_param: [RoleParameters, KernelArgs]} + _TUNED_PROFILE_NAME_: {get_param: [RoleParameters, TunedProfileName]} + _TUNED_CORES_: {get_param: [RoleParameters, IsolCpusList]} + + # Details @https://bugzilla.redhat.com/show_bug.cgi?id=1515269 + # Ensure gid of hugetlbfs matching with kolla so that container deployment + # and baremetal (future migrating to container) deployment have same id. This + # is a new group created from ovs2.8 onwards. 42477 is the kolla hugetlbfs + # gid value. Ensure that it is applied and restart(ovs) or reboot(host) + # before starting with DPDK initialization. + DpdkVhostGroupConfig: + type: OS::Heat::SoftwareConfig + condition: is_dpdk_config_required + properties: + group: ansible + outputs: + - name: result + config: | + --- + - hosts: localhost + connection: local + gather_facts: False + tasks: + - group: + name: "hugetlbfs" + gid: 42477 + + DpdkVhostGroupDeployment: + type: OS::TripleO::Reboot::SoftwareDeployment + condition: is_dpdk_config_required + properties: + name: DpdkVhostGroupDeployment + server: {get_param: server} + config: {get_resource: DpdkVhostGroupConfig} + actions: + if: + - deployment_actions_empty + - [] + - ['CREATE'] # Only do this on CREATE + + RebootConfig: + type: OS::Heat::SoftwareConfig + condition: is_reboot_config_required + properties: + group: script + config: | + #!/bin/bash + # Stop os-collect-config to avoid any race collecting another + # deployment before reboot happens + systemctl stop os-collect-config.service + /sbin/reboot + + RebootDeployment: + type: OS::TripleO::Reboot::SoftwareDeployment + depends_on: [HostParametersDeployment, DpdkVhostGroupDeployment] + condition: is_reboot_config_required + properties: + name: RebootDeployment + server: {get_param: server} + config: {get_resource: RebootConfig} + actions: + if: + - deployment_actions_empty + - [] + - ['CREATE'] # Only do this on CREATE + signal_transport: NO_SIGNAL + + # For successful RebootDeployment, the signal_transport should be NO_SIGNAL, + # which will make the resource as COMPLETE immediately. If the + # RebootDeployment is the last resource of the tree, then it will be + # synchronized, else the next resource (EnableDpdkDeployment), is also sent + # along with RebootDeployment. Because of which sometimes, EnableDpdkDeployment + # is executed before rebooting. As hugepages are not set to bootargs (waiting + # for reboot), EnableDpdkDeployment will fail. To ensure synchronization, + # a dummpy deployment RebootEnsureDeployment has been introduced to wait + # for reboot to enable DPDK. + RebootEnsureConfig: + type: OS::Heat::SoftwareConfig + condition: is_reboot_config_required + properties: + group: script + config: | + #!/bin/bash + echo "Reboot completed" + + RebootEnsureDeployment: + type: OS::TripleO::Reboot::SoftwareDeployment + depends_on: RebootDeployment + condition: is_reboot_config_required + properties: + name: RebootEnsureDeployment + server: {get_param: server} + config: {get_resource: RebootEnsureConfig} + actions: + if: + - deployment_actions_empty + - [] + - ['CREATE'] # Only do this on CREATE + + # With OvS2.7 (which is default with pike), ovs-vswitchd will start dpdk + # immediately after setting dpdk-init (behaviour change from ovs2.6). + # Starting of DPDK require the huge page configuration to be enabled. So + # reboot will happen before DPDK config and we don't need an explicity + # restart after dpdk-init as true because of the behavior change. + # TODO(skramaja): Dependency is that till the service file workaround, is + # maintained, restart of ovs is required. + EnableDpdkConfig: + type: OS::Heat::SoftwareConfig + condition: is_dpdk_config_required + properties: + group: script + config: + str_replace: + template: | + #!/bin/bash + set -x + + # DO NOT use --detailed-exitcodes + puppet apply --logdest console --summarize \ + --modulepath /etc/puppet/modules:/opt/stack/puppet-modules:/usr/share/openstack-puppet/modules \ + -e ' + class {"vswitch::dpdk": + host_core_list => "$HOST_CORES", + pmd_core_list => "$PMD_CORES", + memory_channels => "$MEMORY_CHANNELS", + socket_mem => "$SOCKET_MEMORY", + } + ' + params: + $HOST_CORES: {get_attr: [RoleParametersValue, value, OvsDpdkCoreList]} + $PMD_CORES: {get_attr: [RoleParametersValue, value, OvsPmdCoreList]} + $MEMORY_CHANNELS: {get_attr: [RoleParametersValue, value, OvsDpdkMemoryChannels]} + $SOCKET_MEMORY: {get_attr: [RoleParametersValue, value, OvsDpdkSocketMemory]} + + EnableDpdkDeployment: + type: OS::Heat::SoftwareDeployment + condition: is_dpdk_config_required + depends_on: RebootEnsureDeployment + properties: + name: EnableDpdkDeployment + server: {get_param: server} + config: {get_resource: EnableDpdkConfig} + actions: + if: + - deployment_actions_empty + - [] + - {get_param: EnableDpdkDeploymentActions} + +outputs: + result: + condition: is_host_config_required + value: + get_attr: [HostParametersDeployment, result] + stdout: + condition: is_host_config_required + value: + get_attr: [HostParametersDeployment, deploy_stdout] + stderr: + condition: is_host_config_required + value: + get_attr: [HostParametersDeployment, deploy_stderr] + status_code: + condition: is_host_config_required + value: + get_attr: [HostParametersDeployment, deploy_status_code] diff --git a/releasenotes/notes/host_config_and_reboot_removal-98d38efa2472458e.yaml b/releasenotes/notes/host_config_and_reboot_removal-98d38efa2472458e.yaml deleted file mode 100644 index b9bcaf9d20..0000000000 --- a/releasenotes/notes/host_config_and_reboot_removal-98d38efa2472458e.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -deprecations: - - The templates at extraconfig/pre_network/host_config_and_reboot.yaml - (replaced with extraconfig/pre_network/boot-params-service.yaml) and - extraconfig/tasks/ssh/host_public_key.yaml (replaced with the - tripleo-ssh-known-hosts role) are removed as they do not - work with config-download. diff --git a/tools/process-templates.py b/tools/process-templates.py index b4cce01db2..06376753c3 100755 --- a/tools/process-templates.py +++ b/tools/process-templates.py @@ -321,8 +321,12 @@ def clean_templates(base_path, role_data_path, network_data_path): for role in role_data: role_path = os.path.join( 'puppet', '%s-role.yaml' % role['name'].lower()) + host_config_and_reboot_path = os.path.join( + 'extraconfig', 'pre_network', + '%s-host_config_and_reboot.yaml' % role['name'].lower()) delete(role_path) + delete(host_config_and_reboot_path) nic_config_dir = os.path.join(base_path, 'network', 'config') for sample_nic_config_dir in os.listdir(nic_config_dir): diff --git a/tools/yaml-validate.py b/tools/yaml-validate.py index e332656cfe..fb1aa98cad 100755 --- a/tools/yaml-validate.py +++ b/tools/yaml-validate.py @@ -282,7 +282,8 @@ ANSIBLE_TASKS_YAMLS = [ HEAT_OUTPUTS_EXCLUSIONS = [ './puppet/extraconfig/tls/ca-inject.yaml', './deployed-server/deployed-server.yaml', - './extraconfig/tasks/ssh/host_public_key.yaml' + './extraconfig/tasks/ssh/host_public_key.yaml', + './extraconfig/pre_network/host_config_and_reboot.yaml' ] def exit_usage():