Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-95757

Improve error reporting when invalid or unsupported RAID configuration is given

Linking RHIVOS CVEs to...Migration: Automation ...Sync from "Extern...XMLWordPrintable

    • rhel-system-roles
    • 0
    • Dev ack
    • False
    • False
    • Hide

      None

      Show
      None
    • Yes
    • Red Hat Enterprise Linux
    • None
    • Bug Fix
    • Hide
      .RAID now reports clear errors for invalid or unsupported configurations

      Before this update, invalid RAID levels or insufficient disks could be specified without raising clear errors. This resulted in failed or inconsistent array creation. As a consequence, the error messages were unclear, and RAID setup was less reliable. With this release, RAID parameters are validated before array creation, and a minimum disk count is enforced. As a result, clear errors are raised, and attempts to create a RAID with inadequate disks are blocked.

      This fix also removes the deprecated `process_device_numbers` helper and uses `unify_raid_level` instead. In addition, failure tests for invalid RAID level and insufficient disks scenarios are also added.
      Show
      .RAID now reports clear errors for invalid or unsupported configurations Before this update, invalid RAID levels or insufficient disks could be specified without raising clear errors. This resulted in failed or inconsistent array creation. As a consequence, the error messages were unclear, and RAID setup was less reliable. With this release, RAID parameters are validated before array creation, and a minimum disk count is enforced. As a result, clear errors are raised, and attempts to create a RAID with inadequate disks are blocked. This fix also removes the deprecated `process_device_numbers` helper and uses `unify_raid_level` instead. In addition, failure tests for invalid RAID level and insufficient disks scenarios are also added.
    • Done
    • Done
    • Done
    • Not Required
    • None

       

              - name: Get unused disks
                include_tasks: get_unused_disk.yml
                vars:
                  min_size: "{{ volume_group_size }}"
                  max_return: 2  
            
              - name: Create LVM VDO volume under volume group 'pool1'
                include_role:
                  name: rhel-system-roles.storage
                vars:
                  storage_pools:
                    - name: pool1
                      disks: "{{ unused_disks }}"
                      type: lvm
                      raid_level: "raid10"
                      volumes:
                        - name: volume1
                          compression: true
                          deduplication: true
                          vdo_pool_size: "{{ pool_size }}"
                          size: "{{ volume_size }}"
                          mount_point: "{{ mount_location }}"
      
      TASK [rhel-system-roles.storage : Manage the pools and volumes to match the specified state] *********************************************
      An exception occurred during task execution. To see the full traceback, use -vvv. The error was: sys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute
      fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/md.py\", line 198, in level\n    level = self._get_level(value, self._levels)\n            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/threads.py\", line 49, in run_with_lock\n    return m(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/raid.py\", line 82, in _get_level\n    raise ValueError(error_msg)\nValueError: RAID level raid10 requires that device have at least 4 members.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1749457024.3835154-825237-12263865527669/AnsiballZ_blivet.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1749457024.3835154-825237-12263865527669/AnsiballZ_blivet.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1749457024.3835154-825237-12263865527669/AnsiballZ_blivet.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible.modules.blivet', init_globals=dict(_module_fqn='ansible.modules.blivet', _modlib_path=modlib_path),\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 2557, in <module>\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 2553, in main\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 2504, in run_module\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 2089, in manage_pool\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1702, in manage\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1936, in _create\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1659, in _create_members\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 573, in _new_mdarray\n  File \"/usr/lib/python3.12/site-packages/blivet/threads.py\", line 49, in run_with_lock\n    return m(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/blivet.py\", line 558, in new_mdarray\n    return MDRaidArrayDevice(name, *args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/threads.py\", line 49, in run_with_lock\n    return m(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/md.py\", line 131, in __init__\n    raise e\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/md.py\", line 125, in __init__\n    self.level = level\n    ^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/threads.py\", line 49, in run_with_lock\n    return m(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/md.py\", line 200, in level\n    raise errors.DeviceError(e)\nblivet.errors.DeviceError: RAID level raid10 requires that device have at least 4 members.\nsys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}TASK [rhel-system-roles.storage : Failed message] ****************************************************************************************
      fatal: [localhost]: FAILED! => {"changed": false, "msg": {"changed": false, "exception": "Traceback (most recent call last):\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/md.py\", line 198, in level\n    level = self._get_level(value, self._levels)\n            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/threads.py\", line 49, in run_with_lock\n    return m(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/raid.py\", line 82, in _get_level\n    raise ValueError(error_msg)\nValueError: RAID level raid10 requires that device have at least 4 members.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1749457024.3835154-825237-12263865527669/AnsiballZ_blivet.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1749457024.3835154-825237-12263865527669/AnsiballZ_blivet.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1749457024.3835154-825237-12263865527669/AnsiballZ_blivet.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible.modules.blivet', init_globals=dict(_module_fqn='ansible.modules.blivet', _modlib_path=modlib_path),\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 2557, in <module>\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 2553, in main\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 2504, in run_module\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 2089, in manage_pool\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1702, in manage\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1936, in _create\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1659, in _create_members\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 573, in _new_mdarray\n  File \"/usr/lib/python3.12/site-packages/blivet/threads.py\", line 49, in run_with_lock\n    return m(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/blivet.py\", line 558, in new_mdarray\n    return MDRaidArrayDevice(name, *args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/threads.py\", line 49, in run_with_lock\n    return m(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/md.py\", line 131, in __init__\n    raise e\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/md.py\", line 125, in __init__\n    self.level = level\n    ^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/threads.py\", line 49, in run_with_lock\n    return m(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/md.py\", line 200, in level\n    raise errors.DeviceError(e)\nblivet.errors.DeviceError: RAID level raid10 requires that device have at least 4 members.\nsys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute\n", "failed": true, "module_stderr": "Traceback (most recent call last):\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/md.py\", line 198, in level\n    level = self._get_level(value, self._levels)\n            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/threads.py\", line 49, in run_with_lock\n    return m(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/raid.py\", line 82, in _get_level\n    raise ValueError(error_msg)\nValueError: RAID level raid10 requires that device have at least 4 members.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1749457024.3835154-825237-12263865527669/AnsiballZ_blivet.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1749457024.3835154-825237-12263865527669/AnsiballZ_blivet.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1749457024.3835154-825237-12263865527669/AnsiballZ_blivet.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible.modules.blivet', init_globals=dict(_module_fqn='ansible.modules.blivet', _modlib_path=modlib_path),\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 2557, in <module>\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 2553, in main\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 2504, in run_module\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 2089, in manage_pool\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1702, in manage\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1936, in _create\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1659, in _create_members\n  File \"/tmp/ansible_blivet_payload_blxph01c/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 573, in _new_mdarray\n  File \"/usr/lib/python3.12/site-packages/blivet/threads.py\", line 49, in run_with_lock\n    return m(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/blivet.py\", line 558, in new_mdarray\n    return MDRaidArrayDevice(name, *args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/threads.py\", line 49, in run_with_lock\n    return m(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/md.py\", line 131, in __init__\n    raise e\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/md.py\", line 125, in __init__\n    self.level = level\n    ^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/threads.py\", line 49, in run_with_lock\n    return m(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n  File \"/usr/lib/python3.12/site-packages/blivet/devices/md.py\", line 200, in level\n    raise errors.DeviceError(e)\nblivet.errors.DeviceError: RAID level raid10 requires that device have at least 4 members.\nsys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}} 

       

      blivet.errors.DeviceError: RAID level raid10 requires that device have at least 4 members

      1. the role should catch the error when  haven't given enough devices.

      2. looks create raid10 no need 4 legs now.

       

      [root@storageqe-109 tests]# mdadm -CR /dev/md0 -n 2 -l raid10  /dev/sda /dev/sdb 
      mdadm: Defaulting to version 1.2 metadata
      mdadm: array /dev/md0 started.
      [root@storageqe-109 tests]#
      [root@storageqe-109 tests]# mdadm -D /dev/md0 
      /dev/md0:
                 Version : 1.2
           Creation Time : Mon Jun  9 04:29:03 2025
              Raid Level : raid10
              Array Size : 780663808 (744.50 GiB 799.40 GB)
           Used Dev Size : 780663808 (744.50 GiB 799.40 GB)
            Raid Devices : 2
           Total Devices : 2
             Persistence : Superblock is persistent     Intent Bitmap : Internal       Update Time : Mon Jun  9 04:42:51 2025
                   State : clean, resyncing 
          Active Devices : 2
         Working Devices : 2
          Failed Devices : 0
           Spare Devices : 0            Layout : near=2
              Chunk Size : 512KConsistency Policy : bitmap     Resync Status : 21% complete              Name : 0
                    UUID : 57e6e9cc:21b18324:727585ca:c3dffe23
                  Events : 150    Number   Major   Minor   RaidDevice State
             0       8        0        0      active sync set-A   /dev/sda
             1       8       16        1      active sync set-B   /dev/sdb
      [root@storageqe-109 tests]#   

      [root@storageqe-109 tests]# rpm -qa |grep -E 'blivet|role|mdadm'
      mdadm-4.3-5.el10.x86_64
      blivet-data-3.10.0-19.el10.noarch
      python3-blivet-3.10.0-19.el10.noarch
      rhel-system-roles-1.101.1-0.1.el10.noarch
      [root@storageqe-109 tests]# uname -a
      Linux storageqe-109.rhts.eng.pek2.redhat.com 6.12.0-89.el10.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 27 00:52:07 EDT 2025 x86_64 GNU/Linux
      [root@storageqe-109 tests]

              vtrefny@redhat.com Vojtěch Trefný
              guazhang@redhat.com Guangwu Zhang
              Richard Megginson Richard Megginson
              Guangwu Zhang Guangwu Zhang
              Angana Chakraborty Angana Chakraborty
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated: