Use project id from volume when retyping volumes
Use the project_id from the volume being retyped to reserve quota in get_volume_type_reservation(). Previously the project_id from the context was used, which could cause reservations to be made and never cleared. Change-Id: I25f7c00961e259102cdaea6ea9394d04ded96b92 Closes-Bug: #1505307
This commit is contained in:
@@ -31,7 +31,14 @@ def get_volume_type_reservation(ctxt, volume, type_id):
|
||||
QUOTAS.add_volume_type_opts(ctxt,
|
||||
reserve_opts,
|
||||
type_id)
|
||||
reservations = QUOTAS.reserve(ctxt, **reserve_opts)
|
||||
# Note that usually the project_id on the volume will be the same as
|
||||
# the project_id in the context. But, if they are different then the
|
||||
# reservations must be recorded against the project_id that owns the
|
||||
# volume.
|
||||
project_id = volume['project_id']
|
||||
reservations = QUOTAS.reserve(ctxt,
|
||||
project_id=project_id,
|
||||
**reserve_opts)
|
||||
except exception.OverQuota as e:
|
||||
overs = e.kwargs['overs']
|
||||
usages = e.kwargs['usages']
|
||||
|
||||
Reference in New Issue
Block a user