Repository navigation
rgw/radosgw-admin: extract user commands into a module (2 of 2) - #71578
RaminNietzsche wants to merge 1 commit into
Conversation
|
This PR is slice 4 of the incremental radosgw-admin modularization plan spun out of #71462. It is based directly on current
Not included in this branch:
The user module uses module-local command enums ( What this change does:
Local verification on a vstart cluster (
|
|
Fixed the Post-init validation cases (e.g. Simulated CI (no |
|
Pushed a follow-up commit addressing review findings:
Local verification on stg-hd1:
|
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
2967754 to
49d5f67
Compare
49d5f67 to
57ee6a0
Compare
|
Rebased onto current |
57ee6a0 to
dcee139
Compare
dcee139 to
2788482
Compare
|
jenkins test make check |
|
@cbodley @ivancich @chardan — slice 4 update (still parallel to #71575 until that merges).
PR text still documents the intentional |
2788482 to
0466137
Compare
|
Pushed The series used two files that only exist in #71575 (the account module), which has not merged yet:
Both are now added to the commits that first use them, byte-identical to the copies in #71575. Whichever of the two PRs merges second rebases with no conflict on those files. Nothing else changed: Verified in a test environment: |
|
@chardan You were restructuring |
|
@adamemerson I sure can! |
chardan
left a comment
There was a problem hiding this comment.
This is completely welcome! I think it's a real improvement (and indeed part of giving the tool its own directory was to allow exactly this sort of thing, I'm so pleased to see it being followed through on!).
There are a few tiny things you might peek at which I mentioned in my comments, but I don't think anything that needs to stop the momentum here!
Please note that I reviewed this as a structural change: I did look over the code but I restrained myself from focusing much on implementation. In general I definitely welcome these improvements and don't want to "throw the baby out with the bathwater".
I imagine it belongs in a more general overhaul of command-line handling, but is there any plan with respect to checking that command-line calls still map to the right functionality? We do want to be careful about breaking scripts.
|
|
||
| namespace { | ||
|
|
||
| constexpr int DEFAULT_MAX_KEYS = 1000; |
There was a problem hiding this comment.
Ah, macro-free! We're living the dream..!
| ? static_cast<uint64_t>(*opts.max_entries) - count | ||
| : static_cast<uint64_t>(DEFAULT_MAX_KEYS); | ||
|
|
||
| // NOTE: intentional behavior change vs. the original inline code in |
There was a problem hiding this comment.
I think you can mention this with a GitHub comment and take it out of the comments.
There was a problem hiding this comment.
Done. I removed the comment from the code and moved the explanation here: the original inline code looped on while (truncated && left > 0) using the pre-fetch left, which could issue one extra meta_list_keys_next() call with left == 0 once count reached max_entries exactly. The module now breaks before that call, and the loop condition re-checks count after the fetch instead of the stale left.
| case OPT::KEY_RM: | ||
| mutate_opts.command = user_mutate_command::key_rm; | ||
| break; | ||
| default: |
There was a problem hiding this comment.
Consider moving this to the very top (in the style of a guard, if you're familiar with those).
There was a problem hiding this comment.
Done: the default: ceph_abort(); label is now the first label of that switch, so the "nothing matched" behaviour is visible without reading the other cases.
| } | ||
| return 0; | ||
|
|
||
| default: |
There was a problem hiding this comment.
Same comment (I tend to NOT repeat comments, so this will apply to any similar situation)-- it's fine as-is, but at the top it becomes visible that this is the error behavior if nothing else matches, preventing us from having to read an unknown number of similar clauses only to see the one that's different. YYMV (you do not HAVE to change this).
There was a problem hiding this comment.
Done for all three switches in user.cc (mutate, query, policy): default now comes first. Thanks for the guard-style suggestion.
| #include "common/errno.h" | ||
|
|
||
| namespace rgw_admin { | ||
| inline int report_error(std::string_view what, int ret, |
There was a problem hiding this comment.
This is fine as this is an incremental change and fixing errors isn't its main point-- and, indeed, this is a HUGE improvement already! But it would be nice eventually to see this done with dout_fmt() and the <source_location> header.
There was a problem hiding this comment.
Agreed, dout_fmt() plus <source_location> would be a good follow-up for util.h. I will keep it out of this change so the extraction stays easy to review, and pick it up in a later slice.
|
@RaminNietzsche Thank you for reviewing this pull request! As a member of the Ceph organization, please add yourself to |
It should be picked up in a QA run soon. |
|
This PR has been added to wip-anrao9-testing-2026-11-13-0841-main. |
|
This PR has been removed from wip-anrao9-testing-2026-11-13-0842-main. |
shaman build creation is failed, https://shaman.ceph.com/builds/ceph/wip-anrao9-testing-2026-11-13-0842-main/ |
54eb647 to
238c6c4
Compare
|
@anrao19 — thanks for the ping. I looked at the QA thread and Shaman: What happened with Current queue: The tracker later moved to PR tip: Rebased on current jenkins test make check |
Move account create/modify/get/stats/rm/list handling from radosgw-admin.cc into account.cc with shared error reporting via util.h. Wire dispatch through rgw_admin_account() using a module-local account_command enum so this slice does not depend on a shared radosgw-admin header. Add shell-based exit-code coverage (test-account-exit-codes.sh and shared helpers). Guard tests with WITH_RADOSGW_RADOS. Use RGWFormatterFlusher& in the module to match rgw_account.h and the sibling user slice; ceph_abort() on the outer dispatch default; document handle_account_list duplication versus admin_meta (ceph#71578). Indent switch case labels and bodies in account.cc per review. Behavior of supported account commands and flags is unchanged. Signed-off-by: ramin.najarbashi <[email protected]>
|
Rebased on current jenkins test make check |
238c6c4 to
d7721f2
Compare
|
This PR has been added to wip-anrao3-testing-2026-11-26-0631-main. |
|
shaman build creation is failed, https://shaman.ceph.com/builds/ceph/wip-anrao3-testing-2026-11-26-0631-main/ |
|
This PR has been removed from wip-anrao3-testing-2026-11-26-0631-main. |
d7721f2 to
e954bfa
Compare
|
Thanks for the ping. I checked the Shaman/chacra side for |
Move user mutate, query, and policy handling from radosgw-admin.cc into user.cc. Add admin_meta.cc for metadata key listing (user list) and reuse util.h for shared CLI errors. Add user exit-code tests (shared helpers, check_cluster for post-init cases). Guard tests with WITH_RADOSGW_RADOS. Use ceph_abort() on dispatch default; put default first in mutate/query/policy switches. Fix admin_meta list pagination and policy list_attached exit code. Use std::optional<bool> for create generate-key. Signed-off-by: ramin.najarbashi <[email protected]>
e954bfa to
ce9c7ca
Compare
|
@anrao19 — follow-up on https://tracker.ceph.com/issues/83592 and the Shaman ping for I rechecked Shaman for 0631-main: package builds are present for multiple distros (tip sha This PR was removed from the 0631 batch after that ping — if the queue has moved on (e.g. the current Code update: rebased onto current |
|
jenkins test make check |
|
@anrao19 — quick follow-up now that Jenkins is green on the rebased tip Ready to be re-added to the active wip-anrao3 QA batch when you have a slot (#83592). Thanks. |
| formatter->open_array_section("keys"); | ||
|
|
||
| do { | ||
| std::list<std::string> keys; |
There was a problem hiding this comment.
Just a quick question: is this pre-existing code? If not, I can't think of any reason to use a std::list<> here rather than a std::vector<>.
chardan
left a comment
There was a problem hiding this comment.
LGTM; please wait for QA approval. Thank you for your work on this, it's a big improvement!
|
This PR has been added to wip-anrao14-testing-2026-12-02-0603-main. |
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Context (incremental split from #71462)
This is slice 4 in the incremental landing plan for the radosgw-admin modularization work in #71462.
This PR contains only the user module extraction and its exit-code tests. It is based directly on
mainand does not include the dead-code cleanup (#71569), command-types header split (#71570), or the account module (#71575). The user module uses module-local command enums so it does not depend on a sharedradosgw-admin.h.Note:
util.his identical to the helper added in #71575; after that PR merges I will rebase and drop the duplicate file from this branch.Summary
user.h/user.ccwithrgw_admin_user_mutate(),rgw_admin_user_query(), andrgw_admin_user_policy()for user/subuser/key/caps commands plus user check/stats/list and managed policy attach/detach/listadmin_meta.h/admin_meta.ccwithrgw_admin_meta_list_keys()for plainuser listutil.hwith sharedrgw_admin::report_error()for consistent CLI error outputradosgw-admin.ccthrough module-local option structs and enumsuser list(including account-filtered list) out of the shared metadata list block into the user moduleuser.ccandadmin_meta.ccto theradosgw-adminCMake targettest-user-exit-codes.shand shared helpersSupported user commands and flags are unchanged.
Testing
Local build and tests (Release,
WITH_RADOSGW_RADOS=ON, vstart cluster):ninja radosgw-adminbash src/test/rgw/radosgw-admin/test-user-exit-codes.sh— 51 passed, 0 faileduser list --max-entries 3,user info --uid …, create/modify/rm lifecycleChecklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.