From 0738af993d01390196954a0dc97b981e0c060aa5 Mon Sep 17 00:00:00 2001 From: arunmani Date: Tue, 22 Aug 2017 02:35:46 -0400 Subject: [PATCH] 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 --- cinder-powervc/powervc/volume/manager/manager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cinder-powervc/powervc/volume/manager/manager.py b/cinder-powervc/powervc/volume/manager/manager.py index 96bc579..7a84bf0 100644 --- a/cinder-powervc/powervc/volume/manager/manager.py +++ b/cinder-powervc/powervc/volume/manager/manager.py @@ -999,6 +999,7 @@ class PowerVCCinderManager(service.Service): volume_id = local_volume.get('id') volume_name = local_volume.get('display_name') volume_size = local_volume.get('size') + volume_project_id = local_volume.get('project_id') if volume_id is None: LOG.debug('Volume id is none and ignore it') return ret @@ -1010,8 +1011,9 @@ class PowerVCCinderManager(service.Service): db.volume_destroy(context, volume_id) # update the quotas reserve_opts = {'volumes': -1, - 'gigabytes': -volume_size} + 'gigabytes': volume_size * -1} reservations = QUOTAS.reserve(context, + project_id=volume_project_id, **reserve_opts) LOG.info(_("Start to deduct quota of volume: %s, size: %s") % (volume_name, volume_size))