From: Samuel Just Date: Tue, 7 Jul 2015 18:43:01 +0000 (-0700) Subject: OSDMonitor: allow addition of cache pool with non-empty snaps with config X-Git-Tag: v0.94.3~40^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F5252%2Fhead;p=ceph.git OSDMonitor: allow addition of cache pool with non-empty snaps with config 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 --- diff --git a/qa/workunits/cephtool/test.sh b/qa/workunits/cephtool/test.sh index 081d13b97d22..81f903fc5c5c 100755 --- a/qa/workunits/cephtool/test.sh +++ b/qa/workunits/cephtool/test.sh @@ -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 diff --git a/src/common/config_opts.h b/src/common/config_opts.h index aee900d4bb03..f2e40414f2c3 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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 diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 79b519a06391..7c68dbb6a604 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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;