]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-objectstore-tool: Better messages for bad --journal-path
authorDavid Zafman <dzafman@redhat.com>
Sat, 9 Sep 2017 00:09:48 +0000 (17:09 -0700)
committerDavid Zafman <dzafman@redhat.com>
Sat, 9 Sep 2017 00:50:46 +0000 (17:50 -0700)
Signed-off-by: David Zafman <dzafman@redhat.com>
qa/standalone/special/ceph_objectstore_tool.py
src/tools/ceph_objectstore_tool.cc

index 2bbb608e0b1669cea21bac5f5f63b3be3565646b..9fdbac90688cb138eaa184a59eb5e01a8fa14b5f 100755 (executable)
@@ -995,6 +995,12 @@ def main(argv):
     cmd = "{path}/ceph-objectstore-tool --journal-path BAD_JOURNAL_PATH --op dump-journal".format(path=CEPH_BIN)
     ERRORS += test_failure(cmd, "journal-path: BAD_JOURNAL_PATH: (2) No such file or directory")
 
+    cmd = (CFSD_PREFIX + "--journal-path BAD_JOURNAL_PATH --op list").format(osd=ONEOSD)
+    ERRORS += test_failure(cmd, "journal-path: BAD_JOURNAL_PATH: No such file or directory")
+
+    cmd = (CFSD_PREFIX + "--journal-path /bin --op list").format(osd=ONEOSD)
+    ERRORS += test_failure(cmd, "journal-path: /bin: (21) Is a directory")
+
     # On import can't use stdin from a terminal
     cmd = (CFSD_PREFIX + "--op import --pgid {pg}").format(osd=ONEOSD, pg=ONEPG)
     ERRORS += test_failure(cmd, "stdin is a tty and no --file filename specified", tty=True)
index 19bac15042d7f4d8090d7e608a3717ad1274de66..7d471a18f16dfbdeac003ebcaf1eaed3b8119a41 100644 (file)
@@ -2772,6 +2772,20 @@ int main(int argc, char **argv)
     return 1;
   }
 
+  //Verify that the journal-path really exists
+  if (type == "filestore") {
+    if (::stat(jpath.c_str(), &st) == -1) {
+      string err = string("journal-path: ") + jpath;
+      perror(err.c_str());
+      return 1;
+    }
+    if (S_ISDIR(st.st_mode)) {
+      cerr << "journal-path: " << jpath << ": "
+          << cpp_strerror(EISDIR) << std::endl;
+      return 1;
+    }
+  }
+
   ObjectStore *fs = ObjectStore::create(g_ceph_context, type, dpath, jpath, flags);
   if (fs == NULL) {
     cerr << "Unable to create store of type " << type << std::endl;