From bfb0dbf0064888b4f949781b866de9d5923c426b Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Thu, 19 Nov 2020 14:45:52 +0000 Subject: [PATCH] rbd: update "rbd-wnbd show" error handling We'll update the "rbd-wnbd show" command to return -ENOENT when the specified mapping doesn't exist, instead of returning -EINVAL. At the moment, it's impossible to tell if the operation failed because of an error or the mapping simply doesn't exist. Worth mentioning that on Windows, we can use 32b for the exit code, which is a bit more flexible. Signed-off-by: Lucian Petrut --- src/tools/rbd_wnbd/rbd_wnbd.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/rbd_wnbd/rbd_wnbd.cc b/src/tools/rbd_wnbd/rbd_wnbd.cc index eb7a9a52301a4..2468a47324d4f 100644 --- a/src/tools/rbd_wnbd/rbd_wnbd.cc +++ b/src/tools/rbd_wnbd/rbd_wnbd.cc @@ -396,7 +396,10 @@ int load_mapping_config_from_registry(string devpath, Config* cfg) auto reg_key = RegistryKey( g_ceph_context, HKEY_LOCAL_MACHINE, strKey.c_str(), false); if (!reg_key.hKey) { - return -EINVAL; + if (reg_key.missingKey) + return -ENOENT; + else + return -EINVAL; } reg_key.get("devpath", cfg->devpath); -- 2.39.5