For the last point https://github.com/harlowja/fasteners/pull/10 makes this possible,
Then cinder can just have one lock file and use something like:
import os
import fasteners
class LockBucket(object): def __init__(self, lock_path, amount): self.locks = fasteners.InterProcessLock.make_offset_locks(lock_path, amount) self.lock_path = lock_path
def __getitem__(self, item): m = hash(item) r = m % len(self.locks) return self.locks[r]
lock_path = "/tmp/cinder.lock" locks = LockBucket(lock_path, 100)
# then get locks from the above lock bucket
For the last point https:/ /github. com/harlowja/ fasteners/ pull/10 makes this possible,
Then cinder can just have one lock file and use something like:
import os
import fasteners
class LockBucket(object):
self. locks = fasteners. InterProcessLoc k.make_ offset_ locks(lock_ path,
amount)
self. lock_path = lock_path
def __init__(self, lock_path, amount):
def __getitem__(self, item):
m = hash(item)
r = m % len(self.locks)
return self.locks[r]
lock_path = "/tmp/cinder.lock" lock_path, 100)
locks = LockBucket(
# then get locks from the above lock bucket