fix(cozystack): exclude loop devices from LVM global_filter#215
Conversation
Add /dev/loop to the LVM global_filter so the host does not scan or activate volume groups located inside loop-mounted images. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR adds ChangesLVM Configuration Update
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the LVM configuration in charts/cozystack/templates/_helpers.tpl by adding /dev/loop.* to the global_filter list to exclude loop devices. There are no review comments to evaluate, and I have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
NOT LGTM — the config change itself is correct and safe, but it adds a fourth entry to a list that is pinned by a contract test without extending that test, and it leaves the test's own description of the filter stale.
Business context: prevent the Talos host LVM from scanning/activating volume groups that live inside loop-mounted images (e.g. guest disk images), by rejecting /dev/loop.* in global_filter — consistent with the existing drbd/dm/zd rejects and with how the disk selector already treats loop devices as a virtual class.
Blockers
B1: the new global_filter loop entry is not pinned by its contract test, and the test comment is now stale
File: pkg/engine/contract_machine_test.go:651-653 (assertions) and :632-634 (comment)
Issue: TestContract_Machine_Files_Cozystack pins each filter entry individually — r|^/dev/drbd.*|, r|^/dev/dm-.*|, r|^/dev/zd.*| — but this PR adds r|^/dev/loop.*| to the template (charts/cozystack/templates/_helpers.tpl:113) without adding the matching assertion. The test's doc comment still reads "global_filter that excludes drbd, dm-, zd- devices", which no longer matches what the template emits.
Evidence: go test ./pkg/engine/ -run TestContract_Machine_Files_Cozystack passes on this branch. Because the test asserts only the three original entries, removing r|^/dev/loop.*| from the template would not fail any test — the new behavior is unpinned, while all three sibling entries are pinned.
Impact: a later edit that drops the loop reject would silently regress (the host LVM resumes scanning loop devices, reintroducing the bug this PR fixes) with a green test suite; the stale comment also misdescribes the shipped contract.
Fix: in the same commit, add an assertContains for r|^/dev/loop.*| right after the zd assertion, and update the comment to read "excludes drbd, dm-, zd-, loop devices".
The cozystack preset's machine config rejects /dev/loop devices in the LVM global_filter alongside drbd, dm-, and zd. The contract test pinned the first three entries but not loop, so a regression dropping the loop reject would pass unnoticed and let the host activate volume groups inside loop-mounted images. Assert the loop entry too and refresh the contract comment to match. Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
LGTM — the contract-test gap from the previous review is resolved.
TestContract_Machine_Files_Cozystack now pins r|^/dev/loop.*| alongside drbd/dm/zd, and the contract comment was refreshed to match. Verified that the new assertion fails if the loop reject is dropped from the template, so the filter is now regression-protected. Pushed directly to the branch as a separate commit.
Add
/dev/loopto the LVMglobal_filterin the generated Talos machine config so the host does not scan or activate volume groups located inside loop-mounted images.Summary by CodeRabbit