5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 - name: Set vcpu_pin_set
18 ini_file: dest=/etc/nova/nova.conf section=DEFAULT option=vcpu_pin_set value={{ ansible_local.cpu_allocation['vm']['list'] }} backup=no
19 register: nova1_result
21 - name: Get performance profile configuration
23 perf_profile: "{{ performance_profiles[hosts[hostname]['performance_profiles'][0]] if 'performance_profiles' in hosts[hostname] else {} }}"
27 - "Hugepagesz: {{perf_profile['hugepagesz']}}"
29 - name: Construct reserved_huge_pages line for 1G case
31 numa0line: "reserved_huge_pages=node:0,size:1GB,count:4"
32 numa1line: "reserved_huge_pages=node:1,size:1GB,count:4"
34 - perf_profile['hugepagesz'] == "1G"
36 - name: Construct reserved_huge_pages line for 2M case
38 numa0line: "reserved_huge_pages=node:0,size:2048,count:2048"
39 numa1line: "reserved_huge_pages=node:1,size:2048,count:2048"
41 - perf_profile['hugepagesz'] == "2M"
45 - "CPUs: {{ansible_processor_count}}"
46 - "NUMA0 conf: {{numa0line}}"
47 - "NUMA1 conf: {{numa1line}}"
49 - name: Set huge page reservation for NUMA 0
51 path: /etc/nova/nova.conf
52 insertafter: 'DEFAULT'
54 register: nova2_result
56 - name: Set huge page reservation for NUMA 1
58 path: /etc/nova/nova.conf
59 insertafter: '{{numa0line}}'
62 - ansible_processor_count | int == 2
63 register: nova3_result
65 - name: Restart nova compute
70 - nova1_result.changed or nova2_result.changed or nova3_result.changed
71 - "'compute' in hosts[ansible_hostname]['service_profiles']"