Browse Source

Fix over-quota exception of snapshot creation

Report consumed snapshot gigabytes instead of share gigabytes

Change-Id: I917d3c68fc2014d4bdeefbf7c473ebc2bf6d8979
Closes-Bug: #1859775
Co-authored-by: Maurice Escher <maurice.escher@sap.com>
(cherry picked from commit 5c858bc528)
(cherry picked from commit 9c07eb3151)
(cherry picked from commit 5f91ab3520)
tags/7.4.1
Chuan Miao 1 year ago
committed by Goutham Pacha Ravi
parent
commit
626b92b445
3 changed files with 11 additions and 5 deletions
  1. +5
    -4
      manila/share/api.py
  2. +1
    -1
      manila/tests/share/test_api.py
  3. +5
    -0
      releasenotes/notes/bug-1859775-snapshot-over-quota-exception-bb6691612af03ddf.yaml

+ 5
- 4
manila/share/api.py View File

@@ -1006,10 +1006,11 @@ class API(base.Base):
msg = ("Quota exceeded for %(s_pid)s, tried to create "
"%(s_size)sG snapshot (%(d_consumed)dG of "
"%(d_quota)dG already consumed).")
LOG.warning(msg, {'s_pid': context.project_id,
's_size': size,
'd_consumed': _consumed('gigabytes'),
'd_quota': quotas['snapshot_gigabytes']})
LOG.warning(msg, {
's_pid': context.project_id,
's_size': size,
'd_consumed': _consumed('snapshot_gigabytes'),
'd_quota': quotas['snapshot_gigabytes']})
raise exception.SnapshotSizeExceedsAvailableQuota()
elif 'snapshots' in overs:
msg = ("Quota exceeded for %(s_pid)s, tried to create "


+ 1
- 1
manila/tests/share/test_api.py View File

@@ -1098,7 +1098,7 @@ class ShareAPITestCase(test.TestCase):
share = fakes.fake_share(
id=uuidutils.generate_uuid(), size=1, project_id='fake_project',
user_id='fake_user', has_replicas=False, status='available')
usages = {'gigabytes': {'reserved': 10, 'in_use': 0}}
usages = {'snapshot_gigabytes': {'reserved': 10, 'in_use': 0}}
quotas = {'snapshot_gigabytes': 10}
side_effect = exception.OverQuota(
overs='snapshot_gigabytes', usages=usages, quotas=quotas)


+ 5
- 0
releasenotes/notes/bug-1859775-snapshot-over-quota-exception-bb6691612af03ddf.yaml View File

@@ -0,0 +1,5 @@
---
fixes:
- |
Fixed Quota exceeded exception for snapshot creation. Consumed gigabytes
now reports the snapshot gigabytes instead of share gigabytes usage.

Loading…
Cancel
Save