Skip to content

lvm: Deduplicate LVs by VG+LV name, not LV name alone - #1229

Merged
vojtechtrefny merged 1 commit into
storaged-project:masterfrom
Vaibhavbhope:fix/bd-lvm-lvs-cross-vg-dedup
Nov 19, 2026
Merged

vojtechtrefny merged 1 commit into
storaged-project:masterfrom
Vaibhavbhope:fix/bd-lvm-lvs-cross-vg-dedup

Conversation

@Vaibhavbhope

@Vaibhavbhope Vaibhavbhope commented Nov 19, 2026 •

Copy link
Copy Markdown

Summary

  • bd_lvm_lvs / bd_lvm_lvs_tree currently treat multi-segment lvs rows as duplicates using only lv_name (from lvm: Do not include duplicate entries in bd_lvm_lvs output #671). That also drops legitimate same-named LVs that live in different VGs.
  • When Anaconda/blivet calls bd_lvm_lvs(NULL), a second VG’s thin pool (e.g. vgold/tpool0 vs vgnew/tpool0) can be omitted, and blivet then raises KeyError looking up the pool while resolving thin LVs.
  • Deduplicate / merge only when both vg_name and lv_name match. Multi-segment duplicates within one LV are still collapsed.

Test plan

  • Added test_lvs_same_name_different_vgs (BlockDev.lvm_lvs(None) must return both VGs’ LVs with the same name)
  • Upstream CI
  • Verified the same fix end-to-end against RHEL installer images with dual VGs sharing thin-pool/LV names (blivet reset() no longer KeyErrors)

Related

Fixes the libblockdev side of RHEL Anaconda failures with shared LV names across VGs (RHEL-305266 / RHEL-305267).

Made with Cursor

Summary by CodeRabbit

  • Bug Fixes
    • Logical volumes with the same name in different volume groups are now listed separately, with each volume associated with its correct group.
    • System-wide logical volume listings now include both volumes instead of treating one as a duplicate.

bd_lvm_lvs and bd_lvm_lvs_tree skipped multi-segment duplicates using
only lv_name, which dropped same-named LVs from different VGs. Blivet
then KeyErrors looking up thin pools such as vgold-tpool0 during
Anaconda storage discovery.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

LVM listing and tree processing now distinguish logical volumes by both volume group name and logical volume name. A test covers same-named logical volumes in different volume groups.

Changes: LVM logical volume listing

Layer / File(s) Summary
Match logical volumes by VG and LV
src/plugins/lvm/lvm.c, tests/_lvm_cases.py
bd_lvm_lvs checks both names when detecting duplicates, and bd_lvm_lvs_tree merges segment entries only when both names match. The test checks that system-wide listing returns both same-named LVs with their respective VG names.

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

Merge Risk: Minimal · up to 6988e

This change stops same-named logical volumes in different volume groups from being dropped or merged during LVM listing. No concrete merge-blocking risk was found; the new test has not yet been run in CI.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title states the main change: LVs are now deduplicated by the combined VG name and LV name instead of the LV name alone. The raw summary and PR objectives both describe this change to bd_lvm_lvs a…
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.
Full details: Title check

Explanation

The title states the main change: LVs are now deduplicated by the combined VG name and LV name instead of the LV name alone. The raw summary and PR objectives both describe this change to bd_lvm_lvs and bd_lvm_lvs_tree, plus the added test for same-named LVs in different VGs. The title is specific and matches the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 282f3a6 and 6988e23.

Files selected for processing: 2

  • src/plugins/lvm/lvm.c
  • tests/_lvm_cases.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@vojtechtrefny vojtechtrefny 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.

LGTM, thank you!

@vojtechtrefny
vojtechtrefny merged commit 092f776 into storaged-project:master Nov 19, 2026
35 of 42 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.

3 participants