Yeela Kaplan has uploaded a new change for review. Change subject: [WIP] Additional oop functionality ......................................................................
[WIP] Additional oop functionality Functionality is still not implemented in IOProcess and includes: directTouch cleanupdir createdir truncatefile Change-Id: I438f01236767e807f010be7531678ee5b1a05056 Signed-off-by: Yeela Kaplan <ykap...@redhat.com> --- M vdsm/storage/outOfProcess.py 1 file changed, 20 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/27641/1 diff --git a/vdsm/storage/outOfProcess.py b/vdsm/storage/outOfProcess.py index c0c7dee..ac98f65 100644 --- a/vdsm/storage/outOfProcess.py +++ b/vdsm/storage/outOfProcess.py @@ -81,6 +81,12 @@ def __init__(self, iop): self._iop = iop + def cleanupdir(self, path): + self._iop.cleanupdir(path) + + def createdir(self, path, mode=None): + self._iop.createdir(path, mode) + def validateAccess(self, targetPath, perms=(os.R_OK | os.W_OK | os.X_OK)): if not self._iop.access(targetPath, perms): log.warning("Permission denied for directory: %s with permissions:" @@ -120,6 +126,10 @@ return self._iop.lexists(path) +def directTouch(ioprocess, path): + ioprocess.touch(path, direct=True) + + def directReadLines(ioprocess, path): fileStr = ioprocess.readfile(path, direct=True) lines = fileStr.split('\n') @@ -131,6 +141,10 @@ for l in lines: data += l return ioprocess.writefile(path, data) + + +def truncateFile(ioprocess, path, size, mode=None, creatExcl=False): + ioprocess.truncateFile(path, size, mode, creatExcl) class _ModuleWrapper(types.ModuleType): @@ -156,6 +170,10 @@ if ioproc: self.glob = _IOProcessGlob(ioproc) + self.fileUtils.cleanupdir = \ + _IOProcessFileUtils(ioproc).cleanupdir + self.fileUtils.createdir = \ + _IOProcessFileUtils(ioproc).createdir self.fileUtils.validateAccess = \ _IOProcessFileUtils(ioproc).validateAccess self.fileUtils.pathExists = \ @@ -167,6 +185,8 @@ self.os.path = _IOProcessOs(ioproc).path self.directReadLines = partial(directReadLines, ioproc) self.writeLines = partial(writeLines, ioproc) + self.directTouch = partial(directTouch, ioproc) + self.truncateFile = partial(truncateFile, ioproc) def __getattr__(self, name): # Root modules is fake, we need to remove it -- To view, visit http://gerrit.ovirt.org/27641 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I438f01236767e807f010be7531678ee5b1a05056 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yeela Kaplan <ykap...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches