Tal Nisan has uploaded a new change for review.
Change subject: Raise specific exception when local path not exist
......................................................................
Raise specific exception when local path not exist
When trying to connect to local storage connection, raise a
specific exception in case the directory does not exist instead of
a general one
Change-Id: I9310e3895e30fa5b2ae9a092aa4c1fef508c8e96
Bug-Url:
https://bugzilla.redhat.com/949292
Signed-off-by: Tal Nisan <tnisan(a)redhat.com>
---
M vdsm/storage/storageServer.py
M vdsm/storage/storage_exception.py
2 files changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/13724/1
diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index 023f607..8eff315 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -463,6 +463,8 @@
self._path.replace("_",
"__").replace("/", "_"))
def checkTarget(self):
+ if not os.path.exists(self._path):
+ raise se.StorageServerLocalDirNotExistError(self._path)
if not os.path.isdir(self._path):
raise se.StorageServerLocalNotDirError(self._path)
fileSD.validateDirAccess(self._path)
diff --git a/vdsm/storage/storage_exception.py b/vdsm/storage/storage_exception.py
index c2c3dc8..cb22cd0 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -1200,6 +1200,13 @@
message = "Connection Reference ID was not registered"
+class StorageServerLocalDirNotExistError(StorageException):
+ code = 480
+ message = "The specified local path does not exist"
+
+ def __init__(self, path):
+ self.value = "path = %s" % path
+
#################################################
# LVM related Exceptions
#################################################
--
To view, visit
http://gerrit.ovirt.org/13724
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9310e3895e30fa5b2ae9a092aa4c1fef508c8e96
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Tal Nisan <tnisan(a)redhat.com>