Merge "Removed gb quota decrement in grp snapshot delete"

This commit is contained in:
Zuul 2017-12-12 22:09:48 +00:00 committed by Gerrit Code Review
commit e7ada824c4
3 changed files with 7 additions and 11 deletions

View File

@ -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

View File

@ -990,10 +990,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'))

View File

@ -3879,13 +3879,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,