]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: update "rbd-wnbd show" error handling
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Thu, 19 Nov 2020 14:45:52 +0000 (14:45 +0000)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Fri, 20 Nov 2020 12:42:18 +0000 (12:42 +0000)
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 <lpetrut@cloudbasesolutions.com>
src/tools/rbd_wnbd/rbd_wnbd.cc

index eb7a9a52301a4cf010d6f302b3700a0ceca0b887..2468a47324d4f781abd58c90bad2f3619bcc0592 100644 (file)
@@ -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);