From e7406fcba86646a4c3fbac66ee54b52ce3d5a33d Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 6 Oct 2015 13:16:51 -0400 Subject: [PATCH] rbd-replay: improve error messages Fixes: #13221 Backport: hammer Signed-off-by: Jason Dillaman (cherry picked from commit 4f436e10802d7b3c3949b592fec238c189a02c50) --- src/rbd_replay/Replayer.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/rbd_replay/Replayer.cc b/src/rbd_replay/Replayer.cc index 19403e51a3d67..9deb0ffb6e4a2 100644 --- a/src/rbd_replay/Replayer.cc +++ b/src/rbd_replay/Replayer.cc @@ -13,6 +13,7 @@ */ #include "Replayer.hpp" +#include "common/errno.h" #include #include #include @@ -154,19 +155,20 @@ void Replayer::run(const std::string& replay_file) { rados.init(NULL); int r = rados.init_with_context(g_ceph_context); if (r) { - cerr << "Unable to read conf file: " << r << std::endl; + cerr << "Failed to initialize RADOS: " << cpp_strerror(r) << std::endl; goto out; } r = rados.connect(); if (r) { - cerr << "Unable to connect to Rados: " << r << std::endl; + cerr << "Failed to connect to cluster: " << cpp_strerror(r) << std::endl; goto out; } m_ioctx = new librados::IoCtx(); { r = rados.ioctx_create(m_pool_name.c_str(), *m_ioctx); if (r) { - cerr << "Unable to create IoCtx: " << r << std::endl; + cerr << "Failed to open pool " << m_pool_name << ": " + << cpp_strerror(r) << std::endl; goto out2; } m_rbd = new librbd::RBD(); @@ -174,7 +176,7 @@ void Replayer::run(const std::string& replay_file) { ifstream input(replay_file.c_str(), ios::in | ios::binary); if (!input.is_open()) { - cerr << "Unable to open " << replay_file << std::endl; + cerr << "Failed to open " << replay_file << std::endl; exit(1); } -- 2.39.5