Removed gb quota decrement in grp snapshot delete
Before https://review.openstack.org/#/c/517725/, when capturing a vm we used to reserve gb quota twice. So then i changed the code such that we should only increment/reserve the gb quota once, i.e., when creating the group snapshot (not while creating volumes). Hence we no longer need to decerment gb quota when we delete the group snapshot (initially we decremented because we incremented twice). Change-Id: I64ff9c25dbea7950ca87f226c6628a730f9e3c0e Closes-Bug: 1735650
This commit is contained in:
parent
af06ceb2c5
commit
5c8b528f4c
|
@ -177,7 +177,7 @@ class QuotaIntegrationTestCase(test.TestCase):
|
|||
fake.CONSISTENCY_GROUP_ID)
|
||||
usages = db.quota_usage_get_all_by_project(self.context,
|
||||
self.project_id)
|
||||
self.assertEqual(1, usages['snapshots']['in_use'])
|
||||
self.assertEqual(2, usages['snapshots']['in_use'])
|
||||
|
||||
def test_too_many_snapshots_of_type(self):
|
||||
resource = 'snapshots_%s' % self.volume_type_name
|
||||
|
|
|
@ -977,10 +977,12 @@ class API(base.Base):
|
|||
reserve_opts_list = []
|
||||
total_reserve_opts = {}
|
||||
try:
|
||||
reserve_opts_list.append({'snapshots': 1})
|
||||
for volume in volume_list:
|
||||
if not CONF.no_snapshot_gb_quota:
|
||||
reserve_opts = {'gigabytes': volume['size']}
|
||||
if CONF.no_snapshot_gb_quota:
|
||||
reserve_opts = {'snapshots': 1}
|
||||
else:
|
||||
reserve_opts = {'snapshots': 1,
|
||||
'gigabytes': volume['size']}
|
||||
QUOTAS.add_volume_type_opts(context,
|
||||
reserve_opts,
|
||||
volume.get('volume_type_id'))
|
||||
|
|
|
@ -3869,13 +3869,7 @@ class VolumeManager(manager.CleanableManager,
|
|||
for snapshot in snapshots:
|
||||
# Get reservations
|
||||
try:
|
||||
if CONF.no_snapshot_gb_quota:
|
||||
reserve_opts = {'snapshots': -1}
|
||||
else:
|
||||
reserve_opts = {
|
||||
'snapshots': -1,
|
||||
'gigabytes': -snapshot.volume_size,
|
||||
}
|
||||
reserve_opts = {'snapshots': -1}
|
||||
volume_ref = objects.Volume.get_by_id(context,
|
||||
snapshot.volume_id)
|
||||
QUOTAS.add_volume_type_opts(context,
|
||||
|
|
Loading…
Reference in New Issue