Nir Soffer has posted comments on this change. Change subject: storage: Introduce guarded utilities ......................................................................
Patch Set 6: (3 comments) https://gerrit.ovirt.org/#/c/61435/6/lib/vdsm/storage/guarded.py File lib/vdsm/storage/guarded.py: Line 135: def __hash__(self): Line 136: return hash(self._key()) Line 137: Line 138: def _key(self): Line 139: return type(self), self.ns, self.name, self.mode > Not sure I follow. There is a bug in VolumeLease (see below) but once that _key cannot be implemented by the superclass since it does not know anything about the subclass properties. See the example implementation bellow. Line 140: Line 141: Line 142: class ResourceManagerLock(LockInterface): Line 143: def __init__(self, ns, name, mode): Line 160: def acquire(self): Line 161: rmanager.acquireResource(self.ns, self.name, self.mode) Line 162: Line 163: def release(self): Line 164: rmanager.releaseResource(self.ns, self.name) Here is the _key for this class: def _key(self): return (type(self), self._ns, self._name, self._mode) Line 165: Line 166: Line 167: class VolumeLease(LockInterface): Line 168: MODE = "exclusive" # All volume leases are exclusive Line 190: dom.acquireVolumeLease(self._host_id, self._img_id, self._vol_id) Line 191: Line 192: def release(self): Line 193: dom = sdCache.produce_manifest(self._sd_id) Line 194: dom.releaseVolumeLease(self._img_id, self._vol_id) Here is the key for this class: def _key(self): return (type(self), self._host_id, self._sd_id, self._img_id, self._vol_id) -- To view, visit https://gerrit.ovirt.org/61435 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2b0a204818d44b6205515277f4c2834cb2b7a057 Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Adam Litke <[email protected]> Gerrit-Reviewer: Adam Litke <[email protected]> Gerrit-Reviewer: Freddy Rolland <[email protected]> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Liron Aravot <[email protected]> Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: gerrit-hooks <[email protected]> Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/admin/lists/[email protected]
