From c13e1b7929c92af72c3b518314f5902bb96eb501 Mon Sep 17 00:00:00 2001 From: Joao Eduardo Luis Date: Fri, 7 Mar 2014 18:25:21 +0000 Subject: [PATCH] mon: OSDMonitor: don't remove unamanaged snaps from not-unmanaged pools Although we should allow creating unmanaged snaps on not-unamanaged pools, as long as those pools don't have any managed snapshots in them, we cannot allow removal -- because the pool will not have any unmanaged snapshots. Fixes: 7210 Signed-off-by: Joao Eduardo Luis --- src/mon/OSDMonitor.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 72ee04d2145d5..8746090c7d234 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -4964,8 +4964,16 @@ bool OSDMonitor::prepare_pool_op(MPoolOp *m) _pool_op_reply(m, ret, osdmap.get_epoch()); return false; - case POOL_OP_CREATE_UNMANAGED_SNAP: case POOL_OP_DELETE_UNMANAGED_SNAP: + // we won't allow removal of an unmanaged snapshot from a pool + // not in unmanaged snaps mode. + if (!pool->is_unmanaged_snaps_mode()) { + _pool_op_reply(m, -ENOTSUP, osdmap.get_epoch()); + return false; + } + case POOL_OP_CREATE_UNMANAGED_SNAP: + // but we will allow creating an unmanaged snapshot on any pool + // as long as it is not in 'pool' snaps mode. if (pool->is_pool_snaps_mode()) { _pool_op_reply(m, -EINVAL, osdmap.get_epoch()); return false;