Provide user with more information on quota fail

Provide the user with useful information when a snapshot or volume
create fails because it would cause the user to exceed available quota.
Specifically report the user's current gigabyte usage and quota
allocations.

Closes-Bug: #1235148

Change-Id: Ib4c5dbcbd172c69834c2824791af755380f38e01
This commit is contained in:
Ollie Leahy
2013-10-04 14:56:26 +00:00
parent 150e83da9f
commit 2d8b905f47
6 changed files with 25 additions and 9 deletions

View File

@@ -496,7 +496,10 @@ class API(base.Base):
's_size': volume['size'],
'd_consumed': _consumed(over),
'd_quota': quotas[over]})
raise exception.VolumeSizeExceedsAvailableQuota()
raise exception.VolumeSizeExceedsAvailableQuota(
requested=volume['size'],
consumed=_consumed('gigabytes'),
quota=quotas['gigabytes'])
elif 'snapshots' in over:
msg = _("Quota exceeded for %(s_pid)s, tried to create "
"snapshot (%(d_consumed)d snapshots "