Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions library/blivet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,9 @@
if self._device:
return

if self._blivet_pool._device and self._blivet_pool._device.type != "lvmvg":
raise BlivetAnsibleError("LVM volume can be placed only on LVM pool")

Check warning on line 1179 in library/blivet.py

View check run for this annotation

Codecov / codecov/patch

library/blivet.py#L1178-L1179

Added lines #L1178 - L1179 were not covered by tests

thin_pool = self._volume.get('thin')
use_vdo = self._volume['deduplication'] or self._volume['compression']
use_lvmraid = self._volume['raid_level']
Expand Down
28 changes: 28 additions & 0 deletions tests/tests_lvm_errors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,31 @@
type: lvm
disks: "{{ unused_disks }}"
state: absent

- name: Test for correct handling of pool and volume type mismatch
include_tasks: verify-role-failed.yml
vars:
storage_safe_mode: false
__storage_failed_regex: LVM volume can be placed only on LVM pool
__storage_failed_msg: Role did not report that wrong pool type was selected
__storage_failed_params:
storage_pools:
- name: foo
disks: "{{ unused_disks }}"
type: partition
volumes:
- name: test1
type: lvm
size: "{{ volume1_size }}"
mount_point: "{{ mount_location1 }}"

- name: Clean up
include_role:
name: linux-system-roles.storage
vars:
storage_safe_mode: false
storage_pools:
- name: testpool1
type: lvm
disks: "{{ unused_disks }}"
state: absent
Loading