@@ -775,7 +775,8 @@ class ImageRequestGenerator {
775775 librbd::RBD rbd;
776776 int r = rbd.list2 (m_io_ctx, &m_images);
777777 if (r < 0 && r != -ENOENT) {
778- std::cerr << " rbd: failed to list images within pool" << std::endl;
778+ std::cerr << " rbd: failed to list images within pool: "
779+ << cpp_strerror (r) << std::endl;
779780 return r;
780781 }
781782
@@ -929,7 +930,8 @@ int execute_peer_bootstrap_import(
929930 fd = open (token_path.c_str (), O_RDONLY|O_BINARY);
930931 if (fd < 0 ) {
931932 r = -errno;
932- std::cerr << " rbd: error opening " << token_path << std::endl;
933+ std::cerr << " rbd: error opening " << token_path << " : "
934+ << cpp_strerror (r) << std::endl;
933935 return r;
934936 }
935937 }
@@ -967,7 +969,8 @@ int execute_peer_bootstrap_import(
967969 std::cerr << " rbd: mirroring is not enabled on remote peer" << std::endl;
968970 return r;
969971 } else if (r < 0 ) {
970- std::cerr << " rbd: failed to import peer bootstrap token" << std::endl;
972+ std::cerr << " rbd: failed to import peer bootstrap token: "
973+ << cpp_strerror (r) << std::endl;
971974 return r;
972975 }
973976
@@ -1027,7 +1030,8 @@ int execute_peer_add(const po::variables_map &vm,
10271030 std::vector<librbd::mirror_peer_site_t > mirror_peers;
10281031 r = rbd.mirror_peer_site_list (io_ctx, &mirror_peers);
10291032 if (r < 0 ) {
1030- std::cerr << " rbd: failed to list mirror peers" << std::endl;
1033+ std::cerr << " rbd: failed to list mirror peers: "
1034+ << cpp_strerror (r) << std::endl;
10311035 return r;
10321036 }
10331037
@@ -1059,7 +1063,8 @@ int execute_peer_add(const po::variables_map &vm,
10591063 std::cerr << " rbd: mirror peer already exists" << std::endl;
10601064 return r;
10611065 } else if (r < 0 ) {
1062- std::cerr << " rbd: error adding mirror peer" << std::endl;
1066+ std::cerr << " rbd: error adding mirror peer: "
1067+ << cpp_strerror (r) << std::endl;
10631068 return r;
10641069 }
10651070
@@ -1111,7 +1116,8 @@ int execute_peer_remove(const po::variables_map &vm,
11111116 librbd::RBD rbd;
11121117 r = rbd.mirror_peer_site_remove (io_ctx, uuid);
11131118 if (r < 0 ) {
1114- std::cerr << " rbd: error removing mirror peer" << std::endl;
1119+ std::cerr << " rbd: error removing mirror peer: "
1120+ << cpp_strerror (r) << std::endl;
11151121 return r;
11161122 }
11171123 return 0 ;
@@ -1208,7 +1214,8 @@ int execute_peer_set(const po::variables_map &vm,
12081214 std::vector<librbd::mirror_peer_site_t > mirror_peers;
12091215 r = rbd.mirror_peer_site_list (io_ctx, &mirror_peers);
12101216 if (r < 0 ) {
1211- std::cerr << " rbd: failed to list mirror peers" << std::endl;
1217+ std::cerr << " rbd: failed to list mirror peers: "
1218+ << cpp_strerror (r) << std::endl;
12121219 return r;
12131220 }
12141221
@@ -1375,16 +1382,16 @@ int execute_enable(const po::variables_map &vm,
13751382 std::string original_remote_namespace;
13761383 r = rbd.mirror_remote_namespace_get (io_ctx, &original_remote_namespace);
13771384 if (r < 0 ) {
1378- std::cerr << " rbd: failed to get the current remote namespace. "
1379- << std::endl;
1385+ std::cerr << " rbd: failed to get the current remote namespace: "
1386+ << cpp_strerror (r) << std::endl;
13801387 return r;
13811388 }
13821389
13831390 if (original_remote_namespace != remote_namespace) {
13841391 r = rbd.mirror_remote_namespace_set (io_ctx, remote_namespace);
13851392 if (r < 0 ) {
1386- std::cerr << " rbd: failed to set the remote namespace. "
1387- << std::endl;
1393+ std::cerr << " rbd: failed to set the remote namespace: "
1394+ << cpp_strerror (r) << std::endl;
13881395 return r;
13891396 }
13901397 }
0 commit comments