From fac1e94cf38c209e251ab1fe9405783ba083bb23 Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Mon, 22 May 2023 10:01:19 +0000 Subject: [PATCH] rbd-wnbd: improve image map error message "rbd-wnbd map" commands are delegated to the centralized ceph-rbd Windows service, which in turn will create the actual image mapping. This allows the daemons to continue running even after the current session ends. rbd-wnbd communicates with the service through a named pipe. If the operation fails, we're only getting an error code. This change will print the according error message based on the error code, suggesting the user to check the logs or use foreground mode ("-f") for additional information. We could also capture the entire subprocess console output and print it in case of errors. This can be quite verbose, so we'll keep it simple for now. Signed-off-by: Lucian Petrut (cherry picked from commit 5bbcfc82970bd3a76536a7dd554096bec70ddc2d) --- src/tools/rbd_wnbd/rbd_wnbd.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tools/rbd_wnbd/rbd_wnbd.cc b/src/tools/rbd_wnbd/rbd_wnbd.cc index 2e8f3ee0434..a9e1604560e 100644 --- a/src/tools/rbd_wnbd/rbd_wnbd.cc +++ b/src/tools/rbd_wnbd/rbd_wnbd.cc @@ -313,8 +313,11 @@ int send_map_request(std::string arguments) { return -EINVAL; } if (reply.status) { - derr << "The ceph service failed to map the image. Error: " - << reply.status << dendl; + derr << "The ceph service failed to map the image. " + << "Check the log file or pass '-f' (foreground mode) " + << "for additional information. " + << "Error: " << cpp_strerror(reply.status) + << dendl; } return reply.status; -- 2.39.5