]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/OSDMonitor: expand iec_options for 'osd pool set'
authorSage Weil <sage@redhat.com>
Mon, 28 Oct 2019 14:21:58 +0000 (09:21 -0500)
committerSage Weil <sage@redhat.com>
Mon, 28 Oct 2019 15:27:53 +0000 (10:27 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
qa/workunits/cephtool/test.sh
src/mon/OSDMonitor.cc

index 8cdf1ed5d327bdd89193c3ec5174070b3ebb8699..46aefbef88ee34b54d64adbbb5ee5013dbb033e9 100755 (executable)
@@ -2275,6 +2275,18 @@ function test_mon_osd_pool_set()
 
   ceph osd pool get rbd crush_rule | grep 'crush_rule: '
 
+  # iec vs si units
+  ceph osd pool set $TEST_POOLGETSET target_max_objects 1K
+  ceph osd pool get $TEST_POOLGETSET target_max_objects | grep 1000
+  for o in target_max_bytes target_size_bytes compression_max_blob_size compression_min_blob_size csum_max_block csum_min_block; do
+    ceph osd pool set $TEST_POOLGETSET $o 1Ki  # no i suffix
+    val=$(ceph osd pool get $TEST_POOLGETSET $o --format=json | jq -c ".$o")
+    [[ $val  == 1024 ]]
+    ceph osd pool set $TEST_POOLGETSET $o 1M   # with i suffix
+    val=$(ceph osd pool get $TEST_POOLGETSET $o --format=json | jq -c ".$o")
+    [[ $val  == 1048576 ]]
+  done
+
   ceph osd pool get $TEST_POOL_GETSET compression_mode | expect_false grep '.'
   ceph osd pool set $TEST_POOL_GETSET compression_mode aggressive
   ceph osd pool get $TEST_POOL_GETSET compression_mode | grep 'aggressive'
index b15eb8e6873e6e765a30e5fa0d52f14925e7161a..f06d07d19d1952437ff63b011c9bfd0b60147326 100644 (file)
@@ -7860,8 +7860,17 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
   int64_t uf = 0;  // micro-f
   cmd_getval(cct, cmdmap, "val", val);
 
-  auto si_options = {"target_max_objects"};
-  auto iec_options = {"target_max_bytes", "target_size_bytes"};
+  auto si_options = {
+    "target_max_objects"
+  };
+  auto iec_options = {
+    "target_max_bytes",
+    "target_size_bytes",
+    "compression_max_blob_size",
+    "compression_min_blob_size",
+    "csum_max_block",
+    "csum_min_block",
+  };
   if (count(begin(si_options), end(si_options), var)) {
     n = strict_si_cast<int64_t>(val.c_str(), &interr);
   } else if (count(begin(iec_options), end(iec_options), var)) {