]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon: add proxy to cache tier options
authortancz1 <tancz1@lenovo.com>
Wed, 16 Mar 2022 09:20:40 +0000 (17:20 +0800)
committertancz1 <tancz1@lenovo.com>
Fri, 29 Apr 2022 02:40:40 +0000 (10:40 +0800)
When we set the proxy mode to remove a writeback cache according to
the ceph official documentation an error occurred:

[root@controller-1 root]# ceph osd tier cache-mode cachepool proxy
Invalid command: proxy not in writeback|readproxy|readonly|none
osd tier cache-mode writeback|readproxy|readonly|none [--yes-i-really-mean-it]:
specify the caching mode for cache tier

According to the description of the official website document: since
a writeback cache may have modified data, you must take steps to ensure
that you do not lose any recent changes to objects in the cache before
you disable and remove it. Change the cache mode to proxy so that new and
modified objects will flush to the backing storage pool.

Fixes: https://tracker.ceph.com/issues/54576
Signed-off-by: tan changzhi <544463199@qq.com>
doc/man/8/ceph.rst
qa/workunits/cephtool/test.sh
src/mon/MonCommands.h
src/mon/OSDMonitor.cc

index 639d85e565d6f23180764f0d998605e8441aef12..1a54cf6eae712d75778efc6b34522dc9e3c6ce9c 100644 (file)
@@ -1314,7 +1314,7 @@ Subcommand ``cache-mode`` specifies the caching mode for cache tier <pool>.
 
 Usage::
 
-       ceph osd tier cache-mode <poolname> writeback|readproxy|readonly|none
+       ceph osd tier cache-mode <poolname> writeback|proxy|readproxy|readonly|none
 
 Subcommand ``remove`` removes the tier <tierpool> (the second one) from base pool
 <pool> (the first one).
index d63f88fc2e8f31315df696b24650902ea1456257..aab9fa45e91252e3007ac6ff85f4668b4edaa26b 100755 (executable)
@@ -350,20 +350,21 @@ function test_tiering_1()
   ceph osd pool ls detail -f json | jq '.[] | select(.pool_name == "slow2") | .application_metadata["rados"]' | grep '{}'
   ceph osd pool ls detail -f json | jq '.[] | select(.pool_name == "cache") | .application_metadata["rados"]' | grep '{}'
   ceph osd pool ls detail -f json | jq '.[] | select(.pool_name == "cache2") | .application_metadata["rados"]' | grep '{}'
-  # forward and proxy are removed/deprecated
+  # forward is removed/deprecated
   expect_false ceph osd tier cache-mode cache forward
   expect_false ceph osd tier cache-mode cache forward --yes-i-really-mean-it
-  expect_false ceph osd tier cache-mode cache proxy
-  expect_false ceph osd tier cache-mode cache proxy --yes-i-really-mean-it
   # test some state transitions
   ceph osd tier cache-mode cache writeback
   expect_false ceph osd tier cache-mode cache readonly
   expect_false ceph osd tier cache-mode cache readonly --yes-i-really-mean-it
+  ceph osd tier cache-mode cache proxy
   ceph osd tier cache-mode cache readproxy
   ceph osd tier cache-mode cache none
   ceph osd tier cache-mode cache readonly --yes-i-really-mean-it
   ceph osd tier cache-mode cache none
   ceph osd tier cache-mode cache writeback
+  ceph osd tier cache-mode cache proxy
+  ceph osd tier cache-mode cache writeback
   expect_false ceph osd tier cache-mode cache none
   expect_false ceph osd tier cache-mode cache readonly --yes-i-really-mean-it
   # test with dirty objects in the tier pool
@@ -371,7 +372,7 @@ function test_tiering_1()
   rados -p cache put /etc/passwd /etc/passwd
   flush_pg_stats
   # 1 dirty object in pool 'cache'
-  ceph osd tier cache-mode cache readproxy
+  ceph osd tier cache-mode cache proxy
   expect_false ceph osd tier cache-mode cache none
   expect_false ceph osd tier cache-mode cache readonly --yes-i-really-mean-it
   ceph osd tier cache-mode cache writeback
@@ -380,7 +381,7 @@ function test_tiering_1()
   rados -p cache cache-flush-evict-all
   flush_pg_stats
   # no dirty objects in pool 'cache'
-  ceph osd tier cache-mode cache readproxy
+  ceph osd tier cache-mode cache proxy
   ceph osd tier cache-mode cache none
   ceph osd tier cache-mode cache readonly --yes-i-really-mean-it
   TRIES=0
@@ -1113,7 +1114,7 @@ function test_mon_mds()
 
   # Removing tier should be permitted because the underlying pool is
   # replicated (#11504 case)
-  ceph osd tier cache-mode mds-tier readproxy
+  ceph osd tier cache-mode mds-tier proxy
   ceph osd tier remove-overlay fs_metadata
   ceph osd tier remove fs_metadata mds-tier
   ceph osd pool delete mds-tier mds-tier --yes-i-really-really-mean-it
index f4f4fef9804e7ca62693b5cc605e7993df103309..7fdaab3a5ccf628258339539c6980a9fd8bd52d1 100644 (file)
@@ -1169,7 +1169,7 @@ COMMAND_WITH_FLAG("osd tier remove "
     FLAG(DEPRECATED))
 COMMAND("osd tier cache-mode "
        "name=pool,type=CephPoolname "
-       "name=mode,type=CephChoices,strings=writeback|readproxy|readonly|none "
+       "name=mode,type=CephChoices,strings=writeback|proxy|readproxy|readonly|none "
        "name=yes_i_really_mean_it,type=CephBool,req=false",
        "specify the caching mode for cache tier <pool>", "osd", "rw")
 COMMAND("osd tier set-overlay "
index b563e375092a6b41608063e1ed46605cc42c423a..e1eb6ee688fe9b4ad2fb6f79f51fcb00c90d28b6 100644 (file)
@@ -13315,6 +13315,8 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
       ss << "unable to set cache-mode '" << pg_pool_t::get_cache_mode_name(mode)
          << "' on a '" << pg_pool_t::get_cache_mode_name(p->cache_mode)
          << "' pool; only '"
+         << pg_pool_t::get_cache_mode_name(pg_pool_t::CACHEMODE_PROXY)
+         << "','"
          << pg_pool_t::get_cache_mode_name(pg_pool_t::CACHEMODE_READPROXY)
         << "' allowed.";
       err = -EINVAL;