Commit 8ef0732c authored by Georgios D. Tsoukalas's avatar Georgios D. Tsoukalas
Browse files

allow overlimit entities to release resources

When a resource holding is found with quantity exceeding its capacity,
it cannot allocate any more quantities,
but it should be able to release quantities.
However, if even after the release the quantity remained
above the capacity, the release was denied with NoCapacity error.

This was fixed by disabling this NoCapacity check when releasing
(i.e. allocated quantity  is negative)
parent 09ca6386
......@@ -702,7 +702,7 @@ class QuotaholderDjangoDBCallpoint(Callpoint):
th = db_get_holding(entity=target, resource=resource,
for_update=True)
except Holding.DoesNotExist:
m = ("There is not enough capacity "
m = ("There is no capacity "
"to allocate into in %s.%s" % (target, resource))
raise NoCapacityError(m,
source=entity, target=target,
......@@ -724,7 +724,7 @@ class QuotaholderDjangoDBCallpoint(Callpoint):
current = (+ th.importing + th.returning
- th.exported - th.released)
if current + quantity > limit:
if not release and (current + quantity > limit):
m = ("There is not enough capacity "
"to allocate into in %s.%s" % (target, resource))
raise NoCapacityError(m,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment