From 4a8214b196d0dd648faba7248888c3e8119703da Mon Sep 17 00:00:00 2001 From: Ben Formosa Date: Mon, 19 Aug 2024 20:32:59 +1000 Subject: [PATCH] Fix regression in quota module I suspect that the change to `update_quota_set` in openstacksdk commit [9145dce64](https://opendev.org/openstack/openstacksdk/commit/9145dcec64) has caused a regession in the quota module, making it not work correctly for volume and compute quotas. This change updates the calls to `update_quota_set` with the new signatures. Closes-Bug: #2068568 Change-Id: I604a8ffb08a76c20397f43c0ed3b23ddb11e53eb --- ci/run-collection.yml | 3 +-- plugins/modules/quota.py | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ci/run-collection.yml b/ci/run-collection.yml index 02112c1e..1771106b 100644 --- a/ci/run-collection.yml +++ b/ci/run-collection.yml @@ -36,8 +36,7 @@ - { role: object_container, tags: object_container } - { role: port, tags: port } - { role: project, tags: project } - # TODO(sshnaidm): Uncomment when the issue with the this test is fixed - # - { role: quota, tags: quota } + - { role: quota, tags: quota } - { role: recordset, tags: recordset } - { role: resource, tags: resource } - { role: resources, tags: resources } diff --git a/plugins/modules/quota.py b/plugins/modules/quota.py index 572d1d7f..920a2c41 100644 --- a/plugins/modules/quota.py +++ b/plugins/modules/quota.py @@ -404,7 +404,7 @@ class QuotaModule(OpenStackModule): def _get_quotas(self, project): quota = {} if self.conn.has_service('block-storage'): - quota['volume'] = self.conn.block_storage.get_quota_set(project) + quota['volume'] = self.conn.block_storage.get_quota_set(project.id) else: self.warn('Block storage service aka volume service is not' ' supported by your cloud. Ignoring volume quotas.') @@ -477,11 +477,11 @@ class QuotaModule(OpenStackModule): if changes: if 'volume' in changes: - self.conn.block_storage.update_quota_set( - quotas['volume'], **changes['volume']) + quotas['volume'] = self.conn.block_storage.update_quota_set( + project.id, **changes['volume']) if 'compute' in changes: - self.conn.compute.update_quota_set( - quotas['compute'], **changes['compute']) + quotas['compute'] = self.conn.compute.update_quota_set( + project.id, **changes['compute']) if 'network' in changes: quotas['network'] = self.conn.network.update_quota( project.id, **changes['network'])