]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mon/MonClient: improve error message when failing to auth
authorPatrick Donnelly <pdonnell@ibm.com>
Wed, 14 May 2025 23:33:43 +0000 (19:33 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Mon, 5 Jan 2026 21:23:33 +0000 (16:23 -0500)
Currently you just see:

    2025-05-14T23:07:37.244+0000 7f00dedd1640 -1 monclient(hunting): handle_auth_bad_method server allowed_methods [2] but i only support [2]

which is terrible at communicating the problem.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
src/mon/MonClient.cc

index 235472c7973e1c519a73bd73a5771843cc9a2738..e5ff0723ba59cb0b3155c0ea5e4309fcbaed2802 100644 (file)
@@ -1924,8 +1924,16 @@ int MonConnection::handle_auth_bad_method(
   p = std::find_first_of(std::next(p), auth_supported.end(),
                         allowed_methods.begin(), allowed_methods.end());
   if (p == auth_supported.end()) {
-    lderr(cct) << __func__ << " server allowed_methods " << allowed_methods
-              << " but i only support " << auth_supported << dendl;
+    auto s_allowed_methods = std::set<uint32_t>(allowed_methods.begin(), allowed_methods.end());
+    auto s_auth_supported = std::set<uint32_t>(auth_supported.begin(), auth_supported.end());
+    bool is_subset = std::includes(s_allowed_methods.begin(), s_allowed_methods.end(),
+                                   s_auth_supported.begin(), s_auth_supported.end());
+    if (!is_subset) {
+      lderr(cct) << __func__ << " server allowed_methods " << allowed_methods
+                << " and I support " << auth_supported << dendl;
+    } else {
+      lderr(cct) << __func__ << " failed to auth with my available methods: " << cpp_strerror(result) << dendl;
+    }
     return handle_auth_failure(cct);
   }
   auth_method = *p;