Francesco Romani has uploaded a new change for review. Change subject: drive: floppy: remove special 'readonly' handling ......................................................................
drive: floppy: remove special 'readonly' handling floppy devices used to have an explicit extra check on the image permissions to determine if the image had to have the 'readonly' attribute set. Engine is already sending this information, and this check is already done previously in vm.Drive.getXML() Moreover, this check is not only redundant, but it is one of the remaining places vdsm can get stuck if the ISO domain becomes inaccessible when a VM is started. To address those issues, this patch removes the explicit additional check and all the code which was used only by it. Change-Id: Ie9183104d3739f2d4a99712e7851fc3172b82621 Bug-Url: https://bugzilla.redhat.com/755528 Signed-off-by: Francesco Romani <[email protected]> --- M lib/vdsm/utils.py M vdsm/virt/vm.py 2 files changed, 0 insertions(+), 46 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/26937/1 diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py index cd178da..b4a1f68 100644 --- a/lib/vdsm/utils.py +++ b/lib/vdsm/utils.py @@ -43,7 +43,6 @@ import sys import os import platform -import pwd import select import shutil import signal @@ -863,46 +862,6 @@ symbolerror = {} for code, symbol in errno.errorcode.iteritems(): symbolerror[os.strerror(code)] = symbol - - -def getUserPermissions(userName, path): - """ - Return a dictionary with user specific permissions with respect to the - given file - """ - def isRead(bits): - return (bits & 4) is not 0 - - def isWrite(bits): - return (bits & 2) is not 0 - - def isExec(bits): - return (bits & 1) is not 0 - - fileStats = os.stat(path) - userInfo = pwd.getpwnam(userName) - permissions = {} - otherBits = fileStats.st_mode - groupBits = otherBits >> 3 - ownerBits = groupBits >> 3 - # TODO: Don't ignore user's auxiliary groups - isSameGroup = userInfo.pw_gid == fileStats.st_gid - isSameOwner = userInfo.pw_uid == fileStats.st_uid - - # 'Other' permissions are the base permissions - permissions['read'] = (isRead(otherBits) or - isSameGroup and isRead(groupBits) or - isSameOwner and isRead(ownerBits)) - - permissions['write'] = (isWrite(otherBits) or - isSameGroup and isWrite(groupBits) or - isSameOwner and isWrite(ownerBits)) - - permissions['exec'] = (isExec(otherBits) or - isSameGroup and isExec(groupBits) or - isSameOwner and isExec(ownerBits)) - - return permissions def listSplit(l, elem, maxSplits=None): diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index e7f6ddf..4c00345 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -1359,11 +1359,6 @@ else: driverAttrs['error_policy'] = 'stop' diskelem.appendChildWithArgs('driver', **driverAttrs) - elif self.device == 'floppy': - if (self.path and - not utils.getUserPermissions(constants.QEMU_PROCESS_USER, - self.path)['write']): - diskelem.appendChildWithArgs('readonly') if hasattr(self, 'specParams') and 'ioTune' in self.specParams: self._validateIoTuneParams() -- To view, visit http://gerrit.ovirt.org/26937 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie9183104d3739f2d4a99712e7851fc3172b82621 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
