Skip to content

Commit

Permalink
Merge pull request ceph#56430 from Matan-B/wip-65095-quincy
Browse files Browse the repository at this point in the history
quincy: mon/OSDMonitor: fix rmsnap command

Reviewed-by: Ronen Friedman <rfriedma@redhat.com>
  • Loading branch information
Matan-B committed Apr 15, 2024
2 parents 4476280 + cabc30e commit 412a552
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/mon/OSDMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4591,6 +4591,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);
Expand Down Expand Up @@ -12953,9 +12964,7 @@ 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);
ss << "removed pool " << poolstr << " snap " << snapname;
} else {
Expand Down Expand Up @@ -14172,10 +14181,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;
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/mon/OSDMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@ class OSDMonitor : public PaxosService,
MOSDMap *build_incremental(epoch_t first, epoch_t last, uint64_t features);
void send_full(MonOpRequestRef op);
void send_incremental(MonOpRequestRef op, epoch_t first);

bool remove_pool_snap(std::string_view snapname,
pg_pool_t &pp, int64_t pool);

public:
/**
* Make sure the existing (up) OSDs support the given features
Expand Down

0 comments on commit 412a552

Please sign in to comment.