exclusive_resources: use set remove instead of discard
If the release function cannot find a resource in the allocation pool, it should raise an error. Change-Id: Ieffd547f5c08fbe56289c99dc0384e7bd8a8f85b
This commit is contained in:
@@ -88,7 +88,7 @@ class ResourceAllocator(object):
|
||||
@utils.synchronized('resource_allocator', external=True, lock_path='/tmp')
|
||||
def release(self, resource):
|
||||
allocations = self._get_allocations()
|
||||
allocations.discard(resource)
|
||||
allocations.remove(resource)
|
||||
if allocations:
|
||||
self._write_allocations(allocations)
|
||||
else: # Clean up the file if we're releasing the last allocation
|
||||
|
Reference in New Issue
Block a user