From 9ccef704550148b63f973ce69ab2147f7a162ba4 Mon Sep 17 00:00:00 2001 From: Shraddha Agrawal Date: Tue, 6 May 2025 11:50:59 +0530 Subject: [PATCH] src/common/options: add config option for availability score This commit modifies src/common/options/mon.yaml.in to add a new config option to enable/disable tracking availability score. This config option can be modified dynamically at runtime as well. To enable tracking availability score, we can run the following command: ceph config set mon enable_availability_tracking true By default, tracking availability score is enabled. To disable tracking availability score: ceph config set mon enable_availablity_tracking false When the feature is turned off, invoking the `availability-status` command will display an error, prompting the user to turn on the feature using the config option. Fixes: https://tracker.ceph.com/issues/71494 Signed-off-by: Shraddha Agrawal --- src/common/options/mon.yaml.in | 11 +++++++++++ src/mon/OSDMonitor.cc | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/src/common/options/mon.yaml.in b/src/common/options/mon.yaml.in index 334113feb5d22..2c337fcea7072 100644 --- a/src/common/options/mon.yaml.in +++ b/src/common/options/mon.yaml.in @@ -1402,3 +1402,14 @@ options: default: 2 services: - mon +- name: enable_availability_tracking + type: bool + level: advanced + desc: Calculate and store availablity score for each pool in the + cluster at regular intervals + default: true + services : + - mon + flags: + - runtime + \ No newline at end of file diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index bc23cdff9091b..0804efb362b80 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -14407,6 +14407,11 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, get_last_committed() + 1)); return true; } else if (prefix == "osd pool availability-status") { + if (!g_conf().get_val("enable_availability_tracking")) { + ss << "availability tracking is disabled; you can enable it by setting the config option enable_availability_tracking"; + err = -EPERM; + goto reply_no_propose; + } TextTable tbl; tbl.define_column("POOL", TextTable::LEFT, TextTable::LEFT); tbl.define_column("UPTIME", TextTable::LEFT, TextTable::RIGHT); -- 2.39.5