From 030258df539b683841fe629dd0b0b45a9fca855a Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Wed, 24 Jan 2024 16:52:49 +0100 Subject: [PATCH] fix: Do not set default value for fs_label For existing devices we want to read the default value from the device instead of trying to reset it to default/empty label when the fs_label attribute is not set. Related: #417 --- library/blivet.py | 4 +--- tests/tests_lvm_pool_shared.yml | 4 ++-- tests/tests_volume_relabel.yml | 34 +++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/library/blivet.py b/library/blivet.py index 5f2af33c..20389ea6 100644 --- a/library/blivet.py +++ b/library/blivet.py @@ -110,7 +110,6 @@ fs_label: description: fs_label type: str - default: '' fs_type: description: fs_type type: str @@ -216,7 +215,6 @@ fs_label: description: fs_label type: str - default: '' fs_type: description: fs_type type: str @@ -2091,7 +2089,7 @@ def run_module(): encryption_luks_version=dict(type='str'), encryption_password=dict(type='str', no_log=True), fs_create_options=dict(type='str'), - fs_label=dict(type='str', default=''), + fs_label=dict(type='str'), fs_type=dict(type='str'), mount_options=dict(type='str'), mount_point=dict(type='str'), diff --git a/tests/tests_lvm_pool_shared.yml b/tests/tests_lvm_pool_shared.yml index e391f277..5e900963 100644 --- a/tests/tests_lvm_pool_shared.yml +++ b/tests/tests_lvm_pool_shared.yml @@ -127,7 +127,7 @@ size: "{{ volume1_size }}" mount_point: "{{ mount_location1 }}" fs_type: gfs2 - fs_create_options: -p lock_nolock + fs_create_options: -j 2 -t rhel9-1node:myfs - name: Verify role results include_tasks: verify-role-results.yml @@ -147,7 +147,7 @@ size: "{{ volume1_size }}" mount_point: "{{ mount_location1 }}" fs_type: gfs2 - fs_create_options: -p lock_nolock + fs_create_options: -j 2 -t rhel9-1node:myfs - name: Verify role results include_tasks: verify-role-results.yml diff --git a/tests/tests_volume_relabel.yml b/tests/tests_volume_relabel.yml index 46525da1..8916b730 100644 --- a/tests/tests_volume_relabel.yml +++ b/tests/tests_volume_relabel.yml @@ -77,6 +77,40 @@ - name: Verify role results include_tasks: verify-role-results.yml + - name: Relabel without explicitly setting the label + include_role: + name: linux-system-roles.storage + vars: + storage_volumes: + - name: test1 + type: disk + mount_point: "{{ mount_location }}" + fs_type: ext4 + disks: "{{ unused_disks }}" + + - name: Check for default value + assert: + that: not blivet_output.changed + msg: "Volume relabeling doesn't preserve existing label." + + - name: Verify role results + include_tasks: verify-role-results.yml + + - name: Remove label + include_role: + name: linux-system-roles.storage + vars: + storage_volumes: + - name: test1 + type: disk + mount_point: "{{ mount_location }}" + fs_type: ext4 + disks: "{{ unused_disks }}" + fs_label: "" + + - name: Verify role results + include_tasks: verify-role-results.yml + - name: Clean up include_role: name: linux-system-roles.storage