Fix bugs with preflight check and DPDK dependency 91/72991/2
authorMichael Pedersen <michaelx.pedersen@intel.com>
Wed, 27 Oct 2021 09:49:18 +0000 (11:49 +0200)
committerMichael Pedersen <michaelx.pedersen@intel.com>
Wed, 27 Oct 2021 12:01:09 +0000 (12:01 +0000)
Remove preflight check for isolcpus as this breaks libvirt (VM) deployments
Update DPDK dependency on meson as v0.60.0 breaks build process

Signed-off-by: Michael Pedersen <michaelx.pedersen@intel.com>
Change-Id: I5f0a46c80c88958437b7ab8c34de5fefc337de60
Reviewed-on: https://gerrit.opnfv.org/gerrit/c/kuberef/+/72991
Tested-by: jenkins-ci <jenkins-opnfv-ci@opnfv.org>
Reviewed-by: Rihab Banday <rihab.banday@ericsson.com>
Reviewed-by: Georg Kunz <georg.kunz@ericsson.com>
functions.sh
sw_config/bmra/patched_install_dpdk_meson.yml [new file with mode: 0644]
sw_config/bmra/patched_preflight.yml

index 67edf7d..73f3d27 100755 (executable)
@@ -256,6 +256,8 @@ cp "${PROJECT_ROOT}"/"${INSTALLER}"/patched_preflight.yml \
     "${PROJECT_ROOT}"/container-experience-kits/playbooks/preflight.yml
 cp "${PROJECT_ROOT}"/"${INSTALLER}"/patched_sriov_cni_install.yml \
     "${PROJECT_ROOT}"/container-experience-kits/roles/sriov_cni_install/tasks/main.yml
+cp "${PROJECT_ROOT}"/"${INSTALLER}"/patched_install_dpdk_meson.yml \
+    "${PROJECT_ROOT}"/container-experience-kits/roles/install_dpdk/tasks/install_dpdk_meson.yml
 
 sudo docker run --rm \
 -e ANSIBLE_CONFIG=/bmra/ansible.cfg \
@@ -291,6 +293,8 @@ cp "${CURRENTPATH}"/sw_config/"${INSTALLER}"/patched_preflight.yml \
     "${CURRENTPATH}"/container-experience-kits/playbooks/preflight.yml
 cp "${CURRENTPATH}"/sw_config/"${INSTALLER}"/patched_sriov_cni_install.yml \
     "${CURRENTPATH}"/container-experience-kits/roles/sriov_cni_install/tasks/main.yml
+cp "${CURRENTPATH}"/sw_config/"${INSTALLER}"/patched_install_dpdk_meson.yml \
+    "${CURRENTPATH}"/container-experience-kits/roles/install_dpdk/tasks/install_dpdk_meson.yml
 
 ansible-playbook -i "$CURRENTPATH"/sw_config/bmra/inventory.ini "$CURRENTPATH"/playbooks/pre-install.yaml
 
diff --git a/sw_config/bmra/patched_install_dpdk_meson.yml b/sw_config/bmra/patched_install_dpdk_meson.yml
new file mode 100644 (file)
index 0000000..9b9a7e7
--- /dev/null
@@ -0,0 +1,132 @@
+##
+##   Copyright (c) 2020-2021 Intel Corporation.
+##
+##   Licensed under the Apache License, Version 2.0 (the "License");
+##   you may not use this file except in compliance with the License.
+##   You may obtain a copy of the License at
+##
+##       http://www.apache.org/licenses/LICENSE-2.0
+##
+##   Unless required by applicable law or agreed to in writing, software
+##   distributed under the License is distributed on an "AS IS" BASIS,
+##   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+##   See the License for the specific language governing permissions and
+##   limitations under the License.
+##
+---
+- name: install Python3 from epel-release
+  package:
+    name:
+      - python36
+      - python36-devel
+      - libselinux-python
+    state: present
+    enablerepo: "epel"
+  when:
+    - ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS'
+    - ansible_distribution_version < '8'
+
+- name: install dpdk-devel required for libraries enablement in RHEL / CentOS >= 8.2
+  dnf:
+    name: dpdk-devel
+  when: ansible_distribution in ["RedHat", "CentOS"] and ansible_distribution_version >= '8.2'
+
+- name: build and install dpdk using meson and ninja tools
+  block:
+    - name: install building tools as python packages
+      pip:
+        name:
+          - selinux
+          - meson>=0.53.2,<0.60.0
+          - ninja>=1.10.0
+          - pyelftools>=0.26
+        state: present
+      register: pip_result
+      retries: 5
+      until: pip_result is succeeded
+      delay: 5
+
+    - name: meson build for ease of compiling and linking libraries enablement
+      command: "meson build"
+      args:
+        chdir: "{{ dpdk_dir }}"
+
+    - name: configure DPDK with ninja
+      command: "ninja"
+      args:
+        chdir: "{{ dpdk_dir }}/build"
+
+    - name: install DPDK with ninja
+      command: "ninja install"
+      args:
+        chdir: "{{ dpdk_dir }}/build"
+
+    - name: update the dynamic linker cache
+      command: "ldconfig"
+      args:
+        chdir: "{{ dpdk_dir }}/build"
+  vars:
+    ansible_python_interpreter: /usr/bin/python3
+
+- name: Ensure dpdk libs is in loader search path on RHEL/CentOS
+  copy:
+    dest: "/etc/ld.so.conf.d/libdpdk-x86_64.conf"
+    content: "/usr/local/lib64/"
+    mode: 0644
+    owner: root
+    group: root
+  become: yes
+  when: ansible_os_family == "RedHat"
+
+- name: find dpdk tools
+  find:
+    path: "{{ dpdk_dir }}"
+    patterns: "dpdk-devbind.py"
+    recurse: yes
+  register: dpdk_tools_dir
+
+- name: set path to dpdk usertools directory
+  set_fact:
+    dpdk_tools: "{{ dpdk_tools_dir.files[0].path }}"
+
+- name: load userspace modules
+  modprobe:
+    name: "{{ item }}"
+    state: present
+  with_items:
+    - vfio-pci
+    - uio
+
+- name: install dpdk-devbind.py in /usr/local/bin
+  copy:
+    remote_src: yes
+    src: "{{ dpdk_tools }}"
+    dest: "/usr/local/bin/dpdk-devbind.py"
+    mode: 0700
+    owner: root
+    group: root
+  become: yes
+
+- name: clone intel module
+  git:
+    repo: "{{ dpdk_kmods_repo }}"
+    dest: "{{ dpdk_kmods_dest }}"
+    version: 'main'
+    force: yes
+
+- name: apply fix to Makefile
+  replace:
+    path: "{{ dpdk_kmods_dest }}/linux/igb_uio/Makefile"
+    regexp: "\\(PWD\\)"
+    replace: "(CURDIR)"
+    mode: "0644"
+
+- name: build intel module
+  make:
+    chdir: "{{ dpdk_kmods_dest }}/linux/igb_uio"
+
+- name: load intel module
+  command: "insmod {{ dpdk_kmods_dest }}/linux/igb_uio/igb_uio.ko"
+  register: result
+  failed_when: "'No such file or directory' in result.stderr"
+  changed_when: "'already bound' not in result.stderr"
index 41b7efd..ae401f9 100644 (file)
         with_items: "{{ isolcpus_list }}"
         when: isolcpus is defined
 
-      - name: Check isolcpus OS Reserved
-        assert:
-          that: "item not in isolcpus_list"
-          msg:
-            - Incorrect configuration pertaining isolcpus. Conflicting or improper values detected
-            - The CPU ID 0...{{ ansible_processor_count - 1 }} should NOT be set for isolcpus. Please correct the configuration
-        with_items: "{{ lookup('sequence','0-{{ ansible_processor_count - 1 }}').split(',') }}"
-        when: isolcpus is defined
-
 #TODO relationship between cmk shared/exclusive cores and isolcpus
 
       when: