]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-objectstore-tool: Improve some error messages
authorDavid Zafman <dzafman@redhat.com>
Tue, 13 Oct 2015 20:02:40 +0000 (13:02 -0700)
committerDavid Zafman <dzafman@redhat.com>
Fri, 30 Oct 2015 20:01:50 +0000 (13:01 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
src/test/ceph_objectstore_tool.py
src/tools/ceph_objectstore_tool.cc

index 79230d22834f669ee38501df19115130e1cfe025..dbb7004dc1781d1aef260ff9cb4128655a199925 100755 (executable)
@@ -760,7 +760,13 @@ def main(argv):
 
     os.unlink(OTHERFILE)
     cmd = (CFSD_PREFIX + "--op import --file {FOO}").format(osd=ONEOSD, FOO=OTHERFILE)
-    ERRORS += test_failure(cmd, "open: No such file or directory")
+    ERRORS += test_failure(cmd, "file: {FOO}: No such file or directory".format(FOO=OTHERFILE))
+
+    cmd = "./ceph-objectstore-tool --data-path BAD_DATA_PATH --journal-path " + OSDDIR + "/{osd}.journal --op list".format(osd=ONEOSD)
+    ERRORS += test_failure(cmd, "data-path: BAD_DATA_PATH: No such file or directory")
+
+    cmd = "./ceph-objectstore-tool --journal-path BAD_JOURNAL_PATH --op dump-journal"
+    ERRORS += test_failure(cmd, "journal-path: BAD_JOURNAL_PATH: (2) No such file or directory")
 
     # On import can't use stdin from a terminal
     cmd = (CFSD_PREFIX + "--op import --pgid {pg}").format(osd=ONEOSD, pg=ONEPG)
index 66225347fbad5c1e5968dd300c0a02f878aaa2b8..93a4a332bcc682f4a6bd831a8b957f1ab58bc2e1 100644 (file)
@@ -2076,7 +2076,8 @@ int main(int argc, char **argv)
   }
 
   if (file_fd != fd_none && file_fd < 0) {
-    perror("open");
+    string err = string("file: ") + file;
+    perror(err.c_str());
     myexit(1);
   }
 
@@ -2109,15 +2110,21 @@ int main(int argc, char **argv)
   // Special handling for filestore journal, so we can dump it without mounting
   if (op == "dump-journal" && type == "filestore") {
     int ret = mydump_journal(formatter, jpath, g_conf->journal_dio);
+    if (ret < 0) {
+      cerr << "journal-path: " << jpath << ": "
+          << cpp_strerror(ret) << std::endl;
+      myexit(1);
+    }
     formatter->flush(cout);
-    myexit(ret != 0);
+    myexit(0);
   }
 
   //Verify that data-path really exists
   struct stat st;
   if (::stat(dpath.c_str(), &st) == -1) {
-     perror("data-path");
-     myexit(1);
+    string err = string("data-path: ") + dpath;
+    perror(err.c_str());
+    myexit(1);
   }
   //Verify data data-path really is a filestore
   if (type == "filestore") {