Bug 2213673 - [RHEL8] Unexpected behavior when creating ext4 filesystem with invalid parameter
Summary: [RHEL8] Unexpected behavior when creating ext4 filesystem with invalid parameter
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: lvm2
Version: 8.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: LVM Team
QA Contact: cluster-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-09 00:51 UTC by guazhang@redhat.com
Modified: 2023-08-10 15:40 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-159352 0 None None None 2023-06-09 01:02:40 UTC

Description guazhang@redhat.com 2023-06-09 00:51:53 UTC
Description of problem:
storage roles regression found the error, please have a look 

Version-Release number of selected component (if applicable):
ansible-core-2.15.0-1.el8.x86_64
rhel-system-roles-1.22.0-0.9.el8.noarch 
RHEL-8.9.0-20230603.20 BaseOS x86_64

How reproducible:


Steps to Reproduce:
1. ansible-playbook -vv -i host tests_misc.yml
2. ansible-playbook -vv -i host tests_misc_scsi_generated.yml
3.

Actual results:


Expected results:


Additional info:


TASK [rhel-system-roles.storage : Make sure required packages are installed] ***
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:39
skipping: [localhost] => {"changed": false, "false_condition": "storage_skip_checks is not defined or not \"packages_installed\" in storage_skip_checks", "skip_reason": "Conditional result was False"}

TASK [rhel-system-roles.storage : Get service facts] ***************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:46
skipping: [localhost] => {"changed": false, "false_condition": "storage_skip_checks is not defined or not \"service_facts\" in storage_skip_checks", "skip_reason": "Conditional result was False"}

TASK [rhel-system-roles.storage : Set storage_cryptsetup_services] *************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:53
ok: [localhost] => {"ansible_facts": {"storage_cryptsetup_services": []}, "changed": false}

TASK [rhel-system-roles.storage : Mask the systemd cryptsetup services] ********
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:67
skipping: [localhost] => {"changed": false, "skipped_reason": "No items in the list"}

TASK [rhel-system-roles.storage : Manage the pools and volumes to match the specified state] ***
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:73
fatal: [localhost]: FAILED! => {"actions": [], "changed": false, "crypts": [], "leaves": [], "mounts": [], "msg": "cannot remove existing formatting (lvmpv) and/or devices on disk 'sdb' (pool 'foo') in safe mode", "packages": [], "pools": [], "volumes": []}

TASK [rhel-system-roles.storage : Failed message] ******************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:95
fatal: [localhost]: FAILED! => {"changed": false, "msg": {"actions": [], "changed": false, "crypts": [], "failed": true, "invocation": {"module_args": {"disklabel_type": null, "diskvolume_mkfs_option_map": {}, "packages_only": false, "pool_defaults": {"disks": [], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "state": "present", "type": "lvm", "volumes": []}, "pools": [{"disks": ["sdb"], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "name": "foo", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "state": "present", "type": "lvm", "volumes": [{"cache_devices": [], "cache_mode": null, "cache_size": null, "cached": null, "compression": null, "deduplication": null, "encryption": null, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "fs_create_options": "-Fb 512", "fs_label": "", "fs_type": "ext4", "mount_group": null, "mount_mode": null, "mount_options": null, "mount_point": "/opt/test1", "mount_user": null, "name": "test1", "raid_disks": [], "raid_level": null, "raid_stripe_size": null, "size": "4g", "state": "present", "thin": false, "thin_pool_name": null, "thin_pool_size": null, "type": null, "vdo_pool_size": null}]}], "safe_mode": true, "use_partitions": null, "volume_defaults": {"cache_devices": [], "cache_mode": null, "cache_size": 0, "cached": false, "compression": null, "deduplication": null, "disks": [], "encryption": false, "encryption_cipher": null, "encryption_key": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_password": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "xfs", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "raid_stripe_size": null, "size": 0, "state": "present", "thin": null, "thin_pool_name": null, "thin_pool_size": null, "type": "lvm", "vdo_pool_size": null}, "volumes": []}}, "leaves": [], "mounts": [], "msg": "cannot remove existing formatting (lvmpv) and/or devices on disk 'sdb' (pool 'foo') in safe mode", "packages": [], "pools": [], "volumes": []}}

TASK [rhel-system-roles.storage : Unmask the systemd cryptsetup services] ******
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:99
skipping: [localhost] => {"changed": false, "skipped_reason": "No items in the list"}

TASK [Check that we failed in the role] ****************************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tests/verify-role-failed.yml:20
ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [Verify the blivet output and error message are correct] ******************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tests/verify-role-failed.yml:25
fatal: [localhost]: FAILED! => {
    "assertion": "blivet_output.msg is search(__storage_failed_regex)",
    "changed": false,
    "evaluated_to": false,
    "msg": "Unexpected behavior when creating ext4 filesystem with invalid parameter"
}

PLAY RECAP *********************************************************************
localhost                  : ok=178  changed=4    unreachable=0    failed=1    skipped=150  rescued=2    ignored=0   
STDERR:
RETURN:2

https://beaker.engineering.redhat.com/recipes/14051127#task161440046

Comment 1 Rich Megginson 2023-06-13 17:21:07 UTC
@guazhang 

> 1. ansible-playbook -vv -i host tests_misc.yml
> 2. ansible-playbook -vv -i host tests_misc_scsi_generated.yml

In this case, is `host` "localhost"?  I'm trying to reproduce this, but so far I have not been able to.  How exactly did you run this?

The problem appears to be clean up.  The test: https://github.com/linux-system-roles/storage/blob/main/tests/tests_misc.yml#L72 is expecting blivet to return an error message like

Failed to commit changes to disk: (FSError('format failed: 1',), '/dev/mapper/foo-test1')

but instead, the error message is

cannot remove existing formatting (lvmpv) and/or devices on disk 'sdb' (pool 'foo') in safe mode

The test wants to create a new lvm pool with sdb and a new volume with ext4 and an invalid parameter.  But for some reason the pool?  or volume? still exists.  @vtrefny ?  How do I tell what still exists that it is complaining about?

I have tried running the test multiple times in a row using qemu/kvm (I do not have a local machine with real SCSI devices) and it seems to clean up properly every time.  So at this point I'm not sure what's going on.

Comment 2 guazhang@redhat.com 2023-06-14 05:44:45 UTC
(In reply to Rich Megginson from comment #1)
> @guazhang 
> 
> > 1. ansible-playbook -vv -i host tests_misc.yml
> > 2. ansible-playbook -vv -i host tests_misc_scsi_generated.yml
> 
> In this case, is `host` "localhost"?  I'm trying to reproduce this, but so
> far I have not been able to.  How exactly did you run this?
> 


echo "localhost  ansible_connection=local" > host

no other setup, I test it with my test server storageqe-104.rhts.eng.pek2.redhat.com which include some SSD.

Comment 3 Vojtech Trefny 2023-06-21 07:28:10 UTC
I also wasn't able to reproduce this. @guazhang I can't find blivet.log in the beaker job, is it available somewhere? From the role output it looks like the cleanup worked as expected and everything, including the lvmpv format on sdb should be removed, but it's hard to tell what actually happened without the blivet.log.

        "actions": [
            {
                "action": "destroy format",
                "device": "/dev/mapper/foo-test1",
                "fs_type": "ext4"
            },
            {
                "action": "destroy device",
                "device": "/dev/mapper/foo-test1",
                "fs_type": null
            },
            {
                "action": "destroy device",
                "device": "/dev/foo",
                "fs_type": null
            },
            {
                "action": "destroy format",
                "device": "/dev/sdb",
                "fs_type": "lvmpv"
            }

Comment 5 Vojtech Trefny 2023-06-21 12:54:10 UTC
The udev database is in inconsistent state after the pvremove call we do. The /dev/sdb PV is removed but udev still thinks it is formatted to lvmpv:

---------------
# lsblk -f /dev/sdb
NAME FSTYPE      LABEL UUID                                   MOUNTPOINT
sdb  LVM2_member       KvVOZf-1tc2-c1E1-c8Vr-aSH3-LZJ3-W3liPZ

# udevadm info /dev/sdb
...
E: ID_FS_TYPE=LVM2_member
E: ID_FS_USAGE=raid
E: ID_FS_UUID=KvVOZf-1tc2-c1E1-c8Vr-aSH3-LZJ3-W3liPZ
---------------

but the disk is empty:
---------------
# pvremove /dev/sdb
  No PV found on device /dev/sdb.
# wipefs /dev/sdb
# 
---------------

Moving to lvm for further investigation.


Note You need to log in before you can comment on or make changes to this bug.