Skip to content

rgw/admin: support user default-storage-class#1246

Merged
mergify[bot] merged 1 commit intoceph:masterfrom
jhoblitt:feature/user-default-storage-class
Apr 16, 2026
Merged

rgw/admin: support user default-storage-class#1246
mergify[bot] merged 1 commit intoceph:masterfrom
jhoblitt:feature/user-default-storage-class

Conversation

@jhoblitt
Copy link
Copy Markdown
Member

Support for this parameter was added in Squid.

Checklist

  • Added tests for features and functional changes
  • Public functions and types are documented
  • Standard formatting is applied to Go code
  • Is this a new API? Added a new file that begins with //go:build ceph_preview
  • Ran make api-update to record new APIs

New or infrequent contributors may want to review the go-ceph Developer's Guide including the section on how we track API Status and the API Stability Plan.

The go-ceph project uses mergify. View the mergify command guide for information on how to interact with mergify. Add a comment with @Mergifyio rebase to rebase your PR when github indicates that the PR is out of date with the base branch.

@jhoblitt
Copy link
Copy Markdown
Member Author

Any idea why the tests are failing? The two tests I touched are reported as passing in the output.

@anoopcs9
Copy link
Copy Markdown
Collaborator

anoopcs9 commented Apr 1, 2026

Any idea why the tests are failing? The two tests I touched are reported as passing in the output.

=== RUN   TestRadosGWTestSuite/TestUser/user_creation_success

PUT /admin/user?default-placement=default-placement&default-storage-class=default-storage-class&display-name=This%20is%20leseb&email=leseb%40example.com&format=json&op-mask=delete&uid=leseb&user-caps=users%3Dread HTTP/1.1
Host: test_ceph_a
User-Agent: Go-http-client/1.1
Content-Length: 0
Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20260331/default/s3/aws4_request, SignedHeaders=host;x-amz-date, Signature=e90779dda7b73f50d2d063361c310b776765c9010a5764a86e350d54677a1708
X-Amz-Date: 20260331T190418Z
Accept-Encoding: gzip



HTTP/1.1 400 Bad Request
Content-Length: 133
Accept-Ranges: bytes
Connection: Keep-Alive
Content-Type: application/json
Date: Tue, 31 Mar 2026 19:04:18 GMT
Server: Ceph Object Gateway (umbrella)
X-Amz-Request-Id: tx00000c94602630178b88f-0069cc1ab2-4197-default

{"Code":"InvalidArgument","Message":"","RequestId":"tx00000c94602630178b88f-0069cc1ab2-4197-default","HostId":"4197-default-default"}
=== NAME  TestRadosGWTestSuite/TestUser
    user_test.go:110: 
        	Error Trace:	/go/src/github.com/ceph/go-ceph/rgw/admin/user_test.go:110
        	Error:      	Received unexpected error:
        	            	InvalidArgument tx00000c94602630178b88f-0069cc1ab2-4197-default 4197-default-default
        	Test:       	TestRadosGWTestSuite/TestUser
    user_test.go:111: 
        	Error Trace:	/go/src/github.com/ceph/go-ceph/rgw/admin/user_test.go:111
        	Error:      	Not equal: 
        	            	expected: "leseb@example.com"
        	            	actual  : ""
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1 +1 @@
        	            	-leseb@example.com
        	            	+
        	Test:       	TestRadosGWTestSuite/TestUser

Comment thread rgw/admin/user_test.go
Comment thread rgw/admin/user_test.go Outdated
Comment thread rgw/admin/user_test.go Outdated
@jhoblitt jhoblitt force-pushed the feature/user-default-storage-class branch from 8088197 to 6ecf40d Compare April 1, 2026 15:44
@jhoblitt
Copy link
Copy Markdown
Member Author

jhoblitt commented Apr 1, 2026

I guess I need to check the container to see what the zonegroup placement is. It appears that this feature may not be part of a tagged squid release: https://github.com/ceph/ceph/blob/8e376e9fe8eb7d3a00bf8a39d6d96dbc4a29eea0/src/rgw/driver/rados/rgw_rest_user.cc#L192 but is part of tentacle.

@anoopcs9
Copy link
Copy Markdown
Collaborator

anoopcs9 commented Apr 2, 2026

I guess I need to check the container to see what the zonegroup placement is. It appears that this feature may not be part of a tagged squid release: https://github.com/ceph/ceph/blob/8e376e9fe8eb7d3a00bf8a39d6d96dbc4a29eea0/src/rgw/driver/rados/rgw_rest_user.cc#L192 but is part of tentacle.

TestRadosGWTestSuite/TestUser/user_creation_success ran successfully. It appears that GET USER INFO does not populate that field in its response. If so, we can omit that check from the test.

=== RUN   TestRadosGWTestSuite/TestUser/get_user_leseb_by_uid

GET /admin/user?format=json&uid=leseb HTTP/1.1
Host: test_ceph_a
User-Agent: Go-http-client/1.1
Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20260401/default/s3/aws4_request, SignedHeaders=host;x-amz-date, Signature=48d4b2e1355bb56caea81231f1eccba010d3088091e44555670a5d01b239a2c9
X-Amz-Date: 20260401T160314Z
Accept-Encoding: gzip



HTTP/1.1 200 OK
Content-Length: 824
Connection: Keep-Alive
Date: Wed, 01 Apr 2026 16:03:14 GMT
Server: Ceph Object Gateway (umbrella)
X-Amz-Request-Id: tx000005ee381fc5949306a-0069cd41c2-4193-default

{"full_user_id":"leseb","tenant":"","user_id":"leseb","display_name":"This is leseb","email":"leseb@example.com","suspended":0,"max_buckets":1000,"subusers":[],"keys":[{"user":"leseb","access_key":"012G7TUJ9AAZDMIL3E2S","secret_key":"Sc2SvHi7fCnYsCIunS5aW08Fj0BiqmGqlyGNorPB","active":true}],"swift_keys":[],"caps":[{"type":"users","perm":"read"}],"op_mask":"delete","system":false,"admin":false,"default_placement":"default-placement","default_storage_class":"","placement_tags":[],"bucket_quota":{"enabled":false,"check_on_raw":false,"max_size":-1,"max_size_kb":0,"max_objects":-1},"user_quota":{"enabled":false,"check_on_raw":false,"max_size":-1,"max_size_kb":0,"max_objects":-1},"temp_url_keys":[],"type":"rgw","mfa_ids":[],"account_id":"","path":"/","create_date":"2026-04-01T16:03:14.580929Z","tags":[],"group_ids":[]}

@anoopcs9
Copy link
Copy Markdown
Collaborator

@jhoblitt Would you like to take this forward?

@jhoblitt
Copy link
Copy Markdown
Member Author

@jhoblitt Would you like to take this forward?

Yes. Apologies. I'll revise the PR today. Thank you for the nudge.

@jhoblitt jhoblitt force-pushed the feature/user-default-storage-class branch from 6ecf40d to fb553d9 Compare April 14, 2026 20:34
Comment thread rgw/admin/user_test.go Outdated
Comment on lines +125 to +131
suite.T().Run("get user leseb by uid returns default_storage_class", func(_ *testing.T) {
suite.T().Skip("skipping test since the default_storage_class is not returned by /user")
user, err := co.GetUser(context.Background(), User{ID: "leseb"})
assert.NoError(suite.T(), err)
assert.Equal(suite.T(), "STANDARD", user.DefaultStorageClass)
})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m sorry if it wasn’t clear before, but we don’t need this test if it’s never supposed to run.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking was that this looks like a bug in the rgw api that will presumably be fixed at some point. I've removed the skipped test completely. It's unfortunately that testify suites don't support the concept of a "pending" unit test.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, if that's the case you may create a tracker and mention it as part of the skip (see rbd/snapshot_test.go for an example). But I'm still fine without the test at all.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it some more, it isn't clear to me that behavior is wrong. I'd like to more forward with this PR and I'll open an rgw ticket if I think it's warranted after digging through the code.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the behavior is not wrong then I'll reiterate Anoops comment above: if the test will never run it adds no value to the test suite and shouldn't be added.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The skipped test has already been removed...

@jhoblitt jhoblitt force-pushed the feature/user-default-storage-class branch from fb553d9 to a830b8f Compare April 15, 2026 22:31
Support for this parameter was added in Squid.

Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
@jhoblitt jhoblitt force-pushed the feature/user-default-storage-class branch from a830b8f to f18cd2a Compare April 15, 2026 22:33
@jhoblitt jhoblitt requested a review from anoopcs9 April 15, 2026 22:56
Copy link
Copy Markdown
Collaborator

@anoopcs9 anoopcs9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks.

@anoopcs9 anoopcs9 added the API This PR includes a change to the public API of a go-ceph package label Apr 16, 2026
@mergify mergify bot added the queued label Apr 16, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Apr 16, 2026

Merge Queue Status

  • Entered queue2026-04-16 20:07 UTC · Rule: default
  • Checks skipped · PR is already up-to-date
  • Merged2026-04-16 20:07 UTC · at f18cd2a82a4bd24ba8b59c53a395190298f6e540

This pull request spent 15 seconds in the queue, including 2 seconds running CI.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = check
    • check-neutral = check
    • check-skipped = check
  • any of [🛡 GitHub branch protection]:
    • check-success = test-suite (pacific)
    • check-neutral = test-suite (pacific)
    • check-skipped = test-suite (pacific)
  • any of [🛡 GitHub branch protection]:
    • check-success = test-suite (quincy)
    • check-neutral = test-suite (quincy)
    • check-skipped = test-suite (quincy)
  • any of [🛡 GitHub branch protection]:
    • check-success = test-suite (reef)
    • check-neutral = test-suite (reef)
    • check-skipped = test-suite (reef)
  • any of [🛡 GitHub branch protection]:
    • check-success = test-suite (squid)
    • check-neutral = test-suite (squid)
    • check-skipped = test-suite (squid)

@mergify mergify bot merged commit 4dd2dee into ceph:master Apr 16, 2026
15 of 16 checks passed
@mergify mergify bot removed the queued label Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API This PR includes a change to the public API of a go-ceph package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants