Liron Aravot has uploaded a new change for review.

Change subject: core: moving InquireNotSupportedError to storage_exception.py
......................................................................

core: moving InquireNotSupportedError to storage_exception.py

InquireNotSupportedError is currently defined in clusterlock.py, that
prohibits from assigning a meaningful error code to that error and to
use it outside of that class scope without using a different method then
our wildly used one. In this patch its moved to storage_exception so
we'll be able catch and inspect that error like any other clusterlock related
error. The engine will use that error as well and will attempt to start
the spm if getSpmStatus() will fail as we don't have the "current" spm
information, on the worst case startSpm() will fail.

Change-Id: I8201794dc96ee24dc9c0da5b7c3d71ab0b75e9f3
Bug-Url: https://bugzilla.redhat.com/1242092
Signed-off-by: Liron Aravot <[email protected]>
---
M vdsm/storage/clusterlock.py
M vdsm/storage/hsm.py
M vdsm/storage/storage_exception.py
3 files changed, 10 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/65/45965/1

diff --git a/vdsm/storage/clusterlock.py b/vdsm/storage/clusterlock.py
index 2630acf..0eba4e6 100644
--- a/vdsm/storage/clusterlock.py
+++ b/vdsm/storage/clusterlock.py
@@ -69,10 +69,6 @@
 HOST_STATUS_DEAD = "dead"
 
 
-class InquireNotSupportedError(Exception):
-    """Raised when the clusterlock class is not supporting inquire"""
-
-
 class SafeLease(object):
     log = logging.getLogger("Storage.SafeLease")
 
@@ -146,7 +142,7 @@
             self.log.debug("Clustered lock acquired successfully")
 
     def inquire(self):
-        raise InquireNotSupportedError()
+        raise se.InquireNotSupportedError()
 
     def getLockUtilFullPath(self):
         return os.path.join(self.lockUtilPath, self.lockCmd)
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 191cf61..662a3d6 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -599,6 +599,10 @@
             # This happens when we cannot read the MD LV
             self.log.error("Can't read LV based metadata", exc_info=True)
             raise se.StorageDomainMasterError("Can't read LV based metadata")
+        except se.InquireNotSupportedError:
+            self.log.error("Inquire spm status isn't supported by "
+                           "the current cluster lock")
+            raise
         except se.StorageException as e:
             self.log.error("MD read error: %s", str(e), exc_info=True)
             raise se.StorageDomainMasterError("MD read error")
diff --git a/vdsm/storage/storage_exception.py 
b/vdsm/storage/storage_exception.py
index 3a4d33f..1d82b06 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -1618,6 +1618,11 @@
     message = "Could not initialize cluster lock"
 
 
+class InquireNotSupportedError(StorageException):
+    code = 702
+    message = "Cluster lock inquire isnt supported"
+
+
 #################################################
 #  Meta data related Exceptions
 #################################################


-- 
To view, visit https://gerrit.ovirt.org/45965
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8201794dc96ee24dc9c0da5b7c3d71ab0b75e9f3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Liron Aravot <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to