]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.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)
committerSage Weil <sage@redhat.com>
Thu, 21 Sep 2017 19:50:47 +0000 (15:50 -0400)
Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit 49ca1fff7fc4360d2f3a9cac60c0ba651cbc4750)

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 397303deaafbc24b68e4b0bb4b002a4f635d014b..de41195e565fae202385e2f4e82f919a947861d1 100644 (file)
@@ -2777,6 +2777,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;