Liron Ar has uploaded a new change for review.
Change subject: core: return lver/spm id from pool metadata
......................................................................
core: return lver/spm id from pool metadata
Currently the lver/spm id are being returned as they appear in the
cluster lock if supported.
The fenceSpmStorage verb is currently used to manually confirm that
there's no current spm on the responsibillity of the caller. This verb
updates the lver/spm id in the pool metadata to indicate that the spm
role is free.
This won't help us currently as getSpmStatus will return the info from
the cluster lock (if supported) which wasn't edited at all. As currently
we can't edit the information return from cluster lock, we can return
the same results as in case it wasn't supported by the cluster lock.
Right now the solution is implemented in StoragePoolDiskBackend only as
a bug fix, as StoragePoolMemoryBackend isn't being used at the moment.
Change-Id: I460801329a9a1c5ee940bce22566ad3d29b351de
Signed-off-by: Liron Aravot <laravot(a)redhat.com>
---
M vdsm/storage/spbackends.py
1 file changed, 8 insertions(+), 19 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/27226/1
diff --git a/vdsm/storage/spbackends.py b/vdsm/storage/spbackends.py
index d090d5a..86714a3 100644
--- a/vdsm/storage/spbackends.py
+++ b/vdsm/storage/spbackends.py
@@ -26,7 +26,6 @@
import sd
import storage_exception as se
-from clusterlock import InquireNotSupportedError
from persistentDict import DictValidator
from persistentDict import unicodeDecoder
from persistentDict import unicodeEncoder
@@ -217,26 +216,16 @@
@unsecured
def getSpmStatus(self):
- try:
- # If the cluster lock implements inquire (e.g. sanlock) then we
- # can fetch the spmId and the lVer from it.
- lVer, spmId = self.masterDomain.inquireClusterLock()
- lVer, spmId = lVer or LVER_INVALID, spmId or SPM_ID_FREE
- except InquireNotSupportedError:
- # Legacy implementation for cluster locks that are not able to
- # return the spmId and the lVer.
+ poolMeta = self._getPoolMD(self.masterDomain)
+
+ # if we claim that we were the SPM (but we're currently not) we
+ # have to make sure that we're not returning stale data
+ if (poolMeta[PMDK_SPM_ID] == self.id
+ and not self.spmRole == SPM_ACQUIRED):
+ self.invalidateMetadata()
poolMeta = self._getPoolMD(self.masterDomain)
- # if we claim that we were the SPM (but we're currently not) we
- # have to make sure that we're not returning stale data
- if (poolMeta[PMDK_SPM_ID] == self.id
- and not self.spmRole == SPM_ACQUIRED):
- self.invalidateMetadata()
- poolMeta = self._getPoolMD(self.masterDomain)
-
- lVer, spmId = poolMeta[PMDK_LVER], poolMeta[PMDK_SPM_ID]
-
- return lVer, spmId
+ return poolMeta[PMDK_LVER], poolMeta[PMDK_SPM_ID]
def setSpmStatus(self, lVer=None, spmId=None):
self.invalidateMetadata()
--
To view, visit
http://gerrit.ovirt.org/27226
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I460801329a9a1c5ee940bce22566ad3d29b351de
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Liron Ar <laravot(a)redhat.com>