From d132c2eb11bdf4a28bedcd4061d5b76b4402a08e Mon Sep 17 00:00:00 2001 From: Mykhailo Dovgal Date: Mon, 10 Jul 2017 19:16:06 +0300 Subject: [PATCH] Get rid of redundant cinder api calls During executing tenant_limit_usages quotas function we get information about cinder volumes/snapshots/gigabites usage that we've already had after tenant_absolute_limits call. Getting this information we make more api calls that slow down our application. This patch fixes this issue. Closes-Bug: #1703584 Change-Id: Ia6d2dbb8f18ce93f71668d6ebd2689b851586ca9 --- .../dashboards/project/cg_snapshots/views.py | 2 +- .../templates/cgroups/_snapshot_limits.html | 4 +- .../dashboards/project/cgroups/views.py | 4 +- .../instances/_flavors_and_quotas.html | 6 +- .../dashboards/project/snapshots/tests.py | 4 +- .../dashboards/project/volumes/forms.py | 7 +- .../templates/volumes/_extend_limits.html | 6 +- .../volumes/templates/volumes/_limits.html | 12 ++-- .../templates/volumes/_snapshot_limits.html | 6 +- .../templates/volumes/_volume_limits.html | 12 ++-- .../dashboards/project/volumes/tests.py | 64 +++++++++---------- .../dashboards/project/volumes/views.py | 4 +- openstack_dashboard/usage/quotas.py | 10 --- 13 files changed, 66 insertions(+), 75 deletions(-) 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 @@
{% trans "Total Volume Storage" %} - {% blocktrans with used=usages.gigabytesUsed|intcomma quota=usages.maxTotalVolumeGigabytes|intcomma|quotainf %} + {% blocktrans with used=usages.totalGigabytesUsed|intcomma quota=usages.maxTotalVolumeGigabytes|intcomma|quotainf %} {{ used }} of {{ quota }} GiB Used {% endblocktrans %} @@ -107,8 +107,8 @@ class="quota_bar" data-progress-indicator-flavor data-quota-limit="{{ usages.maxTotalVolumeGigabytes }}" - data-quota-used="{{ usages.gigabytesUsed }}"> - {% widthratio usages.gigabytesUsed usages.maxTotalVolumeGigabytes 100 as volume_storage_percent %} + data-quota-used="{{ usages.totalGigabytesUsed }}"> + {% widthratio usages.totalGigabytesUsed usages.maxTotalVolumeGigabytes 100 as volume_storage_percent %} {% bs_progress_bar volume_storage_percent 0 %}
{% endif %} diff --git a/openstack_dashboard/dashboards/project/snapshots/tests.py b/openstack_dashboard/dashboards/project/snapshots/tests.py index 84e499fccf..3e2b6c39c4 100644 --- a/openstack_dashboard/dashboards/project/snapshots/tests.py +++ b/openstack_dashboard/dashboards/project/snapshots/tests.py @@ -130,8 +130,8 @@ class VolumeSnapshotsViewTests(test.TestCase): .AndReturn(volume) snapshot_used = len(self.cinder_volume_snapshots.list()) usage_limit = {'maxTotalVolumeGigabytes': 250, - 'gigabytesUsed': 20, - 'snapshotsUsed': snapshot_used, + 'totalGigabytesUsed': 20, + 'totalSnapshotsUsed': snapshot_used, 'maxTotalSnapshots': 6} quotas.tenant_limit_usages(IsA(http.HttpRequest)).\ AndReturn(usage_limit) diff --git a/openstack_dashboard/dashboards/project/volumes/forms.py b/openstack_dashboard/dashboards/project/volumes/forms.py index 44ac7a7b69..7c95fc98e6 100644 --- a/openstack_dashboard/dashboards/project/volumes/forms.py +++ b/openstack_dashboard/dashboards/project/volumes/forms.py @@ -320,8 +320,9 @@ class CreateForm(forms.SelfHandlingForm): try: usages = quotas.tenant_limit_usages(self.request) availableGB = usages['maxTotalVolumeGigabytes'] - \ - usages['gigabytesUsed'] - availableVol = usages['maxTotalVolumes'] - usages['volumesUsed'] + usages['totalGigabytesUsed'] + availableVol = usages['maxTotalVolumes'] - \ + usages['totalVolumesUsed'] snapshot_id = None image_id = None @@ -734,7 +735,7 @@ class ExtendForm(forms.SelfHandlingForm): usages = quotas.tenant_limit_usages(self.request) availableGB = usages['maxTotalVolumeGigabytes'] - \ - usages['gigabytesUsed'] + usages['totalGigabytesUsed'] if availableGB < (new_size - orig_size): message = _('Volume cannot be extended to %(req)iGiB as ' 'you only have %(avail)iGiB of your quota ' diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/_extend_limits.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/_extend_limits.html index fcf76c62ca..b0c157c859 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/_extend_limits.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/_extend_limits.html @@ -11,16 +11,16 @@ {% trans "Total Gibibytes" %} - {% blocktrans with used=usages.gigabytesUsed|intcomma quota=usages.maxTotalVolumeGigabytes|intcomma|quotainf %}{{ used }} of {{ quota }} GiB Used{% endblocktrans %} + {% blocktrans with used=usages.totalGigabytesUsed|intcomma quota=usages.maxTotalVolumeGigabytes|intcomma|quotainf %}{{ used }} of {{ quota }} GiB Used{% endblocktrans %}
- {% 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 @@ {% trans "Total Gibibytes" %} - {% blocktrans with used=usages.gigabytesUsed|intcomma quota=usages.maxTotalVolumeGigabytes|intcomma|quotainf %}{{ used }} of {{ quota }} GiB Used{% endblocktrans %} + {% blocktrans with used=usages.totalGigabytesUsed|intcomma quota=usages.maxTotalVolumeGigabytes|intcomma|quotainf %}{{ used }} of {{ quota }} GiB Used{% endblocktrans %} @@ -27,9 +27,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 }} @@ -40,7 +40,7 @@ {% block used_of_quota %} - {% blocktrans with used=usages.volumesUsed|intcomma quota=usages.maxTotalVolumes|intcomma|quotainf %}{{ used }} of {{ quota }} Used{% endblocktrans %} + {% blocktrans with used=usages.totalVolumesUsed|intcomma quota=usages.maxTotalVolumes|intcomma|quotainf %}{{ used }} of {{ quota }} Used{% endblocktrans %} {% endblock %} @@ -48,10 +48,10 @@ {{ minifyspace }}
{% 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)