Change in vdsm[master]: storage: simplify hasVolumeLeases
alitke at redhat.com
alitke at redhat.com
Mon Jul 13 19:45:54 UTC 2015
Adam Litke has uploaded a new change for review.
Change subject: storage: simplify hasVolumeLeases
......................................................................
storage: simplify hasVolumeLeases
Whether a storage domain has volume leases depends on the lock
implementation used, not the storage domain version. SafeLease never
supports volume leases but LocalLock and SANLock both do. Simplify
hasVolumeLeases and the clusterLock tables by moving the support flag
into the class implementing the lock.
Change-Id: Iaf0c1cf341e7d028b5d4e30a27e9a045b43470e4
Signed-off-by: Adam Litke <alitke at redhat.com>
---
M vdsm/storage/clusterlock.py
M vdsm/storage/localFsSD.py
M vdsm/storage/sd.py
3 files changed, 13 insertions(+), 14 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/43548/1
diff --git a/vdsm/storage/clusterlock.py b/vdsm/storage/clusterlock.py
index 2630acf..3a4bfa1 100644
--- a/vdsm/storage/clusterlock.py
+++ b/vdsm/storage/clusterlock.py
@@ -79,6 +79,7 @@
lockUtilPath = config.get('irs', 'lock_util_path')
lockCmd = config.get('irs', 'lock_cmd')
freeLockCmd = config.get('irs', 'free_lock_cmd')
+ volumeLeasesSupported = False
def __init__(self, sdUUID, idsPath, leasesPath, lockRenewalIntervalSec,
leaseTimeSec, leaseFailRetry, ioOpTimeoutSec):
@@ -196,6 +197,7 @@
_sanlock_fd = None
_sanlock_lock = threading.Lock()
+ volumeLeasesSupported = True
def __init__(self, sdUUID, idsPath, leasesPath, *args):
self._lock = threading.Lock()
@@ -356,6 +358,7 @@
_globalLockMap = {}
_globalLockMapSync = threading.Lock()
+ volumeLeasesSupported = True
def __init__(self, sdUUID, idsPath, leasesPath, *args):
self._sdUUID = sdUUID
diff --git a/vdsm/storage/localFsSD.py b/vdsm/storage/localFsSD.py
index 1abf018..1dd1ade 100644
--- a/vdsm/storage/localFsSD.py
+++ b/vdsm/storage/localFsSD.py
@@ -30,11 +30,11 @@
class LocalFsStorageDomain(fileSD.FileStorageDomain):
- # version: (clusterLockClass, hasVolumeLeases)
+ # version: clusterLockClass
_clusterLockTable = {
- 0: (clusterlock.SafeLease, False),
- 2: (clusterlock.SafeLease, False),
- 3: (clusterlock.LocalLock, True),
+ 0: clusterlock.SafeLease,
+ 2: clusterlock.SafeLease,
+ 3: clusterlock.LocalLock,
}
@property
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index 336cee0..fedbdee 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -382,11 +382,11 @@
mdBackupVersions = config.get('irs', 'md_backup_versions')
mdBackupDir = config.get('irs', 'md_backup_dir')
- # version: (clusterLockClass, hasVolumeLeases)
+ # version: clusterLockClass
_clusterLockTable = {
- 0: (clusterlock.SafeLease, False),
- 2: (clusterlock.SafeLease, False),
- 3: (clusterlock.SANLock, True),
+ 0: clusterlock.SafeLease,
+ 2: clusterlock.SafeLease,
+ 3: clusterlock.SANLock,
}
def __init__(self, manifest):
@@ -472,7 +472,7 @@
)
try:
- clusterLockClass = self._clusterLockTable[domVersion][0]
+ clusterLockClass = self._clusterLockTable[domVersion]
except KeyError:
raise se.UnsupportedDomainVersion(domVersion)
@@ -593,11 +593,7 @@
return self._clusterLock.getHostStatus(hostId)
def hasVolumeLeases(self):
- domVersion = self.getVersion()
- try:
- return self._clusterLockTable[domVersion][1]
- except KeyError:
- raise se.UnsupportedDomainVersion(domVersion)
+ return self._clusterLock.volumeLeasesSupported
def getVolumeLease(self, volUUID):
"""
--
To view, visit https://gerrit.ovirt.org/43548
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf0c1cf341e7d028b5d4e30a27e9a045b43470e4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke at redhat.com>
More information about the vdsm-patches
mailing list