]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-replay: improve error messages
authorJason Dillaman <dillaman@redhat.com>
Tue, 6 Oct 2015 17:16:51 +0000 (13:16 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 15 Oct 2015 18:27:14 +0000 (14:27 -0400)
Fixes: #13221
Backport: hammer
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 4f436e10802d7b3c3949b592fec238c189a02c50)

src/rbd_replay/Replayer.cc

index 19403e51a3d67ccfcb3965b508214d5dc22321c9..9deb0ffb6e4a2b0d1ecb16903baf68f6c13feb1d 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include "Replayer.hpp"
+#include "common/errno.h"
 #include <boost/foreach.hpp>
 #include <boost/thread/thread.hpp>
 #include <fstream>
@@ -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);
       }