Change in vdsm[master]: vdsm: add hostdev rules for vfio

mpolednik at redhat.com mpolednik at redhat.com
Mon Sep 1 09:33:37 UTC 2014


Martin Polednik has uploaded a new change for review.

Change subject: vdsm: add hostdev rules for vfio
......................................................................

vdsm: add hostdev rules for vfio

qemu requires readable /dev/vfio/[0-9][0-9]* in order to
allow attaching of host devices without root permissions.
As it's not feasible to run qemu under root, these udev rules
modify the ownership and mode to root:qemu 660 allowing to
function without changing qemu user.

Change-Id: Iba7dc8b786e1dd7399411639fa3fe35372708333
Signed-off-by: Martin Polednik <mpolednik at redhat.com>
---
M debian/rules
M debian/vdsm.install
M vdsm.spec.in
A vdsm/vdsm-vfio.rules.in
4 files changed, 34 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/18/32218/1

diff --git a/debian/rules b/debian/rules
index b32b160..40598cd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -40,6 +40,8 @@
 	# Install the lvm rules
 	install -Dm 0644 vdsm/storage/vdsm-lvm.rules \
 		$(destdir)/lib/udev/rules.d/61-vdsm-lvm.rules
+	install -Dm 0644 vdsm/vdsm-vfio.rules \
+		$(destdir)/lib/udev/rules.d/62-vdsm-vfio.rules
 	install -Dm 0644 vdsm/limits.conf \
 		$(destdir)/etc/security/limits.d/99-vdsm.conf
 	install -Dm 0644 init/upstart/vdsmd.upstart \
diff --git a/debian/vdsm.install b/debian/vdsm.install
index b1840ec..7eef434 100644
--- a/debian/vdsm.install
+++ b/debian/vdsm.install
@@ -21,6 +21,7 @@
 ./etc/vdsm/svdsm.logger.conf
 ./etc/vdsm/vdsm-tmpfiles.conf
 ./lib/udev/rules.d/61-vdsm-lvm.rules
+./lib/udev/rules.d/62-vdsm-vfio.rules
 ./usr/lib/python2.7/dist-packages/sos/plugins/vdsm.py
 ./usr/lib/python2.7/dist-packages/vdsmapi.py
 ./usr/libexec/vdsm/curl-img-wrap
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 323b586..9209302 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -657,6 +657,10 @@
 install -Dm 0644 vdsm/storage/vdsm-lvm.rules \
                  %{buildroot}%{_udevrulesdir}/12-vdsm-lvm.rules
 
+# Install the vfio rules
+install -Dm 0644 vdsm/vdsm-vfio.rules \
+                 %{buildroot}%{_udevrulesdir}/13-vdsm-vfio.rules
+
 install -Dm 0644 vdsm/limits.conf \
                  %{buildroot}/etc/security/limits.d/99-vdsm.conf
 
@@ -1133,6 +1137,7 @@
 %endif
 %{python_sitelib}/sos/plugins/vdsm.py*
 %{_udevrulesdir}/12-vdsm-lvm.rules
+%{_udevrulesdir}/13-vdsm-vfio.rules
 /etc/security/limits.d/99-vdsm.conf
 %{_mandir}/man8/vdsmd.8*
 %if 0%{?rhel}
diff --git a/vdsm/vdsm-vfio.rules.in b/vdsm/vdsm-vfio.rules.in
new file mode 100644
index 0000000..b367235
--- /dev/null
+++ b/vdsm/vdsm-vfio.rules.in
@@ -0,0 +1,26 @@
+#
+# Copyright 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+# Udev rules for vfio devices.
+#
+# These rules change ownership and permissions
+# of vfio devices spawned in /dev/vfio.
+
+KERNEL=="[0-9][0-9]*", SUBSYSTEM=="vfio" GROUP:="@QEMUGROUP@" MODE="0660"


-- 
To view, visit http://gerrit.ovirt.org/32218
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba7dc8b786e1dd7399411639fa3fe35372708333
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik at redhat.com>


More information about the vdsm-patches mailing list