From: Sage Weil Date: Sat, 26 Aug 2017 19:13:54 +0000 (-0400) Subject: mon: collapse MonPGStatService into PGStatService X-Git-Tag: v13.0.1~1005^2~31 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cea8ca9c5f3dc02509a6b12b9923d7ad8b92b36a;p=ceph.git mon: collapse MonPGStatService into PGStatService Signed-off-by: Sage Weil --- diff --git a/src/mon/MgrStatMonitor.cc b/src/mon/MgrStatMonitor.cc index 12b10eb2650d..2ed996aa9218 100644 --- a/src/mon/MgrStatMonitor.cc +++ b/src/mon/MgrStatMonitor.cc @@ -11,7 +11,7 @@ #include "messages/MStatfsReply.h" #include "messages/MServiceMap.h" -class MgrPGStatService : public MonPGStatService { +class MgrPGStatService : public PGStatService { PGMapDigest& digest; public: MgrPGStatService(PGMapDigest& d) : digest(d) {} @@ -64,7 +64,7 @@ MgrStatMonitor::MgrStatMonitor(Monitor *mn, Paxos *p, const string& service_name MgrStatMonitor::~MgrStatMonitor() = default; -MonPGStatService *MgrStatMonitor::get_pg_stat_service() +PGStatService *MgrStatMonitor::get_pg_stat_service() { return pgservice.get(); } diff --git a/src/mon/MgrStatMonitor.h b/src/mon/MgrStatMonitor.h index 157a415914c4..03c2e8cdf2c0 100644 --- a/src/mon/MgrStatMonitor.h +++ b/src/mon/MgrStatMonitor.h @@ -8,7 +8,7 @@ #include "mon/PGMap.h" #include "mgr/ServiceMap.h" -class MonPGStatService; +class PGStatService; class MgrPGStatService; class MgrStatMonitor : public PaxosService { @@ -67,7 +67,7 @@ public: void print_summary(Formatter *f, std::ostream *ss) const; - MonPGStatService *get_pg_stat_service(); + PGStatService *get_pg_stat_service(); const ServiceMap& get_service_map() { return service_map; } diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 9bb702d27248..7bd17021305b 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -173,7 +173,7 @@ public: MgrClient mgr_client; uint64_t mgr_proxy_bytes = 0; // in-flight proxied mgr command message bytes - const MonPGStatService *pgservice; + const PGStatService *pgservice; private: void new_tick(); diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 256d03abe8ee..d8f2514bf96c 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -3565,11 +3565,6 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) else rdata.append(ds); } - else if (prefix == "osd perf" || - prefix == "osd blocked-by") { - r = mon->pgservice->process_pg_command(prefix, cmdmap, - osdmap, f.get(), &ss, &rdata); - } else if (prefix == "osd dump" || prefix == "osd tree" || prefix == "osd ls" || @@ -4524,9 +4519,6 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op) } } r = 0; - } else if (prefix == "osd pool stats") { - r = mon->pgservice->process_pg_command(prefix, cmdmap, - osdmap, f.get(), &ss, &rdata); } else if (prefix == "osd pool get-quota") { string pool_name; cmd_getval(g_ceph_context, cmdmap, "pool", pool_name); @@ -10633,75 +10625,6 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, wait_for_finished_proposal( op, new Monitor::C_Command(mon, op, 0, rs, get_last_committed() + 1)); return true; - } else if (prefix == "osd reweight-by-pg" || - prefix == "osd reweight-by-utilization" || - prefix == "osd test-reweight-by-pg" || - prefix == "osd test-reweight-by-utilization") { - bool by_pg = - prefix == "osd reweight-by-pg" || prefix == "osd test-reweight-by-pg"; - bool dry_run = - prefix == "osd test-reweight-by-pg" || - prefix == "osd test-reweight-by-utilization"; - int64_t oload; - cmd_getval(g_ceph_context, cmdmap, "oload", oload, int64_t(120)); - set pools; - vector poolnamevec; - cmd_getval(g_ceph_context, cmdmap, "pools", poolnamevec); - for (unsigned j = 0; j < poolnamevec.size(); j++) { - int64_t pool = osdmap.lookup_pg_pool_name(poolnamevec[j]); - if (pool < 0) { - ss << "pool '" << poolnamevec[j] << "' does not exist"; - err = -ENOENT; - goto reply; - } - pools.insert(pool); - } - double max_change = g_conf->mon_reweight_max_change; - cmd_getval(g_ceph_context, cmdmap, "max_change", max_change); - if (max_change <= 0.0) { - ss << "max_change " << max_change << " must be positive"; - err = -EINVAL; - goto reply; - } - int64_t max_osds = g_conf->mon_reweight_max_osds; - cmd_getval(g_ceph_context, cmdmap, "max_osds", max_osds); - if (max_osds <= 0) { - ss << "max_osds " << max_osds << " must be positive"; - err = -EINVAL; - goto reply; - } - string no_increasing; - cmd_getval(g_ceph_context, cmdmap, "no_increasing", no_increasing); - string out_str; - mempool::osdmap::map new_weights; - err = mon->pgservice->reweight_by_utilization(osdmap, - oload, - max_change, - max_osds, - by_pg, - pools.empty() ? NULL : &pools, - no_increasing == "--no-increasing", - &new_weights, - &ss, &out_str, f.get()); - if (err >= 0) { - dout(10) << "reweight::by_utilization: finished with " << out_str << dendl; - } - if (f) - f->flush(rdata); - else - rdata.append(out_str); - if (err < 0) { - ss << "FAILED reweight-by-pg"; - } else if (err == 0 || dry_run) { - ss << "no change"; - } else { - ss << "SUCCESSFUL reweight-by-pg"; - pending_inc.new_weight = std::move(new_weights); - wait_for_finished_proposal( - op, - new Monitor::C_Command(mon, op, 0, rs, rdata, get_last_committed() + 1)); - return true; - } } else if (prefix == "osd force-create-pg") { pg_t pgid; string pgidstr; diff --git a/src/mon/PGStatService.h b/src/mon/PGStatService.h index f179b9c767f0..150f7d88edbb 100644 --- a/src/mon/PGStatService.h +++ b/src/mon/PGStatService.h @@ -34,7 +34,7 @@ public: virtual ~PGStatService() {} // FIXME: Kill this once we rip out PGMonitor post-luminous /** returns true if the underlying data is readable. Always true - * post-luminous, but not when we are redirecting to the PGMonitor + * post-luminous, but not when we are redirecting to the yPGMonitor */ virtual bool is_readable() const { return true; } virtual const pool_stat_t* get_pool_stat(int64_t poolid) const = 0; @@ -81,34 +81,6 @@ public: virtual void dump_pool_stats(const OSDMap& osdm, stringstream *ss, Formatter *f, bool verbose) const = 0; - virtual int process_pg_command(const string& prefix, - const map& cmdmap, - const OSDMap& osdmap, - Formatter *f, - stringstream *ss, - bufferlist *odata) const { - ceph_abort(); - } - -}; - -class MonPGStatService : virtual public PGStatService { -public: - MonPGStatService() : PGStatService() {} - virtual ~MonPGStatService() {} - - virtual 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) const { - ceph_abort(); - } }; #endif