]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMap: allow 'pg ls unknown' 24032/head
authorSage Weil <sage@redhat.com>
Tue, 11 Sep 2018 18:36:39 +0000 (13:36 -0500)
committerSage Weil <sage@redhat.com>
Tue, 11 Sep 2018 19:01:22 +0000 (14:01 -0500)
"unknown" is annoying because it is 0 and needs a special case.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/PGMap.cc
src/osd/osd_types.cc

index dbe79bddc29586bb9709d8c4d7a219447534260b..7dd0d1ac6dcbf5de15d1b52355873023a11db6d7 100644 (file)
@@ -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);
+    }
   }
 }
 
index 37ed56cd382e46cc9d7e4420e8c898d21675e9f6..2d0e86e55bde86c9e2d0ef5836760d38deb25d0f 100644 (file)
@@ -968,6 +968,8 @@ boost::optional<uint64_t> 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;