From 389efba589e5698e30ee6a9b63db59a38443e4ab Mon Sep 17 00:00:00 2001 From: Jose J Palacios-Perez Date: Tue, 3 Feb 2026 14:19:27 +0000 Subject: [PATCH] crimson: fix dump_metrics skipping metrics argument. Add minimal qa test for the fix. Signed-off-by: Jose J Palacios-Perez --- .../singleton/all/osd-dump-metrics.yaml | 30 +++++++++++++++++ .../cephtool/test_crimson_dump_metrics.sh | 32 +++++++++++++++++++ src/crimson/admin/osd_admin.cc | 2 +- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 qa/suites/crimson-rados/singleton/all/osd-dump-metrics.yaml create mode 100755 qa/workunits/cephtool/test_crimson_dump_metrics.sh diff --git a/qa/suites/crimson-rados/singleton/all/osd-dump-metrics.yaml b/qa/suites/crimson-rados/singleton/all/osd-dump-metrics.yaml new file mode 100644 index 000000000000..e22c901606c2 --- /dev/null +++ b/qa/suites/crimson-rados/singleton/all/osd-dump-metrics.yaml @@ -0,0 +1,30 @@ +roles: +- - mon.a + - mon.b + - mon.c + - mgr.x + - osd.0 + - osd.1 + - osd.2 + - client.0 +openstack: + - volumes: # attached to each instance + count: 3 + size: 10 # GB +tasks: +- install: +- ceph: + pre-mgr-commands: + - sudo ceph config set mgr mgr_pool false --force + log-ignorelist: + - but it is still running + - overall HEALTH_ + conf: + osd: + osd min pg log entries: 5 + crimson cpu num: 2 + global: +- workunit: + clients: + client.0: + - cephtool/test_crimson_dump_metrics.sh diff --git a/qa/workunits/cephtool/test_crimson_dump_metrics.sh b/qa/workunits/cephtool/test_crimson_dump_metrics.sh new file mode 100755 index 000000000000..10b373a6f1eb --- /dev/null +++ b/qa/workunits/cephtool/test_crimson_dump_metrics.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +. $(dirname $0)/../../standalone/ceph-helpers.sh + +set -x + +function test_dump_metrics() { + # Ensure can get dump_metrics full + ceph tell osd.0 dump_metrics 2>/dev/null > /tmp/dump_metrics_full.json || true + + # Ensure can get dump_metrics reactor_utilization: can be done with each metric name individually + ceph tell osd.0 dump_metrics reactor_utilization 2>/dev/null > /tmp/dump_metrics_reactor.json || true + + # The number of occurrences must match (must be greater than zero) + full_count=$(grep -c reactor_utilization /tmp/dump_metrics_full.json) + reactor_count=$(grep -c reactor_utilization /tmp/dump_metrics_reactor.json) + + [ $full_count -gt 0 ] || return 1 + [ $reactor_count -gt 0 ] || return 1 + [ $full_count -eq $reactor_count ] || return 1 + + # Remove auxiliary files + rm -f /tmp/dump_metrics_full.json /tmp/dump_metrics_reactor.json + return 0 # success +} + +# A more complete test: traverse the "metrics" section and ensure each metric contains the expected attributes + +test_dump_metrics || { echo "test_dump_metrics failed"; exit 1; } + +echo "OK" + diff --git a/src/crimson/admin/osd_admin.cc b/src/crimson/admin/osd_admin.cc index 8e73180edb07..c2f46e0bfa36 100644 --- a/src/crimson/admin/osd_admin.cc +++ b/src/crimson/admin/osd_admin.cc @@ -347,7 +347,7 @@ public: seastar::scollectd::get_value_map(), f, [prefix](const auto &full_name) { - return prefix.empty() || full_name.compare(0, prefix.size(), prefix) != 0; + return prefix.empty() || full_name.compare(0, prefix.size(), prefix) == 0; }); }); fref->close_section(); -- 2.47.3