Skip to content

Commit e30593c

Browse files
committed
fix(seaweedfs): do not swallow NoSuchBucket 404 during quota disable
The quota-disable 404 tolerance treated every 404/405 as an absent quota extension. SeaweedFS also returns 404 with a NoSuchBucket error body when the bucket does not exist, so a missing remote bucket with quota 0 was reported as success and the database quota was updated, leaving CloudStack and S3 inconsistent. Exclude NoSuchBucket responses from the tolerance so only the extension-not-available case is swallowed.
1 parent b424170 commit e30593c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

plugins/storage/object/seaweedfs/src/main/java/org/apache/cloudstack/storage/datastore/util/SeaweedFSObjectStoreUtil.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,15 @@ public static void setBucketQuotaViaS3Extension(String s3Url, String accessKey,
296296
// available (404/405), tolerate the failure for quota 0 so basic
297297
// bucket CRUD works on deployments without the extension. A
298298
// positive quota still requires the extension and must fail.
299+
//
300+
// Distinguish "extension not available" from "bucket not found":
301+
// SeaweedFS returns a standard S3 NoSuchBucket error (with
302+
// <Code>NoSuchBucket</Code> in the body) when the bucket does not
303+
// exist, which must NOT be swallowed — it indicates CloudStack and
304+
// S3 are out of sync.
299305
if (sizeGiB == 0 && e.getMessage() != null
300-
&& (e.getMessage().contains("status 404") || e.getMessage().contains("status 405"))) {
306+
&& (e.getMessage().contains("status 404") || e.getMessage().contains("status 405"))
307+
&& !e.getMessage().contains("NoSuchBucket")) {
301308
org.apache.logging.log4j.LogManager.getLogger(SeaweedFSObjectStoreUtil.class)
302309
.warn("SeaweedFS quota extension not available for bucket {}; skipping quota disable (quota is already off by default)", bucketName);
303310
return;

0 commit comments

Comments
 (0)