diff --git a/openstack_dashboard/dashboards/project/cg_snapshots/views.py b/openstack_dashboard/dashboards/project/cg_snapshots/views.py
index ef21157cf6..e2e14041b8 100644
--- a/openstack_dashboard/dashboards/project/cg_snapshots/views.py
+++ b/openstack_dashboard/dashboards/project/cg_snapshots/views.py
@@ -132,7 +132,7 @@ class CreateCGroupView(forms.ModalFormView):
num_volumes = len(volumes)
usages = quotas.tenant_limit_usages(self.request)
- if usages['volumesUsed'] + num_volumes > \
+ if usages['totalVolumesUsed'] + num_volumes > \
usages['maxTotalVolumes']:
raise ValueError(_('Unable to create consistency group due to '
'exceeding volume quota limit.'))
diff --git a/openstack_dashboard/dashboards/project/cgroups/templates/cgroups/_snapshot_limits.html b/openstack_dashboard/dashboards/project/cgroups/templates/cgroups/_snapshot_limits.html
index f7b9f6cfb2..1c58a5a887 100644
--- a/openstack_dashboard/dashboards/project/cgroups/templates/cgroups/_snapshot_limits.html
+++ b/openstack_dashboard/dashboards/project/cgroups/templates/cgroups/_snapshot_limits.html
@@ -22,7 +22,7 @@
{% endblock %}
{% block used %}
- {{ usages.snapshotsUsed|intcomma }}
+ {{ usages.totalSnapshotsUsed|intcomma }}
{% endblock %}
{% block total %}
@@ -38,5 +38,5 @@
{% endblock %}
{% block used_progress %}
- "{{ usages.snapshotsUsed }}"
+ "{{ usages.totalSnapshotsUsed }}"
{% endblock %}
diff --git a/openstack_dashboard/dashboards/project/cgroups/views.py b/openstack_dashboard/dashboards/project/cgroups/views.py
index 954b5e4a1b..17dc076c6a 100644
--- a/openstack_dashboard/dashboards/project/cgroups/views.py
+++ b/openstack_dashboard/dashboards/project/cgroups/views.py
@@ -205,7 +205,7 @@ class CreateSnapshotView(forms.ModalFormView):
num_volumes = len(volumes)
usages = quotas.tenant_limit_usages(self.request)
- if usages['snapshotsUsed'] + num_volumes > \
+ if usages['totalSnapshotsUsed'] + num_volumes > \
usages['maxTotalSnapshots']:
raise ValueError(_('Unable to create snapshots due to '
'exceeding snapshot quota limit.'))
@@ -249,7 +249,7 @@ class CloneCGroupView(forms.ModalFormView):
num_volumes = len(volumes)
usages = quotas.tenant_limit_usages(self.request)
- if usages['volumesUsed'] + num_volumes > \
+ if usages['totalVolumesUsed'] + num_volumes > \
usages['maxTotalVolumes']:
raise ValueError(_('Unable to create consistency group due to '
'exceeding volume quota limit.'))
diff --git a/openstack_dashboard/dashboards/project/instances/templates/instances/_flavors_and_quotas.html b/openstack_dashboard/dashboards/project/instances/templates/instances/_flavors_and_quotas.html
index 180ef08d53..99a6e321b8 100644
--- a/openstack_dashboard/dashboards/project/instances/templates/instances/_flavors_and_quotas.html
+++ b/openstack_dashboard/dashboards/project/instances/templates/instances/_flavors_and_quotas.html
@@ -98,7 +98,7 @@
- {% widthratio usages.gigabytesUsed usages.maxTotalVolumeGigabytes 100 as gigabytes_percent %}
+ {% widthratio usages.totalGigabytesUsed usages.maxTotalVolumeGigabytes 100 as gigabytes_percent %}
{% bs_progress_bar gigabytes_percent 0 %}
diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/_limits.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/_limits.html
index d0ee1cc2ea..565ece3c22 100644
--- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/_limits.html
+++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/_limits.html
@@ -19,7 +19,7 @@
- {% widthratio usages.gigabytesUsed usages.maxTotalVolumeGigabytes 100 as gigabytes_percent %}
+ {% widthratio usages.totalGigabytesUsed usages.maxTotalVolumeGigabytes 100 as gigabytes_percent %}
{% bs_progress_bar gigabytes_percent 0 %}
{{ endminifyspace }}
@@ -40,7 +40,7 @@
{% block show_progress_bar %}
- {% widthratio usages.volumesUsed usages.maxTotalVolumes 100 as volumes_percent %}
+ {% widthratio usages.totalVolumesUsed usages.maxTotalVolumes 100 as volumes_percent %}
{% if usages.numRequestedItems %}
{% widthratio 100 usages.maxTotalVolumes usages.numRequestedItems as single_step %}
{% else %}
diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/_snapshot_limits.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/_snapshot_limits.html
index 1a9f7bf832..4b01cf9c4b 100644
--- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/_snapshot_limits.html
+++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/_snapshot_limits.html
@@ -22,7 +22,7 @@
{% endblock %}
{% block used_of_quota %}
- {% blocktrans with used=usages.snapshotsUsed|intcomma quota=usages.maxTotalSnapshots|intcomma|quotainf %}{{ used }} of {{ quota }} Used{% endblocktrans %}
+ {% blocktrans with used=usages.totalSnapshotsUsed|intcomma quota=usages.maxTotalSnapshots|intcomma|quotainf %}{{ used }} of {{ quota }} Used{% endblocktrans %}
{% endblock %}
{% block type_id %}
@@ -34,11 +34,11 @@
{% endblock %}
{% block used_progress %}
- "{{ usages.snapshotsUsed }}"
+ "{{ usages.totalSnapshotsUsed }}"
{% endblock %}
{% block show_progress_bar %}
- {% widthratio usages.snapshotsUsed usages.maxTotalSnapshots 100 as volumes_percent %}
+ {% widthratio usages.totalSnapshotsUsed usages.maxTotalSnapshots 100 as volumes_percent %}
{% if usages.numRequestedItems %}
{% widthratio usages.numRequestedItems usages.maxTotalSnapshots 100 as single_step %}
{% else %}
diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/_volume_limits.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/_volume_limits.html
index 4efd367d3f..4d31bc5ac4 100644
--- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/_volume_limits.html
+++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/_volume_limits.html
@@ -5,7 +5,7 @@
{% trans "Total Gibibytes" %}
- ({% block gigabytes_used %}{{ usages.gigabytesUsed|intcomma }}{% endblock %} {% trans "GiB" %})
+ ({% block gigabytes_used %}{{ usages.totalGigabytesUsed|intcomma }}{% endblock %} {% trans "GiB" %})
{{ usages.maxTotalVolumeGigabytes|intcomma|quota:_("GiB") }}
@@ -14,9 +14,9 @@
- {% widthratio usages.gigabytesUsed usages.maxTotalVolumeGigabytes 100 as gigabytes_percent %}
+ {% widthratio usages.totalGigabytesUsed usages.maxTotalVolumeGigabytes 100 as gigabytes_percent %}
{% bs_progress_bar gigabytes_percent 0 %}
{{ endminifyspace }}
@@ -24,7 +24,7 @@
{% block type_title %}{% trans "Number of Volumes" %}{% endblock %}
- ({% block used %}{{ usages.volumesUsed|intcomma }}{% endblock %})
+ ({% block used %}{{ usages.totalVolumesUsed|intcomma }}{% endblock %})
{% block total %}{{ usages.maxTotalVolumes|intcomma|quota }}{% endblock %}
@@ -32,9 +32,9 @@
{{ minifyspace }}
- {% widthratio usages.volumesUsed usages.maxTotalVolumes 100 as volumes_percent %}
+ {% widthratio usages.totalVolumesUsed usages.maxTotalVolumes 100 as volumes_percent %}
{% if usages.numRequestedItems %}
{% widthratio 100 usages.maxTotalVolumes usages.numRequestedItems as single_step %}
{% else %}
diff --git a/openstack_dashboard/dashboards/project/volumes/tests.py b/openstack_dashboard/dashboards/project/volumes/tests.py
index 5171d7c126..fea517df67 100644
--- a/openstack_dashboard/dashboards/project/volumes/tests.py
+++ b/openstack_dashboard/dashboards/project/volumes/tests.py
@@ -213,8 +213,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
volume_type = self.cinder_volume_types.first()
az = self.cinder_availability_zones.first().zoneName
usage_limit = {'maxTotalVolumeGigabytes': 250,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.cinder_volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.cinder_volumes.list()),
'maxTotalVolumes': 6}
formData = {'name': u'A Volume I Am Making',
'description': u'This is a volume I am making for a test.',
@@ -286,8 +286,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
volume_type = self.cinder_volume_types.first()
az = self.cinder_availability_zones.first().zoneName
usage_limit = {'maxTotalVolumeGigabytes': 250,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.cinder_volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.cinder_volumes.list()),
'maxTotalVolumes': 6}
formData = {'name': '',
'description': u'This is a volume I am making for a test.',
@@ -356,8 +356,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_create_volume_dropdown(self):
volume = self.cinder_volumes.first()
usage_limit = {'maxTotalVolumeGigabytes': 250,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.cinder_volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.cinder_volumes.list()),
'maxTotalVolumes': 6}
formData = {'name': u'A Volume I Am Making',
'description': u'This is a volume I am making for a test.',
@@ -423,8 +423,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_create_volume_from_snapshot(self):
volume = self.cinder_volumes.first()
usage_limit = {'maxTotalVolumeGigabytes': 250,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.cinder_volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.cinder_volumes.list()),
'maxTotalVolumes': 6}
snapshot = self.cinder_volume_snapshots.first()
formData = {'name': u'A Volume I Am Making',
@@ -480,8 +480,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_create_volume_from_volume(self):
volume = self.cinder_volumes.first()
usage_limit = {'maxTotalVolumeGigabytes': 250,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.cinder_volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.cinder_volumes.list()),
'maxTotalVolumes': 6}
formData = {'name': u'A copy of a volume',
@@ -553,8 +553,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_create_volume_from_snapshot_dropdown(self):
volume = self.cinder_volumes.first()
usage_limit = {'maxTotalVolumeGigabytes': 250,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.cinder_volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.cinder_volumes.list()),
'maxTotalVolumes': 6}
snapshot = self.cinder_volume_snapshots.first()
formData = {'name': u'A Volume I Am Making',
@@ -622,8 +622,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
quotas: ('tenant_limit_usages',)})
def test_create_volume_from_snapshot_invalid_size(self):
usage_limit = {'maxTotalVolumeGigabytes': 100,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.cinder_volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.cinder_volumes.list()),
'maxTotalVolumes': 6}
snapshot = self.cinder_volume_snapshots.first()
formData = {'name': u'A Volume I Am Making',
@@ -673,8 +673,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_create_volume_from_image(self):
volume = self.cinder_volumes.first()
usage_limit = {'maxTotalVolumeGigabytes': 200,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.cinder_volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.cinder_volumes.list()),
'maxTotalVolumes': 6}
image = self.images.first()
formData = {'name': u'A Volume I Am Making',
@@ -733,8 +733,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_create_volume_from_image_dropdown(self):
volume = self.cinder_volumes.first()
usage_limit = {'maxTotalVolumeGigabytes': 200,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.cinder_volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.cinder_volumes.list()),
'maxTotalVolumes': 6}
image = self.images.first()
formData = {'name': u'A Volume I Am Making',
@@ -804,8 +804,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
quotas: ('tenant_limit_usages',)})
def test_create_volume_from_image_under_image_size(self):
usage_limit = {'maxTotalVolumeGigabytes': 100,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.cinder_volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.cinder_volumes.list()),
'maxTotalVolumes': 6}
image = self.images.first()
formData = {'name': u'A Volume I Am Making',
@@ -860,8 +860,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
quotas: ('tenant_limit_usages',)})
def _test_create_volume_from_image_under_image_min_disk_size(self, image):
usage_limit = {'maxTotalVolumeGigabytes': 100,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.cinder_volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.cinder_volumes.list()),
'maxTotalVolumes': 6}
formData = {'name': u'A Volume I Am Making',
'description': u'This is a volume I am making for a test.',
@@ -930,8 +930,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
quotas: ('tenant_limit_usages',)})
def test_create_volume_gb_used_over_alloted_quota(self):
usage_limit = {'maxTotalVolumeGigabytes': 100,
- 'gigabytesUsed': 80,
- 'volumesUsed': len(self.cinder_volumes.list()),
+ 'totalGigabytesUsed': 80,
+ 'totalVolumesUsed': len(self.cinder_volumes.list()),
'maxTotalVolumes': 6}
formData = {'name': u'This Volume Is Huge!',
'description': u'This is a volume that is just too big!',
@@ -1009,8 +1009,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
quotas: ('tenant_limit_usages',)})
def test_create_volume_number_over_alloted_quota(self):
usage_limit = {'maxTotalVolumeGigabytes': 100,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.cinder_volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.cinder_volumes.list()),
'maxTotalVolumes': len(self.cinder_volumes.list())}
formData = {'name': u'Too Many...',
'description': u'We have no volumes left!',
@@ -1636,8 +1636,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_extend_volume(self):
volume = self.cinder_volumes.first()
usage_limit = {'maxTotalVolumeGigabytes': 100,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.volumes.list()),
'maxTotalVolumes': 6}
formData = {'name': u'A Volume I Am Making',
'orig_size': volume.size,
@@ -1665,8 +1665,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_extend_volume_with_wrong_size(self):
volume = self.cinder_volumes.first()
usage_limit = {'maxTotalVolumeGigabytes': 100,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.volumes.list()),
'maxTotalVolumes': 6}
formData = {'name': u'A Volume I Am Making',
'orig_size': volume.size,
@@ -1793,8 +1793,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase):
def test_extend_volume_with_size_out_of_quota(self):
volume = self.volumes.first()
usage_limit = {'maxTotalVolumeGigabytes': 100,
- 'gigabytesUsed': 20,
- 'volumesUsed': len(self.volumes.list()),
+ 'totalGigabytesUsed': 20,
+ 'totalVolumesUsed': len(self.volumes.list()),
'maxTotalVolumes': 6}
formData = {'name': u'A Volume I Am Making',
'orig_size': volume.size,
diff --git a/openstack_dashboard/dashboards/project/volumes/views.py b/openstack_dashboard/dashboards/project/volumes/views.py
index 977704f2ca..06beff5069 100644
--- a/openstack_dashboard/dashboards/project/volumes/views.py
+++ b/openstack_dashboard/dashboards/project/volumes/views.py
@@ -275,8 +275,8 @@ class ExtendView(forms.ModalFormView):
context['submit_url'] = reverse(self.submit_url, args=args)
try:
usages = quotas.tenant_limit_usages(self.request)
- usages['gigabytesUsed'] = (usages['gigabytesUsed']
- - context['volume'].size)
+ usages['totalGigabytesUsed'] = (usages['totalGigabytesUsed']
+ - context['volume'].size)
context['usages'] = usages
except Exception:
exceptions.handle(self.request)
diff --git a/openstack_dashboard/usage/quotas.py b/openstack_dashboard/usage/quotas.py
index 2fc2633621..3d72e6f564 100644
--- a/openstack_dashboard/usage/quotas.py
+++ b/openstack_dashboard/usage/quotas.py
@@ -487,16 +487,6 @@ def tenant_limit_usages(request):
if cinder.is_volume_service_enabled(request):
try:
limits.update(cinder.tenant_absolute_limits(request))
- volumes = cinder.volume_list(request)
- snapshots = cinder.volume_snapshot_list(request)
- # gigabytesUsed should be a total of volumes and snapshots
- vol_size = sum([getattr(volume, 'size', 0) for volume
- in volumes])
- snap_size = sum([getattr(snap, 'size', 0) for snap
- in snapshots])
- limits['gigabytesUsed'] = vol_size + snap_size
- limits['volumesUsed'] = len(volumes)
- limits['snapshotsUsed'] = len(snapshots)
except cinder.cinder_exception.ClientException:
msg = _("Unable to retrieve volume limit information.")
exceptions.handle(request, msg)