Initial commit
[ta/infra-ansible.git] / roles / performance_nodes / tasks / ovsdpdk.yaml
1 ---
2
3 # Copyright 2019 Nokia
4
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
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
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.
16
17 - debug:
18     msg:
19       - "DPDK cores {{ ansible_local.ncir_cpu_allocation['ovs_dpdk']['list'] }}"
20       - "Platform cores {{ ansible_local.ncir_cpu_allocation['platform']['list'] }}"
21       - "Host VPUs  {{ansible_processor_vcpus}}, Processor cores {{ansible_processor_cores}}"
22       - "Threads per core {{ansible_processor_threads_per_core}}, Sockets {{ansible_processor_count}}"
23
24 - name: Add vfio.conf to modules-load.d
25   lineinfile:
26     path: /etc/modules-load.d/vfio.conf
27     create: "yes"
28     state: present
29     line: 'vfio-pci'
30
31 - name: Modprobe vfio-pci
32   modprobe:
33     name: vfio-pci
34     state: present
35
36 - name: Ensure openvswitch.service is started
37   systemd:
38     name: openvswitch
39     state: started
40
41 - name: configure DPDK cores
42   script: >
43       configure_ovsdpdk.py --cores {{ansible_processor_vcpus}} --pcore {{ansible_processor_cores}}
44       --tcore {{ansible_processor_threads_per_core}} --sockets {{ansible_processor_count}}
45       --dpdkcores {{ ansible_local.ncir_cpu_allocation['ovs_dpdk']['list'] }}
46   register: result
47   changed_when: result.rc == 0
48   failed_when: result.rc == 2
49
50 - debug:
51     msg: "RC: {{ result.rc }}"
52
53 - debug:
54     var=result.stdout_lines
55   when: result.rc != 0
56
57 - name: Ensure enable-dpdk.service is enabled
58   systemd:
59     name: enable-dpdk
60     enabled: "yes"
61   when: result.rc == 0
62
63 - name: Start enable-dpdk.service on other than installation host
64   systemd:
65     name: enable-dpdk
66     state: started
67   when:
68     - result.rc == 0
69     - hostname != installation_controller
70
71 - name: restart openvswitch.service
72   systemd:
73     name: openvswitch
74     state: restarted
75   when: result.rc == 0
76
77 - name: restart libvirtd.service
78   systemd:
79     name: libvirtd
80     state: restarted
81   when: result.rc == 0