Skip to content

feat: add ceph, rados, rbd, ceph-volume and radosgw-admin commands#249

Merged
gmeghnag merged 1 commit into
gmeghnag:mainfrom
AlexonOliveiraRH:feat/ceph-support
May 15, 2026
Merged

feat: add ceph, rados, rbd, ceph-volume and radosgw-admin commands#249
gmeghnag merged 1 commit into
gmeghnag:mainfrom
AlexonOliveiraRH:feat/ceph-support

Conversation

@AlexonOliveiraRH

Copy link
Copy Markdown
Contributor

Summary

  • Add support for displaying pre-captured Ceph command outputs from ODF (OpenShift Data Foundation) must-gather archives
  • New commands: omc ceph, omc rados, omc rbd, omc ceph-volume, omc radosgw-admin
  • Dynamic passthrough approach - all 80+ captured Ceph commands are automatically accessible without hardcoded mappings
  • JSON output support via --output json-pretty flag
  • Suggestions for available commands when the requested output is not found

Closes #248

Motivation

The ODF must-gather already collects Ceph CLI outputs as files under ceph/must_gather_commands/ and ceph/must_gather_commands_json_output/, but omc had no way to access them. Users had to manually navigate the must-gather directory structure.

This feature was inspired by a similar implementation in o-must-gather (omg) v2 branch, which was never officially released (last release v1.2.6, April 2021; project dormant since February 2024). Since omc is the actively maintained tool, this brings the functionality here with an improved approach - dynamic argument-to-filename mapping instead of the limited set of commands omg v2 supported.

How it works

Arguments are converted to filenames matching the must-gather naming convention:

  • omc ceph status -> reads ceph/must_gather_commands/ceph_status
  • omc ceph osd tree -> reads ceph/must_gather_commands/ceph_osd_tree
  • omc ceph status --output json-pretty -> reads ceph/must_gather_commands_json_output/ceph_status_--format_json-pretty
  • omc ceph config show osd.0 -> reads ceph/must_gather_commands/config_osd.0 (special case for ODF naming)

When the output file is not found, available commands matching the prefix are listed as suggestions.

Files changed

File Description
cmd/ceph/lookup.go Shared logic: filename construction, arg parsing, file lookup, suggestions
cmd/ceph/ceph.go omc ceph command
cmd/ceph/rados.go omc rados command
cmd/ceph/rbd.go omc rbd command
cmd/ceph/cephvolume.go omc ceph-volume command
cmd/ceph/radosgwadmin.go omc radosgw-admin command
cmd/ceph/lookup_test.go Tests (7 test functions covering all logic)
root/root.go Register new commands

Test plan

  • go build -v ./... passes
  • go test -v ./... passes (all existing + 7 new tests)
  • Tested manually against a real ODF must-gather (case 04432224):
    • omc ceph status - cluster status output
    • omc ceph osd tree - OSD tree
    • omc ceph status --output json-pretty - JSON output
    • omc ceph config show osd.0 - OSD config (special case)
    • omc rados lspools - pool listing
    • omc rbd ls <pool> - RBD volume listing
    • omc ceph-volume raw list - volume raw list
    • omc radosgw-admin realm list - RGW realm listing
    • omc ceph nonexistent - error with no suggestions
    • omc ceph osd - error with matching suggestions
    • omc ceph / omc ceph --help - help output
    • No regressions in existing commands

Add support for displaying pre-captured Ceph command outputs from ODF
(OpenShift Data Foundation) must-gather archives. The ODF must-gather
collects Ceph CLI outputs as files under ceph/must_gather_commands/ and
ceph/must_gather_commands_json_output/, and these new commands provide
a convenient way to access them directly from omc.

New commands:
- omc ceph <args> - Ceph cluster commands (status, osd tree, health, etc.)
- omc rados <args> - RADOS commands (lspools, ls, etc.)
- omc rbd <args> - RBD commands (ls, mirror, trash, etc.)
- omc ceph-volume <args> - ceph-volume commands (raw list, etc.)
- omc radosgw-admin <args> - Object Gateway admin commands (realm, zone, etc.)

All commands use a dynamic passthrough approach: arguments are converted
to filenames matching the must-gather naming convention, and the
corresponding file content is printed. When a command output is not
found, available commands are listed as suggestions.

JSON output is supported via --output/--format json-pretty flag on the
ceph command.

Signed-off-by: Alexon Oliveira <alolivei@redhat.com>
@gmeghnag gmeghnag merged commit e8221e0 into gmeghnag:main May 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add ceph, rados, rbd, ceph-volume, and radosgw-admin commands for ODF must-gather

2 participants