From: Alex Ainscow Date: Fri, 17 Oct 2025 07:52:27 +0000 (+0100) Subject: osd: Add mon command to override pool flags. X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e81fd31b23806696a8e2175bcfb6f1bbc8a679b2;p=ceph-ci.git osd: Add mon command to override pool flags. This is intended as a developer too and as such requires the yes_i_really_mean_it flag. The idea is that we can add new experimental pool features, with a generic way of turning the features on, without polluting the parameters in the command yet further. The command is perhaps a little messy: ceph osd pool set set_pool_flags ceph osd pool set unset_pool_flags I also decided against an API to show the pool flags. As this would be hard to read without some complex decode and the functionality to observe pool flags in logs with high debug levels already exists. Signed-off-by: Alex Ainscow --- diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 504619bd2bb..6ff253876e3 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -1175,7 +1175,7 @@ COMMAND("osd pool get " "get pool parameter ", "osd", "r") COMMAND("osd pool set " "name=pool,type=CephPoolname " - "name=var,type=CephChoices,strings=size|min_size|pg_num|pgp_num|pgp_num_actual|crush_rule|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|target_max_bytes|target_max_objects|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|min_read_recency_for_promote|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority|scrub_priority|compression_mode|compression_algorithm|compression_required_ratio|compression_max_blob_size|compression_min_blob_size|csum_type|csum_min_block|csum_max_block|allow_ec_overwrites|fingerprint_algorithm|pg_autoscale_mode|pg_autoscale_bias|pg_num_min|pg_num_max|target_size_bytes|target_size_ratio|dedup_tier|dedup_chunk_algorithm|dedup_cdc_chunk_size|eio|bulk|read_ratio|pct_update_delay|allow_ec_optimizations " + "name=var,type=CephChoices,strings=size|min_size|pg_num|pgp_num|pgp_num_actual|crush_rule|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|target_max_bytes|target_max_objects|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|min_read_recency_for_promote|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority|scrub_priority|compression_mode|compression_algorithm|compression_required_ratio|compression_max_blob_size|compression_min_blob_size|csum_type|csum_min_block|csum_max_block|allow_ec_overwrites|fingerprint_algorithm|pg_autoscale_mode|pg_autoscale_bias|pg_num_min|pg_num_max|target_size_bytes|target_size_ratio|dedup_tier|dedup_chunk_algorithm|dedup_cdc_chunk_size|eio|bulk|read_ratio|pct_update_delay|allow_ec_optimizations|set_pool_flags|clear_pool_flags " "name=val,type=CephString " "name=yes_i_really_mean_it,type=CephBool,req=false", "set pool parameter to ", "osd", "rw") diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index a0011b0d170..334eca31ba6 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -8967,6 +8967,23 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap, } } } + } else if (var == "set_pool_flags" || var == "unset_pool_flags") { + bool force; + cmd_getval(cmdmap, "yes_i_really_mean_it", force); + if (!force) { + ss << "This is a development tool and should not be used in production."; + return -EINVAL; + } + if (!interr.empty()) { + ss << "expecting integer value"; + return -EINVAL; + } + bool enable = (var == "set_pool_flags"); + if (enable) { + p.set_flag(n); + } else { + p.unset_flag(n); + } } else if (var == "target_max_objects") { if (interr.length()) { ss << "error parsing int '" << val << "': " << interr;