Skip to content

lvm: Add warning when user specifies invalid VDO index memory size - #1203

Merged
vojtechtrefny merged 1 commit into
storaged-project:masterfrom
vojtechtrefny:master_lvm-vdo-index-size-fix
Aug 11, 2026
Merged

lvm: Add warning when user specifies invalid VDO index memory size#1203
vojtechtrefny merged 1 commit into
storaged-project:masterfrom
vojtechtrefny:master_lvm-vdo-index-size-fix

Conversation

@vojtechtrefny

@vojtechtrefny vojtechtrefny commented Aug 10, 2026

Copy link
Copy Markdown
Member

The invalid values are silently rounded up by LVM.

This was found by our tests mostly by accident, bigger index now needs more disk space so our tests started failing on systems with the latest LVM.

Summary by CodeRabbit

  • Bug Fixes

    • Added validation for VDO index-memory settings during pool creation and conversion.
    • Warns when configured memory is not 256, 512, or 768 MiB, or a multiple of 1024 MiB.
    • Prevents unsupported nonzero index-memory settings from being applied before the operation runs.
  • Tests

    • Updated VDO coverage for current resource requirements and supported index-memory options.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9dfee053-0ccf-4a7f-8c79-110aaf891bf5

📥 Commits

Reviewing files that changed from the base of the PR and between f638658 and db8a5b7.

📒 Files selected for processing (1)
  • tests/_lvm_cases.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/_lvm_cases.py

📝 Walkthrough

Walkthrough

VDO pool creation and conversion now validate nonzero index memory values before LVM operations. The helper warns for values that LVM rounds. VDO tests use a 9 GiB backing loop and accepted index-memory parameters.

Changes

VDO index memory validation

Layer / File(s) Summary
Add the VDO index memory validation helper
src/plugins/lvm/lvm-common.c, src/plugins/lvm/lvm-private.h
The plugin declares and implements validation for accepted VDO index memory values.
Validate pool creation and conversion
src/plugins/lvm/lvm.c, src/plugins/lvm/lvm-dbus.c
Pool creation and conversion validate nonzero index_memory before applying configuration and executing the operation.
Update VDO integration test parameters
tests/_lvm_cases.py
Tests use a 9 GiB backing loop, a 512 MiB index size, and no obsolete explicit index-size arguments.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 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 clearly and concisely describes the main change: warning users about invalid VDO index memory sizes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/_lvm_cases.py (1)

2169-2169: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add dedicated coverage for invalid index-memory warnings.

These changes remove the invalid 300 MiB inputs from the feature-toggle tests. The new 512 MiB test covers only an accepted value. Add a focused test that passes 300 * 1024**2 and verifies that the warning is emitted.

Also applies to: 2195-2195

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/_lvm_cases.py` at line 2169, Add a focused test near the existing VDO
pool creation tests using BlockDev.lvm_vdo_pool_create with 300 * 1024**2 as the
index-memory value, and assert that the expected invalid index-memory warning is
emitted. Keep the feature-toggle tests limited to accepted values such as 512
MiB.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/_lvm_cases.py`:
- Line 2169: Add a focused test near the existing VDO pool creation tests using
BlockDev.lvm_vdo_pool_create with 300 * 1024**2 as the index-memory value, and
assert that the expected invalid index-memory warning is emitted. Keep the
feature-toggle tests limited to accepted values such as 512 MiB.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e8f15575-8fac-4a64-a858-ab40aa52c13c

📥 Commits

Reviewing files that changed from the base of the PR and between 7db5dc3 and f638658.

📒 Files selected for processing (5)
  • src/plugins/lvm/lvm-common.c
  • src/plugins/lvm/lvm-dbus.c
  • src/plugins/lvm/lvm-private.h
  • src/plugins/lvm/lvm.c
  • tests/_lvm_cases.py

tbzatek
tbzatek previously approved these changes Aug 10, 2026

@tbzatek tbzatek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wooo

The invalid values are silently rounded up by LVM.
@vojtechtrefny
vojtechtrefny merged commit b1ba4a2 into storaged-project:master Aug 11, 2026
46 of 47 checks passed
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.

2 participants