Merge "Fix volume storage usage value"

This commit is contained in:
Jenkins 2016-12-16 05:07:21 +00:00 committed by Gerrit Code Review
commit c16c950d40
2 changed files with 4 additions and 2 deletions

View File

@ -67,7 +67,7 @@ class QuotaTests(test.APITestCase):
usages.update({'volumes': {'available': 0, 'used': 4, 'quota': 1},
'snapshots': {'available': 0, 'used': 3,
'quota': 1},
'gigabytes': {'available': 880, 'used': 120,
'gigabytes': {'available': 600, 'used': 400,
'quota': 1000}})
return usages

View File

@ -381,7 +381,9 @@ def _get_tenant_volume_usages(request, usages, disabled_quotas, tenant_id):
else:
volumes = cinder.volume_list(request)
snapshots = cinder.volume_snapshot_list(request)
usages.tally('gigabytes', sum([int(v.size) for v in volumes]))
volume_usage = sum([int(v.size) for v in volumes])
snapshot_usage = sum([int(s.size) for s in snapshots])
usages.tally('gigabytes', (snapshot_usage + volume_usage))
usages.tally('volumes', len(volumes))
usages.tally('snapshots', len(snapshots))
except cinder.cinder_exception.ClientException: