]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-kvstore-tool: nicer failure message on open failure
authorSage Weil <sage@redhat.com>
Thu, 20 Apr 2017 22:08:49 +0000 (18:08 -0400)
committerSage Weil <sage@redhat.com>
Mon, 24 Apr 2017 14:04:00 +0000 (10:04 -0400)
I have been hating this assert for a long time.

Signed-off-by: Sage Weil <sage@redhat.com>
src/tools/ceph_kvstore_tool.cc

index e0efe39e7d4cbbfc9fe1fa78addaffe0b56b427d..0c96a041665813506ceaa372e97dae3456662615 100644 (file)
@@ -37,7 +37,12 @@ class StoreTool
   public:
   StoreTool(string type, const string &path) : store_path(path) {
     KeyValueDB *db_ptr = KeyValueDB::create(g_ceph_context, type, path);
-    assert(!db_ptr->open(std::cerr));
+    int r = db_ptr->open(std::cerr);
+    if (r < 0) {
+      cerr << "failed to open type " << type << " path " << path << ": "
+          << cpp_strerror(r) << std::endl;
+      exit(1);
+    }
     db.reset(db_ptr);
   }