From 692de6d5d5542bc934c0c418693952a0b0d7e2b8 Mon Sep 17 00:00:00 2001 From: Daniel Hofer Date: Thu, 19 Feb 2026 15:47:44 +0100 Subject: [PATCH 1/3] Fix for DPDK on Debian 13 On VM startup, the directory /var/run/openvswitch/vm-sockets is expected to exist. However, it is located on a temporary file system. Therefore, the seapath-config_ovs service unit is modified to create it before service startup. Signed-off-by: Daniel Hofer --- roles/deploy_python3_setup_ovs/files/seapath-config_ovs.service | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/deploy_python3_setup_ovs/files/seapath-config_ovs.service b/roles/deploy_python3_setup_ovs/files/seapath-config_ovs.service index c2ac4b98e..39018b9d6 100644 --- a/roles/deploy_python3_setup_ovs/files/seapath-config_ovs.service +++ b/roles/deploy_python3_setup_ovs/files/seapath-config_ovs.service @@ -10,6 +10,8 @@ Before=systemd-networkd.service [Service] Type=oneshot RemainAfterExit=true +ExecStartPre=/bin/mkdir -p /var/run/openvswitch/vm-sockets +ExecStartPre=/bin/chown libvirt-qemu:root /var/run/openvswitch/vm-sockets ExecStart=/usr/local/bin/setup_ovs [Install] From 95aa89c712b2214a65233602d4ee14e358fe18ff Mon Sep 17 00:00:00 2001 From: Daniel Hofer Date: Mon, 2 Mar 2026 10:43:56 +0100 Subject: [PATCH 2/3] Switch to OVS with DPDK support if required on Debian Ansible detects the usage of DPDK in the Open vSwitch config per node and switches between the ovs binary with or without DPDK support accordings using the update-alternatives command. This is only done on Debian. Co-authored-by: Claude Signed-off-by: Daniel Hofer --- roles/network_configovs/tasks/main.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/roles/network_configovs/tasks/main.yml b/roles/network_configovs/tasks/main.yml index 23aec012b..9382470ce 100644 --- a/roles/network_configovs/tasks/main.yml +++ b/roles/network_configovs/tasks/main.yml @@ -5,6 +5,30 @@ - name: Load distribution-specific variables include_vars: "{{ seapath_distro }}.yml" +- name: Detect DPDK usage from OVS bridge configuration + set_fact: + dpdk_enabled: >- + {{ ovs_bridges | default([]) + | map(attribute='ports', default=[]) + | flatten + | selectattr('type', 'in', ['dpdk', 'dpdkvhostuserclient']) + | list | length > 0 }} + when: seapath_distro == "Debian" +- name: Switch to OVS with DPDK support + community.general.alternatives: + name: ovs-vswitchd + path: /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk + when: + - seapath_distro == "Debian" + - dpdk_enabled | bool +- name: Switch to OVS without DPDK support + community.general.alternatives: + name: ovs-vswitchd + path: /usr/lib/openvswitch-switch/ovs-vswitchd + when: + - seapath_distro == "Debian" + - not dpdk_enabled | bool + - name: Create OVS configuration template: src: ovs_configuration.json.j2 From 24948659274fde9eaa0a4cc98187549761b91552 Mon Sep 17 00:00:00 2001 From: Daniel Hofer Date: Mon, 2 Mar 2026 11:12:18 +0100 Subject: [PATCH 3/3] Generalisation of DPDK socket fix The fix for the socket directoriy's permissions only works for Debian. Therefore, the systemd unit file was converted into a template and the target user defined using a variable. Additionally, the module vfio-pci is loaded on startup. Co-authored-by: Claude Signed-off-by: Daniel Hofer --- roles/deploy_python3_setup_ovs/README.md | 4 +++- roles/deploy_python3_setup_ovs/defaults/main.yml | 5 +++++ roles/deploy_python3_setup_ovs/tasks/main.yml | 6 +++--- .../seapath-config_ovs.service.j2} | 3 ++- roles/deploy_python3_setup_ovs/vars/Debian.yml | 1 + roles/network_configovs/tasks/main.yml | 10 ++++++++++ 6 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 roles/deploy_python3_setup_ovs/defaults/main.yml rename roles/deploy_python3_setup_ovs/{files/seapath-config_ovs.service => templates/seapath-config_ovs.service.j2} (71%) diff --git a/roles/deploy_python3_setup_ovs/README.md b/roles/deploy_python3_setup_ovs/README.md index 1f08fe925..75680f3d6 100644 --- a/roles/deploy_python3_setup_ovs/README.md +++ b/roles/deploy_python3_setup_ovs/README.md @@ -8,7 +8,9 @@ No requirement. ## Role Variables -No variable. +| Variable | Default | Description | +|--------------------------------------|---------|------------------------------------------------------------------------------------------------------------------------| +| `deploy_python3_setup_ovs_qemu_user` | `qemu` | System user that runs QEMU guests. Used for ownership of the OVS VM socket directory. Set to `libvirt-qemu` on Debian. | ## Example Playbook diff --git a/roles/deploy_python3_setup_ovs/defaults/main.yml b/roles/deploy_python3_setup_ovs/defaults/main.yml new file mode 100644 index 000000000..bed324e5b --- /dev/null +++ b/roles/deploy_python3_setup_ovs/defaults/main.yml @@ -0,0 +1,5 @@ +# Copyright (C) 2025 RTE +# SPDX-License-Identifier: Apache-2.0 + +--- +deploy_python3_setup_ovs_qemu_user: qemu \ No newline at end of file diff --git a/roles/deploy_python3_setup_ovs/tasks/main.yml b/roles/deploy_python3_setup_ovs/tasks/main.yml index 141d907af..60643dc79 100644 --- a/roles/deploy_python3_setup_ovs/tasks/main.yml +++ b/roles/deploy_python3_setup_ovs/tasks/main.yml @@ -15,9 +15,9 @@ command: cmd: "/usr/bin/pip install {{ deploy_python3_setup_ovs_pip_options }} /tmp/src/python3-setup-ovs" changed_when: true -- name: Copy seapath-config_ovs.service - ansible.builtin.copy: - src: seapath-config_ovs.service +- name: Deploy seapath-config_ovs.service + ansible.builtin.template: + src: seapath-config_ovs.service.j2 dest: /etc/systemd/system/seapath-config_ovs.service mode: '0644' notify: Trigger daemon-reload diff --git a/roles/deploy_python3_setup_ovs/files/seapath-config_ovs.service b/roles/deploy_python3_setup_ovs/templates/seapath-config_ovs.service.j2 similarity index 71% rename from roles/deploy_python3_setup_ovs/files/seapath-config_ovs.service rename to roles/deploy_python3_setup_ovs/templates/seapath-config_ovs.service.j2 index 39018b9d6..f5196b99f 100644 --- a/roles/deploy_python3_setup_ovs/files/seapath-config_ovs.service +++ b/roles/deploy_python3_setup_ovs/templates/seapath-config_ovs.service.j2 @@ -11,7 +11,8 @@ Before=systemd-networkd.service Type=oneshot RemainAfterExit=true ExecStartPre=/bin/mkdir -p /var/run/openvswitch/vm-sockets -ExecStartPre=/bin/chown libvirt-qemu:root /var/run/openvswitch/vm-sockets +ExecStartPre=/bin/chown {{ deploy_python3_setup_ovs_qemu_user }}:root /var/run/openvswitch/vm-sockets +ExecStartPre=/bin/chmod 0750 /var/run/openvswitch/vm-sockets ExecStart=/usr/local/bin/setup_ovs [Install] diff --git a/roles/deploy_python3_setup_ovs/vars/Debian.yml b/roles/deploy_python3_setup_ovs/vars/Debian.yml index d941046da..7595c2e17 100644 --- a/roles/deploy_python3_setup_ovs/vars/Debian.yml +++ b/roles/deploy_python3_setup_ovs/vars/Debian.yml @@ -3,3 +3,4 @@ # SPDX-License-Identifier: Apache-2.0 deploy_python3_setup_ovs_pip_options: "--root-user-action=ignore --no-build-isolation --prefix=/usr/" +deploy_python3_setup_ovs_qemu_user: libvirt-qemu diff --git a/roles/network_configovs/tasks/main.yml b/roles/network_configovs/tasks/main.yml index 9382470ce..560f8a9eb 100644 --- a/roles/network_configovs/tasks/main.yml +++ b/roles/network_configovs/tasks/main.yml @@ -14,6 +14,15 @@ | selectattr('type', 'in', ['dpdk', 'dpdkvhostuserclient']) | list | length > 0 }} when: seapath_distro == "Debian" + +- name: Load vfio-pci module for DPDK + community.general.modprobe: + name: vfio-pci + state: present + persistent: present + when: + - dpdk_enabled | bool + - name: Switch to OVS with DPDK support community.general.alternatives: name: ovs-vswitchd @@ -21,6 +30,7 @@ when: - seapath_distro == "Debian" - dpdk_enabled | bool + - name: Switch to OVS without DPDK support community.general.alternatives: name: ovs-vswitchd