1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
7 * Copyright (C) 2013,2014 Cloudwatt <libre.licensing@cloudwatt.com>
9 * Author: Loic Dachary <loic@dachary.org>
11 * This is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License version 2.1, as published by the Free Software
14 * Foundation. See file COPYING.
18 /* Object Store Device (OSD) Monitor
21 #ifndef CEPH_OSDMONITOR_H
22 #define CEPH_OSDMONITOR_H
27 #include "include/types.h"
28 #include "include/encoding.h"
29 #include "common/simple_cache.hpp"
30 #include "common/PriorityCache.h"
31 #include "msg/Messenger.h"
33 #include "osd/OSDMap.h"
34 #include "osd/OSDMapMapping.h"
36 #include "CreatingPGs.h"
37 #include "PaxosService.h"
44 #include "erasure-code/ErasureCodeInterface.h"
45 #include "mon/MonOpRequest.h"
46 #include <boost/functional/hash.hpp>
47 // re-include our assert to clobber the system one; fix dout:
48 #include "include/ceph_assert.h"
50 /// information about a particular peer's failure reports for one osd
51 struct failure_reporter_t
{
52 utime_t failed_since
; ///< when they think it failed
53 MonOpRequestRef op
; ///< failure op request
55 failure_reporter_t() {}
56 explicit failure_reporter_t(utime_t s
) : failed_since(s
) {}
57 ~failure_reporter_t() { }
60 /// information about all failure reports for one osd
61 struct failure_info_t
{
62 map
<int, failure_reporter_t
> reporters
; ///< reporter -> failed_since etc
63 utime_t max_failed_since
; ///< most recent failed_since
67 utime_t
get_failed_since() {
68 if (max_failed_since
== utime_t() && !reporters
.empty()) {
69 // the old max must have canceled; recalculate.
70 for (map
<int, failure_reporter_t
>::iterator p
= reporters
.begin();
73 if (p
->second
.failed_since
> max_failed_since
)
74 max_failed_since
= p
->second
.failed_since
;
76 return max_failed_since
;
79 // set the message for the latest report. return any old op request we had,
80 // if any, so we can discard it.
81 MonOpRequestRef
add_report(int who
, utime_t failed_since
,
83 map
<int, failure_reporter_t
>::iterator p
= reporters
.find(who
);
84 if (p
== reporters
.end()) {
85 if (max_failed_since
!= utime_t() && max_failed_since
< failed_since
)
86 max_failed_since
= failed_since
;
87 p
= reporters
.insert(map
<int, failure_reporter_t
>::value_type(who
, failure_reporter_t(failed_since
))).first
;
90 MonOpRequestRef ret
= p
->second
.op
;
95 void take_report_messages(list
<MonOpRequestRef
>& ls
) {
96 for (map
<int, failure_reporter_t
>::iterator p
= reporters
.begin();
100 ls
.push_back(p
->second
.op
);
101 p
->second
.op
.reset();
106 MonOpRequestRef
cancel_report(int who
) {
107 map
<int, failure_reporter_t
>::iterator p
= reporters
.find(who
);
108 if (p
== reporters
.end())
109 return MonOpRequestRef();
110 MonOpRequestRef ret
= p
->second
.op
;
112 max_failed_since
= utime_t();
118 class LastEpochClean
{
120 vector
<epoch_t
> epoch_by_pg
;
121 ps_t next_missing
= 0;
122 epoch_t floor
= std::numeric_limits
<epoch_t
>::max();
123 void report(ps_t pg
, epoch_t last_epoch_clean
);
125 std::map
<uint64_t, Lec
> report_by_pool
;
127 void report(const pg_t
& pg
, epoch_t last_epoch_clean
);
128 void remove_pool(uint64_t pool
);
129 epoch_t
get_lower_bound(const OSDMap
& latest
) const;
133 struct osdmap_manifest_t
{
134 // all the maps we have pinned -- i.e., won't be removed unless
135 // they are inside a trim interval.
136 set
<version_t
> pinned
;
138 osdmap_manifest_t() {}
140 version_t
get_last_pinned() const
142 set
<version_t
>::const_reverse_iterator it
= pinned
.crbegin();
143 if (it
== pinned
.crend()) {
149 version_t
get_first_pinned() const
151 set
<version_t
>::const_iterator it
= pinned
.cbegin();
152 if (it
== pinned
.cend()) {
158 bool is_pinned(version_t v
) const
160 return pinned
.find(v
) != pinned
.end();
163 void pin(version_t v
)
168 version_t
get_lower_closest_pinned(version_t v
) const {
169 set
<version_t
>::const_iterator p
= pinned
.lower_bound(v
);
170 if (p
== pinned
.cend()) {
173 if (p
== pinned
.cbegin()) {
181 void encode(bufferlist
& bl
) const
183 ENCODE_START(1, 1, bl
);
188 void decode(bufferlist::const_iterator
& bl
)
195 void decode(bufferlist
& bl
) {
196 auto p
= bl
.cbegin();
200 void dump(Formatter
*f
) {
201 f
->dump_unsigned("first_pinned", get_first_pinned());
202 f
->dump_unsigned("last_pinned", get_last_pinned());
203 f
->open_array_section("pinned_maps");
204 for (auto& i
: pinned
) {
205 f
->dump_unsigned("epoch", i
);
210 WRITE_CLASS_ENCODER(osdmap_manifest_t
);
212 class OSDMonitor
: public PaxosService
,
213 public md_config_obs_t
{
220 const char** get_tracked_conf_keys() const override
;
221 void handle_conf_change(const ConfigProxy
& conf
,
222 const std::set
<std::string
> &changed
) override
;
224 OSDMap::Incremental pending_inc
;
225 map
<int, bufferlist
> pending_metadata
;
226 set
<int> pending_metadata_rm
;
227 map
<int, failure_info_t
> failure_info
;
228 map
<int,utime_t
> down_pending_out
; // osd down -> out
229 bool priority_convert
= false;
230 std::shared_ptr
<PriorityCache::PriCache
> rocksdb_binned_kv_cache
= nullptr;
231 std::shared_ptr
<PriorityCache::Manager
> pcm
= nullptr;
232 ceph::mutex balancer_lock
= ceph::make_mutex("OSDMonitor::balancer_lock");
234 map
<int,double> osd_weight
;
236 using osdmap_key_t
= std::pair
<version_t
, uint64_t>;
237 using osdmap_cache_t
= SimpleLRU
<osdmap_key_t
,
239 std::less
<osdmap_key_t
>,
240 boost::hash
<osdmap_key_t
>>;
241 osdmap_cache_t inc_osd_cache
;
242 osdmap_cache_t full_osd_cache
;
244 bool has_osdmap_manifest
;
245 osdmap_manifest_t osdmap_manifest
;
247 bool check_failures(utime_t now
);
248 bool check_failure(utime_t now
, int target_osd
, failure_info_t
& fi
);
249 void force_failure(int target_osd
, int by
);
251 bool _have_pending_crush();
252 CrushWrapper
&_get_stable_crush();
253 void _get_pending_crush(CrushWrapper
& newcrush
);
261 struct CleanUpmapJob
: public ParallelPGMapper::Job
{
263 const OSDMap
& osdmap
;
264 OSDMap::Incremental
& pending_inc
;
265 // lock to protect pending_inc form changing
266 // when checking is done
267 Mutex pending_inc_lock
= {"CleanUpmapJob::pending_inc_lock"};
269 CleanUpmapJob(CephContext
*cct
, const OSDMap
& om
, OSDMap::Incremental
& pi
)
270 : ParallelPGMapper::Job(&om
),
275 void process(const vector
<pg_t
>& to_check
) override
{
276 vector
<pg_t
> to_cancel
;
277 map
<pg_t
, mempool::osdmap::vector
<pair
<int,int>>> to_remap
;
278 osdmap
.check_pg_upmaps(cct
, to_check
, &to_cancel
, &to_remap
);
279 // don't bother taking lock if nothing changes
280 if (!to_cancel
.empty() || !to_remap
.empty()) {
281 std::lock_guard
l(pending_inc_lock
);
282 osdmap
.clean_pg_upmaps(cct
, &pending_inc
, to_cancel
, to_remap
);
286 void process(int64_t poolid
, unsigned ps_begin
, unsigned ps_end
) override
{}
287 void complete() override
{}
288 }; // public as this will need to be accessible from TestTestOSDMap.cc
292 void create_initial() override
;
293 void get_store_prefixes(std::set
<string
>& s
) const override
;
296 void update_from_paxos(bool *need_bootstrap
) override
;
297 void create_pending() override
; // prepare a new pending
298 void encode_pending(MonitorDBStore::TransactionRef t
) override
;
299 void on_active() override
;
300 void on_restart() override
;
301 void on_shutdown() override
;
303 /* osdmap full map prune */
304 void load_osdmap_manifest();
305 bool should_prune() const;
306 void _prune_update_trimmed(
307 MonitorDBStore::TransactionRef tx
,
309 void prune_init(osdmap_manifest_t
& manifest
);
310 bool _prune_sanitize_options() const;
311 bool is_prune_enabled() const;
312 bool is_prune_supported() const;
313 bool do_prune(MonitorDBStore::TransactionRef tx
);
315 // Priority cache control
316 uint32_t mon_osd_cache_size
= 0; ///< Number of cached OSDMaps
317 uint64_t rocksdb_cache_size
= 0; ///< Cache for kv Db
318 double cache_kv_ratio
= 0; ///< Cache ratio dedicated to kv
319 double cache_inc_ratio
= 0; ///< Cache ratio dedicated to inc
320 double cache_full_ratio
= 0; ///< Cache ratio dedicated to full
321 uint64_t mon_memory_base
= 0; ///< Mon base memory for cache autotuning
322 double mon_memory_fragmentation
= 0; ///< Expected memory fragmentation
323 uint64_t mon_memory_target
= 0; ///< Mon target memory for cache autotuning
324 uint64_t mon_memory_min
= 0; ///< Min memory to cache osdmaps
325 bool mon_memory_autotune
= false; ///< Cache auto tune setting
326 int register_cache_with_pcm();
327 int _set_cache_sizes();
328 int _set_cache_ratios();
329 void _set_new_cache_sizes();
330 void _set_cache_autotuning();
331 int _update_mon_cache_settings();
333 friend struct OSDMemCache
;
334 friend struct IncCache
;
335 friend struct FullCache
;
338 * we haven't delegated full version stashing to paxosservice for some time
339 * now, making this function useless in current context.
341 void encode_full(MonitorDBStore::TransactionRef t
) override
{ }
343 * do not let paxosservice periodically stash full osdmaps, or we will break our
344 * locally-managed full maps. (update_from_paxos loads the latest and writes them
345 * out going forward from there, but if we just synced that may mean we skip some.)
347 bool should_stash_full() override
{
352 * hook into trim to include the oldest full map in the trim transaction
354 * This ensures that anyone post-sync will have enough to rebuild their
357 void encode_trim_extra(MonitorDBStore::TransactionRef tx
, version_t first
) override
;
359 void update_msgr_features();
360 int check_cluster_features(uint64_t features
, stringstream
&ss
);
362 * check if the cluster supports the features required by the
363 * given crush map. Outputs the daemons which don't support it
364 * to the stringstream.
366 * @returns true if the map is passable, false otherwise
368 bool validate_crush_against_features(const CrushWrapper
*newcrush
,
370 void check_osdmap_subs();
371 void share_map_with_random_osd();
373 Mutex prime_pg_temp_lock
= {"OSDMonitor::prime_pg_temp_lock"};
374 struct PrimeTempJob
: public ParallelPGMapper::Job
{
376 PrimeTempJob(const OSDMap
& om
, OSDMonitor
*m
)
377 : ParallelPGMapper::Job(&om
), osdmon(m
) {}
378 void process(int64_t pool
, unsigned ps_begin
, unsigned ps_end
) override
{
379 for (unsigned ps
= ps_begin
; ps
< ps_end
; ++ps
) {
381 osdmon
->prime_pg_temp(*osdmap
, pgid
);
384 void process(const vector
<pg_t
>& pgs
) override
{}
385 void complete() override
{}
387 void maybe_prime_pg_temp();
388 void prime_pg_temp(const OSDMap
& next
, pg_t pgid
);
390 ParallelPGMapper mapper
; ///< for background pg work
391 OSDMapMapping mapping
; ///< pg <-> osd mappings
392 unique_ptr
<ParallelPGMapper::Job
> mapping_job
; ///< background mapping job
393 void start_mapping();
395 void update_logger();
397 void handle_query(PaxosServiceMessage
*m
);
398 bool preprocess_query(MonOpRequestRef op
) override
; // true if processed.
399 bool prepare_update(MonOpRequestRef op
) override
;
400 bool should_propose(double &delay
) override
;
402 version_t
get_trim_to() const override
;
404 bool can_mark_down(int o
);
405 bool can_mark_up(int o
);
406 bool can_mark_out(int o
);
407 bool can_mark_in(int o
);
410 MOSDMap
*build_latest_full(uint64_t features
);
411 MOSDMap
*build_incremental(epoch_t first
, epoch_t last
, uint64_t features
);
412 void send_full(MonOpRequestRef op
);
413 void send_incremental(MonOpRequestRef op
, epoch_t first
);
415 // @param req an optional op request, if the osdmaps are replies to it. so
416 // @c Monitor::send_reply() can mark_event with it.
417 void send_incremental(epoch_t first
, MonSession
*session
, bool onetime
,
418 MonOpRequestRef req
= MonOpRequestRef());
421 void print_utilization(ostream
&out
, Formatter
*f
, bool tree
) const;
423 bool check_source(MonOpRequestRef op
, uuid_d fsid
);
425 bool preprocess_get_osdmap(MonOpRequestRef op
);
427 bool preprocess_mark_me_down(MonOpRequestRef op
);
429 friend class C_AckMarkedDown
;
430 bool preprocess_failure(MonOpRequestRef op
);
431 bool prepare_failure(MonOpRequestRef op
);
432 bool prepare_mark_me_down(MonOpRequestRef op
);
433 void process_failures();
434 void take_all_failures(list
<MonOpRequestRef
>& ls
);
436 bool preprocess_full(MonOpRequestRef op
);
437 bool prepare_full(MonOpRequestRef op
);
439 bool preprocess_boot(MonOpRequestRef op
);
440 bool prepare_boot(MonOpRequestRef op
);
441 void _booted(MonOpRequestRef op
, bool logit
);
443 void update_up_thru(int from
, epoch_t up_thru
);
444 bool preprocess_alive(MonOpRequestRef op
);
445 bool prepare_alive(MonOpRequestRef op
);
446 void _reply_map(MonOpRequestRef op
, epoch_t e
);
448 bool preprocess_pgtemp(MonOpRequestRef op
);
449 bool prepare_pgtemp(MonOpRequestRef op
);
451 bool preprocess_pg_created(MonOpRequestRef op
);
452 bool prepare_pg_created(MonOpRequestRef op
);
454 bool preprocess_pg_ready_to_merge(MonOpRequestRef op
);
455 bool prepare_pg_ready_to_merge(MonOpRequestRef op
);
457 int _check_remove_pool(int64_t pool_id
, const pg_pool_t
&pool
, ostream
*ss
);
458 bool _check_become_tier(
459 int64_t tier_pool_id
, const pg_pool_t
*tier_pool
,
460 int64_t base_pool_id
, const pg_pool_t
*base_pool
,
461 int *err
, ostream
*ss
) const;
462 bool _check_remove_tier(
463 int64_t base_pool_id
, const pg_pool_t
*base_pool
, const pg_pool_t
*tier_pool
,
464 int *err
, ostream
*ss
) const;
466 int _prepare_remove_pool(int64_t pool
, ostream
*ss
, bool no_fake
);
467 int _prepare_rename_pool(int64_t pool
, string newname
);
469 bool enforce_pool_op_caps(MonOpRequestRef op
);
470 bool preprocess_pool_op (MonOpRequestRef op
);
471 bool preprocess_pool_op_create (MonOpRequestRef op
);
472 bool prepare_pool_op (MonOpRequestRef op
);
473 bool prepare_pool_op_create (MonOpRequestRef op
);
474 bool prepare_pool_op_delete(MonOpRequestRef op
);
475 int crush_rename_bucket(const string
& srcname
,
476 const string
& dstname
,
478 void check_legacy_ec_plugin(const string
& plugin
,
479 const string
& profile
) const;
480 int normalize_profile(const string
& profilename
,
481 ErasureCodeProfile
&profile
,
484 int crush_rule_create_erasure(const string
&name
,
485 const string
&profile
,
488 int get_crush_rule(const string
&rule_name
,
491 int get_erasure_code(const string
&erasure_code_profile
,
492 ErasureCodeInterfaceRef
*erasure_code
,
494 int prepare_pool_crush_rule(const unsigned pool_type
,
495 const string
&erasure_code_profile
,
496 const string
&rule_name
,
499 bool erasure_code_profile_in_use(
500 const mempool::osdmap::map
<int64_t, pg_pool_t
> &pools
,
501 const string
&profile
,
503 int parse_erasure_code_profile(const vector
<string
> &erasure_code_profile
,
504 map
<string
,string
> *erasure_code_profile_map
,
506 int prepare_pool_size(const unsigned pool_type
,
507 const string
&erasure_code_profile
,
509 unsigned *size
, unsigned *min_size
,
511 int prepare_pool_stripe_width(const unsigned pool_type
,
512 const string
&erasure_code_profile
,
513 unsigned *stripe_width
,
515 int check_pg_num(int64_t pool
, int pg_num
, int size
, ostream
* ss
);
516 int prepare_new_pool(string
& name
,
518 const string
&crush_rule_name
,
519 unsigned pg_num
, unsigned pgp_num
,
522 const uint64_t target_size_bytes
,
523 const float target_size_ratio
,
524 const string
&erasure_code_profile
,
525 const unsigned pool_type
,
526 const uint64_t expected_num_objects
,
527 FastReadType fast_read
,
529 int prepare_new_pool(MonOpRequestRef op
);
531 void set_pool_flags(int64_t pool_id
, uint64_t flags
);
532 void clear_pool_flags(int64_t pool_id
, uint64_t flags
);
533 bool update_pools_status();
535 string
make_snap_epoch_key(int64_t pool
, epoch_t epoch
);
536 string
make_snap_key(int64_t pool
, snapid_t snap
);
537 string
make_snap_key_value(int64_t pool
, snapid_t snap
, snapid_t num
,
538 epoch_t epoch
, bufferlist
*v
);
539 string
make_snap_purged_key(int64_t pool
, snapid_t snap
);
540 string
make_snap_purged_key_value(int64_t pool
, snapid_t snap
, snapid_t num
,
541 epoch_t epoch
, bufferlist
*v
);
542 bool try_prune_purged_snaps();
543 int lookup_pruned_snap(int64_t pool
, snapid_t snap
,
544 snapid_t
*begin
, snapid_t
*end
);
546 bool prepare_set_flag(MonOpRequestRef op
, int flag
);
547 bool prepare_unset_flag(MonOpRequestRef op
, int flag
);
549 void _pool_op_reply(MonOpRequestRef op
,
550 int ret
, epoch_t epoch
, bufferlist
*blp
=NULL
);
552 struct C_Booted
: public C_MonOp
{
555 C_Booted(OSDMonitor
*cm
, MonOpRequestRef op_
, bool l
=true) :
556 C_MonOp(op_
), cmon(cm
), logit(l
) {}
557 void _finish(int r
) override
{
559 cmon
->_booted(op
, logit
);
560 else if (r
== -ECANCELED
)
562 else if (r
== -EAGAIN
)
565 ceph_abort_msg("bad C_Booted return value");
569 struct C_ReplyMap
: public C_MonOp
{
572 C_ReplyMap(OSDMonitor
*o
, MonOpRequestRef op_
, epoch_t ee
)
573 : C_MonOp(op_
), osdmon(o
), e(ee
) {}
574 void _finish(int r
) override
{
576 osdmon
->_reply_map(op
, e
);
577 else if (r
== -ECANCELED
)
579 else if (r
== -EAGAIN
)
580 osdmon
->dispatch(op
);
582 ceph_abort_msg("bad C_ReplyMap return value");
585 struct C_PoolOp
: public C_MonOp
{
589 bufferlist reply_data
;
590 C_PoolOp(OSDMonitor
* osd
, MonOpRequestRef op_
, int rc
, int e
, bufferlist
*rd
=NULL
) :
591 C_MonOp(op_
), osdmon(osd
), replyCode(rc
), epoch(e
) {
595 void _finish(int r
) override
{
597 osdmon
->_pool_op_reply(op
, replyCode
, epoch
, &reply_data
);
598 else if (r
== -ECANCELED
)
600 else if (r
== -EAGAIN
)
601 osdmon
->dispatch(op
);
603 ceph_abort_msg("bad C_PoolOp return value");
607 bool preprocess_remove_snaps(MonOpRequestRef op
);
608 bool prepare_remove_snaps(MonOpRequestRef op
);
610 int load_metadata(int osd
, map
<string
, string
>& m
, ostream
*err
);
611 void count_metadata(const string
& field
, Formatter
*f
);
613 void reencode_incremental_map(bufferlist
& bl
, uint64_t features
);
614 void reencode_full_map(bufferlist
& bl
, uint64_t features
);
616 void count_metadata(const string
& field
, map
<string
,int> *out
);
618 int get_osd_objectstore_type(int osd
, std::string
*type
);
619 bool is_pool_currently_all_bluestore(int64_t pool_id
, const pg_pool_t
&pool
,
622 // when we last received PG stats from each osd
623 map
<int,utime_t
> last_osd_report
;
624 // TODO: use last_osd_report to store the osd report epochs, once we don't
625 // need to upgrade from pre-luminous releases.
626 map
<int,epoch_t
> osd_epochs
;
627 LastEpochClean last_epoch_clean
;
628 bool preprocess_beacon(MonOpRequestRef op
);
629 bool prepare_beacon(MonOpRequestRef op
);
630 epoch_t
get_min_last_epoch_clean() const;
632 friend class C_UpdateCreatingPGs
;
633 std::map
<int, std::map
<epoch_t
, std::set
<spg_t
>>> creating_pgs_by_osd_epoch
;
634 std::vector
<pg_t
> pending_created_pgs
;
635 // the epoch when the pg mapping was calculated
636 epoch_t creating_pgs_epoch
= 0;
637 creating_pgs_t creating_pgs
;
638 mutable std::mutex creating_pgs_lock
;
640 creating_pgs_t
update_pending_pgs(const OSDMap::Incremental
& inc
,
641 const OSDMap
& nextmap
);
642 unsigned scan_for_creating_pgs(
643 const mempool::osdmap::map
<int64_t,pg_pool_t
>& pools
,
644 const mempool::osdmap::set
<int64_t>& removed_pools
,
646 creating_pgs_t
* creating_pgs
) const;
647 pair
<int32_t, pg_t
> get_parent_pg(pg_t pgid
) const;
648 void update_creating_pgs();
649 void check_pg_creates_subs();
650 epoch_t
send_pg_creates(int osd
, Connection
*con
, epoch_t next
) const;
652 int32_t _allocate_osd_id(int32_t* existing_id
);
655 OSDMonitor(CephContext
*cct
, Monitor
*mn
, Paxos
*p
, const string
& service_name
);
657 void tick() override
; // check state, take actions
659 bool preprocess_command(MonOpRequestRef op
);
660 bool prepare_command(MonOpRequestRef op
);
661 bool prepare_command_impl(MonOpRequestRef op
, const cmdmap_t
& cmdmap
);
663 int validate_osd_create(
666 const bool check_osd_exists
,
667 int32_t* existing_id
,
669 int prepare_command_osd_create(
672 int32_t* existing_id
,
674 void do_osd_create(const int32_t id
, const uuid_d
& uuid
,
675 const string
& device_class
,
677 int prepare_command_osd_purge(int32_t id
, stringstream
& ss
);
678 int prepare_command_osd_destroy(int32_t id
, stringstream
& ss
);
679 int _prepare_command_osd_crush_remove(
680 CrushWrapper
&newcrush
,
685 void do_osd_crush_remove(CrushWrapper
& newcrush
);
686 int prepare_command_osd_crush_remove(
687 CrushWrapper
&newcrush
,
692 int prepare_command_osd_remove(int32_t id
);
693 int prepare_command_osd_new(
695 const cmdmap_t
& cmdmap
,
696 const map
<string
,string
>& secrets
,
700 int prepare_command_pool_set(const cmdmap_t
& cmdmap
,
703 int prepare_command_pool_application(const string
&prefix
,
704 const cmdmap_t
& cmdmap
,
706 int preprocess_command_pool_application(const string
&prefix
,
707 const cmdmap_t
& cmdmap
,
710 int _command_pool_application(const string
&prefix
,
711 const cmdmap_t
& cmdmap
,
716 bool handle_osd_timeouts(const utime_t
&now
,
717 std::map
<int,utime_t
> &last_osd_report
);
719 void send_latest(MonOpRequestRef op
, epoch_t start
=0);
720 void send_latest_now_nodelete(MonOpRequestRef op
, epoch_t start
=0) {
721 op
->mark_osdmon_event(__func__
);
722 send_incremental(op
, start
);
725 void get_removed_snaps_range(
726 epoch_t start
, epoch_t end
,
727 mempool::osdmap::map
<int64_t,OSDMap::snap_interval_set_t
> *gap_removed_snaps
);
729 int get_version(version_t ver
, bufferlist
& bl
) override
;
730 int get_version(version_t ver
, uint64_t feature
, bufferlist
& bl
);
732 int get_version_full(version_t ver
, uint64_t feature
, bufferlist
& bl
);
733 int get_version_full(version_t ver
, bufferlist
& bl
) override
;
734 int get_inc(version_t ver
, OSDMap::Incremental
& inc
);
735 int get_full_from_pinned_map(version_t ver
, bufferlist
& bl
);
737 epoch_t
blacklist(const entity_addrvec_t
& av
, utime_t until
);
738 epoch_t
blacklist(entity_addr_t a
, utime_t until
);
740 void dump_info(Formatter
*f
);
741 int dump_osd_metadata(int osd
, Formatter
*f
, ostream
*err
);
742 void print_nodes(Formatter
*f
);
744 void check_osdmap_sub(Subscription
*sub
);
745 void check_pg_creates_sub(Subscription
*sub
);
747 void do_application_enable(int64_t pool_id
, const std::string
&app_name
,
748 const std::string
&app_key
="",
749 const std::string
&app_value
="");
750 void do_set_pool_opt(int64_t pool_id
, pool_opts_t::key_t opt
,
751 pool_opts_t::value_t
);
753 void add_flag(int flag
) {
754 if (!(osdmap
.flags
& flag
)) {
755 if (pending_inc
.new_flags
< 0)
756 pending_inc
.new_flags
= osdmap
.flags
;
757 pending_inc
.new_flags
|= flag
;
761 void remove_flag(int flag
) {
762 if(osdmap
.flags
& flag
) {
763 if (pending_inc
.new_flags
< 0)
764 pending_inc
.new_flags
= osdmap
.flags
;
765 pending_inc
.new_flags
&= ~flag
;
768 void convert_pool_priorities(void);