Nir Soffer has posted comments on this change.
Change subject: block: use the contextmanager for getVolumeMetadataSlot ......................................................................
Patch Set 3:
(2 comments)
http://gerrit.ovirt.org/#/c/25988/3/tests/volumeTests.py File tests/volumeTests.py:
Line 97: self.assertEqual(mdSlot, self.EXPECTED_METADATA_SLOT) Line 98: Line 99: def testMetaSlotLock(self): Line 100: with self.blksd.getVolumeMetadataSlot(None, 1): Line 101: lktaken = self.blksd._lvTagMetaSlotLock.acquire(False) This will break if we rename the private lock or move it to other class. We want to test that only one thread can enter this context, not that is locks some specific lock.
http://gerrit.ovirt.org/#/c/25988/3/vdsm/storage/imageRepository/formatConve... File vdsm/storage/imageRepository/formatConverter.py:
Line 181: metaContent = vol.getMetadata() Line 182: Line 183: with domain.getVolumeMetadataSlot( Line 184: vol.volUUID, blockVolume.VOLUME_MDNUMBLKS) \ Line 185: as newMetaSlot: I think this would be little more clear as:
newMetaSlot = domain.getVolumeMetadataSlot( vol.volUUID, blockVolume.VOLUME_MDNUMBLKS) with newMetaSlot: ... Line 186: if newMetaSlot > metaMaxSlot: Line 187: raise se.NoSpaceLeftOnDomain(domain.sdUUID) Line 188: Line 189: log.debug("Copying metadata for volume %s to the new slot %s",