]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: allow new pool policy fields to be set
authorSage Weil <sage@inktank.com>
Fri, 10 Jan 2014 04:36:13 +0000 (20:36 -0800)
committerSage Weil <sage@inktank.com>
Sun, 16 Feb 2014 06:08:12 +0000 (22:08 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
qa/workunits/cephtool/test.sh
src/mon/MonCommands.h
src/mon/OSDMonitor.cc

index 33245f63de91a3f97425c02ba1d8871c363d662a..f2117ac9806f80beeb45ea8b0c8069ee25cc1181 100755 (executable)
@@ -398,6 +398,18 @@ ceph osd pool set rbd hit_set_period 123
 ceph osd pool set rbd hit_set_count 12
 ceph osd pool set rbd hit_set_fpp .01
 
+ceph osd pool set rbd target_max_objects 123
+ceph osd pool set rbd target_max_bytes 123456
+ceph osd pool set rbd cache_target_dirty_ratio .123
+expect_false ceph osd pool set rbd cache_target_dirty_ratio -.2
+expect_false ceph osd pool set rbd cache_target_dirty_ratio 1.1
+ceph osd pool set rbd cache_target_full_ratio .123
+ceph osd pool set rbd cache_target_full_ratio 1.0
+ceph osd pool set rbd cache_target_full_ratio 0
+expect_false ceph osd pool set rbd cache_target_full_ratio 1.1
+ceph osd pool set rbd cache_min_flush_age 123
+ceph osd pool set rbd cache_min_evict_age 234
+
 ceph osd pool get rbd crush_ruleset | grep 'crush_ruleset: 0'
 
 ceph osd thrash 10
index bc7921794fb33c7996a937d92b0a722ba6ab8706..219229467aeec5341c79a30bd4266e0611129ffc 100644 (file)
@@ -528,7 +528,7 @@ COMMAND("osd pool get " \
        "get pool parameter <var>", "osd", "r", "cli,rest")
 COMMAND("osd pool set " \
        "name=pool,type=CephPoolname " \
-       "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|debug_fake_ec_pool " \
+       "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|debug_fake_ec_pool||target_max_bytes|target_max_objects|cache_target_dirty_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age " \
        "name=val,type=CephString", \
        "set pool parameter <var> to <val>", "osd", "rw", "cli,rest")
 // 'val' is a CephString because it can include a unit.  Perhaps
index c3359859b90e211138245f540eba3ddcea596924..e0bef1f76f91ea006ec2390304470cd3c22b68f6 100644 (file)
@@ -3229,7 +3229,50 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
     if (val == "true" || (interr.empty() && n == 1)) {
       p.flags |= pg_pool_t::FLAG_DEBUG_FAKE_EC_POOL;
     }
-    ss << " pool " << pool << " set debug_fake_ec_pool";
+  } else if (var == "target_max_objects") {
+    if (interr.length()) {
+      ss << "error parsing int '" << val << "': " << interr;
+      return -EINVAL;
+    }
+    p.target_max_objects = n;
+  } else if (var == "target_max_bytes") {
+    if (interr.length()) {
+      ss << "error parsing int '" << val << "': " << interr;
+      return -EINVAL;
+    }
+    p.target_max_bytes = n;
+  } else if (var == "cache_target_dirty_ratio") {
+    if (floaterr.length()) {
+      ss << "error parsing float '" << val << "': " << floaterr;
+      return -EINVAL;
+    }
+    if (f < 0 || f > 1.0) {
+      ss << "value must be in the range 0..1";
+      return -ERANGE;
+    }
+    p.cache_target_dirty_ratio_micro = f * 1000000;
+  } else if (var == "cache_target_full_ratio") {
+    if (floaterr.length()) {
+      ss << "error parsing float '" << val << "': " << floaterr;
+      return -EINVAL;
+    }
+    if (f < 0 || f > 1.0) {
+      ss << "value must be in the range 0..1";
+      return -ERANGE;
+    }
+    p.cache_target_full_ratio_micro = n;
+  } else if (var == "cache_min_flush_age") {
+    if (interr.length()) {
+      ss << "error parsing int '" << val << "': " << interr;
+      return -EINVAL;
+    }
+    p.cache_min_flush_age = n;
+  } else if (var == "cache_min_evict_age") {
+    if (interr.length()) {
+      ss << "error parsing int '" << val << "': " << interr;
+      return -EINVAL;
+    }
+    p.cache_min_evict_age = n;
   } else {
     ss << "unrecognized variable '" << var << "'";
     return -EINVAL;