Closed yizhanglinux closed 4 years ago
tests_disk_errors will be failed if the system has SWAP configured, I tried disable the SWAP partition on fstab and it passed.
$ ansible-playbook -i inventory tests/tests_disk_errors.yml
TASK [Try to replace the file system on disk in safe mode] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tests/tests_disk_errors.yml:101 TASK [storage : Set version specific variables] ********************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main.yml:2 ok: [localhost] => (item=/root/test/storage/vars/RedHat-8.yml) => {"ansible_facts": {"blivet_package_list": ["python3-blivet", "libblockdev-crypto", "libblockdev-dm", "libblockdev-lvm", "libblockdev-mdraid", "libblockdev-swap"]}, "ansible_included_var_files": ["/root/test/storage/vars/RedHat-8.yml"], "ansible_loop_var": "item", "changed": false, "item": "/root/test/storage/vars/RedHat-8.yml"} TASK [storage : define an empty list of pools to be used in testing] ************************************************************************************************************************************************************************* task path: /root/test/storage/tasks/main.yml:9 ok: [localhost] => {"ansible_facts": {"_storage_pools_list": []}, "changed": false} TASK [storage : define an empty list of volumes to be used in testing] *********************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main.yml:13 ok: [localhost] => {"ansible_facts": {"_storage_volumes_list": []}, "changed": false} TASK [storage : include the appropriate provider tasks] ************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main.yml:17 included: /root/test/storage/tasks/main-blivet.yml for localhost TASK [storage : get a list of rpm packages installed on host machine] ************************************************************************************************************************************************************************ task path: /root/test/storage/tasks/main-blivet.yml:2 skipping: [localhost] => {"changed": false, "skip_reason": "Conditional result was False"} TASK [storage : make sure blivet is available] *********************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:7 ok: [localhost] => {"changed": false, "msg": "Nothing to do", "rc": 0, "results": []} TASK [storage : initialize internal facts] *************************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:18 ok: [localhost] => {"ansible_facts": {"_storage_pools": [], "_storage_vol_defaults": [], "_storage_vol_pools": [], "_storage_vols_no_defaults": [], "_storage_vols_no_defaults_by_pool": {}, "_storage_vols_w_defaults": [], "_storage_volumes": []}, "changed": false} TASK [storage : Apply defaults to pools and volumes [1/6]] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:28 TASK [storage : Apply defaults to pools and volumes [2/6]] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:36 TASK [storage : Apply defaults to pools and volumes [3/6]] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:44 TASK [storage : Apply defaults to pools and volumes [4/6]] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:52 TASK [storage : Apply defaults to pools and volumes [5/6]] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:61 TASK [storage : Apply defaults to pools and volumes [6/6]] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:72 ok: [localhost] => (item={'name': 'test1', 'type': 'disk', 'fs_type': 'ext3', 'disks': ['nvme0n1']}) => {"ansible_facts": {"_storage_volumes": [{"disks": ["nvme0n1"], "encryption": false, "encryption_cipher": null, "encryption_key_file": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_passphrase": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "ext3", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "", "name": "test1", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": 0, "state": "present", "type": "disk"}]}, "ansible_loop_var": "volume", "changed": false, "volume": {"disks": ["nvme0n1"], "fs_type": "ext3", "name": "test1", "type": "disk"}} TASK [storage : debug] *********************************************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:84 ok: [localhost] => { "_storage_pools": [] } TASK [storage : debug] *********************************************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:87 ok: [localhost] => { "_storage_volumes": [ { "disks": [ "nvme0n1" ], "encryption": false, "encryption_cipher": null, "encryption_key_file": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_passphrase": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "ext3", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "", "name": "test1", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": 0, "state": "present", "type": "disk" } ] } TASK [storage : get required packages] ******************************************************************************************************************************************************************************************************* task path: /root/test/storage/tasks/main-blivet.yml:90 ok: [localhost] => {"actions": [], "changed": false, "crypts": [], "leaves": [], "mounts": [], "packages": ["e2fsprogs"], "pools": [], "volumes": []} TASK [storage : make sure required packages are installed] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:99 ok: [localhost] => {"changed": false, "msg": "Nothing to do", "rc": 0, "results": []} TASK [storage : manage the pools and volumes to match the specified state] ******************************************************************************************************************************************************************* task path: /root/test/storage/tasks/main-blivet.yml:104 fatal: [localhost]: FAILED! => {"actions": [], "changed": false, "crypts": [], "leaves": [], "mounts": [], "msg": "cannot remove existing formatting on volume 'test1' in safe mode", "packages": [], "pools": [], "volumes": []} TASK [Check that we failed in the role] ****************************************************************************************************************************************************************************************************** task path: /root/test/storage/tests/tests_disk_errors.yml:116 ok: [localhost] => { "changed": false, "msg": "All assertions passed" } TASK [Verify the output] ********************************************************************************************************************************************************************************************************************* task path: /root/test/storage/tests/tests_disk_errors.yml:122 ok: [localhost] => { "changed": false, "msg": "All assertions passed" } TASK [Unmount file system] ******************************************************************************************************************************************************************************************************************* task path: /root/test/storage/tests/tests_disk_errors.yml:129 TASK [storage : Set version specific variables] ********************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main.yml:2 ok: [localhost] => (item=/root/test/storage/vars/RedHat-8.yml) => {"ansible_facts": {"blivet_package_list": ["python3-blivet", "libblockdev-crypto", "libblockdev-dm", "libblockdev-lvm", "libblockdev-mdraid", "libblockdev-swap"]}, "ansible_included_var_files": ["/root/test/storage/vars/RedHat-8.yml"], "ansible_loop_var": "item", "changed": false, "item": "/root/test/storage/vars/RedHat-8.yml"} TASK [storage : define an empty list of pools to be used in testing] ************************************************************************************************************************************************************************* task path: /root/test/storage/tasks/main.yml:9 ok: [localhost] => {"ansible_facts": {"_storage_pools_list": []}, "changed": false} TASK [storage : define an empty list of volumes to be used in testing] *********************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main.yml:13 ok: [localhost] => {"ansible_facts": {"_storage_volumes_list": []}, "changed": false} TASK [storage : include the appropriate provider tasks] ************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main.yml:17 included: /root/test/storage/tasks/main-blivet.yml for localhost TASK [storage : get a list of rpm packages installed on host machine] ************************************************************************************************************************************************************************ task path: /root/test/storage/tasks/main-blivet.yml:2 skipping: [localhost] => {"changed": false, "skip_reason": "Conditional result was False"} TASK [storage : make sure blivet is available] *********************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:7 ok: [localhost] => {"changed": false, "msg": "Nothing to do", "rc": 0, "results": []} TASK [storage : initialize internal facts] *************************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:18 ok: [localhost] => {"ansible_facts": {"_storage_pools": [], "_storage_vol_defaults": [], "_storage_vol_pools": [], "_storage_vols_no_defaults": [], "_storage_vols_no_defaults_by_pool": {}, "_storage_vols_w_defaults": [], "_storage_volumes": []}, "changed": false} TASK [storage : Apply defaults to pools and volumes [1/6]] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:28 TASK [storage : Apply defaults to pools and volumes [2/6]] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:36 TASK [storage : Apply defaults to pools and volumes [3/6]] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:44 TASK [storage : Apply defaults to pools and volumes [4/6]] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:52 TASK [storage : Apply defaults to pools and volumes [5/6]] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:61 TASK [storage : Apply defaults to pools and volumes [6/6]] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:72 ok: [localhost] => (item={'name': 'test1', 'type': 'disk', 'fs_type': 'ext4', 'disks': ['nvme0n1'], 'mount_point': 'none'}) => {"ansible_facts": {"_storage_volumes": [{"disks": ["nvme0n1"], "encryption": false, "encryption_cipher": null, "encryption_key_file": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_passphrase": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "ext4", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "none", "name": "test1", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": 0, "state": "present", "type": "disk"}]}, "ansible_loop_var": "volume", "changed": false, "volume": {"disks": ["nvme0n1"], "fs_type": "ext4", "mount_point": "none", "name": "test1", "type": "disk"}} TASK [storage : debug] *********************************************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:84 ok: [localhost] => { "_storage_pools": [] } TASK [storage : debug] *********************************************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:87 ok: [localhost] => { "_storage_volumes": [ { "disks": [ "nvme0n1" ], "encryption": false, "encryption_cipher": null, "encryption_key_file": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_passphrase": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "ext4", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "none", "name": "test1", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": 0, "state": "present", "type": "disk" } ] } TASK [storage : get required packages] ******************************************************************************************************************************************************************************************************* task path: /root/test/storage/tasks/main-blivet.yml:90 ok: [localhost] => {"actions": [], "changed": false, "crypts": [], "leaves": [], "mounts": [], "packages": ["e2fsprogs"], "pools": [], "volumes": []} TASK [storage : make sure required packages are installed] *********************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:99 ok: [localhost] => {"changed": false, "msg": "Nothing to do", "rc": 0, "results": []} TASK [storage : manage the pools and volumes to match the specified state] ******************************************************************************************************************************************************************* task path: /root/test/storage/tasks/main-blivet.yml:104 ok: [localhost] => {"actions": [], "changed": false, "crypts": [], "leaves": ["/dev/sda1", "/dev/sda2", "/dev/mapper/rhel_storageqe--62-home", "/dev/mapper/rhel_storageqe--62-root", "/dev/mapper/rhel_storageqe--62-swap", "/dev/sdb", "/dev/sdh", "/dev/sdi", "/dev/sdj", "/dev/sdc", "/dev/sdk", "/dev/sdl1", "/dev/sdd", "/dev/sde", "/dev/sdf", "/dev/sdg", "/dev/nvme0n1"], "mounts": [{"path": "/opt/test1", "state": "absent"}, {"dump": 0, "fstype": "ext4", "opts": "defaults", "passno": 0, "path": "none", "src": "UUID=6190b98d-8e08-4a5d-b64d-1f7f99f1e9f6", "state": "mounted"}], "packages": ["e2fsprogs", "lvm2", "xfsprogs", "dosfstools"], "pools": [], "volumes": [{"_device": "/dev/nvme0n1", "_kernel_device": "/dev/nvme0n1", "_mount_id": "UUID=6190b98d-8e08-4a5d-b64d-1f7f99f1e9f6", "_raw_device": "/dev/nvme0n1", "_raw_kernel_device": "/dev/nvme0n1", "disks": ["nvme0n1"], "encryption": false, "encryption_cipher": null, "encryption_key_file": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_passphrase": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "ext4", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "none", "name": "test1", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": 0, "state": "present", "type": "disk"}]} TASK [storage : debug] *********************************************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:113 ok: [localhost] => { "blivet_output": { "actions": [], "changed": false, "crypts": [], "failed": false, "leaves": [ "/dev/sda1", "/dev/sda2", "/dev/mapper/rhel_storageqe--62-home", "/dev/mapper/rhel_storageqe--62-root", "/dev/mapper/rhel_storageqe--62-swap", "/dev/sdb", "/dev/sdh", "/dev/sdi", "/dev/sdj", "/dev/sdc", "/dev/sdk", "/dev/sdl1", "/dev/sdd", "/dev/sde", "/dev/sdf", "/dev/sdg", "/dev/nvme0n1" ], "mounts": [ { "path": "/opt/test1", "state": "absent" }, { "dump": 0, "fstype": "ext4", "opts": "defaults", "passno": 0, "path": "none", "src": "UUID=6190b98d-8e08-4a5d-b64d-1f7f99f1e9f6", "state": "mounted" } ], "packages": [ "e2fsprogs", "lvm2", "xfsprogs", "dosfstools" ], "pools": [], "volumes": [ { "_device": "/dev/nvme0n1", "_kernel_device": "/dev/nvme0n1", "_mount_id": "UUID=6190b98d-8e08-4a5d-b64d-1f7f99f1e9f6", "_raw_device": "/dev/nvme0n1", "_raw_kernel_device": "/dev/nvme0n1", "disks": [ "nvme0n1" ], "encryption": false, "encryption_cipher": null, "encryption_key_file": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_passphrase": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "ext4", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "none", "name": "test1", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": 0, "state": "present", "type": "disk" } ] } } TASK [storage : set the list of pools for test verification] ********************************************************************************************************************************************************************************* task path: /root/test/storage/tasks/main-blivet.yml:116 ok: [localhost] => {"ansible_facts": {"_storage_pools_list": []}, "changed": false} TASK [storage : set the list of volumes for test verification] ******************************************************************************************************************************************************************************* task path: /root/test/storage/tasks/main-blivet.yml:120 ok: [localhost] => {"ansible_facts": {"_storage_volumes_list": [{"_device": "/dev/nvme0n1", "_kernel_device": "/dev/nvme0n1", "_mount_id": "UUID=6190b98d-8e08-4a5d-b64d-1f7f99f1e9f6", "_raw_device": "/dev/nvme0n1", "_raw_kernel_device": "/dev/nvme0n1", "disks": ["nvme0n1"], "encryption": false, "encryption_cipher": null, "encryption_key_file": null, "encryption_key_size": null, "encryption_luks_version": null, "encryption_passphrase": null, "fs_create_options": "", "fs_label": "", "fs_overwrite_existing": true, "fs_type": "ext4", "mount_check": 0, "mount_device_identifier": "uuid", "mount_options": "defaults", "mount_passno": 0, "mount_point": "none", "name": "test1", "raid_chunk_size": null, "raid_device_count": null, "raid_level": null, "raid_metadata_version": null, "raid_spare_count": null, "size": 0, "state": "present", "type": "disk"}]}, "changed": false} TASK [storage : remove obsolete mounts] ****************************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:136 changed: [localhost] => (item={'path': '/opt/test1', 'state': 'absent'}) => {"ansible_loop_var": "mount_info", "changed": true, "dump": "0", "fstab": "/etc/fstab", "mount_info": {"path": "/opt/test1", "state": "absent"}, "name": "/opt/test1", "opts": "defaults", "passno": "0"} TASK [storage : tell systemd to refresh its view of /etc/fstab] ****************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:147 ok: [localhost] => {"changed": false, "name": null, "status": {}} TASK [storage : set up new/current mounts] *************************************************************************************************************************************************************************************************** task path: /root/test/storage/tasks/main-blivet.yml:152 failed: [localhost] (item={'src': 'UUID=6190b98d-8e08-4a5d-b64d-1f7f99f1e9f6', 'path': 'none', 'fstype': 'ext4', 'opts': 'defaults', 'dump': 0, 'passno': 0, 'state': 'mounted'}) => {"ansible_loop_var": "mount_info", "changed": false, "mount_info": {"dump": 0, "fstype": "ext4", "opts": "defaults", "passno": 0, "path": "none", "src": "UUID=6190b98d-8e08-4a5d-b64d-1f7f99f1e9f6", "state": "mounted"}, "msg": "Error mounting none: mount: /root/test/storage/tests/none: unknown filesystem type 'swap'.\n"} PLAY RECAP *********************************************************************************************************************************************************************************************************************************** localhost : ok=95 changed=4 unreachable=0 failed=1 skipped=45 rescued=3 ignored=0
[root@storageqe-62 storage]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 279.4G 0 disk ├─sda1 8:1 0 600M 0 part /boot/efi ├─sda2 8:2 0 1G 0 part /boot └─sda3 8:3 0 277.8G 0 part ├─rhel_storageqe--62-root 253:0 0 70G 0 lvm / ├─rhel_storageqe--62-swap 253:1 0 7.9G 0 lvm [SWAP] └─rhel_storageqe--62-home 253:2 0 200G 0 lvm /home sdb 8:16 0 279.4G 0 disk sdc 8:32 0 186.3G 0 disk sdd 8:48 0 111.8G 0 disk sde 8:64 0 111.8G 0 disk sdf 8:80 0 931.5G 0 disk sdg 8:96 0 931.5G 0 disk sdh 8:112 0 931.5G 0 disk sdi 8:128 0 931.5G 0 disk sdj 8:144 0 931.5G 0 disk sdk 8:160 0 279.4G 0 disk sdl 8:176 0 279.4G 0 disk └─sdl1 8:177 0 279.4G 0 part /root/test nvme0n1 259:0 0 745.2G 0 disk [root@storageqe-62 storage]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Tue Jun 16 02:49:03 2020 # # Accessible filesystems, by reference, are maintained under '/dev/disk/'. # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. # # After editing this file, run 'systemctl daemon-reload' to update systemd # units generated from this file. # /dev/mapper/rhel_storageqe--62-root / xfs defaults 0 0 UUID=0c459216-6a71-4860-8e5f-97bfc9c93095 /boot xfs defaults 0 0 UUID=3189-4B31 /boot/efi vfat umask=0077,shortname=winnt 0 2 /dev/mapper/rhel_storageqe--62-home /home xfs defaults 0 0 /dev/mapper/rhel_storageqe--62-swap none swap defaults 0 0 UUID=6190b98d-8e08-4a5d-b64d-1f7f99f1e9f6 none ext4 defaults 0 0 [root@storageqe-62 storage]# blkid | grep 6190b98d-8e08-4a5d-b64d-1f7f99f1e9f /dev/nvme0n1: UUID="6190b98d-8e08-4a5d-b64d-1f7f99f1e9f6" TYPE="ext4"
thank you, I saw exactly the same problem.
It looks like the problem is that no mountpoint is supplied and the role does not catch this and erroneously tries to set up an /etc/fstab entry for it.
tests_disk_errors will be failed if the system has SWAP configured, I tried disable the SWAP partition on fstab and it passed.
test case