Change in vdsm[ovirt-3.5]: supervdsmServer: Do not use udev to set permissions on exter...

nsoffer at redhat.com nsoffer at redhat.com
Tue Oct 14 16:24:46 UTC 2014


Hello Dan Kenigsberg, Francesco Romani,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/34162

to review the following change.

Change subject: supervdsmServer: Do not use udev to set permissions on external luns
......................................................................

supervdsmServer: Do not use udev to set permissions on external luns

Before plugging external luns to vms, we setup up a temporary udev rule
for setting device permissions. Using this rule will cause the device to
loose the libvirt selinux label if a device has a change event.

This is the same issue we had with vdsm images, but with external luns
we do not trigger change events, so the issue is unlikely. However, if
it happens, it will cause a vm to pause.

This patch applies the same fix, use chown instead of udev OWNER and
GROUP directives.

Change-Id: I7adb8a441497c9dd335119f55af73189ed89c23c
Bug-Url: https://bugzilla.redhat.com/1152661
Relates-To: http://gerrit.ovirt.org/33875
Relates-To: https://bugzilla.redhat.com/1147910
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/33994
Reviewed-by: Francesco Romani <fromani at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M vdsm/supervdsmServer
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/34162/1

diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index a63caa2..8fa55e4 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -69,7 +69,7 @@
 from supervdsm import _SuperVdsmManager
 from storage.fileUtils import chown, resolveGid, resolveUid
 from storage.fileUtils import validateAccess as _validateAccess
-from vdsm.constants import METADATA_GROUP, EXT_UDEVADM, \
+from vdsm.constants import METADATA_GROUP, EXT_CHOWN, EXT_UDEVADM, \
     DISKIMAGE_USER, DISKIMAGE_GROUP, P_LIBVIRT_VMCHANNELS, VDSM_USER
 from storage.devicemapper import _removeMapping, _getPathsStatus
 from vdsm.config import config
@@ -289,8 +289,11 @@
     @logDecorator
     def appropriateDevice(self, guid, thiefId):
         ruleFile = _UDEV_RULE_FILE_NAME % (guid, thiefId)
-        rule = 'SYMLINK=="mapper/%s", OWNER="%s", GROUP="%s"\n' % (
-            guid, DISKIMAGE_USER, DISKIMAGE_GROUP)
+        # WARNING: we cannot use USER, GROUP and MODE since using any of them
+        # will change the selinux label to the default, causing vms to pause.
+        # See https://bugzilla.redhat.com/1147910
+        rule = 'SYMLINK=="mapper/%s", RUN+="%s %s:%s $env{DEVNAME}"\n' % (
+            guid, EXT_CHOWN, DISKIMAGE_USER, DISKIMAGE_GROUP)
         with open(ruleFile, "w") as rf:
             self.log.debug("Creating rule %s: %r", ruleFile, rule)
             rf.write(rule)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7adb8a441497c9dd335119f55af73189ed89c23c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list