From 9f8d2b7af10622b966aef9af5bcb1d5fec0849f6 Mon Sep 17 00:00:00 2001 From: Justin Riley Date: Mon, 13 May 2024 14:57:15 -0400 Subject: [PATCH] openstack: set minimum for object quota to 1 --- src/coldfront_plugin_cloud/openstack.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/coldfront_plugin_cloud/openstack.py b/src/coldfront_plugin_cloud/openstack.py index d9ce0cf3..db61b4c0 100644 --- a/src/coldfront_plugin_cloud/openstack.py +++ b/src/coldfront_plugin_cloud/openstack.py @@ -188,9 +188,12 @@ def _set_object_quota(self, project_id, payload): # Note(knikolla): For consistency with other OpenStack # quotas we're storing this as GB on the attribute and # converting to bytes for Swift. - payload[QUOTA_KEY_MAPPING['object']['keys'][ - attributes.QUOTA_OBJECT_GB] - ] *= GB_IN_BYTES + obj_q_mapping = QUOTA_KEY_MAPPING['object']['keys'][ + attributes.QUOTA_OBJECT_GB + ] + payload[obj_q_mapping] *= GB_IN_BYTES + if payload[obj_q_mapping] <= 0: + payload[obj_q_mapping] = 1 self.object(project_id).post_account(headers=payload) except ksa_exceptions.catalog.EndpointNotFound: logger.debug('No swift available, skipping its quota.')