-
Notifications
You must be signed in to change notification settings - Fork 4
lvm2: Fix "no device" case for _is_lvm_device() and avoid no provider test if /boot is not a mount point #589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Resolves: #588 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
WalkthroughChanged Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Caller
participant LVM as _Lvm2._is_lvm_device
participant FS as Filesystem
participant DM as device-mapper
Caller->>LVM: _is_lvm_device(device)
alt device is absolute path
LVM->>FS: stat(device) — exists?
FS-->>LVM: exists / not exists
alt exists
LVM->>DM: _check_dm_major(dev) → read major
DM-->>LVM: major == DM_MAJOR? (yes/no)
end
else device is mapper name
LVM->>DM: build /dev/mapper/{device} and stat() — exists?
DM-->>LVM: exists / not exists
alt exists
LVM->>DM: _check_dm_major(dev) → read major
DM-->>LVM: major == DM_MAJOR? (yes/no)
end
end
LVM-->>Caller: boolean (is_lvm_device)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
tests/test_manager.py (1)
11-11: Consider usingos.ismount()instead of importingos.pathseparately.Since
osis already imported at line 10, you can useos.path.ismount()without the separate import, or useos.ismount()if available. However, the current approach is also valid and explicit.-import os.pathThen at line 510, use:
@unittest.skipIf(not os.path.ismount("/boot"), "no suitable mount path")This works because
os.pathis automatically available whenosis imported.snapm/manager/plugins/lvm2.py (1)
539-542: Consider adding block device validation for consistency.When the device is not an absolute path, the code only checks if
/dev/mapper/{device}exists but skips the block device and major number validation performed for absolute paths (lines 534-538). Whilst this is likely safe—since entries under/dev/mappershould always be device-mapper devices—adding these checks would make the validation more consistent and robust.Apply this diff to add consistent validation:
else: check_path = path_join(DEV_MAPPER_PREFIX, device) if not path_exists(check_path): return False + st = stat(check_path, follow_symlinks=True) + if not S_ISBLK(st.st_mode): + return False + if dev_major(st.st_rdev) != _get_dm_major(): + return False
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
snapm/manager/plugins/lvm2.py(1 hunks)tests/test_manager.py(2 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 0
File: :0-0
Timestamp: 2025-09-14T02:14:30.316Z
Learning: PR #478 in snapshotmanager/snapm fixes a regression in the LVM2 plugin where `can_snapshot()` method throws `SnapmCalloutError` when probing non-device-mapper devices. The fix adds device major number validation to prevent calling dmsetup on non-dm devices, allowing proper "no provider found" error messages instead of confusing dmsetup errors.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 541
File: snapm/manager/_mounts.py:174-197
Timestamp: 2025-10-22T20:06:54.993Z
Learning: For snapshotmanager/snapm follow-up requests from bmr-cymru, create a GitHub issue with label "enhancement", set/ensure a "type: Task" label, and assign it to bmr-cymru. Include backlinks to the PR and the discussion comment in the issue body.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 0
File: :0-0
Timestamp: 2025-08-25T17:19:19.563Z
Learning: The man page changes mentioned in the AI summary for PR #383 were rebasing artifacts and should be ignored when reviewing this branch - there are no actual man page changes on the bmr-vm-tests branch.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 0
File: :0-0
Timestamp: 2025-08-26T19:07:42.290Z
Learning: In the snapm virt_tests module, verify_lvm_setup() is intended as a lightweight sanity check for essential volumes, not comprehensive validation for every storage layout. The responsibility for testing new layout kickstart fragments lies with the developer submitting them. Adding extensive validation for each layout would be redundant and create clutter.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 383
File: virt_tests/testvm.py:284-296
Timestamp: 2025-08-26T03:42:26.409Z
Learning: In the snapm virt_tests module, the current virt-install --boot configuration using "uefi=on/off" syntax works correctly across all target platforms that bmr-cymru tests on, so compatibility changes to avoid "uefi=off" are not needed.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 478
File: snapm/manager/plugins/lvm2.py:512-518
Timestamp: 2025-09-14T17:36:57.822Z
Learning: The removeprefix() method in Python correctly removes the entire prefix string. For example, "/dev/mapper/rhel-root".removeprefix("/dev/mapper/") returns "rhel-root", not "/rhel-root". The existing LVM2 plugin logic correctly handles device-mapper name extraction.
📚 Learning: 2025-09-14T02:14:30.316Z
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 0
File: :0-0
Timestamp: 2025-09-14T02:14:30.316Z
Learning: PR #478 in snapshotmanager/snapm fixes a regression in the LVM2 plugin where `can_snapshot()` method throws `SnapmCalloutError` when probing non-device-mapper devices. The fix adds device major number validation to prevent calling dmsetup on non-dm devices, allowing proper "no provider found" error messages instead of confusing dmsetup errors.
Applied to files:
snapm/manager/plugins/lvm2.py
📚 Learning: 2025-09-14T17:36:57.822Z
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 478
File: snapm/manager/plugins/lvm2.py:512-518
Timestamp: 2025-09-14T17:36:57.822Z
Learning: The removeprefix() method in Python correctly removes the entire prefix string. For example, "/dev/mapper/rhel-root".removeprefix("/dev/mapper/") returns "rhel-root", not "/rhel-root". The existing LVM2 plugin logic correctly handles device-mapper name extraction.
Applied to files:
snapm/manager/plugins/lvm2.py
📚 Learning: 2025-10-20T21:12:52.344Z
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 541
File: snapm/manager/_mounts.py:372-377
Timestamp: 2025-10-20T21:12:52.344Z
Learning: In snapm/manager/_mounts.py mount operations: do not create missing mount point directories on snapshot filesystems; instead, check if the directory exists with isdir(), log a warning if missing, and skip that mount to avoid modifying the snapshot filesystem unnecessarily.
Applied to files:
tests/test_manager.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (31)
- GitHub Check: rpm-build:centos-stream-10-x86_64
- GitHub Check: rpm-build:fedora-41-x86_64
- GitHub Check: rpm-build:centos-stream-9-x86_64
- GitHub Check: rpm-build:fedora-rawhide-x86_64
- GitHub Check: rpm-build:epel-9-x86_64
- GitHub Check: rpm-build:fedora-43-x86_64
- GitHub Check: rpm-build:fedora-42-x86_64
- GitHub Check: rpm-build:centos-stream-10-x86_64
- GitHub Check: rpm-build:fedora-rawhide-x86_64
- GitHub Check: rpm-build:fedora-42-x86_64
- GitHub Check: rpm-build:fedora-43-x86_64
- GitHub Check: rpm-build:centos-stream-9-x86_64
- GitHub Check: rpm-build:epel-9-x86_64
- GitHub Check: rpm-build:fedora-41-x86_64
- GitHub Check: virt_tests (uefi, lvm-thin, fedora41)
- GitHub Check: virt_tests (bios, lvm-thin, fedora41)
- GitHub Check: virt_tests (bios, lvm, centos-stream9)
- GitHub Check: virt_tests (uefi, lvm, centos-stream10)
- GitHub Check: virt_tests (bios, lvm-thin, centos-stream9)
- GitHub Check: virt_tests (uefi, lvm-thin, fedora42)
- GitHub Check: virt_tests (uefi, lvm-thin, centos-stream10)
- GitHub Check: virt_tests (bios, lvm, fedora42)
- GitHub Check: virt_tests (bios, lvm-thin, centos-stream10)
- GitHub Check: virt_tests (uefi, lvm, centos-stream9)
- GitHub Check: virt_tests (uefi, lvm, fedora41)
- GitHub Check: virt_tests (uefi, lvm, fedora42)
- GitHub Check: virt_tests (bios, lvm, centos-stream10)
- GitHub Check: virt_tests (bios, lvm-thin, fedora42)
- GitHub Check: virt_tests (uefi, lvm-thin, centos-stream9)
- GitHub Check: virt_tests (bios, lvm, fedora41)
- GitHub Check: python-basic-tests
🔇 Additional comments (4)
tests/test_manager.py (1)
510-513: LGTM! Test skip condition properly addresses issue #588.The skip condition correctly ensures this test only runs when
/bootis a mount point, avoiding false failures on systems where/bootis not separately mounted.Based on PR objectives.
snapm/manager/plugins/lvm2.py (3)
523-529: LGTM! Parameter rename improves clarity.The parameter name change from
devpathtodevicebetter reflects that the method now handles both absolute device paths and device-mapper names, supporting the fix for issue #587.Based on PR objectives.
530-538: LGTM! Absolute path validation properly handles non-device filesystems.The validation correctly returns
Falsefor non-device filesystems (e.g., tmpfs) at line 536, addressing issue #587. The checks for existence, block device status, and device-mapper major number are appropriate.Based on PR objectives and retrieved learnings.
544-547: LGTM! Device name extraction logic is correct.The
dm_nameresolution properly handles both/dev/mapper/prefixed paths and bare device-mapper names, ensuring the correct argument is passed to thedmsetupcommand.Based on retrieved learnings.
ca7de0e to
4b37e10
Compare
Before: root@f42-snapm-vm1:~/src/git/snapm# snapm snapset create badset /tmp ERROR - Command failed: Error calling dmsetup: Device does not exist. Command failed. After: root@f42-snapm-vm1:~/src/git/snapm# snapm snapset create badset /tmp ERROR - Command failed: Could not find snapshot provider for /tmp Resolves: #587 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
snapm/manager/plugins/lvm2.py (1)
550-553: Consider simplifying the dm_name derivation.Since
removeprefix()only removes the prefix when it matches (returning the original string otherwise), you could simplify this to:dm_name = device.removeprefix(DEV_MAPPER_PREFIX)This is functionally equivalent, but the current explicit form is also perfectly acceptable and may be clearer about intent.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
snapm/manager/plugins/lvm2.py(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 0
File: :0-0
Timestamp: 2025-09-14T02:14:30.316Z
Learning: PR #478 in snapshotmanager/snapm fixes a regression in the LVM2 plugin where `can_snapshot()` method throws `SnapmCalloutError` when probing non-device-mapper devices. The fix adds device major number validation to prevent calling dmsetup on non-dm devices, allowing proper "no provider found" error messages instead of confusing dmsetup errors.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 541
File: snapm/manager/_mounts.py:174-197
Timestamp: 2025-10-22T20:06:54.993Z
Learning: For snapshotmanager/snapm follow-up requests from bmr-cymru, create a GitHub issue with label "enhancement", set/ensure a "type: Task" label, and assign it to bmr-cymru. Include backlinks to the PR and the discussion comment in the issue body.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 0
File: :0-0
Timestamp: 2025-08-25T17:19:19.563Z
Learning: The man page changes mentioned in the AI summary for PR #383 were rebasing artifacts and should be ignored when reviewing this branch - there are no actual man page changes on the bmr-vm-tests branch.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 0
File: :0-0
Timestamp: 2025-08-26T19:07:42.290Z
Learning: In the snapm virt_tests module, verify_lvm_setup() is intended as a lightweight sanity check for essential volumes, not comprehensive validation for every storage layout. The responsibility for testing new layout kickstart fragments lies with the developer submitting them. Adding extensive validation for each layout would be redundant and create clutter.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 383
File: virt_tests/testvm.py:284-296
Timestamp: 2025-08-26T03:42:26.409Z
Learning: In the snapm virt_tests module, the current virt-install --boot configuration using "uefi=on/off" syntax works correctly across all target platforms that bmr-cymru tests on, so compatibility changes to avoid "uefi=off" are not needed.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 478
File: snapm/manager/plugins/lvm2.py:512-518
Timestamp: 2025-09-14T17:36:57.822Z
Learning: The removeprefix() method in Python correctly removes the entire prefix string. For example, "/dev/mapper/rhel-root".removeprefix("/dev/mapper/") returns "rhel-root", not "/rhel-root". The existing LVM2 plugin logic correctly handles device-mapper name extraction.
📚 Learning: 2025-09-14T02:14:30.316Z
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 0
File: :0-0
Timestamp: 2025-09-14T02:14:30.316Z
Learning: PR #478 in snapshotmanager/snapm fixes a regression in the LVM2 plugin where `can_snapshot()` method throws `SnapmCalloutError` when probing non-device-mapper devices. The fix adds device major number validation to prevent calling dmsetup on non-dm devices, allowing proper "no provider found" error messages instead of confusing dmsetup errors.
Applied to files:
snapm/manager/plugins/lvm2.py
📚 Learning: 2025-09-14T17:36:57.822Z
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 478
File: snapm/manager/plugins/lvm2.py:512-518
Timestamp: 2025-09-14T17:36:57.822Z
Learning: The removeprefix() method in Python correctly removes the entire prefix string. For example, "/dev/mapper/rhel-root".removeprefix("/dev/mapper/") returns "rhel-root", not "/rhel-root". The existing LVM2 plugin logic correctly handles device-mapper name extraction.
Applied to files:
snapm/manager/plugins/lvm2.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (24)
- GitHub Check: rpm-build:centos-stream-10-x86_64
- GitHub Check: rpm-build:epel-9-x86_64
- GitHub Check: rpm-build:fedora-rawhide-x86_64
- GitHub Check: rpm-build:fedora-43-x86_64
- GitHub Check: rpm-build:centos-stream-9-x86_64
- GitHub Check: rpm-build:fedora-41-x86_64
- GitHub Check: rpm-build:fedora-42-x86_64
- GitHub Check: virt_tests (bios, lvm, centos-stream9)
- GitHub Check: virt_tests (uefi, lvm, fedora41)
- GitHub Check: virt_tests (uefi, lvm, centos-stream9)
- GitHub Check: virt_tests (bios, lvm-thin, centos-stream9)
- GitHub Check: virt_tests (uefi, lvm, centos-stream10)
- GitHub Check: virt_tests (bios, lvm-thin, centos-stream10)
- GitHub Check: virt_tests (uefi, lvm-thin, fedora41)
- GitHub Check: virt_tests (bios, lvm, centos-stream10)
- GitHub Check: virt_tests (uefi, lvm, fedora42)
- GitHub Check: virt_tests (bios, lvm-thin, fedora42)
- GitHub Check: virt_tests (uefi, lvm-thin, centos-stream10)
- GitHub Check: virt_tests (bios, lvm, fedora42)
- GitHub Check: virt_tests (bios, lvm, fedora41)
- GitHub Check: virt_tests (uefi, lvm-thin, centos-stream9)
- GitHub Check: virt_tests (bios, lvm-thin, fedora41)
- GitHub Check: virt_tests (uefi, lvm-thin, fedora42)
- GitHub Check: python-basic-tests
🔇 Additional comments (1)
snapm/manager/plugins/lvm2.py (1)
523-570: LGTM! Correctly handles non-device filesystems.The updated implementation properly addresses issue #587 by:
- Returning
Falseearly for non-block devices (e.g., tmpfs) via theS_ISBLKcheck in_check_dm_major- Supporting both absolute device paths and device-mapper names
- Validating path existence before attempting device-major checks
The inner helper
_check_dm_majorcentralises the block device and device-mapper major number validation, making the logic clearer and avoiding duplicatestat()calls.Based on learnings.
4b37e10 to
479f6e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
snapm/manager/plugins/lvm2.py(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 0
File: :0-0
Timestamp: 2025-09-14T02:14:30.316Z
Learning: PR #478 in snapshotmanager/snapm fixes a regression in the LVM2 plugin where `can_snapshot()` method throws `SnapmCalloutError` when probing non-device-mapper devices. The fix adds device major number validation to prevent calling dmsetup on non-dm devices, allowing proper "no provider found" error messages instead of confusing dmsetup errors.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 541
File: snapm/manager/_mounts.py:174-197
Timestamp: 2025-10-22T20:06:54.993Z
Learning: For snapshotmanager/snapm follow-up requests from bmr-cymru, create a GitHub issue with label "enhancement", set/ensure a "type: Task" label, and assign it to bmr-cymru. Include backlinks to the PR and the discussion comment in the issue body.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 0
File: :0-0
Timestamp: 2025-08-26T19:07:42.290Z
Learning: In the snapm virt_tests module, verify_lvm_setup() is intended as a lightweight sanity check for essential volumes, not comprehensive validation for every storage layout. The responsibility for testing new layout kickstart fragments lies with the developer submitting them. Adding extensive validation for each layout would be redundant and create clutter.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 0
File: :0-0
Timestamp: 2025-08-25T17:19:19.563Z
Learning: The man page changes mentioned in the AI summary for PR #383 were rebasing artifacts and should be ignored when reviewing this branch - there are no actual man page changes on the bmr-vm-tests branch.
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 478
File: snapm/manager/plugins/lvm2.py:512-518
Timestamp: 2025-09-14T17:36:57.822Z
Learning: The removeprefix() method in Python correctly removes the entire prefix string. For example, "/dev/mapper/rhel-root".removeprefix("/dev/mapper/") returns "rhel-root", not "/rhel-root". The existing LVM2 plugin logic correctly handles device-mapper name extraction.
📚 Learning: 2025-09-14T02:14:30.316Z
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 0
File: :0-0
Timestamp: 2025-09-14T02:14:30.316Z
Learning: PR #478 in snapshotmanager/snapm fixes a regression in the LVM2 plugin where `can_snapshot()` method throws `SnapmCalloutError` when probing non-device-mapper devices. The fix adds device major number validation to prevent calling dmsetup on non-dm devices, allowing proper "no provider found" error messages instead of confusing dmsetup errors.
Applied to files:
snapm/manager/plugins/lvm2.py
📚 Learning: 2025-09-14T17:36:57.822Z
Learnt from: bmr-cymru
Repo: snapshotmanager/snapm PR: 478
File: snapm/manager/plugins/lvm2.py:512-518
Timestamp: 2025-09-14T17:36:57.822Z
Learning: The removeprefix() method in Python correctly removes the entire prefix string. For example, "/dev/mapper/rhel-root".removeprefix("/dev/mapper/") returns "rhel-root", not "/rhel-root". The existing LVM2 plugin logic correctly handles device-mapper name extraction.
Applied to files:
snapm/manager/plugins/lvm2.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (44)
- GitHub Check: rpm-build:fedora-43-x86_64
- GitHub Check: rpm-build:fedora-rawhide-x86_64
- GitHub Check: rpm-build:centos-stream-10-x86_64
- GitHub Check: rpm-build:centos-stream-9-x86_64
- GitHub Check: rpm-build:fedora-42-x86_64
- GitHub Check: rpm-build:epel-9-x86_64
- GitHub Check: rpm-build:fedora-42-x86_64
- GitHub Check: rpm-build:fedora-41-x86_64
- GitHub Check: rpm-build:fedora-rawhide-x86_64
- GitHub Check: rpm-build:centos-stream-10-x86_64
- GitHub Check: rpm-build:fedora-43-x86_64
- GitHub Check: rpm-build:centos-stream-9-x86_64
- GitHub Check: rpm-build:epel-9-x86_64
- GitHub Check: rpm-build:fedora-41-x86_64
- GitHub Check: rpm-build:fedora-42-x86_64
- GitHub Check: rpm-build:centos-stream-10-x86_64
- GitHub Check: rpm-build:fedora-rawhide-x86_64
- GitHub Check: rpm-build:epel-9-x86_64
- GitHub Check: rpm-build:fedora-43-x86_64
- GitHub Check: rpm-build:centos-stream-9-x86_64
- GitHub Check: rpm-build:fedora-42-x86_64
- GitHub Check: rpm-build:centos-stream-10-x86_64
- GitHub Check: rpm-build:centos-stream-9-x86_64
- GitHub Check: rpm-build:epel-9-x86_64
- GitHub Check: rpm-build:fedora-43-x86_64
- GitHub Check: rpm-build:fedora-rawhide-x86_64
- GitHub Check: rpm-build:fedora-41-x86_64
- GitHub Check: virt_tests (uefi, lvm-thin, centos-stream10)
- GitHub Check: virt_tests (uefi, lvm, fedora42)
- GitHub Check: virt_tests (bios, lvm-thin, fedora42)
- GitHub Check: virt_tests (uefi, lvm-thin, fedora41)
- GitHub Check: virt_tests (uefi, lvm, centos-stream10)
- GitHub Check: virt_tests (bios, lvm-thin, fedora41)
- GitHub Check: virt_tests (bios, lvm-thin, centos-stream10)
- GitHub Check: virt_tests (uefi, lvm, fedora41)
- GitHub Check: virt_tests (uefi, lvm, centos-stream9)
- GitHub Check: virt_tests (bios, lvm, fedora42)
- GitHub Check: virt_tests (bios, lvm-thin, centos-stream9)
- GitHub Check: virt_tests (bios, lvm, centos-stream10)
- GitHub Check: virt_tests (uefi, lvm-thin, fedora42)
- GitHub Check: virt_tests (uefi, lvm-thin, centos-stream9)
- GitHub Check: virt_tests (bios, lvm, centos-stream9)
- GitHub Check: virt_tests (bios, lvm, fedora41)
- GitHub Check: python-basic-tests
🔇 Additional comments (2)
snapm/manager/plugins/lvm2.py (2)
523-537: The helper function approach is sound.The addition of the
_check_dm_major()helper centralises the device-major validation logic. The rename fromdevpathtodevicebetter reflects the broader input types now accepted (absolute paths or mapper names).Note:
stat()at line 532 could raiseOSErrorfor permission issues or other filesystem errors beyond non-existence. Whilst this may be acceptable (as it signals a genuine error condition), consider whether explicit error handling would improve robustness.
539-549: Correctly handles non-device filesystems.The dual-path logic properly addresses issue #587:
- Absolute paths are validated directly
- Relative names (assumed to be mapper names) are validated under
/dev/mapper/- Non-device filesystems (e.g., tmpfs) return
Falseearly without invoking dmsetupThis prevents the "Device does not exist" errors mentioned in the PR objectives.
Resolves: #587
Resolves: #588
Summary by CodeRabbit
Bug Fixes
Tests