Skip to content

osdtrace: add Ceph Version column to --list output#126

Merged
taodd merged 1 commit into
mainfrom
feature/list-osd-ceph-version
Jun 5, 2026
Merged

osdtrace: add Ceph Version column to --list output#126
taodd merged 1 commit into
mainfrom
feature/list-osd-ceph-version

Conversation

@taodd
Copy link
Copy Markdown
Owner

@taodd taodd commented Jun 5, 2026

Summary

Adds a Ceph Version column to osdtrace --list so each discovered ceph-osd shows its package version, and removes the now-redundant Executable Path column from that view.

How the version is resolved (per OSD)

Traceability Container? Exe upgraded on disk? Version shown Source
yes either exact version matched embedded DWARF entry (is_embedded_traceablematched_version_out) — authoritative, container-safe
no no no best-effort host get_package_version()
no no yes unknown check_executable_deleted() catches the on-disk≠running case
no yes unknown host package DB describes the host, not the container
unknown unknown build-id unreadable (non-root)

The version is authoritative and free for traceable OSDs (including containerized ones, since the build-id is read through /proc/<pid>/root). For non-traceable OSDs it falls back to a host package query, but only when it can be trusted — native binary, not replaced on disk since launch.

The Executable Path column is dropped from --list (it is always /usr/bin/ceph-osd and carries no signal). The separate tracing-flow listing (print_discovered_osds without traceability) keeps it.

A footnote under the table documents these semantics.

Example

Detected 11 active ceph-osd process(es) on the host:
  PID        OSD ID     Container    Traceable   Ceph Version
  -----------------------------------------------------------------------
  117249     0          yes          yes         2:17.2.6-0.el8
  124194     0          yes          yes         2:19.2.3-0.el9
  321437     3          yes          yes         19.2.3-0ubuntu0.24.04.3

Scope

  • One file: src/osdtrace.cc. Reuses existing helpers (is_embedded_traceable, get_package_version, check_executable_deleted) — no new dependencies, no change to the tracing path or radostrace.

Testing

  • make osdtrace — clean build; make clang-tidy — clean on osdtrace.cc.
  • sudo ./osdtrace --list on a host with 11 containerized OSDs across multiple Ceph releases — versions resolved correctly and columns align.
  • Functional test (functional-test-embedded-dwarf.sh) only asserts on --list-embedded, which is untouched.

🤖 Generated with Claude Code

Show each discovered ceph-osd's package version in `osdtrace --list`.
The version is resolved per OSD:

  - Traceable ("yes"): taken from the matched embedded DWARF entry via
    is_embedded_traceable()'s matched_version_out. Authoritative and
    container-safe (build-id is read through /proc/<pid>/root).
  - Not traceable, native, binary not replaced on disk: best-effort host
    package query (get_package_version), gated by check_executable_deleted()
    so an upgraded-on-disk binary never reports a version we aren't running.
  - Containerized non-traceable, upgraded-on-disk, or unreadable build-id:
    "unknown" (the host package DB does not describe these binaries).

Also drop the Executable Path column from the --list view (it is always
/usr/bin/ceph-osd and adds no signal); the tracing-flow listing keeps it.
A footnote documents the Ceph Version semantics.
@taodd taodd force-pushed the feature/list-osd-ceph-version branch from 37cb1e2 to f417875 Compare June 5, 2026 01:56
@taodd taodd requested a review from Copilot June 5, 2026 02:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates osdtrace --list output to surface a per-OSD “Ceph Version” column (preferring the matched embedded DWARF version when traceable, otherwise falling back to a safe host package query) and removes the “Executable Path” column from that traceability-focused view.

Changes:

  • Add OsdProcessInfo::version and populate it during annotate_traceability() using embedded-match version or a guarded host package lookup.
  • Update --list table formatting to display “Ceph Version” instead of “Executable Path” when show_traceable=true.
  • Add explanatory footnote text describing the version-resolution semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/osdtrace.cc
Comment on lines +1014 to +1015
std::string pkg = get_package_version(proc.exe_path);
if (!pkg.empty() && pkg != "unknown") proc.version = pkg;
Comment thread src/osdtrace.cc
Comment on lines 1294 to 1311
if (any_no || any_unknown) {
std::cout << std::endl
<< "Traceable: 'yes' means this osdtrace already has matching DWARF data built in." << std::endl;
if (any_no) {
std::cout << " 'no': no embedded DWARF matches this binary's build-id. Export a DWARF JSON" << std::endl;
std::cout << " on a host that has the matching ceph-osd (osdtrace -j <file>), then trace" << std::endl;
std::cout << " with: osdtrace -p <pid> -i <file> --skip-version-check" << std::endl;
}
if (any_unknown) {
std::cout << " 'unknown': could not read the OSD binary's build-id; re-run as root" << std::endl;
std::cout << " (required for containerized OSDs)." << std::endl;
}
std::cout << std::endl
<< "Ceph Version: authoritative when Traceable='yes' (the matched embedded entry)." << std::endl;
std::cout << " For Traceable='no' it is a best-effort host package lookup, shown only" << std::endl;
std::cout << " for native OSDs whose on-disk binary still matches the running process;" << std::endl;
std::cout << " 'unknown' for containerized OSDs or binaries upgraded since launch." << std::endl;
}
@taodd taodd merged commit 9a32525 into main Jun 5, 2026
49 of 50 checks 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.

2 participants