Merge "Improve logs from ansible, puppet, docker-puppet.py"
[apex-tripleo-heat-templates.git] / puppet / services / openvswitch.yaml
1 heat_template_version: pike
2
3 description: >
4   Open vSwitch Configuration
5
6 parameters:
7   ServiceData:
8     default: {}
9     description: Dictionary packing service data
10     type: json
11   ServiceNetMap:
12     default: {}
13     description: Mapping of service_name -> network name. Typically set
14                  via parameter_defaults in the resource registry.  This
15                  mapping overrides those in ServiceNetMapDefaults.
16     type: json
17   DefaultPasswords:
18     default: {}
19     type: json
20   RoleName:
21     default: ''
22     description: Role name on which the service is applied
23     type: string
24   RoleParameters:
25     default: {}
26     description: Parameters specific to the role
27     type: json
28   EndpointMap:
29     default: {}
30     description: Mapping of service endpoint -> protocol. Typically set
31                  via parameter_defaults in the resource registry.
32     type: json
33   OvsDpdkCoreList:
34     description: >
35       List of cores to be used for DPDK lcore threads.  Note, these threads
36       are used by the OVS control path for validator and handling functions.
37     type: string
38     constraints:
39       - allowed_pattern: "[0-9,-]*"
40     default: ""
41   OvsDpdkMemoryChannels:
42     description: Number of memory channels per socket to be used for DPDK
43     type: string
44     constraints:
45       - allowed_pattern: "[0-9]*"
46     default: ""
47   OvsDpdkSocketMemory:
48     default: ""
49     description: >
50       Sets the amount of hugepage memory to assign per NUMA node. It is
51       recommended to use the socket closest to the PCIe slot used for the
52       desired DPDK NIC.  The format should be in "<socket 0 mem>, <socket 1
53       mem>, <socket n mem>", where the value is specified in MB.  For example:
54       "1024,0".
55     type: string
56   OvsDpdkDriverType:
57     default: "vfio-pci"
58     description: >
59       DPDK Driver type. Ensure the Overcloud NIC to be used for DPDK supports
60       this UIO/PMD driver.
61     type: string
62   OvsPmdCoreList:
63     description: >
64       A list or range of CPU cores for PMD threads to be pinned to.  Note, NIC
65       location to cores on socket, number of hyper-threaded logical cores, and
66       desired number of PMD threads can all play a role in configuring this
67       setting.  These cores should be on the same socket where
68       OvsDpdkSocketMemory is assigned.  If using hyperthreading then specify
69       both logical cores that would equal the physical core. Also, specifying
70       more than one core will trigger multiple PMD threads to be spawned which
71       may improve dataplane performance.
72     constraints:
73       - allowed_pattern: "[0-9,-]*"
74     type: string
75     default: ""
76   # DEPRECATED: the following options are deprecated and are currently maintained
77   # for backwards compatibility. They will be removed in the Queens cycle.
78   HostCpusList:
79     description: List of cores to be used for host process
80     type: string
81     constraints:
82       - allowed_pattern: "[0-9,-]*"
83     default: ''
84   NeutronDpdkCoreList:
85     description: List of cores to be used for DPDK Poll Mode Driver
86     type: string
87     constraints:
88       - allowed_pattern: "[0-9,-]*"
89     default: ''
90   NeutronDpdkMemoryChannels:
91     description: Number of memory channels to be used for DPDK
92     type: string
93     constraints:
94       - allowed_pattern: "[0-9]*"
95     default: ''
96   NeutronDpdkSocketMemory:
97     default: ''
98     description: Memory allocated for each socket
99     type: string
100   NeutronDpdkDriverType:
101     default: "vfio-pci"
102     description: DPDK Driver type
103     type: string
104
105 parameter_groups:
106 - label: deprecated
107   description: Do not use deprecated params, they will be removed.
108   parameters:
109     - HostCpusList
110     - NeutronDpdkCoreList
111     - NeutronDpdkMemoryChannels
112     - NeutronDpdkSocketMemory
113     - NeutronDpdkDriverType
114
115 conditions:
116   l_cores_empty: {equals: [{get_param: OvsDpdkCoreList}, '']}
117   pmd_cores_empty: {equals: [{get_param: OvsPmdCoreList}, '']}
118   mem_channels_empty: {equals: [{get_param: OvsDpdkMemoryChannels}, '']}
119   socket_mem_empty: {equals: [{get_param: OvsDpdkSocketMemory}, '']}
120   driver_not_set: {equals: [{get_param: OvsDpdkDriverType}, 'vfio-pci']}
121
122 outputs:
123   role_data:
124     description: Role data for the Open vSwitch service.
125     value:
126       service_name: openvswitch
127       config_settings:
128         map_replace:
129           - map_replace:
130             - vswitch::dpdk::driver_type: OvsDpdkDriverType
131               vswitch::dpdk::host_core_list: OvsDpdkCoreList
132               vswitch::dpdk::pmd_core_list: OvsPmdCoreList
133               vswitch::dpdk::memory_channels: OvsDpdkMemoryChannels
134               vswitch::dpdk::socket_mem: OvsDpdkSocketMemory
135             - values: {get_param: [RoleParameters]}
136           - values:
137               OvsDpdkCoreList: {if: [l_cores_empty, {get_param: HostCpusList}, {get_param: OvsDpdkCoreList}]}
138               OvsDpdkMemoryChannels: {if: [mem_channels_empty, {get_param: NeutronDpdkMemoryChannels}, {get_param: OvsDpdkMemoryChannels}]}
139               OvsDpdkSocketMemory: {if: [socket_mem_empty, {get_param: NeutronDpdkSocketMemory}, {get_param: OvsDpdkSocketMemory}]}
140               OvsDpdkDriverType: {if: [driver_not_set, {get_param: NeutronDpdkDriverType}, {get_param: OvsDpdkDriverType}]}
141               OvsPmdCoreList: {if: [pmd_cores_empty, {get_param: NeutronDpdkCoreList}, {get_param: OvsPmdCoreList}]}
142
143       upgrade_tasks:
144         - name: Check openvswitch version.
145           tags: step2
146           register: ovs_version
147           ignore_errors: true
148           shell: rpm -qa | awk -F- '/^openvswitch-2/{print $2 "-" $3}'
149         - name: Check openvswitch packaging.
150           tags: step2
151           shell: rpm -q --scripts openvswitch | awk '/postuninstall/,/*/' | grep -q "systemctl.*try-restart"
152           register: ovs_packaging_issue
153           ignore_errors: true
154         - block:
155             - name: "Ensure empty directory: emptying."
156               file:
157                 state: absent
158                 path: /root/OVS_UPGRADE
159             - name: "Ensure empty directory: creating."
160               file:
161                 state: directory
162                 path: /root/OVS_UPGRADE
163                 owner: root
164                 group: root
165                 mode: 0750
166             - name: Download OVS packages.
167               command: yumdownloader --destdir /root/OVS_UPGRADE --resolve openvswitch
168             - name: Get rpm list for manual upgrade of OVS.
169               shell: ls -1 /root/OVS_UPGRADE/*.rpm
170               register: ovs_list_of_rpms
171             - name: Manual upgrade of OVS
172               shell: |
173                 rpm -U --test {{item}} 2>&1 | grep "already installed" || \
174                 rpm -U --replacepkgs --notriggerun --nopostun {{item}};
175               args:
176                 chdir: /root/OVS_UPGRADE
177               with_items:
178                 - "{{ovs_list_of_rpms.stdout_lines}}"
179           tags: step2
180           when: "'2.5.0-14' in '{{ovs_version.stdout}}'
181                 or
182                 ovs_packaging_issue|succeeded"