From c676c43db4d2ab1df835bb29514556fef4326716 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Fri, 9 Jun 2017 15:42:47 -0700 Subject: [PATCH] mon: move creating_pgs and reweight_by_utilization into new MonPGStatService Use that throughout the monitor code, so that we can use the PGStatService elsewhere. Signed-off-by: Greg Farnum --- src/mon/MgrMonitor.h | 2 -- src/mon/MgrStatMonitor.cc | 4 ++-- src/mon/MgrStatMonitor.h | 4 ++-- src/mon/Monitor.h | 2 +- src/mon/PGMonitor.cc | 4 ++-- src/mon/PGMonitor.h | 6 +++--- src/mon/PGStatService.h | 42 ++++++++++++++++++++++----------------- 7 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/mon/MgrMonitor.h b/src/mon/MgrMonitor.h index 33981c705c8..ea1a0a91a4a 100644 --- a/src/mon/MgrMonitor.h +++ b/src/mon/MgrMonitor.h @@ -18,8 +18,6 @@ #include "MgrMap.h" #include "PaxosService.h" -class PGStatService; - class MgrMonitor: public PaxosService { MgrMap map; diff --git a/src/mon/MgrStatMonitor.cc b/src/mon/MgrStatMonitor.cc index 773e2e2dff3..a408f54cf1b 100644 --- a/src/mon/MgrStatMonitor.cc +++ b/src/mon/MgrStatMonitor.cc @@ -11,7 +11,7 @@ #include "messages/MStatfs.h" #include "messages/MStatfsReply.h" -class MgrPGStatService : public PGStatService { +class MgrPGStatService : public MonPGStatService { PGMapDigest& digest; public: MgrPGStatService(PGMapDigest& d) : digest(d) {} @@ -63,7 +63,7 @@ MgrStatMonitor::MgrStatMonitor(Monitor *mn, Paxos *p, const string& service_name MgrStatMonitor::~MgrStatMonitor() = default; -PGStatService *MgrStatMonitor::get_pg_stat_service() +MonPGStatService *MgrStatMonitor::get_pg_stat_service() { return pgservice.get(); } diff --git a/src/mon/MgrStatMonitor.h b/src/mon/MgrStatMonitor.h index c6e4bea0c95..7ecbc9d377f 100644 --- a/src/mon/MgrStatMonitor.h +++ b/src/mon/MgrStatMonitor.h @@ -7,7 +7,7 @@ #include "PaxosService.h" #include "mon/PGMap.h" -class PGStatService; +class MonPGStatService; class MgrPGStatService; class MgrStatMonitor : public PaxosService { @@ -65,7 +65,7 @@ public: void print_summary(Formatter *f, std::ostream *ss) const; - PGStatService *get_pg_stat_service(); + MonPGStatService *get_pg_stat_service(); friend class C_Updated; }; diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 27b1dac865d..a7a00642a27 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -170,7 +170,7 @@ public: MgrClient mgr_client; uint64_t mgr_proxy_bytes = 0; // in-flight proxied mgr command message bytes - const PGStatService *pgservice; + const MonPGStatService *pgservice; private: void new_tick(); diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 6937887c5f3..7bf41506dc5 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1172,7 +1172,7 @@ bool PGMonitor::check_sub(Subscription *sub) return true; } -class PGMapStatService : public PGStatService { +class PGMapStatService : public MonPGStatService { const PGMap& pgmap; PGMonitor *pgmon; public: @@ -1311,7 +1311,7 @@ public: } }; -PGStatService *PGMonitor::get_pg_stat_service() +MonPGStatService *PGMonitor::get_pg_stat_service() { if (!pgservice) { pgservice.reset(new PGMapStatService(pg_map, this)); diff --git a/src/mon/PGMonitor.h b/src/mon/PGMonitor.h index 0e2171d3ebc..c025bfff994 100644 --- a/src/mon/PGMonitor.h +++ b/src/mon/PGMonitor.h @@ -33,11 +33,11 @@ using namespace std; #include "mon/MonitorDBStore.h" class MPGStats; -class PGStatService; +class MonPGStatService; class PGMonitor : public PaxosService { PGMap pg_map; - std::unique_ptr pgservice; + std::unique_ptr pgservice; bool do_delete = false; ///< propose deleting pgmap data bool did_delete = false; ///< we already deleted pgmap data @@ -131,7 +131,7 @@ public: void check_subs(); bool check_sub(Subscription *sub); - PGStatService *get_pg_stat_service(); + MonPGStatService *get_pg_stat_service(); private: // no copying allowed diff --git a/src/mon/PGStatService.h b/src/mon/PGStatService.h index ee1b9856775..4fe3b118709 100644 --- a/src/mon/PGStatService.h +++ b/src/mon/PGStatService.h @@ -59,24 +59,6 @@ public: virtual bool is_creating_pg(pg_t pgid) const { ceph_abort(); } - /** - * For upgrades. If the PGMap has newer data than the monitor's new - * creating_pgs (scan_epoch), insert them into the passed pending_creates. - */ - virtual unsigned maybe_add_creating_pgs(epoch_t scan_epoch, - const mempool::osdmap::map& pools, - creating_pgs_t *pending_creates) const { - ceph_abort(); - return 0; - } - /** - * For upgrades. If some PGs are created before all OSDs are luminous - * and start sending MOSDPGCreated, we need to be sync with pgmap - * - */ - virtual void maybe_trim_creating_pgs(creating_pgs_t *creates) const { - ceph_abort(); - } virtual epoch_t get_min_last_epoch_clean() const { ceph_abort(); } @@ -107,6 +89,30 @@ public: ceph_abort(); } +}; + +class MonPGStatService : public PGStatService { +public: + MonPGStatService() : PGStatService() {} + virtual ~MonPGStatService() {} + /** + * For upgrades. If the PGMap has newer data than the monitor's new + * creating_pgs (scan_epoch), insert them into the passed pending_creates. + */ + virtual unsigned maybe_add_creating_pgs(epoch_t scan_epoch, + const mempool::osdmap::map& pools, + creating_pgs_t *pending_creates) const { + ceph_abort(); + return 0; + } + /** + * For upgrades. If some PGs are created before all OSDs are luminous + * and start sending MOSDPGCreated, we need to be sync with pgmap + * + */ + virtual void maybe_trim_creating_pgs(creating_pgs_t *creates) const { + ceph_abort(); + } virtual int reweight_by_utilization(const OSDMap &osd_map, int oload, double max_changef, -- 2.39.5