MCPcopy Create free account
hub / github.com/ceph/ceph / process_pg_map_command

Function process_pg_map_command

src/mon/PGMap.cc:3551–3828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3549}
3550
3551int process_pg_map_command(
3552 const string& orig_prefix,
3553 const cmdmap_t& orig_cmdmap,
3554 const PGMap& pg_map,
3555 const OSDMap& osdmap,
3556 ceph::Formatter *f,
3557 stringstream *ss,
3558 bufferlist *odata)
3559{
3560 string prefix = orig_prefix;
3561 auto cmdmap = orig_cmdmap;
3562
3563 string omap_stats_note =
3564 "\n* NOTE: Omap statistics are gathered during deep scrub and "
3565 "may be inaccurate soon afterwards depending on utilization. See "
3566 "http://docs.ceph.com/en/latest/dev/placement-group/#omap-statistics "
3567 "for further details.\n";
3568 bool omap_stats_note_required = false;
3569
3570 // perhaps these would be better in the parsing, but it's weird
3571 bool primary = false;
3572 if (prefix == "pg dump_json") {
3573 vector<string> v;
3574 v.push_back(string("all"));
3575 cmd_putval(g_ceph_context, cmdmap, "dumpcontents", v);
3576 prefix = "pg dump";
3577 } else if (prefix == "pg dump_pools_json") {
3578 vector<string> v;
3579 v.push_back(string("pools"));
3580 cmd_putval(g_ceph_context, cmdmap, "dumpcontents", v);
3581 prefix = "pg dump";
3582 } else if (prefix == "pg ls-by-primary") {
3583 primary = true;
3584 prefix = "pg ls";
3585 } else if (prefix == "pg ls-by-osd") {
3586 prefix = "pg ls";
3587 } else if (prefix == "pg ls-by-pool") {
3588 prefix = "pg ls";
3589 string poolstr;
3590 cmd_getval(cmdmap, "poolstr", poolstr);
3591 int64_t pool = osdmap.lookup_pg_pool_name(poolstr.c_str());
3592 if (pool < 0) {
3593 *ss << "pool " << poolstr << " does not exist";
3594 return -ENOENT;
3595 }
3596 cmd_putval(g_ceph_context, cmdmap, "pool", pool);
3597 }
3598
3599 stringstream ds;
3600 if (prefix == "pg stat") {
3601 if (f) {
3602 f->open_object_section("pg_summary");
3603 pg_map.print_oneline_summary(f, NULL);
3604 f->close_section();
3605 f->flush(ds);
3606 } else {
3607 ds << pg_map;
3608 }

Callers 1

_handle_commandMethod · 0.85

Calls 15

cmd_putvalFunction · 0.85
pg_string_stateFunction · 0.85
pg_state_stringFunction · 0.85
lookup_pg_pool_nameMethod · 0.80
dump_basicMethod · 0.80
dump_osd_statsMethod · 0.80
dump_pg_statsMethod · 0.80
dump_deltaMethod · 0.80
dump_pg_sum_statsMethod · 0.80
dump_osd_sum_statsMethod · 0.80
have_pg_poolMethod · 0.80
get_filtered_pg_statsMethod · 0.80

Tested by

no test coverage detected