Hello Saggi Mizrahi,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/30167
to review the following change.
Change subject: fix error handling in isdir and islink
......................................................................
fix error handling in isdir and islink
isdir and islink implemented using ioprocess will
throw an exception in case of stat failure because of
errno ENOENT, while it should return False.
Change-Id: Iaa7d1a16ba2940963d29a19a7140235fbd80ba8d
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1115123
Signed-off-by: Yeela Kaplan <[email protected]>
Reviewed-on: http://gerrit.ovirt.org/29633
Reviewed-by: Saggi Mizrahi <[email protected]>
---
M vdsm/storage/outOfProcess.py
1 file changed, 18 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/30167/1
diff --git a/vdsm/storage/outOfProcess.py b/vdsm/storage/outOfProcess.py
index 9003f40..6291319 100644
--- a/vdsm/storage/outOfProcess.py
+++ b/vdsm/storage/outOfProcess.py
@@ -248,12 +248,26 @@
self._iop = iop
def isdir(self, path):
- res = self._iop.stat(path)
- return stat.S_ISDIR(res.st_mode)
+ try:
+ res = self._iop.stat(path)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ return False
+ else:
+ raise
+ else:
+ return stat.S_ISDIR(res.st_mode)
def islink(self, path):
- res = self._iop.stat(path)
- return stat.S_ISLNK(res.st_mode)
+ try:
+ res = self._iop.stat(path)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ return False
+ else:
+ raise
+ else:
+ return stat.S_ISLNK(res.st_mode)
def lexists(self, path):
return self._iop.lexists(path)
--
To view, visit http://gerrit.ovirt.org/30167
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaa7d1a16ba2940963d29a19a7140235fbd80ba8d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Yeela Kaplan <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches