summaryrefslogtreecommitdiffstats
path: root/src/mon
diff options
context:
space:
mode:
authorMilind Changire <mchangir@redhat.com>2022-08-23 13:13:08 +0200
committerMilind Changire <mchangir@redhat.com>2022-11-21 11:44:53 +0100
commit23db15d5c2b428afec27c682052347ad07170413 (patch)
treed8ba7eb29ed2f09ec28978bd48eb33c026a0f2e2 /src/mon
parentosd: add utility function has_snaps() (diff)
downloadceph-23db15d5c2b428afec27c682052347ad07170413.tar.xz
ceph-23db15d5c2b428afec27c682052347ad07170413.zip
mon: block monitor managed snaps for fs pools
Signed-off-by: Milind Changire <mchangir@redhat.com>
Diffstat (limited to 'src/mon')
-rw-r--r--src/mon/FSCommands.cc6
-rw-r--r--src/mon/OSDMonitor.cc10
2 files changed, 16 insertions, 0 deletions
diff --git a/src/mon/FSCommands.cc b/src/mon/FSCommands.cc
index 5fd1f4a21de..3111dc099b7 100644
--- a/src/mon/FSCommands.cc
+++ b/src/mon/FSCommands.cc
@@ -1545,6 +1545,12 @@ int FileSystemCommandHandler::_check_pool(
return -ENOENT;
}
+ if (pool->has_snaps()) {
+ *ss << "pool(" << pool_id <<") already has mon-managed snaps; "
+ "can't attach pool to fs";
+ return -EOPNOTSUPP;
+ }
+
const string& pool_name = osd_map.get_pool_name(pool_id);
auto app_map = pool->application_metadata;
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index e9e7ce72a8b..b95ee73cdb3 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -14052,6 +14052,16 @@ bool OSDMonitor::prepare_pool_op(MonOpRequestRef op)
const pg_pool_t *pool = osdmap.get_pg_pool(m->pool);
+ if (m->op == POOL_OP_CREATE_SNAP ||
+ m->op == POOL_OP_CREATE_UNMANAGED_SNAP) {
+ if (const auto& fsmap = mon.mdsmon()->get_fsmap(); fsmap.pool_in_use(m->pool)) {
+ dout(20) << "monitor-managed snapshots have been disabled for pools "
+ " attached to an fs - pool:" << m->pool << dendl;
+ _pool_op_reply(op, -EOPNOTSUPP, osdmap.get_epoch());
+ return false;
+ }
+ }
+
switch (m->op) {
case POOL_OP_CREATE_SNAP:
if (pool->is_tier()) {