]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: Add mon command to override pool flags.
authorAlex Ainscow <aainscow@uk.ibm.com>
Fri, 17 Oct 2025 07:52:27 +0000 (08:52 +0100)
committerAlex Ainscow <aainscow@uk.ibm.com>
Tue, 21 Oct 2025 13:34:54 +0000 (14:34 +0100)
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 <pool> set set_pool_flags <int>
ceph osd pool <pool> set unset_pool_flags <int>

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 <aainscow@uk.ibm.com>
src/mon/MonCommands.h
src/mon/OSDMonitor.cc

index 504619bd2bbc5e68f1e5ae5bb3d6f3d83adb1c56..6ff253876e3fc594255773a9ec80bfc3131d14cf 100644 (file)
@@ -1175,7 +1175,7 @@ COMMAND("osd pool get "
        "get pool parameter <var>", "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 <var> to <val>", "osd", "rw")
index a0011b0d1703b75fee58332401eeb8f928c8ecc6..334eca31ba675b46e252a55d2b14728832acf794 100644 (file)
@@ -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;