Incorrect name assigned to software raid device

Bug #2073406 reported by typezz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ironic-python-agent
Fix Released
Undecided
Jakub Jelinek

Bug Description

According to documentation (https://docs.openstack.org/ironic/latest/admin/raid.html#software-raid), only mandatory parameters are supported when configuring software RAID. These parameters doesn't include "volume_name" (or docs aren't clear about that). Examples of software raid configs doesn't include "volume_name" parameter as well.

If I omit the "volume_name" parameter, creation of software raid via "agent" interface fails:

"mdadm --create /dev/md0 --force --run --metadata=1 --level 1 --name /dev/md0 --raid-devices 2 /dev/sda1 /dev/sdb1\nExit code: 2\nStdout: ''\nStderr: 'mdadm: Value \"/dev/md0\" cannot be set as name. Reason: Not POSIX compatible."

The "--name" mdadm parameter has to be "md0" instead of "/dev/md0", or we may just omit it.

Probably, there is a bug there - https://github.com/openstack/ironic-python-agent/blob/master/ironic_python_agent/raid_utils.py#L230
and we have to use basename instead of full path.

When supplying the "volume_name" parameter in Ironic raid config (e.g. with the "md0" value) everything works fine. But it contradicts with the docs and can't be used with Metal3 (since it doesn't match it's spec)

Revision history for this message
Michal (groundnuty) wrote :

I was just hit by the same issue.
I'm trying to provision bare-metal using metal3 and baremetal-operator.
The configuration supplied to baremetal-operator is as follows:

  raid:
    softwareRAIDVolumes:
      - level: '1'
        physicalDisks:
          - serialNumber: S664NN0W200258
          - serialNumber: S664NN0W200257

and results in error:
Command: mdadm --create /dev/md0 --force --run --metadata=1 --level 1 --name /dev/md0 --raid-devices 2 /dev/sdf1 /dev/sde1
Exit code: 2
Stdout: ''
Stderr: 'mdadm: Value "/dev/md0" cannot be set as name. Reason: Not POSIX compatible.\n'

As stated above metal3 does not support any 'name' parameter, but more importantly the logic in lines:
https://github.com/openstack/ironic-python-agent/blob/master/ironic_python_agent/raid_utils.py#L229-L230
is just wrong. The mdadm will always fail when md_device is put in a --name parameter.

As suggested above the last part of the md_device should be put into volume_name and possibly more validation for POSIX compatibility might be needed.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic-python-agent (master)
Changed in ironic-python-agent:
status: New → In Progress
Jakub Jelinek (kubajj)
Changed in ironic-python-agent:
assignee: nobody → Jakub Jelinek (kubajj)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic-python-agent (master)

Reviewed: https://review.opendev.org/c/openstack/ironic-python-agent/+/939340
Committed: https://opendev.org/openstack/ironic-python-agent/commit/6dceb332091359ae11365e897fa579916ebbded5
Submitter: "Zuul (22348)"
Branch: master

commit 6dceb332091359ae11365e897fa579916ebbded5
Author: kubajj <email address hidden>
Date: Wed Jan 15 12:34:36 2025 +0000

    Fix RAID volume name

    Use just md<index> as the default volume name if a volume name is not defined.
    The original change (https://review.opendev.org/c/openstack/ironic-python-agent/+/853182)
    introduced an error:

    mdadm: Value "/dev/md0" cannot be set as name. Reason: Not POSIX compatible.\n

    This change fixes it.

    Closes-Bug: #2073406
    Change-Id: Ic8bd473801fcb92fc814f6ad4e1d6dc316783bf3

Changed in ironic-python-agent:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic-python-agent (stable/2024.2)

Fix proposed to branch: stable/2024.2
Review: https://review.opendev.org/c/openstack/ironic-python-agent/+/939700

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic-python-agent (stable/2024.2)

Reviewed: https://review.opendev.org/c/openstack/ironic-python-agent/+/939700
Committed: https://opendev.org/openstack/ironic-python-agent/commit/0718ad7383d88a7609be1741b4ffc36b481c09f8
Submitter: "Zuul (22348)"
Branch: stable/2024.2

commit 0718ad7383d88a7609be1741b4ffc36b481c09f8
Author: kubajj <email address hidden>
Date: Wed Jan 15 12:34:36 2025 +0000

    Fix RAID volume name

    Use just md<index> as the default volume name if a volume name is not defined.
    The original change (https://review.opendev.org/c/openstack/ironic-python-agent/+/853182)
    introduced an error:

    mdadm: Value "/dev/md0" cannot be set as name. Reason: Not POSIX compatible.\n

    This change fixes it.

    Closes-Bug: #2073406
    Change-Id: Ic8bd473801fcb92fc814f6ad4e1d6dc316783bf3
    (cherry picked from commit 6dceb332091359ae11365e897fa579916ebbded5)
    (cherry picked from commit 2ece938671b60d2bee0f55120035afb8c4f2bbb4)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic-python-agent (stable/2024.1)

Fix proposed to branch: stable/2024.1
Review: https://review.opendev.org/c/openstack/ironic-python-agent/+/939959

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic-python-agent (stable/2023.2)

Fix proposed to branch: stable/2023.2
Review: https://review.opendev.org/c/openstack/ironic-python-agent/+/939960

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic-python-agent (stable/2024.1)

Reviewed: https://review.opendev.org/c/openstack/ironic-python-agent/+/939959
Committed: https://opendev.org/openstack/ironic-python-agent/commit/84edb10e060a83114dbb28c45ad65fdaf4b9ce83
Submitter: "Zuul (22348)"
Branch: stable/2024.1

commit 84edb10e060a83114dbb28c45ad65fdaf4b9ce83
Author: kubajj <email address hidden>
Date: Wed Jan 15 12:34:36 2025 +0000

    Fix RAID volume name

    Use just md<index> as the default volume name if a volume name is not defined.
    The original change (https://review.opendev.org/c/openstack/ironic-python-agent/+/853182)
    introduced an error:

    mdadm: Value "/dev/md0" cannot be set as name. Reason: Not POSIX compatible.\n

    This change fixes it.

    Closes-Bug: #2073406
    Change-Id: Ic8bd473801fcb92fc814f6ad4e1d6dc316783bf3
    (cherry picked from commit 6dceb332091359ae11365e897fa579916ebbded5)
    (cherry picked from commit 2ece938671b60d2bee0f55120035afb8c4f2bbb4)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ironic-python-agent 10.1.0

This issue was fixed in the openstack/ironic-python-agent 10.1.0 Epoxy release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic-python-agent (stable/2023.2)

Reviewed: https://review.opendev.org/c/openstack/ironic-python-agent/+/939960
Committed: https://opendev.org/openstack/ironic-python-agent/commit/47f60559a04cb0bd33dbe29ce36fa96083783e53
Submitter: "Zuul (22348)"
Branch: stable/2023.2

commit 47f60559a04cb0bd33dbe29ce36fa96083783e53
Author: kubajj <email address hidden>
Date: Wed Jan 15 12:34:36 2025 +0000

    Fix RAID volume name

    Use just md<index> as the default volume name if a volume name is not defined.
    The original change (https://review.opendev.org/c/openstack/ironic-python-agent/+/853182)
    introduced an error:

    mdadm: Value "/dev/md0" cannot be set as name. Reason: Not POSIX compatible.\n

    This change fixes it.

    Closes-Bug: #2073406
    Change-Id: Ic8bd473801fcb92fc814f6ad4e1d6dc316783bf3
    (cherry picked from commit 6dceb332091359ae11365e897fa579916ebbded5)
    (cherry picked from commit 2ece938671b60d2bee0f55120035afb8c4f2bbb4)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ironic-python-agent 9.7.3

This issue was fixed in the openstack/ironic-python-agent 9.7.3 Bobcat release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ironic-python-agent 9.11.2

This issue was fixed in the openstack/ironic-python-agent 9.11.2 Caracal release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ironic-python-agent 9.14.1

This issue was fixed in the openstack/ironic-python-agent 9.14.1 Dalmatian release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.