From c9c6befe7e19adc168aefe1cfaeac8d68dd398fa Mon Sep 17 00:00:00 2001 From: liyingjun Date: Fri, 21 Feb 2014 02:58:58 +0800 Subject: [PATCH] Add snapshot related data to limits api When calling the limits api we can only get Volume and Gigabyte data, the snapshot related limit value should be returned too. Change-Id: I6a5e1e2d1aa6abbac5d5dacd042223ce49207c1f Closes-bug: 1282924 --- cinder/api/contrib/used_limits.py | 1 + cinder/api/views/limits.py | 1 + cinder/tests/api/contrib/test_used_limits.py | 1 + 3 files changed, 3 insertions(+) diff --git a/cinder/api/contrib/used_limits.py b/cinder/api/contrib/used_limits.py index a36ceb944..bfcb88f0b 100644 --- a/cinder/api/contrib/used_limits.py +++ b/cinder/api/contrib/used_limits.py @@ -34,6 +34,7 @@ class UsedLimitsController(wsgi.Controller): quota_map = { 'totalVolumesUsed': 'volumes', 'totalGigabytesUsed': 'gigabytes', + 'totalSnapshotsUsed': 'snapshots', } used_limits = {} diff --git a/cinder/api/views/limits.py b/cinder/api/views/limits.py index 528ca417d..880c51389 100644 --- a/cinder/api/views/limits.py +++ b/cinder/api/views/limits.py @@ -47,6 +47,7 @@ class ViewBuilder(object): "cores": ["maxTotalCores"], "gigabytes": ["maxTotalVolumeGigabytes"], "volumes": ["maxTotalVolumes"], + "snapshots": ["maxTotalSnapshots"], "key_pairs": ["maxTotalKeypairs"], "floating_ips": ["maxTotalFloatingIps"], "metadata_items": ["maxServerMeta", "maxImageMeta"], diff --git a/cinder/tests/api/contrib/test_used_limits.py b/cinder/tests/api/contrib/test_used_limits.py index d102253e8..4511cc83a 100644 --- a/cinder/tests/api/contrib/test_used_limits.py +++ b/cinder/tests/api/contrib/test_used_limits.py @@ -45,6 +45,7 @@ class UsedLimitsTestCase(test.TestCase): quota_map = { 'totalVolumesUsed': 'volumes', 'totalGigabytesUsed': 'gigabytes', + 'totalSnapshotsUsed': 'snapshots', } limits = {} -- 2.45.2