]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: prevent pool with snapshot state from being used as a tier
authorSage Weil <sage@redhat.com>
Wed, 29 Apr 2015 19:34:25 +0000 (12:34 -0700)
committerSamuel Just <sjust@redhat.com>
Fri, 15 May 2015 17:39:49 +0000 (10:39 -0700)
If we add a pool with snap state as a tier the snap state gets clobbered
by OSDMap::Incremental::propogate_snaps_to_tiers(), and may prevent OSDs
from starting.  Disallow this.

Include a test.

Fixes: #11493
Backport: hammer, giant, firefly
Signed-off-by: Sage Weil <sage@redhat.com>
qa/workunits/cephtool/test.sh
src/mon/OSDMonitor.cc

index 0a8282bfedb29a0ef81bd0e79d76da8ec9f34297..b6fbabe08bced627ee1d400a775d4e0ca991f366 100755 (executable)
@@ -314,6 +314,16 @@ function test_tiering()
   ceph osd pool delete cache cache --yes-i-really-really-mean-it
   ceph osd pool delete cache2 cache2 --yes-i-really-really-mean-it
 
+  # 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 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
+
   # convenient add-cache command
   ceph osd pool create cache3 2
   ceph osd tier add-cache slow cache3 1024000
index 10597d0f7df0e6b9294c1326be31fa53cc43eb1c..9d3f6e4f744b54433ca84475e6874eaf46ce0e09 100644 (file)
@@ -6463,6 +6463,11 @@ done:
       err = -ENOTEMPTY;
       goto reply;
     }
+    if (!tp->removed_snaps.empty() || !tp->snaps.empty()) {
+      ss << "tier pool '" << tierpoolstr << "' has snapshot state; it cannot be added as a tier without breaking the pool";
+      err = -ENOTEMPTY;
+      goto reply;
+    }
     // go
     pg_pool_t *np = pending_inc.get_new_pool(pool_id, p);
     pg_pool_t *ntp = pending_inc.get_new_pool(tierpool_id, tp);