Repository navigation
mon: allow setting/unsetting multiple OSD flags in one command - #69587
Conversation
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
16 similar comments
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Nice! I left a couple suggestions. Once the tests pass we can flag for qa |
| @@ -1399,13 +1399,14 @@ Usage:: | |||
|
|
|||
| ceph osd scrub <who> | |||
|
|
|||
| Subcommand ``set`` sets cluster-wide <flag> by updating OSD map. | |||
| Subcommand ``set`` sets cluster-wide <flag> by updating OSD map. More than | |||
There was a problem hiding this comment.
While you’re here:
the OSD map
There was a problem hiding this comment.
While you're here: the OSD map
Done.
b17a0f1 to
c16f285
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
c16f285 to
c5acc6b
Compare
anthonyeleven
left a comment
There was a problem hiding this comment.
LGTM! Implementation is the most sincere form of flattery. We'll need someone from @ceph/core to approve the code bits.
|
@ljflores @adamemerson Thoughts on who might be a good reviewer for the code? |
Maybe @aainscow ? |
|
I can look at this when I am back from PTO. |
aainscow
left a comment
There was a problem hiding this comment.
Overall, looks good. I have some improvements to request:
- Replace the if (!flags) test with an assert.
- Fix the grammar for setting multiple flags.
- Further updates to the docs. You have the basic man page - but you have not updated anything in the main docs. There are a few places which could benefit from this multi-flag set.
- Better testing. You have some basic tests - but they don't check error messages or completion messages and don't check some edge cases like no flags.
`ceph osd set` and `ceph osd unset` only accepted a single flag per
invocation, so an operator preparing for maintenance had to run one
command per flag:
ceph osd set noout
ceph osd set nobackfill
ceph osd set norebalance
Passing several at once failed with a confusing parser error
("nobackfill not one of 'true', 'false'") because the extra words were
matched against the optional yes_i_really_mean_it boolean.
Accept one or more flags (n=N) for both commands. The handler now
validates every flag first and applies them as a single OSD map update,
so either all of the requested flags are set/unset or, if any flag is
invalid, none are and the command is rejected. The per-flag
name-to-bit mapping that was duplicated between the two handlers is
pulled into a small helper.
Declaring the argument n=N changes the JSON the monitor receives from a
bare string to a list. The CLI adapts on its own, but callers that build
the command themselves do not: the pg_autoscaler and dashboard mgr
modules, and ceph_test_rados_io_sequence, all still send a string, and
cmd_getval() matches the variant type exactly. Reading only a list would
have failed those with "bad or missing field 'key'", which in the
pg_autoscaler case is silent because it does not check the return, so
`ceph osd pool set noautoscale` would report success without setting the
flag. Both shapes are therefore accepted.
A single flag still behaves exactly as before. The completion message
now agrees its verb with the number of flag names it reports, so one
flag still reads "noout is set" while several read "nobackfill,noout
are set".
Updates the usage strings, the man page, and the cluster flag sections
of the health-check and OSD troubleshooting docs. Extends the cephtool
test to cover the completion and error messages, a repeated flag, a
rejected flag mixed with a valid one, an empty flag list, and a flag
passed as a bare string.
Tracker: https://tracker.ceph.com/issues/77397
Signed-off-by: Slíva, Lumír <[email protected]>
c5acc6b to
f506368
Compare
thanks, can we move it forward please? |
|
The flags should get this batched up for qa and merge. |
|
This PR has been added to wip-bharath24-testing-20260918.001059-main. |
|
@lumir-sliva Please resolve the PR checks and proceed with merging the PR once all checks have passed. If a rerun is required, remove the |
|
@anthonyeleven @aainscow can anyone of you pleae put the the LABELS in I'm not part of the org, I cant. thanks! |
|
jenkins test make check |
|
jenkins test api |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
ceph osd setandceph osd unsetonly accepted a single flag per invocation, so an operator preparing for maintenance had to run one command per flag:Passing several at once failed with a confusing parser error (
nobackfill not one of 'true', 'false') because the extra words were matched against the optionalyes_i_really_mean_itboolean.This makes both commands accept one or more flags (
n=N). The handler validates every flag first and applies them as a single OSD map update, so either all of the requested flags are set/unset or, if any flag is invalid, none are and the command is rejected. The per-flag name-to-bit mapping that was duplicated between the two handlers is pulled into a small helper.A single flag still behaves exactly as before, and the completion message now agrees its verb with the number of flag names it reports, so one flag reads
noout is setwhile several readnobackfill,noout are set.Compatibility with callers that build the command themselves
Declaring the argument
n=Nchanges the JSON the monitor receives from"key": "noout"to"key": ["noout"]. The CLI adapts on its own, but callers that assemble the command directly do not, andcmd_getval()matches the variant type exactly. Reading only avector<string>would have failed all of these with-EINVAL "bad or missing field 'key'":pg_autoscaler/module.py, which backsceph osd pool set/unset noautoscaledashboard/controllers/osd.py_update_flags(), behind the OSD Flags pagetest/pybind/test_rados.py, six sites, each assertingeq(r, 0)ceph_test_rados_io_sequence, viaOSDSetRequestwhich holdskeyas astd::stringThe pg_autoscaler case fails silently, since it does not check the return value:
ceph osd pool set noautoscalewould report success without setting the flag. Both shapes are therefore accepted, which keeps those callers working untouched.Testing
Besides the added
cephtool/test.shcases, verified on a vstart cluster:ceph osd set norecover nobackfill norebalancesets all three in one command,ceph osd unsetclears several at oncepausereports both of its bitspglog_hardlimitcombined with another flag still honors its feature/release guardmon_commandceph osd pool set/unset noautoscaleround-trips correctlytest_rados.pytests that passkeyas a bare string passTracker: https://tracker.ceph.com/issues/77397
Checklist