Change in vdsm[master]: Add missing validateQemuReadable to oop

ykaplan at redhat.com ykaplan at redhat.com
Mon Jun 30 10:45:49 UTC 2014


Yeela Kaplan has uploaded a new change for review.

Change subject: Add missing validateQemuReadable to oop
......................................................................

Add missing validateQemuReadable to oop

Change-Id: I6598619c7acd18e41b51c15018627973f1eb263a
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1114499
Signed-off-by: Yeela Kaplan <ykaplan at redhat.com>
---
M vdsm/storage/outOfProcess.py
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/29398/1

diff --git a/vdsm/storage/outOfProcess.py b/vdsm/storage/outOfProcess.py
index 77f40aa..9003f40 100644
--- a/vdsm/storage/outOfProcess.py
+++ b/vdsm/storage/outOfProcess.py
@@ -18,12 +18,14 @@
 # Refer to the README and COPYING files for full details of the license
 #
 import errno
+import grp
 import logging
 import os
 import stat
 import sys
 import types
 
+from vdsm import constants
 from vdsm.config import config
 import threading
 from functools import partial
@@ -176,6 +178,17 @@
     def pathExists(self, filename, writable=False):
         return self._iop.pathExists(filename, writable)
 
+    def validateQemuReadable(self, targetPath):
+        """
+        Validate that qemu process can read file
+        """
+        gids = (grp.getgrnam(constants.DISKIMAGE_GROUP).gr_gid,
+                grp.getgrnam(constants.METADATA_GROUP).gr_gid)
+        st = _IOProcessOs(self._iop).stat(targetPath)
+        if not (st.st_gid in gids and st.st_mode & stat.S_IRGRP or
+                st.st_mode & stat.S_IROTH):
+            raise OSError(errno.EACCES, os.strerror(errno.EACCES))
+
 
 class _IOProcessOs(object):
     def __init__(self, iop):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6598619c7acd18e41b51c15018627973f1eb263a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan at redhat.com>


More information about the vdsm-patches mailing list