diff --git a/openstack/block_storage/v3/_proxy.py b/openstack/block_storage/v3/_proxy.py index 6b17f9151..cf2d675e7 100644 --- a/openstack/block_storage/v3/_proxy.py +++ b/openstack/block_storage/v3/_proxy.py @@ -1293,7 +1293,11 @@ class Proxy(_base_proxy.BaseBlockStorageProxy): params = {} if project: params['project_id'] = resource.Resource._get_id(project) - return self._get(_limits.Limits, requires_id=False, **params) + + # we don't use Proxy._get since that doesn't allow passing arbitrary + # query string parameters + res = self._get_resource(_limits.Limits, None) + return res.fetch(self, requires_id=False, **params) # ====== CAPABILITIES ====== def get_capabilities(self, host): diff --git a/openstack/block_storage/v3/limits.py b/openstack/block_storage/v3/limits.py index fe726a6e6..71717b4f3 100644 --- a/openstack/block_storage/v3/limits.py +++ b/openstack/block_storage/v3/limits.py @@ -71,6 +71,12 @@ class Limits(resource.Resource): resource_key = "limits" base_path = "/limits" + _max_microversion = "3.39" + + _query_mapping = resource.QueryParameters( + "project_id", + ) + # capabilities allow_fetch = True diff --git a/openstack/tests/unit/block_storage/v3/test_proxy.py b/openstack/tests/unit/block_storage/v3/test_proxy.py index 986fe3696..c8b82f76f 100644 --- a/openstack/tests/unit/block_storage/v3/test_proxy.py +++ b/openstack/tests/unit/block_storage/v3/test_proxy.py @@ -19,7 +19,6 @@ from openstack.block_storage.v3 import extension from openstack.block_storage.v3 import group from openstack.block_storage.v3 import group_snapshot from openstack.block_storage.v3 import group_type -from openstack.block_storage.v3 import limits from openstack.block_storage.v3 import quota_class_set from openstack.block_storage.v3 import quota_set from openstack.block_storage.v3 import resource_filter @@ -137,11 +136,13 @@ class TestPools(TestVolumeProxy): class TestLimit(TestVolumeProxy): def test_limits_get(self): - self.verify_get( + self._verify( + 'openstack.resource.Resource.fetch', self.proxy.get_limits, - limits.Limits, method_args=[], - expected_kwargs={'requires_id': False}, + method_kwargs={'project': 'foo'}, + expected_args=[self.proxy], + expected_kwargs={'requires_id': False, 'project_id': 'foo'}, )