void FSMap::print(ostream& out) const
{
- // TODO add a non-json print?
- JSONFormatter f(true);
- f.open_object_section("fsmap");
- dump(&f);
- f.close_section();
- f.flush(out);
+ out << "e" << epoch << std::endl;
+ out << "enable_multiple: " << enable_multiple << std::endl;
+ out << "compat: " << enable_multiple << std::endl;
+ out << " " << std::endl;
+
+ if (filesystems.empty()) {
+ out << "No filesystems configured" << std::endl;
+ return;
+ }
+
+ for (const auto &fs : filesystems) {
+ fs.second->print(out);
+ out << " " << std::endl << " " << std::endl; // Space out a bit
+ }
+
+ if (!standby_daemons.empty()) {
+ out << "Standby daemons:" << std::endl << " " << std::endl;
+ }
+
+ for (const auto &p : standby_daemons) {
+ p.second.print_summary(out);
+ out << std::endl;
+ }
}
void Filesystem::print(std::ostream &out) const
{
- // TODO add a non-json print?
- JSONFormatter f;
- dump(&f);
- f.flush(out);
+ out << "Filesystem '" << mds_map.fs_name
+ << "' (" << fscid << ")" << std::endl;
+ mds_map.print(out);
}
mds_gid_t FSMap::find_standby_for(mds_role_t role, const std::string& name) const
f->dump_unsigned("features", mds_features);
}
+void MDSMap::mds_info_t::print_summary(ostream &out) const
+{
+ out << global_id << ":\t"
+ << addr
+ << " '" << name << "'"
+ << " mds." << rank
+ << "." << inc
+ << " " << ceph_mds_state_name(state)
+ << " seq " << state_seq;
+ if (laggy()) {
+ out << " laggy since " << laggy_since;
+ }
+ if (standby_for_rank != -1 ||
+ !standby_for_name.empty()) {
+ out << " (standby for";
+ //if (standby_for_rank >= 0)
+ out << " rank " << standby_for_rank;
+ if (!standby_for_name.empty()) {
+ out << " '" << standby_for_name << "'";
+ }
+ out << ")";
+ }
+ if (!export_targets.empty()) {
+ out << " export_targets=" << export_targets;
+ }
+}
+
void MDSMap::mds_info_t::generate_test_instances(list<mds_info_t*>& ls)
{
mds_info_t *sample = new mds_info_t();
for (const auto &p : foo) {
const mds_info_t& info = mds_info.at(p.second);
-
- out << p.second << ":\t"
- << info.addr
- << " '" << info.name << "'"
- << " mds." << info.rank
- << "." << info.inc
- << " " << ceph_mds_state_name(info.state)
- << " seq " << info.state_seq;
- if (info.laggy())
- out << " laggy since " << info.laggy_since;
- if (info.standby_for_rank != -1 ||
- !info.standby_for_name.empty()) {
- out << " (standby for";
- //if (info.standby_for_rank >= 0)
- out << " rank " << info.standby_for_rank;
- if (!info.standby_for_name.empty())
- out << " '" << info.standby_for_name << "'";
- out << ")";
- }
- if (!info.export_targets.empty())
- out << " export_targets=" << info.export_targets;
- out << "\n";
+ info.print_summary(out);
+ out << "\n";
}
}