From: Sage Weil Date: Tue, 11 Sep 2018 18:36:39 +0000 (-0500) Subject: mon/PGMap: allow 'pg ls unknown' X-Git-Tag: v14.0.1~312^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F24032%2Fhead;p=ceph.git mon/PGMap: allow 'pg ls unknown' "unknown" is annoying because it is 0 and needs a special case. Signed-off-by: Sage Weil --- diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index dbe79bddc2958..7dd0d1ac6dcbf 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -2056,9 +2056,11 @@ void PGMap::get_filtered_pg_stats(uint64_t state, int64_t poolid, int64_t osdid, continue; if ((osdid >= 0) && !(i->second.is_acting_osd(osdid,primary))) continue; - if (state != (uint64_t)-1 && !(i->second.state & state)) - continue; - pgs.insert(i->first); + if (state == (uint64_t)-1 || // "all" + (i->second.state & state) || // matches a state bit + (state == 0 && i->second.state == 0)) { // matches "unknown" (== 0) + pgs.insert(i->first); + } } } diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 37ed56cd382e4..2d0e86e55bde8 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -968,6 +968,8 @@ boost::optional pg_string_state(const std::string& state) type = PG_STATE_SNAPTRIM_WAIT; else if (state == "snaptrim_error") type = PG_STATE_SNAPTRIM_ERROR; + else if (state == "unknown") + type = 0; else type = boost::none; return type;