| 2375 | } |
| 2376 | |
| 2377 | int OSDMap::apply_incremental(const Incremental &inc) |
| 2378 | { |
| 2379 | new_blocklist_entries = false; |
| 2380 | if (inc.epoch == 1) |
| 2381 | fsid = inc.fsid; |
| 2382 | else if (inc.fsid != fsid) |
| 2383 | return -EINVAL; |
| 2384 | |
| 2385 | ceph_assert(inc.epoch == epoch+1); |
| 2386 | |
| 2387 | epoch++; |
| 2388 | modified = inc.modified; |
| 2389 | |
| 2390 | // full map? |
| 2391 | if (inc.fullmap.length()) { |
| 2392 | ceph::buffer::list bl(inc.fullmap); |
| 2393 | decode(bl); |
| 2394 | return 0; |
| 2395 | } |
| 2396 | |
| 2397 | // nope, incremental. |
| 2398 | if (inc.new_flags >= 0) { |
| 2399 | flags = inc.new_flags; |
| 2400 | // the below is just to cover a newly-upgraded luminous mon |
| 2401 | // cluster that has to set require_jewel_osds or |
| 2402 | // require_kraken_osds before the osds can be upgraded to |
| 2403 | // luminous. |
| 2404 | if (flags & CEPH_OSDMAP_REQUIRE_KRAKEN) { |
| 2405 | if (require_osd_release < ceph_release_t::kraken) { |
| 2406 | require_osd_release = ceph_release_t::kraken; |
| 2407 | } |
| 2408 | } else if (flags & CEPH_OSDMAP_REQUIRE_JEWEL) { |
| 2409 | if (require_osd_release < ceph_release_t::jewel) { |
| 2410 | require_osd_release = ceph_release_t::jewel; |
| 2411 | } |
| 2412 | } |
| 2413 | } |
| 2414 | |
| 2415 | if (inc.new_max_osd >= 0) |
| 2416 | set_max_osd(inc.new_max_osd); |
| 2417 | |
| 2418 | if (inc.new_pool_max != -1) |
| 2419 | pool_max = inc.new_pool_max; |
| 2420 | |
| 2421 | for (const auto &pool : inc.new_pools) { |
| 2422 | pools[pool.first] = pool.second; |
| 2423 | pools[pool.first].last_change = epoch; |
| 2424 | } |
| 2425 | |
| 2426 | new_removed_snaps = inc.new_removed_snaps; |
| 2427 | new_purged_snaps = inc.new_purged_snaps; |
| 2428 | for (auto p = new_removed_snaps.begin(); |
| 2429 | p != new_removed_snaps.end(); |
| 2430 | ++p) { |
| 2431 | removed_snaps_queue[p->first].union_of(p->second); |
| 2432 | } |
| 2433 | for (auto p = new_purged_snaps.begin(); |
| 2434 | p != new_purged_snaps.end(); |
no test coverage detected