Skip to content

lvm2: add debug logging for all LVM2 command lines#994

Open
tasleson wants to merge 1 commit into
snapshotmanager:mainfrom
tasleson:lvm2_central_log
Open

lvm2: add debug logging for all LVM2 command lines#994
tasleson wants to merge 1 commit into
snapshotmanager:mainfrom
tasleson:lvm2_central_log

Conversation

@tasleson

@tasleson tasleson commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Introduce two new debug subsystems for LVM2 command tracing:

--debug=lvm2 Log every command line and its stdout on success.
--debug=lvm2err Log only commands that fail, with their stderr.

All logging is centralised in _Lvm2._run() so every subprocess invocation is covered. Command lines are formatted with shlex.join(). Both subsystems are included in --debug=all but can be enabled independently for fine-grained control.

Resolves: #979

Assisted-by: Claude noreply@anthropic.com

Summary by CodeRabbit

Release Notes

New Features

  • Added new LVM2-specific debug flags and logging subsystems for extended debugging capabilities
  • Extended debug support to include "lvm2" and "lvm2err" debug categories
  • Implemented automatic capture and logging of LVM2 command details including execution information, output, and error diagnostics

@packit-as-a-service

Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo dnf install -y 'dnf*-command(copr)'
  • dnf copr enable packit/snapshotmanager-snapm-994
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@coderabbitai

coderabbitai Bot commented Apr 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@bmr-cymru, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 48 minutes and 56 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cdfd0900-e37d-4d32-bff8-d1923de220b8

📥 Commits

Reviewing files that changed from the base of the PR and between 05645ca and 29b14e4.

📒 Files selected for processing (4)
  • snapm/_snapm.py
  • snapm/command.py
  • snapm/manager/plugins/lvm2.py
  • tests/test_command.py

Walkthrough

The pull request extends the debugging infrastructure by introducing two new debug mask flags (SNAPM_DEBUG_LVM2 and SNAPM_DEBUG_LVM2_ERR) and corresponding logging subsystems. These flags are wired into the command-line debug selector and used in the LVM2 plugin to emit debug logs for executed commands and captured error output.

Changes

Cohort / File(s) Summary
Debug Infrastructure
snapm/_snapm.py, snapm/command.py
Added constants SNAPM_DEBUG_LVM2, SNAPM_DEBUG_LVM2_ERR and subsystem names SNAPM_SUBSYSTEM_LVM2, SNAPM_SUBSYSTEM_LVM2_ERR; updated global debug mask and subsystem mapping; extended command-line debug selector to recognise "lvm2" and "lvm2err" options.
LVM2 Plugin Logging
snapm/manager/plugins/lvm2.py
Added module-level logger and debug logging in _Lvm2._run() to emit command-line strings on execution, decode and log stderr on errors, and conditionally emit failure details to "lvm2err" subsystem based on debug mask.
Test Updates
tests/test_command.py
Updated test_set_debug_list to include "lvm2" and "lvm2err" in the debug selector list assertion.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

enhancement, Debugging, Plugin Integration

Poem

🐰 Hops with glee

New debug flags hop into view,
LVM2 commands now logged too,
When errors arise, they're captured with care,
A rabbit's delight—transparency everywhere! 🔍

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the primary change: adding debug logging for LVM2 command lines, which matches the core objective of centralising LVM2 command logging.
Linked Issues check ✅ Passed The pull request fully addresses issue #979 by implementing central debug logging for all LVM2 command lines in the _Lvm2._run() method, with controllable subsystems (--debug=lvm2 and --debug=lvm2err).
Out of Scope Changes check ✅ Passed All changes are within scope: new debug constants, debug subsystem support in command handling, logging implementation in lvm2.py, and corresponding test updates are all directly related to the central LVM2 debug logging objective.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Introduce two new debug subsystems for LVM2 command tracing:

  --debug=lvm2     Log every command line and its stdout on success.
  --debug=lvm2err  Log only commands that fail, with their stderr.

All logging is centralised in _Lvm2._run() so every subprocess
invocation is covered. Command lines are formatted with shlex.join().
Both subsystems are included in --debug=all but can be enabled
independently for fine-grained control.

Resolves: snapshotmanager#979

Assisted-by: Claude <noreply@anthropic.com>
Signed-off-by: Tony Asleson <tasleson@redhat.com>
@bmr-cymru

Copy link
Copy Markdown
Contributor

Rebased to current main to pick up GitHub CI fix.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lvm2: add central debug logging for LVM2 commands

2 participants