feat: add ceph, rados, rbd, ceph-volume and radosgw-admin commands#249
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
omc ceph,omc rados,omc rbd,omc ceph-volume,omc radosgw-admin--output json-prettyflagCloses #248
Motivation
The ODF must-gather already collects Ceph CLI outputs as files under
ceph/must_gather_commands/andceph/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-> readsceph/must_gather_commands/ceph_statusomc ceph osd tree-> readsceph/must_gather_commands/ceph_osd_treeomc ceph status --output json-pretty-> readsceph/must_gather_commands_json_output/ceph_status_--format_json-prettyomc ceph config show osd.0-> readsceph/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
cmd/ceph/lookup.gocmd/ceph/ceph.goomc cephcommandcmd/ceph/rados.goomc radoscommandcmd/ceph/rbd.goomc rbdcommandcmd/ceph/cephvolume.goomc ceph-volumecommandcmd/ceph/radosgwadmin.goomc radosgw-admincommandcmd/ceph/lookup_test.goroot/root.goTest plan
go build -v ./...passesgo test -v ./...passes (all existing + 7 new tests)omc ceph status- cluster status outputomc ceph osd tree- OSD treeomc ceph status --output json-pretty- JSON outputomc ceph config show osd.0- OSD config (special case)omc rados lspools- pool listingomc rbd ls <pool>- RBD volume listingomc ceph-volume raw list- volume raw listomc radosgw-admin realm list- RGW realm listingomc ceph nonexistent- error with no suggestionsomc ceph osd- error with matching suggestionsomc ceph/omc ceph --help- help output