This is an automated email from the ASF dual-hosted git repository.
sureshanaparti pushed a commit to branch 4.22
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.22 by this push:
new 16238b10c31 Recalculate the allocated size in bytes for each Object
Storage provider (#14678)
16238b10c31 is described below
commit 16238b10c3181f2f920f4300ffa37beaca1c89ff
Author: Bernardo De Marco Gonçalves <[email protected]>
AuthorDate: Mon Nov 23 06:25:42 2026 -0300
Recalculate the allocated size in bytes for each Object Storage provider
(#14678)
Fixes the deletion of S3 buckets
---
.../src/main/resources/META-INF/db/schema-42210to42220.sql | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git
a/engine/schema/src/main/resources/META-INF/db/schema-42210to42220.sql
b/engine/schema/src/main/resources/META-INF/db/schema-42210to42220.sql
index 2fe476dd7bb..412c49e3158 100644
--- a/engine/schema/src/main/resources/META-INF/db/schema-42210to42220.sql
+++ b/engine/schema/src/main/resources/META-INF/db/schema-42210to42220.sql
@@ -72,3 +72,13 @@ JOIN cloud.vm_template vt ON vt.cross_zones = 1 AND
vt.removed IS NULL
WHERE dc.type = 'Edge' AND dc.removed IS NULL
AND NOT EXISTS (SELECT 1 FROM cloud.template_zone_ref tzr
WHERE tzr.zone_id = dc.id AND tzr.template_id = vt.id AND
tzr.removed IS NULL);
+
+--- Recalculate the allocated size in bytes for each Object Storage provider
+UPDATE `cloud`.`object_store`
+JOIN (
+ SELECT object_store_id, SUM(quota) * 1024 * 1024 * 1024 AS total_quota
+ FROM `cloud`.`bucket`
+ WHERE removed IS NULL
+ GROUP BY object_store_id
+) buckets_quota_sum_view ON `object_store`.id =
buckets_quota_sum_view.object_store_id
+SET `object_store`.allocated_size = buckets_quota_sum_view.total_quota;