Skip to content

rgw: Implement Admin REST APIs for Setting Account Quota - #65480

Merged
cbodley merged 5 commits into
ceph:mainfrom
nzliu-dev:wip-admin-rest-api-for-setting-account-quota
Oct 22, 2025
Merged

cbodley merged 5 commits into
ceph:mainfrom
nzliu-dev:wip-admin-rest-api-for-setting-account-quota

Conversation

@nzliu-dev

@nzliu-dev nzliu-dev commented Sep 10, 2025 •

Copy link
Copy Markdown
Contributor

tracker: https://tracker.ceph.com/issues/72527
Signed-off-by: Nicholas Liu [email protected]

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects rgw, opened tracker ticket
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)

To test, I used vstart to start a local cluster and ran the ceph_test_cls_rgw_admin_account_quota_set and the ceph_test_cls_rgw_meta tests with GTEST set to 1.

bin/ceph_test_cls_rgw_admin_account_quota_set -g 127.0.0.1 -p 8000 -c ceph.conf -rgw-admin /build/bin/radosgw-admin:

image

bin/ceph_test_cls_rgw_meta -g 127.0.0.1 -p 8000 -c ceph.conf -rgw-admin /build/bin/radosgw-admin:

image
Show available Jenkins commands

Comment thread doc/radosgw/adminops.rst Outdated
:Example: ``RGW00000000000000001``
:Required: Yes

An account ID must be 20 bytes long.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we maybe want to say 20 characters? Mention the set of acceptable chars? Alphanumerics? 7 bit ASCII? 8 bit? Unicode? Little Bobby Tables?

Comment thread doc/radosgw/adminops.rst

:Description: Specifies the maximum number of buckets the account can own.
:Type: Integer
:Example: 500 [1000]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here and above, are the numbers in brackets defaults? If so would be good to state so.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

bump

Comment thread doc/radosgw/adminops.rst Outdated
===========
.. versionadded:: Squid

Get account info. Either an "id" or a "name" needs to be provided.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/needs to/must/

Comment thread doc/radosgw/adminops.rst Outdated

``account-id``

:Description: the Account under which a user should exist.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Most instances of “account” above are lowercase. I can see a rationale either way but suggest consistency throughout the page.

@bluikko bluikko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These are quite minor, feel free to ignore them if you are busy and I'll file a PR for them later.

Comment thread doc/radosgw/adminops.rst Outdated
Comment on lines +375 to +376
Create Account
===========

@bluikko bluikko Sep 11, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sphinx will complain if the section title text is longer than the line below it.

Suggested change
Create Account
===========
Create Account
==============

Comment thread doc/radosgw/adminops.rst Outdated


Modify Account
===========

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto

Suggested change
===========
==============

Comment thread doc/radosgw/adminops.rst Outdated
===========
.. versionadded:: Squid

Modify a account. Either an "id", "name", or "email" needs to be provided.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The parameter names in text seem to be usually formatted as inline preformat.
Also article "an account" and I believe the list should either include all articles or none.

Suggested change
Modify a account. Either an "id", "name", or "email" needs to be provided.
Modify an account. Either ``id``, ``name``, or ``email`` needs to be provided.

Comment thread doc/radosgw/adminops.rst Outdated

``id``

:Description: The account id.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"ID" is capitalized elsewhere so for consistency I'd suggest to do so here also.

Suggested change
:Description: The account id.
:Description: The account ID.

Comment thread doc/radosgw/adminops.rst Outdated
===========
.. versionadded:: Squid

Get account info. Either an "id" or a "name" needs to be provided.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto for inline preformat.

Suggested change
Get account info. Either an "id" or a "name" needs to be provided.
Get account info. Either an ``id`` or a ``name`` needs to be provided.

Comment thread doc/radosgw/adminops.rst Outdated

``id``

:Description: The account id.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto

Suggested change
:Description: The account id.
:Description: The account ID.

Comment thread doc/radosgw/adminops.rst Outdated
None.

Remove Account
===========

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto

Suggested change
===========
==============

Comment thread doc/radosgw/adminops.rst Outdated
===========
.. versionadded:: Squid

Remove an existing account. Either an "id", "name", or "email" needs to be provided.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto

Suggested change
Remove an existing account. Either an "id", "name", or "email" needs to be provided.
Remove an existing account. Either ``id``, ``name``, or ``email`` needs to be provided.

Comment thread doc/radosgw/adminops.rst Outdated
@@ -2068,6 +2768,22 @@ The content must include a JSON representation of the quota settings
as mentioned in Set Bucket Quota section above.


Set Account Quota
~~~~~~~~~~~~~~

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto

Suggested change
~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~

Comment thread doc/radosgw/adminops.rst Outdated
Comment on lines +2779 to +2780
Set Bucket Quota under an Account
~~~~~~~~~~~~~~~~

@bluikko bluikko Sep 11, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto

Suggested change
Set Bucket Quota under an Account
~~~~~~~~~~~~~~~~
Set Bucket Quota under an Account
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@cbodley cbodley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the changes in rgw_rest_account.cc look wonderful 👍

and thank you for working on test coverage. however, i had no idea that test_rgw_admin_meta.cc existed and it doesn't run as part of rgw's qa suite in teuthology

qa/tasks/radosgw_admin_rest.py contains the /admin api tests that we do run. however, it's coupled to teuthology in a way that makes it hard to run locally against a vstart cluster

@cbodley

cbodley commented Sep 12, 2025

Copy link
Copy Markdown
Contributor

Signed-off-by: one or more commits in this PR are not signed

please add the missing brackets around your email addr:

Signed-off-by: Nicholas Liu <[email protected]>

@nzliu-dev
nzliu-dev force-pushed the wip-admin-rest-api-for-setting-account-quota branch from 252a05c to 752d235 Compare September 15, 2025 15:17
@nzliu-dev

Copy link
Copy Markdown
Contributor Author

@cbodley @anthonyeleven @bluikko Thank you for reviewing! I have made the requested changes.

It seems ceph windows tests is failing due to a file lock issue unrelated to the last commit:

+ qemu-img resize /home/jenkins-build/build/workspace/ceph-windows-pull-requests/libvirt/ceph-ubuntu-vstart.qcow2 128G
qemu-img: Could not open '/home/jenkins-build/build/workspace/ceph-windows-pull-requests/libvirt/ceph-ubuntu-vstart.qcow2': Failed to get "write" lock

Is there a way to rerun it?

@adamemerson

Copy link
Copy Markdown
Contributor

jenkins test windows

@bluikko bluikko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

docs part from my side OK

@anthonyeleven

Copy link
Copy Markdown
Contributor

Expand "Show available Jenkins commands". You can add a comment with one of these commands and Jenkins in theory will rerun that test.

It seems ceph windows tests is failing due to a file lock issue unrelated to the last commit:

+ qemu-img resize /home/jenkins-build/build/workspace/ceph-windows-pull-requests/libvirt/ceph-ubuntu-vstart.qcow2 128G
qemu-img: Could not open '/home/jenkins-build/build/workspace/ceph-windows-pull-requests/libvirt/ceph-ubuntu-vstart.qcow2': Failed to get "write" lock

Is there a way to rerun it?

@nzliu-dev

Copy link
Copy Markdown
Contributor Author

@cbodley @anthonyeleven Thanks again. Does the PR look good to you?

@cbodley

cbodley commented Sep 18, 2025

Copy link
Copy Markdown
Contributor

@cbodley @anthonyeleven Thanks again. Does the PR look good to you?

@nzliu-dev as above, i'm afraid we'll need the test coverage in qa/tasks/radosgw_admin_rest.py instead of test_rgw_admin_meta.cc

@anthonyeleven

Copy link
Copy Markdown
Contributor

I see several of the changes I suggested, but the question about the bracketed number remains.

@nzliu-dev

nzliu-dev commented Sep 18, 2025 •

Copy link
Copy Markdown
Contributor Author

I see several of the changes I suggested, but the question about the bracketed number remains.

Thanks--not sure why it's not reflected in the comment itself but I have already updated the documentation to explain the bracketed numbers wherever they appear. e.g. "Specifies the maximum number of buckets the account can own. The default is 1000."

delete_cmds = ['trim', 'rm', 'process']
get_cmds = ['check', 'info', 'show', 'list', 'get', '']

bucket_sub_resources = ['object', 'policy', 'index']
user_sub_resources = ['subuser', 'key', 'caps', 'quota']

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

because the subresource names are not unique, i.e. user/quota and account/quota are both valid, this way of doing a 1:1 mapping of sub_resource to a resource is problematic. It's better to pass both the resource and the subresource as a tuple into the command, e.g. ('user', 'quota')

@nzliu-dev
nzliu-dev force-pushed the wip-admin-rest-api-for-setting-account-quota branch from 2d2b157 to 2b133a1 Compare September 19, 2025 13:31
@nzliu-dev

Copy link
Copy Markdown
Contributor Author

@cbodley Thanks for clarifying. I have added tests in the rgwadmin_rest file for QA/Teuthology. Please take another look when you get a chance.

@nzliu-dev
nzliu-dev force-pushed the wip-admin-rest-api-for-setting-account-quota branch from 2b133a1 to 5eae196 Compare October 10, 2025 14:43
@nzliu-dev

Copy link
Copy Markdown
Contributor Author

jenkins test api

@nzliu-dev

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@nzliu-dev
nzliu-dev force-pushed the wip-admin-rest-api-for-setting-account-quota branch from 5eae196 to 71071e8 Compare October 10, 2025 20:41
@nzliu-dev
nzliu-dev force-pushed the wip-admin-rest-api-for-setting-account-quota branch from 71071e8 to 69e177d Compare October 15, 2025 18:32
@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

This commit implements the functionality of setting bucket- and account-level quotas with PUT /admin/account

tracker: https://tracker.ceph.com/issues/72527
Signed-off-by: Nicholas Liu <[email protected]>
This commit refactors the test_rgw_admin_meta test by using common helper functions

Signed-off-by: Nicholas Liu <[email protected]>
This commit adds documentation on how to create, get, modify, and delete accounts using Admin APIs. It also explains how to set quota for an account and how to create a user under an account

Signed-off-by: Nicholas Liu <[email protected]>
This commit addresses PR comments related to the doc/radosgw/adminops documentation

Signed-off-by: Nicholas Liu <[email protected]>
This commit implements tests related to setting account quotas at the account and bucket levels for qa and Teuthology
tracker: https://tracker.ceph.com/issues/72527
Signed-off-by: Nicholas Liu <[email protected]>
@nzliu-dev
nzliu-dev force-pushed the wip-admin-rest-api-for-setting-account-quota branch from 69e177d to 187573e Compare October 16, 2025 15:26
@cbodley

cbodley commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

@cbodley

cbodley commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

@nzliu-dev

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants