summaryrefslogtreecommitdiffstats
path: root/src/mon/OSDMonitor.cc
diff options
context:
space:
mode:
authorMatan Breizman <mbreizma@redhat.com>2024-03-03 14:43:10 +0100
committerMatan Breizman <mbreizma@redhat.com>2024-03-03 14:43:10 +0100
commit70c1d79d1d0f52cd65541f59cedb00e39cba3f76 (patch)
tree667c77908606e3753d9b5cab535ee1413151a384 /src/mon/OSDMonitor.cc
parentmon/OSDMonitor: fix rmsnap command (diff)
downloadceph-70c1d79d1d0f52cd65541f59cedb00e39cba3f76.tar.xz
ceph-70c1d79d1d0f52cd65541f59cedb00e39cba3f76.zip
mon/OSDMonitor: unify remove_pool_snap callers
No changes in behavior. Signed-off-by: Matan Breizman <mbreizma@redhat.com>
Diffstat (limited to 'src/mon/OSDMonitor.cc')
-rw-r--r--src/mon/OSDMonitor.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index 3f1254cd718..fe106a71d8e 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -4570,6 +4570,17 @@ void OSDMonitor::send_incremental(epoch_t first,
}
}
+bool OSDMonitor::remove_pool_snap(std::string_view snapname,
+ pg_pool_t &pp, int64_t pool) {
+ snapid_t snapid = pp.snap_exists(snapname);
+ if (snapid) {
+ pp.remove_snap(snapid);
+ pending_inc.new_removed_snaps[pool].insert(snapid);
+ return true;
+ }
+ return false;
+};
+
int OSDMonitor::get_version(version_t ver, bufferlist& bl)
{
return get_version(ver, mon.get_quorum_con_features(), bl);
@@ -13083,11 +13094,8 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
pp = &pending_inc.new_pools[pool];
*pp = *p;
}
- snapid_t sn = pp->snap_exists(snapname.c_str());
- if (sn) {
- pp->remove_snap(sn);
+ if (remove_pool_snap(snapname, *pp, pool)) {
pp->set_snap_epoch(pending_inc.epoch);
- pending_inc.new_removed_snaps[pool].insert(sn);
ss << "removed pool " << poolstr << " snap " << snapname;
} else {
ss << "already removed pool " << poolstr << " snap " << snapname;
@@ -14307,10 +14315,7 @@ bool OSDMonitor::prepare_pool_op(MonOpRequestRef op)
case POOL_OP_DELETE_SNAP:
{
- snapid_t s = pp.snap_exists(m->name.c_str());
- if (s) {
- pp.remove_snap(s);
- pending_inc.new_removed_snaps[m->pool].insert(s);
+ if (remove_pool_snap(m->name, pp, m->pool)) {
changed = true;
}
}