Skip to content
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

fix: Fix recreate check for formats without labelling support #435

Merged
merged 2 commits into from
Apr 11, 2024
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
5 changes: 4 additions & 1 deletion library/blivet.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@
device.original_format._key_file = self._volume.get('encryption_key')
device.original_format.passphrase = self._volume.get('encryption_password')
if device.isleaf:
self._blivet.populate()
self._blivet.devicetree.populate()

Check warning on line 633 in library/blivet.py

View check run for this annotation

Codecov / codecov/patch

library/blivet.py#L633

Added line #L633 was not covered by tests

if not device.isleaf:
device = device.children[0]
Expand Down Expand Up @@ -826,6 +826,9 @@
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"):

Check warning on line 829 in library/blivet.py

View check run for this annotation

Codecov / codecov/patch

library/blivet.py#L829

Added line #L829 was not covered by tests
# not all formats support labels
return

Check warning on line 831 in library/blivet.py

View check run for this annotation

Codecov / codecov/patch

library/blivet.py#L831

Added line #L831 was not covered by tests
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
Loading