Skip to content

Commit

Permalink
Allow disabling rbd-mirror debug logs
Browse files Browse the repository at this point in the history
For testing the fix to bug[1], Ilia asked to run without debug logs,
since they make the issue much harder to reproduce. Add an environment
variable RBD_MIRROR_DEBUG=0 to disable debug logs. We enable debug logs
by default so issues in CI or developers environment will have useful
logs by default.

The new environment variable may also be useful for developers keeping
an environment for long time and want to avoid collecting hundreds of
megabytes of debug logs.

Example usage:

    # Starting environment without debug logs
    $ RBD_MIRROR_DEBUG=0 drenv start envs/rook.yaml
    ...

    # Disabling debug logs on running environment
    $ RBD_MIRROR_DEBUG=0 addons/rbd-mirror/start dr1 dr2
    Disable rbd-mirror debug logs in cluster 'dr1'
    Disable rbd-mirror debug logs in cluster 'dr2'
    Getting mirroring info site name for cluster 'dr1'
    ...

    # Enabling debug logs on running environment
    $ addons/rbd-mirror/start dr1 dr2
    $ addons/rbd-mirror/start dr1 dr2
    Enable rbd-mirror debug logs in cluster 'dr1'
    Enable rbd-mirror debug logs in cluster 'dr2'
    Getting mirroring info site name for cluster 'dr1'
    ...

[1] https://tracker.ceph.com/issues/65487#note-20

Signed-off-by: Nir Soffer <[email protected]>
  • Loading branch information
nirs authored and raghavendra-talur committed Apr 30, 2024
1 parent 388b9e7 commit 64d0b8c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
19 changes: 17 additions & 2 deletions test/addons/rbd-mirror/start
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ def enable_rbd_mirror_debug_logs(cluster):
ceph.set_config(cluster, "mgr", "mgr/rbd_support/log_level", "debug")


def disable_rbd_mirror_debug_logs(cluster):
print(f"Disable rbd-mirror debug logs in cluster '{cluster}'")
for who in "client.rbd-mirror.a", "client.rbd-mirror-peer":
ceph.rm_config(cluster, who, "debug_ms")
ceph.rm_config(cluster, who, "debug_rbd")
ceph.rm_config(cluster, who, "debug_rbd_mirror")
ceph.rm_config(cluster, who, "log_file")
ceph.rm_config(cluster, "mgr", "mgr/rbd_support/log_level")


def configure_rbd_mirroring(cluster, peer_info):
print(f"Applying rbd mirror secret in cluster '{cluster}'")

Expand Down Expand Up @@ -229,8 +239,13 @@ os.chdir(os.path.dirname(__file__))
cluster1 = sys.argv[1]
cluster2 = sys.argv[2]

enable_rbd_mirror_debug_logs(cluster1)
enable_rbd_mirror_debug_logs(cluster2)
# Run with RBD_MIRROR_DEBUG=0 to disable debug logs.
if os.environ.get("RBD_MIRROR_DEBUG") == "0":
disable_rbd_mirror_debug_logs(cluster1)
disable_rbd_mirror_debug_logs(cluster2)
else:
enable_rbd_mirror_debug_logs(cluster1)
enable_rbd_mirror_debug_logs(cluster2)

cluster1_info = fetch_secret_info(cluster1)
cluster2_info = fetch_secret_info(cluster2)
Expand Down
7 changes: 7 additions & 0 deletions test/drenv/ceph.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ def set_config(cluster, who, option, value):
tool(cluster, "ceph", "config", "set", who, option, value)


def rm_config(cluster, who, option):
"""
See https://docs.ceph.com/en/latest/rados/configuration/ceph-conf/#commands
"""
tool(cluster, "ceph", "config", "rm", who, option)


def tool(cluster, *args):
return kubectl.exec(
"deploy/rook-ceph-tools",
Expand Down

0 comments on commit 64d0b8c

Please sign in to comment.