This commit builds on the non-root ovs work and adds a udev rule which will
automatically set the group permissions of vfio devices.

Signed-off-by: Aaron Conole <acon...@redhat.com>
---
Systemd folks say that this is not something that should be a part of systemd,
but should be part of openvswitch.  I can make a case for either, but it seems
it's probably an uphill battle to get it in through systemd.  This should be
applied on branch-2.8, as it _could_ be considered a "fix" for
commit e3e738a3d058 ("redhat: allow dpdk to also run as non-root user").

 rhel/automake.mk                        | 1 +
 rhel/openvswitch-fedora.spec.in         | 8 ++++++++
 rhel/usr_lib_udev_rules.d_91-vfio.rules | 1 +
 3 files changed, 10 insertions(+)
 create mode 100644 rhel/usr_lib_udev_rules.d_91-vfio.rules

diff --git a/rhel/automake.mk b/rhel/automake.mk
index 11c8be0..1d1ac1a 100644
--- a/rhel/automake.mk
+++ b/rhel/automake.mk
@@ -26,6 +26,7 @@ EXTRA_DIST += \
        rhel/openvswitch-fedora.spec.in \
        rhel/usr_share_openvswitch_scripts_sysconfig.template \
        rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
+       rhel/usr_lib_udev_rules.d_91-vfio.rules \
        rhel/usr_lib_systemd_system_openvswitch.service \
        rhel/usr_lib_systemd_system_ovsdb-server.service \
        rhel/usr_lib_systemd_system_ovs-vswitchd.service.in \
diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index 2eccada..59e8ff8 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -250,6 +250,11 @@ install -d -m 0755 $RPM_BUILD_ROOT%{_rundir}/openvswitch
 install -d -m 0750 $RPM_BUILD_ROOT%{_localstatedir}/log/openvswitch
 install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/openvswitch
 
+%if %{with dpdk}
+install -p -D -m 0644 rhel/usr_lib_udev_rules.d_91-vfio.rules \
+        $RPM_BUILD_ROOT%{_prefix}/lib/udev/rules.d/91-vfio.rules
+%endif
+
 install -p -D -m 0644 \
         rhel/usr_share_openvswitch_scripts_systemd_sysconfig.template \
         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/openvswitch
@@ -566,6 +571,9 @@ fi
 %{_mandir}/man8/ovs-vswitchd.8*
 %{_mandir}/man8/ovs-parse-backtrace.8*
 %{_mandir}/man8/ovs-testcontroller.8*
+%if %{with dpdk}
+%{_prefix}/lib/udev/rules.d/91-vfio.rules
+%endif
 %doc COPYING NOTICE README.rst NEWS rhel/README.RHEL.rst
 /var/lib/openvswitch
 /var/log/openvswitch
diff --git a/rhel/usr_lib_udev_rules.d_91-vfio.rules 
b/rhel/usr_lib_udev_rules.d_91-vfio.rules
new file mode 100644
index 0000000..8e34b2a
--- /dev/null
+++ b/rhel/usr_lib_udev_rules.d_91-vfio.rules
@@ -0,0 +1 @@
+ACTION=="add", SUBSYSTEM=="vfio*", GROUP="hugetlbfs", MODE="0660"
-- 
2.9.4

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to