]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-crash: reduce log noise from auth fallback in post_crash() 68283/head
authorKefu Chai <k.chai@proxmox.com>
Thu, 9 Apr 2026 12:52:57 +0000 (20:52 +0800)
committerKefu Chai <k.chai@proxmox.com>
Thu, 9 Apr 2026 13:00:26 +0000 (21:00 +0800)
post_crash() iterates auth_names trying each identity until one
succeeds. Previously it logged a WARNING for every failed attempt,
even when the next name succeeds. This is noisy in deployments
where only a subset of the auth names have keyrings (e.g. manual
deployments with only client.crash, or environments where
client.admin is not accessible to ceph-crash).

Improve the logging:

- For auth failures (EACCES), log at DEBUG level and continue to
  the next name.
- For non-auth failures, log a WARNING and stop immediately —
  trying other names won't help.
- If all names fail authentication, log a single WARNING with the
  last stderr.

Retain the stderr check from a77b47eeeb57 as a safeguard for mgr
commands that may return rc=0 with an error on stderr.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/ceph-crash.in

index 52303c3e8a5ff7e21c9c311f8a83fe1ae3ebeb0d..25d7ca4e0a4ede95674634d5a5a416487a21dbec 100755 (executable)
@@ -3,6 +3,7 @@
 # vim: ts=4 sw=4 expandtab
 
 import argparse
+import errno
 import grp
 import logging
 import os
@@ -56,10 +57,16 @@ def post_crash(path):
         stderr = stderr.decode()
         rc = pr.wait()
         f.close()
-        if rc != 0 or stderr != "":
+        if rc == 0 and stderr == "":
+            break
+        if rc == errno.EACCES:
+            log.debug('post %s as %s failed: %s' % (path, n, stderr))
+        else:
             log.warning('post %s as %s failed: %s' % (path, n, stderr))
-        if rc == 0:
             break
+    else:
+        log.warning('post %s failed: unable to authenticate as %s: %s'
+                    % (path, ', '.join(auth_names), stderr))
     return rc