]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/ceph-[objectstore|bluestore]-tool: fix reporting on repaired warnings
authorIgor Fedotov <ifedotov@suse.com>
Mon, 20 Jan 2020 23:20:47 +0000 (02:20 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Thu, 23 Jan 2020 15:57:03 +0000 (18:57 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/bluestore_tool.cc
src/tools/ceph_objectstore_tool.cc

index 0b3865e86d4672fe69a84a7e635a022ce32b014e..e23b5b83bb99f113f3ed95eb0fa6a1f4726c4e37 100644 (file)
@@ -8820,7 +8820,12 @@ out_scan:
          << repaired << " repaired, "
          << (errors + warnings - (int)repaired) << " remaining in "
          << duration << " seconds" << dendl;
-  return errors - (int)repaired;
+
+  // In non-repair mode we should return error count only as
+  // it indicates if store status is OK.
+  // In repair mode both errors and warnings are taken into account
+  // since repaired counter relates to them both.
+  return repair ? errors + warnings - (int)repaired : errors;
 }
 
 /// methods to inject various errors fsck can repair
index e9a904502ee7b7935902c60c6da6b00f44f22ad7..66b5a796dde294f4a68ff2c769551db63a9af2ae 100644 (file)
@@ -431,10 +431,10 @@ int main(int argc, char **argv)
       r = bluestore.quick_fix();
     }
     if (r < 0) {
-      cerr << "error from fsck: " << cpp_strerror(r) << std::endl;
+      cerr << action << " failed: " << cpp_strerror(r) << std::endl;
       exit(EXIT_FAILURE);
     } else if (r > 0) {
-      cerr << action << " found " << r << " error(s)" << std::endl;
+      cerr << action << " status: remaining " << r << " error(s) and warning(s)" << std::endl;
       exit(EXIT_FAILURE);
     } else {
       cout << action << " success" << std::endl;
index b534e0ab317b0823d733026c9119db8072039721..9422ad239ebe25818a33e2965c4ea4e9511f92c8 100644 (file)
@@ -3520,10 +3520,10 @@ int main(int argc, char **argv)
       return 1;
     }
     if (r > 0) {
-      cerr << "fsck found " << r << " errors" << std::endl;
+      cerr << "fsck status: " << r << " remaining error(s) and warning(s)" << std::endl;
       return 1;
     }
-    cout << "fsck found no errors" << std::endl;
+    cout << "fsck success" << std::endl;
     return 0;
   }
   if (op == "repair" || op == "repair-deep") {
@@ -3533,10 +3533,10 @@ int main(int argc, char **argv)
       return 1;
     }
     if (r > 0) {
-      cerr << "repair found " << r << " errors" << std::endl;
+      cerr << "repair status: " << r << " remaining error(s) and warning(s)" << std::endl;
       return 1;
     }
-    cout << "repair found no errors" << std::endl;
+    cout << "repair success" << std::endl;
     return 0;
   }
   if (op == "mkfs") {