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>
(cherry picked from commit
bbec53edf9e585af4e20bbc9ba9057d6fdfda342)
Conflicts:
qa/workunits/cephtool/test.sh
properly co-exist with "# make sure we can't create an ec pool tier"
src/mon/OSDMonitor.cc
properly co-exist with preceding "if (tp->ec_pool())"
(The changes to both files would have applied cleanly if
https://github.com/ceph/ceph/pull/5389 had not been merged first.)
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
+
# make sure we can't create an ec pool tier
ceph osd pool create eccache 2 2 erasure
ceph osd pool create repbase 2
err = -ENOTSUP;
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);