Adam Litke has posted comments on this change.
Change subject: block: use the contextmanager for getVolumeMetadataSlot ......................................................................
Patch Set 6:
(2 comments)
https://gerrit.ovirt.org/#/c/25988/6//COMMIT_MSG Commit Message:
Line 3: AuthorDate: 2014-03-21 14:22:41 -0400 Line 4: Commit: Adam Litke alitke@redhat.com Line 5: CommitDate: 2015-03-09 16:55:21 -0400 Line 6: Line 7: block: use the contextmanager for getVolumeMetadataSlot
English: convert getVolumeMetadataSlot into a contexmanager
Done Line 8: Line 9: Using the contextmanager on getVolumeMetadataSlot allows us to hide the Line 10: metadata slot lock inside the StorageDomain object instead of having to Line 11: use it from other modules (e.g. formatConverter).
https://gerrit.ovirt.org/#/c/25988/6/vdsm/storage/blockSD.py File vdsm/storage/blockSD.py:
Line 716: Line 717: @contextmanager Line 718: def getVolumeMetadataSlot(self, vol_name, slotSize): Line 719: # TODO: _lvTagMetaSlotLock should be relevant only when we use Line 720: # getFreeMetadataSlot to avoid a race between getting the occupied
sorry, I do not understand this TODO. The suggested code takes the lock for
We'll have to get Federico to weigh in on it. Line 721: # metadata slots and tagging the new LV (commit to the new slot). Line 722: with self._lvTagMetaSlotLock: Line 723: if self.getVersion() in VERS_METADATA_LV: Line 724: yield self.getVolumeMetadataOffsetFromPvMapping(vol_name)