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:
Rajat Dhasmana
2025-04-15 14:05:15 +05:30
parent 419ece12d9
commit df1b9e4f8c
3 changed files with 11 additions and 3 deletions

View File

@@ -2024,7 +2024,9 @@ class Proxy(proxy.Proxy):
res = self._get_resource(
_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):
"""Reset Quota for the project/user.

View File

@@ -1176,14 +1176,15 @@ class TestQuotaSet(TestVolumeProxy):
)
def test_quota_set_get_defaults(self):
project_id = 'prj'
self._verify(
'openstack.resource.Resource.fetch',
self.proxy.get_quota_set_defaults,
method_args=['prj'],
method_args=[project_id],
expected_args=[
self.proxy,
False,
'/os-quota-sets/defaults',
f'/os-quota-sets/{project_id}/defaults',
None,
False,
],

View File

@@ -0,0 +1,5 @@
---
fixes:
- |
Fixed issue with ``quota show --default`` command by
correcting the API URL.