Skip to content

Commit

Permalink
Merge pull request #5160: mon: pg ls is broken
Browse files Browse the repository at this point in the history
Reviewed-by: Loic Dachary <ldachary@redhat.com>
  • Loading branch information
ldachary committed Jul 19, 2015
2 parents ee0e19d + 1a32379 commit 131c0a9
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion qa/workunits/cephtool/test.sh
Expand Up @@ -1108,7 +1108,7 @@ function test_mon_pg()
ceph pg ls
ceph pg ls 0
ceph pg ls stale
ceph pg ls active stale
ceph pg ls active stale repair recovering
ceph pg ls 0 active
ceph pg ls 0 active stale
ceph pg ls-by-primary osd.0
Expand Down
8 changes: 4 additions & 4 deletions src/mon/MonCommands.h
Expand Up @@ -133,21 +133,21 @@ COMMAND("pg dump_stuck " \
"pg", "r", "cli,rest")
COMMAND("pg ls-by-pool " \
"name=poolstr,type=CephString " \
"name=states,type=CephChoices,strings=active|clean|down|replay|splitting|scrubbing|scrubq|degraded|inconsistent|peering|repair|recovery|backfill_wait|incomplete|stale|remapped|deep_scrub|backfill|backfill_toofull|recovery_wait|undersized,n=N,req=false ", \
"name=states,type=CephChoices,strings=active|clean|down|replay|splitting|scrubbing|scrubq|degraded|inconsistent|peering|repair|recovering|backfill_wait|incomplete|stale|remapped|deep_scrub|backfill|backfill_toofull|recovery_wait|undersized,n=N,req=false ", \
"list pg with pool = [poolname | poolid]", "pg", "r", "cli,rest")
COMMAND("pg ls-by-primary " \
"name=osd,type=CephOsdName " \
"name=pool,type=CephInt,req=false " \
"name=states,type=CephChoices,strings=active|clean|down|replay|splitting|scrubbing|scrubq|degraded|inconsistent|peering|repair|recovery|backfill_wait|incomplete|stale|remapped|deep_scrub|backfill|backfill_toofull|recovery_wait|undersized,n=N,req=false ", \
"name=states,type=CephChoices,strings=active|clean|down|replay|splitting|scrubbing|scrubq|degraded|inconsistent|peering|repair|recovering|backfill_wait|incomplete|stale|remapped|deep_scrub|backfill|backfill_toofull|recovery_wait|undersized,n=N,req=false ", \
"list pg with primary = [osd]", "pg", "r", "cli,rest")
COMMAND("pg ls-by-osd " \
"name=osd,type=CephOsdName " \
"name=pool,type=CephInt,req=false " \
"name=states,type=CephChoices,strings=active|clean|down|replay|splitting|scrubbing|scrubq|degraded|inconsistent|peering|repair|recovery|backfill_wait|incomplete|stale|remapped|deep_scrub|backfill|backfill_toofull|recovery_wait|undersized,n=N,req=false ", \
"name=states,type=CephChoices,strings=active|clean|down|replay|splitting|scrubbing|scrubq|degraded|inconsistent|peering|repair|recovering|backfill_wait|incomplete|stale|remapped|deep_scrub|backfill|backfill_toofull|recovery_wait|undersized,n=N,req=false ", \
"list pg on osd [osd]", "pg", "r", "cli,rest")
COMMAND("pg ls " \
"name=pool,type=CephInt,req=false " \
"name=states,type=CephChoices,strings=active|clean|down|replay|splitting|scrubbing|scrubq|degraded|inconsistent|peering|repair|recovery|backfill_wait|incomplete|stale|remapped|deep_scrub|backfill|backfill_toofull|recovery_wait|undersized,n=N,req=false ", \
"name=states,type=CephChoices,strings=active|clean|down|replay|splitting|scrubbing|scrubq|degraded|inconsistent|peering|repair|recovering|backfill_wait|incomplete|stale|remapped|deep_scrub|backfill|backfill_toofull|recovery_wait|undersized,n=N,req=false ", \
"list pg with specific pool, osd, state", "pg", "r", "cli,rest")
COMMAND("pg map name=pgid,type=CephPgid", "show mapping of pg to osds", \
"pg", "r", "cli,rest")
Expand Down
2 changes: 1 addition & 1 deletion src/mon/PGMap.cc
Expand Up @@ -1426,7 +1426,7 @@ void PGMap::generate_test_instances(list<PGMap*>& o)
}
}

void PGMap::get_filtered_pg_stats(string& state, int64_t poolid, int64_t osdid,
void PGMap::get_filtered_pg_stats(const string& state, int64_t poolid, int64_t osdid,
bool primary, set<pg_t>& pgs)
{
int type = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/mon/PGMap.h
Expand Up @@ -290,7 +290,7 @@ class PGMap {
void dump_osd_blocked_by_stats(Formatter *f) const;
void print_osd_blocked_by_stats(std::ostream *ss) const;

void get_filtered_pg_stats(string& state, int64_t poolid, int64_t osdid,
void get_filtered_pg_stats(const string& state, int64_t poolid, int64_t osdid,
bool primary, set<pg_t>& pgs);
void recovery_summary(Formatter *f, list<string> *psl,
const pool_stat_t& delta_sum) const;
Expand Down
10 changes: 6 additions & 4 deletions src/osd/osd_types.cc
Expand Up @@ -770,7 +770,7 @@ std::string pg_state_string(int state)
return ret;
}

int pg_string_state(std::string state)
int pg_string_state(const std::string& state)
{
int type;
if (state == "active")
Expand All @@ -793,16 +793,18 @@ int pg_string_state(std::string state)
type = PG_STATE_INCONSISTENT;
else if (state == "peering")
type = PG_STATE_PEERING;
else if (state == "recoverying")
else if (state == "repair")
type = PG_STATE_REPAIR;
else if (state == "recovering")
type = PG_STATE_RECOVERING;
else if (state == "backfill_wait")
type = PG_STATE_BACKFILL_WAIT;
else if (state == "incomplete")
type = PG_STATE_INCOMPLETE;
else if (state == "remapped")
type = PG_STATE_REMAPPED;
else if (state == "stale")
type = PG_STATE_STALE;
else if (state == "remapped")
type = PG_STATE_REMAPPED;
else if (state == "deep_scrub")
type = PG_STATE_DEEP_SCRUB;
else if (state == "backfill")
Expand Down
2 changes: 1 addition & 1 deletion src/osd/osd_types.h
Expand Up @@ -772,7 +772,7 @@ inline ostream& operator<<(ostream& out, const osd_stat_t& s) {

std::string pg_state_string(int state);
std::string pg_vector_string(const vector<int32_t> &a);
int pg_string_state(std::string state);
int pg_string_state(const std::string& state);


/*
Expand Down

0 comments on commit 131c0a9

Please sign in to comment.