From: David Zafman Date: Tue, 13 Oct 2015 20:02:40 +0000 (-0700) Subject: ceph-objectstore-tool: Improve some error messages X-Git-Tag: v10.0.0~30^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b0c884ba8b51eedf9def093c61f0f06398101ecc;p=ceph.git ceph-objectstore-tool: Improve some error messages Signed-off-by: David Zafman --- diff --git a/src/test/ceph_objectstore_tool.py b/src/test/ceph_objectstore_tool.py index 79230d22834f..dbb7004dc178 100755 --- a/src/test/ceph_objectstore_tool.py +++ b/src/test/ceph_objectstore_tool.py @@ -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) diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index 66225347fbad..93a4a332bcc6 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -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") {