From 0d571a2ba80c4e2e03ebbf92e9564a341bd56f8f 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 (cherry picked from commit 9812319616056a92750d3c89151445353f0fb501) --- 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, 35 insertions(+), 29 deletions(-) diff --git a/src/mon/MgrMonitor.h b/src/mon/MgrMonitor.h index 33981c705c89e..a09e10919321e 100644 --- a/src/mon/MgrMonitor.h +++ b/src/mon/MgrMonitor.h @@ -18,7 +18,7 @@ #include "MgrMap.h" #include "PaxosService.h" -class PGStatService; +class MonPGStatService; class MgrMonitor: public PaxosService { diff --git a/src/mon/MgrStatMonitor.cc b/src/mon/MgrStatMonitor.cc index b82ce6084ceee..9245219f048f7 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 c6e4bea0c95f8..7ecbc9d377f5d 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 0d3a9080e812c..c2fdae7af8c71 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 fc46cbf92d069..41aea591cfe02 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1169,7 +1169,7 @@ bool PGMonitor::check_sub(Subscription *sub) return true; } -class PGMapStatService : public PGStatService { +class PGMapStatService : public MonPGStatService { const PGMap& pgmap; PGMonitor *pgmon; public: @@ -1308,7 +1308,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 0e2171d3ebce1..c025bfff994b7 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 ee1b9856775c4..4fe3b11870957 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