Skip to content

mgr/cephadm: Control cephadm.log messages based on a mgr logging flag - #67300

Closed
ashjosh1git wants to merge 3 commits into
ceph:mainfrom
ashjosh1git:ibmceph-5691-fix
Closed

ashjosh1git wants to merge 3 commits into
ceph:mainfrom
ashjosh1git:ibmceph-5691-fix

Conversation

@ashjosh1git

@ashjosh1git ashjosh1git commented Feb 11, 2026 •

Copy link
Copy Markdown
Contributor

User wants to disable the host check-hosts, or gather-facts logs that is being captured every minute in the cephadm.log file. The existing mgr flag mgr/cephadm/log_to_cluster_level does not control the logging by cephadm binary. This patch adds a new mgr flag cephadm_binary_logging_level to control the logging in cephadm.log. The default behaviour would have 'debug' level set, and the repetative messages can be turned off by setting mgr/cephadm/cephadm_binary_logging_level to 'info'. The cephadm_binary_logging_level logging level applies to all cephadm binary invocations by mgr.

Fixes: https://tracker.ceph.com/issues/74872
Signed-off-by: Ashwin M. Joshi [email protected]

  1. The per minute gather-facts repetitive logs continue to appear with default ‘debug’ setting of the flag, and error or warning levels if set.
[ceph: root@ceph-node-0 /]# ceph config get mgr mgr/cephadm/cephadm_binary_logging_level
debug
[ceph: root@ceph-node-0 /]#

2026-02-11 07:14:54,680 7fd4e73d3740 DEBUG --------------------------------------------------------------------------------
cephadm ['--logging-level', 'debug', '--timeout', '895', 'gather-facts']
2026-02-11 07:15:59,977 7fb582bd8740 DEBUG --------------------------------------------------------------------------------
cephadm ['--logging-level', 'debug', '--timeout', '895', 'gather-facts']
  1. The above logs stop with the ‘info’ setting for cephadm_binary_logging_level
[ceph: root@ceph-node-0 /]# ceph config set mgr mgr/cephadm/cephadm_binary_logging_level info
[ceph: root@ceph-node-0 /]# ceph config get mgr mgr/cephadm/cephadm_binary_logging_level
info
[ceph: root@ceph-node-0 /]# 
  1. Command line invocation work as expected with all new logging levels:
[root@ceph-node-0 ~]# cephadm --logging-level info check-host
podman (/usr/bin/podman) version 4.9.4 is present
systemctl is present
lvcreate is present
Unit chronyd.service is enabled and running
Host looks OK
[root@ceph-node-0 ~]# cephadm --logging-level debug check-host
podman (/usr/bin/podman) version 4.9.4 is present
systemctl is present
lvcreate is present
Unit chronyd.service is enabled and running
Host looks OK
[root@ceph-node-0 ~]# cephadm --logging-level warning check-host
podman (/usr/bin/podman) version 4.9.4 is present
systemctl is present
lvcreate is present
Unit chronyd.service is enabled and running
Host looks OK
[root@ceph-node-0 ~]# cephadm --logging-level error check-host
podman (/usr/bin/podman) version 4.9.4 is present
systemctl is present
lvcreate is present
Unit chronyd.service is enabled and running
Host looks OK
[root@ceph-node-0 ~]# 

  1. Other commands work as expected with default debug level
[root@ceph-node-0 ~]# cephadm ceph-volume inventory
Inferring fsid 750dc53a-0b3e-11f1-a55c-525400515ad4

Device Path               Size         Device nodes    rotates available Model name
/dev/sr0                  2.26 MB      sr0             True    False     QEMU DVD-ROM
/dev/vda                  100.00 GB    vda             True    False     
/dev/vdb                  10.00 GB     vdb             True    False     
/dev/zram0                5.77 GB      zram0           False   False     
[root@ceph-node-0 ~]#

And with higher logging levels

[root@ceph-node-0 ~]# cephadm  --logging-level error ceph-volume inventory 
Inferring fsid 750dc53a-0b3e-11f1-a55c-525400515ad4

Device Path               Size         Device nodes    rotates available Model name
/dev/sr0                  2.26 MB      sr0             True    False     QEMU DVD-ROM
/dev/vda                  100.00 GB    vda             True    False     
/dev/vdb                  10.00 GB     vdb             True    False     
/dev/zram0                5.77 GB      zram0           False   False     
[root@ceph-node-0 ~]#

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@ashjosh1git
ashjosh1git requested a review from a team as a code owner February 11, 2026 10:21
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

13 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@adk3798 adk3798 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be going in the right direction. We will need to test for commands the cephadm mgr module calls to the binary where it expects to get info back (e.g. cephadm ls, cephadm ceph-volume inventory) still give us back the correct info in the case we log at a higher level. I think they should, but something that needs to be checked.

Comment thread src/pybind/mgr/cephadm/serve.py Resolved
Comment thread src/cephadm/cephadmlib/logging.py Resolved

@ashjosh1git ashjosh1git left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments incorporated, please review

@rkachach rkachach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes mostly LGTM but I'm worried about using debug as default. Normally in production defaults should be error (or at most info) and debugging should only be switched on when needed.

Comment thread src/cephadm/cephadmlib/context.py Resolved
Comment thread src/cephadm/cephadmlib/logging.py Resolved
Comment thread src/cephadm/cephadm.py Resolved
Comment thread src/pybind/mgr/cephadm/module.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a configurable logging verbosity level for the cephadm binary when invoked remotely by the mgr/cephadm orchestrator, with the goal of reducing noisy host-status / host-check output.

Changes:

  • Add a new mgr module option mgr/cephadm/cephadm_binary_logging_level and plumb it into remote cephadm invocations as --logging-level.
  • Extend the cephadm CLI to accept --logging-level and wire it into cephadm’s logging initialization.
  • Add a cephadm mgr unit test asserting that check-host is invoked with the configured --logging-level.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/pybind/mgr/cephadm/module.py Adds the new mgr option and a type-checking default attribute for it.
src/pybind/mgr/cephadm/serve.py Appends --logging-level <level> to remote cephadm command invocations.
src/cephadm/cephadm.py Adds --logging-level as a global cephadm CLI argument.
src/cephadm/cephadmlib/context.py Adds logging_level to the cephadm context so argparse can populate it.
src/cephadm/cephadmlib/logging.py Attempts to apply logging_level to cephadm’s logging config and gate command-line debug output.
src/pybind/mgr/cephadm/tests/test_cephadm.py Adds a test verifying the mgr passes --logging-level to cephadm check-host.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/cephadm/cephadmlib/logging.py Resolved
Comment on lines +2943 to +2958
class TestCephadmBinaryLoggingLevel:
"""Test that host-status / cephadm binary logs are suppressed based on
mgr/cephadm/cephadm_binary_logging_level.
"""
@pytest.mark.parametrize("logging_level", ['info', 'debug', 'error', 'warning'])
@mock.patch("cephadm.ssh.SSHManager._remote_connection")
@mock.patch("cephadm.ssh.SSHManager._execute_command")
@mock.patch("cephadm.ssh.SSHManager._check_execute_command")
def test_check_host_invokes_cephadm_with_logging_level(
self, check_execute_command, execute_command, remote_connection, cephadm_module, logging_level
):
"""Cephadm binary must be invoked with --logging-level matching
mgr/cephadm/cephadm_binary_logging_level (info, debug, error, warning).
Check that mgr builds the cephadm command with appropriate --logging-level flag
Use check-host as a sample command although all cephadm commands receive the flag.
"""

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class/docstring claims to test that cephadm binary logs are “suppressed”, but the assertions only verify that --logging-level is present in the constructed command. Either adjust the docstring/test name to match what’s actually being asserted, or extend the test to validate the behavioral effect (reduced stderr/log output) so the test covers the intended suppression semantics.

Copilot uses AI. Check for mistakes.
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@ashjosh1git
ashjosh1git deleted the ibmceph-5691-fix branch May 12, 2026 07:51
@ashjosh1git

Copy link
Copy Markdown
Contributor Author

#68859 takes this PR further.

@ashjosh1git

Copy link
Copy Markdown
Contributor Author

Changes mostly LGTM but I'm worried about using debug as default. Normally in production defaults should be error (or at most info) and debugging should only be switched on when needed.

Makes sense. This can be taken in a staged manner since which of the existing default debug logging can be converted to info needs a separate consideration. #68859 takes this PR forward to add infra to control the repetitive logging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants