]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd, test: do not allow ec pool to be set as a base tier in dedup
authormyoungwon oh <ohmyoungwon@gmail.com>
Sat, 31 Oct 2020 05:46:03 +0000 (14:46 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Sat, 31 Oct 2020 05:46:03 +0000 (14:46 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsumg.com>
src/mon/OSDMonitor.cc
src/osd/PrimaryLogPG.cc
src/test/librados/tier_cxx.cc

index b55e7461a64cc97b23cbdcf1bf872e2821f0e33a..e38c598b3898d9b84bf98909e7e8da9af6e2dba7 100644 (file)
@@ -8662,6 +8662,12 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
        return -EINVAL;
       }
     } else if (var == "dedup_tier") {
+      // Current base tier in dedup does not support ec pool 
+      if (p.is_erasure()) {
+       ss << "pool '" << poolstr
+          << "' is an ec pool, which cannot be a base tier";
+       return -ENOTSUP;
+      }
       int64_t lowtierpool_id = osdmap.lookup_pg_pool_name(val);
       if (lowtierpool_id < 0) {
        ss << "unrecognized pool '" << val << "'";
@@ -8669,13 +8675,8 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
       }
       const pg_pool_t *tp = osdmap.get_pg_pool(lowtierpool_id);
       ceph_assert(tp);
-      if (p.is_erasure()) {
-       ss << "pool '" << poolstr
-          << "' is an ec pool, which cannot be a tier";
-       return -ENOTSUP;
-      }
       n = lowtierpool_id;
-      interr.clear(); 
+      interr.clear();
     } else if (var == "dedup_chunk_algorithm") {
       if (!unset) {
         auto alg = pg_pool_t::get_dedup_chunk_algorithm_from_str(val);
index 41e08205cd771ad140d698bd6546870dba5f4fbe..cba34cbb420dafd73d34f2c9b4a6abd2acb85ce4 100644 (file)
@@ -6886,6 +6886,10 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
          result = -EOPNOTSUPP;
          break;
        }
+       if (pool.info.is_erasure()) {
+         result = -EOPNOTSUPP;
+         break;
+       }
 
        for (auto &p : oi.manifest.chunk_map) {
          interval_set<uint64_t> chunk;
index e6c549a656c9fe81f919bb72c25bc067ae889684..7f7dee49e4aae43f2d0a8cf387f59741b9702486 100644 (file)
@@ -7827,6 +7827,15 @@ TEST_F(LibRadosTwoPoolsECPP, ManifestPromoteRead) {
   cluster.wait_for_latest_osdmap();
 }
 
+TEST_F(LibRadosTwoPoolsECPP, TrySetDedupTier) {
+  // note: require >= mimic
+  
+  bufferlist inbl;
+  ASSERT_EQ(-EOPNOTSUPP, cluster.mon_command(
+       set_pool_str(pool_name, "dedup_tier", cache_pool_name),
+       inbl, NULL, NULL));
+}
+
 TEST_F(LibRadosTwoPoolsPP, PropagateBaseTierError) {
   // write object  to base tier
   bufferlist omap_bl;