ceph-objectstore-tool: Improve some error messages

Signed-off-by: David Zafman <dzafman@redhat.com>
This commit is contained in:
David Zafman 2015-10-13 13:02:40 -07:00
parent 0564f39826
commit b0c884ba8b
2 changed files with 18 additions and 5 deletions

View File

@ -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)

View 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") {