Fix: Quota show defaults
The ``quota show --default`` command has the URL ``os-quota-sets/{project_id}/defaults`` whereas we used ``os-quota-sets/defaults`` which results in passes "defaults" as the project ID. This was uncovered by adding project ID validation in the cinder quotas API[2]. Closes-Bug: #2107375 [1] https://docs.openstack.org/api-ref/block-storage/v3/#get-default-quotas-for-a-project [2] https://review.opendev.org/c/openstack/cinder/+/784763 Change-Id: Ibc8a084dbf41f18af28ab5592d9f5638f481c007
This commit is contained in:
@@ -2024,7 +2024,9 @@ class Proxy(proxy.Proxy):
|
|||||||
res = self._get_resource(
|
res = self._get_resource(
|
||||||
_quota_set.QuotaSet, None, project_id=project.id
|
_quota_set.QuotaSet, None, project_id=project.id
|
||||||
)
|
)
|
||||||
return res.fetch(self, base_path='/os-quota-sets/defaults')
|
return res.fetch(
|
||||||
|
self, base_path=(f'/os-quota-sets/{project.id}/defaults')
|
||||||
|
)
|
||||||
|
|
||||||
def revert_quota_set(self, project, **query):
|
def revert_quota_set(self, project, **query):
|
||||||
"""Reset Quota for the project/user.
|
"""Reset Quota for the project/user.
|
||||||
|
@@ -1176,14 +1176,15 @@ class TestQuotaSet(TestVolumeProxy):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_quota_set_get_defaults(self):
|
def test_quota_set_get_defaults(self):
|
||||||
|
project_id = 'prj'
|
||||||
self._verify(
|
self._verify(
|
||||||
'openstack.resource.Resource.fetch',
|
'openstack.resource.Resource.fetch',
|
||||||
self.proxy.get_quota_set_defaults,
|
self.proxy.get_quota_set_defaults,
|
||||||
method_args=['prj'],
|
method_args=[project_id],
|
||||||
expected_args=[
|
expected_args=[
|
||||||
self.proxy,
|
self.proxy,
|
||||||
False,
|
False,
|
||||||
'/os-quota-sets/defaults',
|
f'/os-quota-sets/{project_id}/defaults',
|
||||||
None,
|
None,
|
||||||
False,
|
False,
|
||||||
],
|
],
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixed issue with ``quota show --default`` command by
|
||||||
|
correcting the API URL.
|
Reference in New Issue
Block a user