Skip to content

Commit

Permalink
fix: Fix recreate check for formats without labelling support
Browse files Browse the repository at this point in the history
Formats like LUKS or LVMPV don't support labels so we need to skip
the label check in BlivetVolume._reformat.

Resolves: RHEL-29874
  • Loading branch information
vojtechtrefny committed Apr 11, 2024
1 parent acd20be commit a8c1c48
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library/blivet.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,9 @@ def _reformat(self):
if ((fmt is None and self._device.format.type is None)
or (fmt is not None and self._device.format.type == fmt.type)):
# format is the same, no need to run reformatting
if not hasattr(self._device.format, "label"):
# not all formats support labels
return
dev_label = '' if self._device.format.label is None else self._device.format.label
if dev_label != fmt.label:
# ...but the label has changed - schedule modification action
Expand Down
20 changes: 20 additions & 0 deletions tests/tests_volume_relabel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,26 @@
- name: Verify role results
include_tasks: verify-role-results.yml

- name: Format the device to LVMPV which doesn't support labels
include_role:
name: linux-system-roles.storage
vars:
storage_volumes:
- name: test1
type: disk
fs_type: lvmpv
disks: "{{ unused_disks }}"

- name: Rerun to check we don't try to relabel preexisitng LVMPV (regression test for RHEL-29874)
include_role:
name: linux-system-roles.storage
vars:
storage_volumes:
- name: test1
type: disk
fs_type: lvmpv
disks: "{{ unused_disks }}"

- name: Clean up
include_role:
name: linux-system-roles.storage
Expand Down

0 comments on commit a8c1c48

Please sign in to comment.