Project

General

Profile

Actions

Bug #17398

open

S3 CreateBucket should issue 409 BucketAlreadyOwnedByYou or 400 IllegalLocationConstraintException for mismatched placement pool

Added by Robin Johnson over 7 years ago. Updated over 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
% Done:

0%

Source:
Community (dev)
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Old buckets have a placement pool of an empty string.

Newer configurations, per the multisite documentation have a default_placement of "default-placement".

If you issue a new CreateBucket, for an existing old bucket that's under your user, it will return 409 BucketAlreadyExists, which has the additional meaning that the bucket is owned by a user OTHER than you.

I think in this case, it should be generating 409 BucketAlreadyOwnedByYou, as a specific case of the design intent of the 409 response: 409 Conflict. The bucket DOES already exist, and is accessible to the present user, but the creation parameters may not match the existing bucket (placement-rule or zonegroup)

Actions #1

Updated by Yehuda Sadeh over 7 years ago

can you validate this behavior with the Amazon S3 api?

Actions #2

Updated by Robin Johnson over 7 years ago

  • Subject changed from S3 CreateBucket should issue 409 BucketAlreadyOwnedByYou for mismatched placement pool to S3 CreateBucket should issue 409 BucketAlreadyOwnedByYou or 400 IllegalLocationConstraintException for mismatched placement pool

I went and explicitly tested AWS S3 behavior for you, to confirm it, and as usual found it differed slightly from their documentation,
The AWS error xml for the location constraint being invalid is: <Error><Code>IllegalLocationConstraintException</Code><Message>The us-west-2 location constraint is incompatible for the region specific endpoint this request was sent to.</Message>. So I revise my expectation, that I should get 400 IllegalLocationConstraintException if the placement group is invalid, and 409 BucketAlreadyOwnedByYou if the bucket exists & my user owns it.

The AWS behavior depends on both the endpoint AND the LocationConstraint value, but not the storage-class, as storage-class is per-object in AWS.

Connect to us-east-1 (s3.amazonaws.com)
The first CreateBucket always succeeds, returns 200 OK, the create seems to be proxied to the correct region.
A second request for the same bucket name, returns 200 OK if the region is us-east-1, and 409 BucketAlreadyOwnedByYou for all other regions.
Changing the LocationConstraint (eg create bucketname=x in us-west-1, then createbucket bucketname=x in us-east-1 gives 200 OK).

CreateBucket, LocationConstraint=us-east-1, repeated: 200 OK
CreateBucket, LocationConstraint=us-west-1, repeated: 409 Conflict: BucketAlreadyOwnedByYou
CreateBucket, LocationConstraint=us-west-2, repeated: 409 Conflict: BucketAlreadyOwnedByYou
CreateBucket, LocationConstraint=ap-south-1, repeated: 409 Conflict: BucketAlreadyOwnedByYou
CreateBucket, LocationConstraint=eu-central-1, repeated: 409 Conflict: BucketAlreadyOwnedByYou
(etc for all regions I tested, just us-east-1 returns 200 OK).

Connect to us-west-1 (s3-us-west-1.amazonaws.com) [all endpoints other than us-east-1]:
First request: 200 OK if endpoint location matches LocationConstraint. 400 IllegalLocationConstraintException if mismatch.
Subsequent requests: 409 Conflict: BucketAlreadyOwnedByYou if location matches, 400 IllegalLocationConstraintException if mismatch.

CreateBucket, LocationConstraint=(empty), all requests: 400 IllegalLocationConstraintException
CreateBucket, LocationConstraint=us-east-1, all requests: 400 IllegalLocationConstraintException
CreateBucket, LocationConstraint=us-west-1, repeated: 409 Conflict: BucketAlreadyOwnedByYou

Actions

Also available in: Atom PDF