From: myoungwon oh Date: Sat, 31 Oct 2020 05:46:03 +0000 (+0900) Subject: osd, test: do not allow ec pool to be set as a base tier in dedup X-Git-Tag: v16.1.0~374^2~33 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=518b78033aef57ca4b2354eb19e746cb3616a45d;p=ceph.git osd, test: do not allow ec pool to be set as a base tier in dedup Signed-off-by: Myoungwon Oh --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index b55e7461a64c..e38c598b3898 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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); diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 41e08205cd77..cba34cbb420d 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -6886,6 +6886,10 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) result = -EOPNOTSUPP; break; } + if (pool.info.is_erasure()) { + result = -EOPNOTSUPP; + break; + } for (auto &p : oi.manifest.chunk_map) { interval_set chunk; diff --git a/src/test/librados/tier_cxx.cc b/src/test/librados/tier_cxx.cc index e6c549a656c9..7f7dee49e4aa 100644 --- a/src/test/librados/tier_cxx.cc +++ b/src/test/librados/tier_cxx.cc @@ -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;