Skip to content

Commit df1b9e4

Browse files
committed
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
1 parent 419ece1 commit df1b9e4

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

openstack/block_storage/v3/_proxy.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,9 @@ def get_quota_set_defaults(self, project):
20242024
res = self._get_resource(
20252025
_quota_set.QuotaSet, None, project_id=project.id
20262026
)
2027-
return res.fetch(self, base_path='/os-quota-sets/defaults')
2027+
return res.fetch(
2028+
self, base_path=(f'/os-quota-sets/{project.id}/defaults')
2029+
)
20282030

20292031
def revert_quota_set(self, project, **query):
20302032
"""Reset Quota for the project/user.

openstack/tests/unit/block_storage/v3/test_proxy.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1176,14 +1176,15 @@ def test_quota_set_get_query(self):
11761176
)
11771177

11781178
def test_quota_set_get_defaults(self):
1179+
project_id = 'prj'
11791180
self._verify(
11801181
'openstack.resource.Resource.fetch',
11811182
self.proxy.get_quota_set_defaults,
1182-
method_args=['prj'],
1183+
method_args=[project_id],
11831184
expected_args=[
11841185
self.proxy,
11851186
False,
1186-
'/os-quota-sets/defaults',
1187+
f'/os-quota-sets/{project_id}/defaults',
11871188
None,
11881189
False,
11891190
],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Fixed issue with ``quota show --default`` command by
5+
correcting the API URL.

0 commit comments

Comments
 (0)