From: Lucian Petrut Date: Thu, 19 Nov 2020 14:45:52 +0000 (+0000) Subject: rbd: update "rbd-wnbd show" error handling X-Git-Tag: v16.1.0~488^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bfb0dbf0064888b4f949781b866de9d5923c426b;p=ceph.git 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 --- 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);