Skip to content

tools/rados: fail rmomapkey when the key does not exist - #73743

Open
abrahamperz wants to merge 1 commit into
ceph:mainfrom
abrahamperz:wip-rados-rmomapkey-enoent
Open

abrahamperz wants to merge 1 commit into
ceph:mainfrom
abrahamperz:wip-rados-rmomapkey-enoent

Conversation

@abrahamperz

@abrahamperz abrahamperz commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

rados rmomapkey printed nothing and exited 0 when the key was not in the object's omap, because omap_rm_keys() succeeds whether or not the key is present. This change looks the key up with omap_get_vals_by_keys() first. A missing key now prints No such key: <pool>/<obj>/<key> to stderr and exits 1, the same way getomapval reports it. A missing object still fails with ENOENT, as before.

Changes:

  • src/tools/rados/rados.cc: check that the key exists before removing it
  • qa/workunits/rados/test_rados_tool.sh: test_omap now checks that removing an already removed key, or one that was never set, fails
  • doc/man/8/rados.rst: document the new failure

Verified on a vstart cluster (1 mon, 1 memstore OSD):

  • before: rados -p rbtest rmomapkey obj waldo printed nothing and exited 0
  • after: it prints No such key: rbtest/obj/waldo and exits 1; removing an existing key still exits 0, and so does removing one with --omap-key-file
  • test_omap from test_rados_tool.sh passes with the patched binary

The existing qa callers of rados rmomapkey (cephfs damage and scrub tests) remove keys that exist when they run, so they don't depend on the old behavior.

Fixes: https://tracker.ceph.com/issues/49020

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 x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

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 Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand comments with more than one command.

omap_rm_keys() succeeds whether or not the key is present, so
'rados rmomapkey' printed nothing and exited 0 for a missing key.
Look the key up first and report 'No such key' with a non-zero exit
status, as getomapval already does.

Fixes: https://tracker.ceph.com/issues/49020
Signed-off-by: Abraham Pérez <[email protected]>
@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR ci-approved to allow Jenkins CI jobs to run.

@abrahamperz
abrahamperz marked this pull request as ready for review November 10, 2026 21:14
@abrahamperz
abrahamperz requested review from a team as code owners November 10, 2026 21:14
@ljflores

Copy link
Copy Markdown
Member

Thanks @abrahamperz! Can you please make an account for yourself in https://tracker.ceph.com/ so we can assign the ticket to you?

@abrahamperz

abrahamperz commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @ljflores! I actually already have a tracker account: username abrahamperz (same as my GitHub handle)

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath11-testing-20261114.052454-main.

@anthonyeleven anthonyeleven 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 lgtm

@ronen-fr

Copy link
Copy Markdown
Contributor

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

@abrahamperz Kindly address the PR check failure and proceed with merging the PR once the issue has been resolved. Should further QA validation be required, please re-add the needs-qa label and remove the TESTED label to facilitate retesting.

@abrahamperz

Copy link
Copy Markdown
Contributor Author

jenkins test windows

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