From 17b699d99dfee94db3789475d60db12b594f6cdf Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 12 May 2017 21:30:43 -0500 Subject: [PATCH] mon/PGStatService: implement pre-luminous methods in parent Many of these are only needed to support PGMonitor. Implement those in the parent and make them ceph_abort() so that the new child can avoid the clutter. Signed-off-by: Sage Weil --- src/mon/MgrMonitor.cc | 57 +++++------------------------------------ src/mon/PGStatService.h | 44 +++++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 62 deletions(-) diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index da818e2997a..a0c84b56b15 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -67,34 +67,14 @@ public: const ceph::unordered_map *get_osd_stat() const { return &parent.osd_stat; } - const ceph::unordered_map *get_pg_stat() const { - return &parent.pg_stat; - } - float get_full_ratio() const { return parent.full_ratio; } - float get_nearfull_ratio() const { return parent.nearfull_ratio; } - - bool have_creating_pgs() const { return !parent.creating_pgs.empty(); } - bool is_creating_pg(pg_t pgid) const { return parent.creating_pgs.count(pgid); } - virtual void maybe_add_creating_pgs(epoch_t scan_epoch, - creating_pgs_t *pending_creates) const { - if (parent.last_pg_scan >= scan_epoch) { - for (auto& pgid : parent.creating_pgs) { - auto st = parent.pg_stat.find(pgid); - assert(st != parent.pg_stat.end()); - auto created = make_pair(st->second.created, st->second.last_scrub_stamp); - // no need to add the pg, if it already exists in creating_pgs - pending_creates->pgs.emplace(pgid, created); - } - } - } - epoch_t get_min_last_epoch_clean() const { return parent.get_min_last_epoch_clean(); } - bool have_full_osds() const { return !parent.full_osds.empty(); } - bool have_nearfull_osds() const { return !parent.nearfull_osds.empty(); } - - size_t get_num_pg_by_osd(int osd) const { return parent.get_num_pg_by_osd(osd); } + size_t get_num_pg_by_osd(int osd) const { + return parent.get_num_pg_by_osd(osd); + } - void print_summary(Formatter *f, ostream *out) const { parent.print_summary(f, out); } + void print_summary(Formatter *f, ostream *out) const { + parent.print_summary(f, out); + } void dump_fs_stats(stringstream *ss, Formatter *f, bool verbose) const { parent.dump_fs_stats(ss, f, verbose); } @@ -102,31 +82,6 @@ public: bool verbose) const { parent.dump_pool_stats_full(osdm, ss, f, verbose); } - - int process_pg_command(const string& prefix, - const map& cmdmap, - const OSDMap& osdmap, - Formatter *f, - stringstream *ss, - bufferlist *odata) { - return process_pg_map_command(prefix, cmdmap, parent, osdmap, f, ss, odata); - } - - int reweight_by_utilization(const OSDMap &osd_map, - int oload, - double max_changef, - int max_osds, - bool by_pg, const set *pools, - bool no_increasing, - mempool::osdmap::map* new_weights, - std::stringstream *ss, - std::string *out_str, - Formatter *f) { - return reweight::by_utilization(osd_map, parent, oload, max_changef, - max_osds, by_pg, pools, no_increasing, - new_weights, ss, out_str, f); - } - }; diff --git a/src/mon/PGStatService.h b/src/mon/PGStatService.h index a23614bfac9..b607af70bf9 100644 --- a/src/mon/PGStatService.h +++ b/src/mon/PGStatService.h @@ -44,21 +44,39 @@ public: virtual const osd_stat_t *get_osd_stat(int osd) const = 0; virtual const ceph::unordered_map *get_osd_stat() const = 0; - virtual const ceph::unordered_map *get_pg_stat() const = 0; - virtual float get_full_ratio() const = 0; - virtual float get_nearfull_ratio() const = 0; - virtual bool have_creating_pgs() const = 0; - virtual bool is_creating_pg(pg_t pgid) const = 0; + virtual const ceph::unordered_map *get_pg_stat() const { + ceph_abort(); + } + virtual float get_full_ratio() const { + ceph_abort(); + } + virtual float get_nearfull_ratio() const { + ceph_abort(); + } + virtual bool have_creating_pgs() const { + ceph_abort(); + } + 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 void maybe_add_creating_pgs(epoch_t scan_epoch, - creating_pgs_t *pending_creates) const = 0; - virtual epoch_t get_min_last_epoch_clean() const = 0; + creating_pgs_t *pending_creates) const { + ceph_abort(); + } + virtual epoch_t get_min_last_epoch_clean() const { + ceph_abort(); + } - virtual bool have_full_osds() const = 0; - virtual bool have_nearfull_osds() const = 0; + virtual bool have_full_osds() const { + ceph_abort(); + } + virtual bool have_nearfull_osds() const { + ceph_abort(); + } virtual size_t get_num_pg_by_osd(int osd) const = 0; virtual void print_summary(Formatter *f, ostream *out) const = 0; @@ -71,7 +89,9 @@ public: const OSDMap& osdmap, Formatter *f, stringstream *ss, - bufferlist *odata) = 0; + bufferlist *odata) { + ceph_abort(); + } virtual int reweight_by_utilization(const OSDMap &osd_map, int oload, @@ -82,7 +102,9 @@ public: mempool::osdmap::map* new_weights, std::stringstream *ss, std::string *out_str, - Formatter *f) = 0; + Formatter *f) { + ceph_abort(); + } }; #endif -- 2.39.5