Federico Simoncelli has uploaded a new change for review.
Change subject: Set StoragePool.id to SPM_ID_FREE by default ......................................................................
Set StoragePool.id to SPM_ID_FREE by default
Setting the storage pool id to SPM_ID_FREE (-1) would prevent mistakes that could lead None to appear in the metadata. In this patch: * replace the storage pool id value None with SPM_ID_FREE * replace the storage pool lver value None with LVER_INVALID * always convert both the pool id and lver to integers before writing the metadata
Signed-off-by: Federico Simoncelli fsimonce@redhat.com Change-Id: Ifd0276f106f7a586025b8d3329ede1aac5a9905b --- M vdsm/storage/sp.py 1 file changed, 17 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/7268/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py index ee45151..658be21 100644 --- a/vdsm/storage/sp.py +++ b/vdsm/storage/sp.py @@ -67,6 +67,8 @@ SPM_ACQUIRED = 'SPM' SPM_CONTEND = 'Contend' SPM_FREE = 'Free' +SPM_ID_FREE = -1 +LVER_INVALID = -1
def domainListEncoder(domDict): domains = ','.join([ '%s:%s' % (k, v) for k, v in domDict.iteritems()]) @@ -85,9 +87,9 @@ # Key dec, enc PMDK_DOMAINS : (domainListDecoder, domainListEncoder), PMDK_POOL_DESCRIPTION : (unicodeDecoder, unicodeEncoder), - PMDK_LVER : (int, str), - PMDK_SPM_ID : (int, str), - PMDK_MASTER_VER : (int, str) + PMDK_LVER : (int, int), + PMDK_SPM_ID : (int, int), + PMDK_MASTER_VER : (int, int) }
# Calculate how many domains can be in the pool before overflowing the Metadata @@ -117,7 +119,7 @@ self._setUnsafe() self.spUUID = str(spUUID) self.poolPath = os.path.join(self.storage_repository, self.spUUID) - self.id = None + self.id = SPM_ID_FREE self.scsiKey = None self.taskMng = taskManager self._poolFile = os.path.join(self._poolsTmpDir, self.spUUID) @@ -145,7 +147,7 @@ def forceFreeSpm(self): # DO NOT USE, STUPID, HERE ONLY FOR BC # TODO: SCSI Fence the 'lastOwner' - self.setMetaParams({PMDK_SPM_ID: -1, PMDK_LVER: -1}, + self.setMetaParams({PMDK_SPM_ID: SPM_ID_FREE, PMDK_LVER: LVER_INVALID}, __securityOverride=True) self.spmRole = SPM_FREE
@@ -381,7 +383,8 @@
if not stopFailed: try: - self.setMetaParam(PMDK_SPM_ID, -1, __securityOverride=True) + self.setMetaParam(PMDK_SPM_ID, SPM_ID_FREE, + __securityOverride=True) except: pass # The system can handle this inconsistency
@@ -511,7 +514,7 @@ msd.releaseHostId(self.id) raise except: - self.id = None + self.id = SPM_ID_FREE raise
@unsecured @@ -521,7 +524,7 @@ msd.releaseClusterLock() finally: msd.releaseHostId(self.id) - self.id = None + self.id = SPM_ID_FREE
@unsecured def create(self, poolName, msdUUID, domList, masterVersion, safeLease): @@ -659,7 +662,7 @@ """ self.log.info("Disconnect from the storage pool %s", self.spUUID)
- self.id = None + self.id = SPM_ID_FREE self.scsiKey = None if os.path.exists(self._poolFile): os.unlink(self._poolFile) @@ -715,8 +718,8 @@ raise se.UnicodeArgumentException()
futurePoolMD.update({ - PMDK_SPM_ID: -1, - PMDK_LVER: -1, + PMDK_SPM_ID: SPM_ID_FREE, + PMDK_LVER: LVER_INVALID, PMDK_MASTER_VER: masterVersion, PMDK_POOL_DESCRIPTION: poolName, PMDK_DOMAINS: {domain.sdUUID: sd.DOM_ACTIVE_STATUS}}) @@ -1390,8 +1393,9 @@ if not self.spUUID: raise se.StoragePoolInternalError
- info = {'type': '', 'name': '', 'domains': '', 'master_uuid': '', 'master_ver': 0, - 'lver': -1, 'spm_id': -1, 'isoprefix': '', 'pool_status': 'uninitialized', 'version': -1} + info = {'type': '', 'name': '', 'domains': '', 'master_uuid': '', + 'master_ver': 0, 'lver': LVER_INVALID, 'spm_id': SPM_ID_FREE, + 'isoprefix': '', 'pool_status': 'uninitialized', 'version': -1} list_and_stats = {}
msdUUID = self.masterDomain.sdUUID
-- To view, visit http://gerrit.ovirt.org/7268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: Ifd0276f106f7a586025b8d3329ede1aac5a9905b Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli fsimonce@redhat.com
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Set StoragePool.id to SPM_ID_FREE by default ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/479/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/7268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifd0276f106f7a586025b8d3329ede1aac5a9905b Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Set StoragePool.id to SPM_ID_FREE by default ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/493/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/7268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifd0276f106f7a586025b8d3329ede1aac5a9905b Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Ayal Baron has posted comments on this change.
Change subject: Set StoragePool.id to SPM_ID_FREE by default ......................................................................
Patch Set 2: Looks good to me, approved
No BZ# in comment?
-- To view, visit http://gerrit.ovirt.org/7268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifd0276f106f7a586025b8d3329ede1aac5a9905b Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: BZ#833084 Set StoragePool.id to SPM_ID_FREE by default ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/583/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/7268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifd0276f106f7a586025b8d3329ede1aac5a9905b Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Daniel Paikov has posted comments on this change.
Change subject: BZ#833084 Set StoragePool.id to SPM_ID_FREE by default ......................................................................
Patch Set 3: Verified
-- To view, visit http://gerrit.ovirt.org/7268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifd0276f106f7a586025b8d3329ede1aac5a9905b Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Daniel Paikov paikov@gmail.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Ayal Baron has posted comments on this change.
Change subject: BZ#833084 Set StoragePool.id to SPM_ID_FREE by default ......................................................................
Patch Set 3: Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/7268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: Ifd0276f106f7a586025b8d3329ede1aac5a9905b Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Daniel Paikov paikov@gmail.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has submitted this change and it was merged.
Change subject: BZ#833084 Set StoragePool.id to SPM_ID_FREE by default ......................................................................
BZ#833084 Set StoragePool.id to SPM_ID_FREE by default
Setting the storage pool id to SPM_ID_FREE (-1) would prevent mistakes that could lead None to appear in the metadata. In this patch: * replace the storage pool id value None with SPM_ID_FREE * replace the storage pool lver value None with LVER_INVALID * validate the hostId in reconstructMaster
Signed-off-by: Federico Simoncelli fsimonce@redhat.com Change-Id: Ifd0276f106f7a586025b8d3329ede1aac5a9905b --- M vdsm/storage/hsm.py M vdsm/storage/sp.py 2 files changed, 18 insertions(+), 10 deletions(-)
Approvals: Ayal Baron: Looks good to me, approved Daniel Paikov: Verified Dan Kenigsberg:
-- To view, visit http://gerrit.ovirt.org/7268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged Gerrit-Change-Id: Ifd0276f106f7a586025b8d3329ede1aac5a9905b Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: Ayal Baron abaron@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Daniel Paikov paikov@gmail.com Gerrit-Reviewer: Federico Simoncelli fsimonce@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
vdsm-patches@lists.fedorahosted.org