dump_pg_stats_plain(ss, stuck_pg_stats, true);
}
+int PGMap::dump_stuck_pg_stats(
+ stringstream &ds,
+ Formatter *f,
+ int threshold,
+ vector<string>& args) const
+{
+ int stuck_types = 0;
+
+ for (vector<string>::iterator i = args.begin(); i != args.end(); ++i) {
+ if (*i == "inactive")
+ stuck_types |= PGMap::STUCK_INACTIVE;
+ else if (*i == "unclean")
+ stuck_types |= PGMap::STUCK_UNCLEAN;
+ else if (*i == "undersized")
+ stuck_types |= PGMap::STUCK_UNDERSIZED;
+ else if (*i == "degraded")
+ stuck_types |= PGMap::STUCK_DEGRADED;
+ else if (*i == "stale")
+ stuck_types |= PGMap::STUCK_STALE;
+ else {
+ ds << "Unknown type: " << *i << std::endl;
+ return -EINVAL;
+ }
+ }
+
+ utime_t now(ceph_clock_now());
+ utime_t cutoff = now - utime_t(threshold, 0);
+
+ if (!f) {
+ dump_stuck_plain(ds, stuck_types, cutoff);
+ } else {
+ dump_stuck(f, stuck_types, cutoff);
+ f->flush(ds);
+ }
+
+ return 0;
+}
+
void PGMap::dump_osd_perf_stats(Formatter *f) const
{
f->open_array_section("osd_perf_infos");
bool get_stuck_counts(const utime_t cutoff, map<string, int>& note) const;
void dump_stuck(Formatter *f, int types, utime_t cutoff) const;
void dump_stuck_plain(ostream& ss, int types, utime_t cutoff) const;
+ int dump_stuck_pg_stats(stringstream &ds,
+ Formatter *f,
+ int threshold,
+ vector<string>& args) const;
void dump(ostream& ss) const;
void dump_basic(ostream& ss) const;
cmd_getval(g_ceph_context, cmdmap, "threshold", threshold,
int64_t(g_conf->mon_pg_stuck_threshold));
- r = dump_stuck_pg_stats(ds, f.get(), (int)threshold, stuckop_vec);
+ r = pg_map.dump_stuck_pg_stats(ds, f.get(), (int)threshold, stuckop_vec);
if (r < 0)
ss << "failed";
else
}
}
-int PGMonitor::dump_stuck_pg_stats(stringstream &ds,
- Formatter *f,
- int threshold,
- vector<string>& args) const
-{
- int stuck_types = 0;
-
- for (vector<string>::iterator i = args.begin(); i != args.end(); ++i) {
- if (*i == "inactive")
- stuck_types |= PGMap::STUCK_INACTIVE;
- else if (*i == "unclean")
- stuck_types |= PGMap::STUCK_UNCLEAN;
- else if (*i == "undersized")
- stuck_types |= PGMap::STUCK_UNDERSIZED;
- else if (*i == "degraded")
- stuck_types |= PGMap::STUCK_DEGRADED;
- else if (*i == "stale")
- stuck_types |= PGMap::STUCK_STALE;
- else {
- ds << "Unknown type: " << *i << std::endl;
- return -EINVAL;
- }
- }
-
- utime_t now(ceph_clock_now());
- utime_t cutoff = now - utime_t(threshold, 0);
-
- if (!f) {
- pg_map.dump_stuck_plain(ds, stuck_types, cutoff);
- } else {
- pg_map.dump_stuck(f, stuck_types, cutoff);
- f->flush(ds);
- }
-
- return 0;
-}
-
void PGMonitor::check_subs()
{
dout(10) << __func__ << dendl;
epoch_t send_pg_creates(int osd, Connection *con, epoch_t next);
- /**
- * Dump stats from pgs stuck in specified states.
- *
- * @return 0 on success, negative error code on failure
- */
- int dump_stuck_pg_stats(stringstream &ds, Formatter *f,
- int threshold,
- vector<string>& args) const;
-
public:
PGMonitor(Monitor *mn, Paxos *p, const string& service_name)
: PaxosService(mn, p, service_name),