| 4280 | // --- |
| 4281 | |
| 4282 | bool OSDMonitor::preprocess_remove_snaps(MonOpRequestRef op) |
| 4283 | { |
| 4284 | op->mark_osdmon_event(__func__); |
| 4285 | auto m = op->get_req<MRemoveSnaps>(); |
| 4286 | dout(7) << "preprocess_remove_snaps " << *m << dendl; |
| 4287 | |
| 4288 | // check privilege, ignore if failed |
| 4289 | MonSession *session = op->get_session(); |
| 4290 | mon.no_reply(op); |
| 4291 | if (!session) |
| 4292 | goto ignore; |
| 4293 | if (!session->caps.is_capable( |
| 4294 | cct, |
| 4295 | session->entity_name, |
| 4296 | "osd", "osd pool rmsnap", {}, true, true, false, |
| 4297 | session->get_peer_socket_addr())) { |
| 4298 | dout(0) << "got preprocess_remove_snaps from entity with insufficient caps " |
| 4299 | << session->caps << dendl; |
| 4300 | goto ignore; |
| 4301 | } |
| 4302 | |
| 4303 | for (map<int, vector<snapid_t> >::iterator q = m->snaps.begin(); |
| 4304 | q != m->snaps.end(); |
| 4305 | ++q) { |
| 4306 | if (!osdmap.have_pg_pool(q->first)) { |
| 4307 | dout(10) << " ignoring removed_snaps " << q->second |
| 4308 | << " on non-existent pool " << q->first << dendl; |
| 4309 | continue; |
| 4310 | } |
| 4311 | const pg_pool_t *pi = osdmap.get_pg_pool(q->first); |
| 4312 | for (vector<snapid_t>::iterator p = q->second.begin(); |
| 4313 | p != q->second.end(); |
| 4314 | ++p) { |
| 4315 | if (*p > pi->get_snap_seq() || |
| 4316 | !_is_removed_snap(q->first, *p)) { |
| 4317 | return false; |
| 4318 | } |
| 4319 | } |
| 4320 | } |
| 4321 | |
| 4322 | if (HAVE_FEATURE(m->get_connection()->get_features(), SERVER_OCTOPUS)) { |
| 4323 | auto reply = make_message<MRemoveSnaps>(); |
| 4324 | reply->snaps = m->snaps; |
| 4325 | mon.send_reply(op, reply.detach()); |
| 4326 | } |
| 4327 | |
| 4328 | ignore: |
| 4329 | return true; |
| 4330 | } |
| 4331 | |
| 4332 | bool OSDMonitor::prepare_remove_snaps(MonOpRequestRef op) |
| 4333 | { |
nothing calls this directly
no test coverage detected