Change in vdsm[master]: Add ResourceLocker

nsoffer at redhat.com nsoffer at redhat.com
Wed Jul 15 16:32:42 UTC 2015


Nir Soffer has posted comments on this change.

Change subject: Add ResourceLocker
......................................................................


Patch Set 2:

(1 comment)

https://gerrit.ovirt.org/#/c/43554/2/vdsm/storage/resourceLocker.py
File vdsm/storage/resourceLocker.py:

Line 34:     def __init__(self):
Line 35:         self._lock = threading.Lock()
Line 36:         self._resources = OrderedDict()
Line 37: 
Line 38:     def acquireResource(self, res, exclusive):
> This make the caller calls much less clear:
Another issue - to prevent locking of arbitrary strings, which may lead to in correct locking (e.g. on thread lock "domain_uuid", the other lock "domain_uuid" + "-" + "image_uuid", both thinking they locked the domain), how about renaming "res" to  "uuid", and validating that the string is a uuid?

This change means that anything you lock must have a uuid, so we may need to add uuids to some objects (e.g. domain monitor). 

And last, add a description optional parameter, so for each lock, we can log the thread id, name, the locked uuid, and the description of the lock (e.g. "locking source volume for live merge")
Line 39:         with self._lock:
Line 40:             if len(self._resources) >= LOCK_CACHE_SIZE:
Line 41:                 self._drop_cached_lock()
Line 42:             if res not in self._resources:


-- 
To view, visit https://gerrit.ovirt.org/43554
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I29589889efd39920d72979e89405ff6cf36b803b
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list