Include project_id in QUOTAS.reserve call

Add project_id kwarg as part of the call to deduct quotas
during unregister volume. This will make sure the
deduction happens for the correct project to which
the volume actually belongs to in ICM.

Change-Id: Ib0596aef1b2fde4da0c8164141d39dae2ece4c94
Closes-Bug: #1712093
This commit is contained in:
arunmani 2017-08-22 02:35:46 -04:00
parent b04397a642
commit 0738af993d
1 changed files with 3 additions and 1 deletions

View File

@ -999,6 +999,7 @@ class PowerVCCinderManager(service.Service):
volume_id = local_volume.get('id') volume_id = local_volume.get('id')
volume_name = local_volume.get('display_name') volume_name = local_volume.get('display_name')
volume_size = local_volume.get('size') volume_size = local_volume.get('size')
volume_project_id = local_volume.get('project_id')
if volume_id is None: if volume_id is None:
LOG.debug('Volume id is none and ignore it') LOG.debug('Volume id is none and ignore it')
return ret return ret
@ -1010,8 +1011,9 @@ class PowerVCCinderManager(service.Service):
db.volume_destroy(context, volume_id) db.volume_destroy(context, volume_id)
# update the quotas # update the quotas
reserve_opts = {'volumes': -1, reserve_opts = {'volumes': -1,
'gigabytes': -volume_size} 'gigabytes': volume_size * -1}
reservations = QUOTAS.reserve(context, reservations = QUOTAS.reserve(context,
project_id=volume_project_id,
**reserve_opts) **reserve_opts)
LOG.info(_("Start to deduct quota of volume: %s, size: %s") % LOG.info(_("Start to deduct quota of volume: %s, size: %s") %
(volume_name, volume_size)) (volume_name, volume_size))