]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMonitor: allow addition of cache pool with non-empty snaps with config 5252/head
authorSamuel Just <sjust@redhat.com>
Tue, 7 Jul 2015 18:43:01 +0000 (11:43 -0700)
committerSamuel Just <sjust@redhat.com>
Wed, 8 Jul 2015 18:32:34 +0000 (11:32 -0700)
We need to be able to allow the version of ceph_test_* from earlier
versions of ceph to continue to work.  This patch also adjusts the
work unit to use a single rados snap to test the condition without
--force-nonempty to ensure that we don't need to be careful about
the config value when running that script.

Signed-off-by: Samuel Just <sjust@redhat.com>
qa/workunits/cephtool/test.sh
src/common/config_opts.h
src/mon/OSDMonitor.cc

index 081d13b97d2246792a55120c7a7c83ae96a36399..81f903fc5c5c77862d086fc1b0c427ca27a195ca 100755 (executable)
@@ -318,10 +318,8 @@ function test_tiering()
   # make sure we can't clobber snapshot state
   ceph osd pool create snap_base 2
   ceph osd pool create snap_cache 2
-  rbd -p snap_cache create foo --size 10
-  rbd -p snap_cache snap create foo --snap snap1
-  rbd -p snap_cache snap rm foo --snap snap1
-  expect_false ceph osd tier add snap_base snap_cache --force-nonempty
+  ceph osd pool mksnap snap_cache snapname
+  expect_false ceph osd tier add snap_base snap_cache
   ceph osd pool delete snap_base snap_base --yes-i-really-really-mean-it
   ceph osd pool delete snap_cache snap_cache --yes-i-really-really-mean-it
 
index aee900d4bb03feb68fc94887c591d0cea8e36be9..f2e40414f2c3e7cb0db4925016ecc3f87de35198 100644 (file)
@@ -263,6 +263,10 @@ OPTION(mon_sync_provider_kill_at, OPT_INT, 0)  // kill the sync provider at a sp
 OPTION(mon_sync_requester_kill_at, OPT_INT, 0) // kill the sync requester at a specific point in the work flow
 OPTION(mon_force_quorum_join, OPT_BOOL, false) // force monitor to join quorum even if it has been previously removed from the map
 OPTION(mon_keyvaluedb, OPT_STR, "leveldb")   // type of keyvaluedb backend
+
+// UNSAFE -- TESTING ONLY! Allows addition of a cache tier with preexisting snaps
+OPTION(mon_debug_unsafe_allow_tier_with_nonempty_snaps, OPT_BOOL, false)
+
 OPTION(paxos_stash_full_interval, OPT_INT, 25)   // how often (in commits) to stash a full copy of the PaxosService state
 OPTION(paxos_max_join_drift, OPT_INT, 10) // max paxos iterations before we must first sync the monitor stores
 OPTION(paxos_propose_interval, OPT_DOUBLE, 1.0)  // gather updates for this long before proposing a map update
index 79b519a0639170d165c5a50f90d6582058eeda02..7c68dbb6a604aa49894d20fc7bceb332dd8eec92 100644 (file)
@@ -6118,7 +6118,9 @@ done:
       err = -ENOTSUP;
       goto reply;
     }
-    if (!tp->removed_snaps.empty() || !tp->snaps.empty()) {
+    if ((!tp->removed_snaps.empty() || !tp->snaps.empty()) &&
+       ((force_nonempty != "--force-nonempty") ||
+        (!g_conf->mon_debug_unsafe_allow_tier_with_nonempty_snaps))) {
       ss << "tier pool '" << tierpoolstr << "' has snapshot state; it cannot be added as a tier without breaking the pool";
       err = -ENOTEMPTY;
       goto reply;