curtin does not properly support MD raid device renaming (uses /dev/<name> instead of /dev/md/<name> when creating a device)

Bug #1820046 reported by Dmitrii Shcherbakov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
curtin
New
Undecided
Unassigned

Bug Description

maas root machine get-curtin-config <system_id>
https://pastebin.canonical.com/p/DRwJYVbYjr/

Trying to set up a raid device with a custom name (os-raid):
      -
        devices:
          - os0-os-data
          - os1-os-data
        id: os-raid
        name: os-raid
        raidlevel: '1'
        spare_devices: []
        type: raid
      -
        fstype: ext4
        id: os-raid-format
        label: 'os'
        type: format
        volume: os-raid
      -
        device: os-raid-format
        id: os-raid-mount
        path: /
        type: mount

Curtin fails to do that while invoking mdadm as it uses /dev/os-raid instead of /dev/md/os-raid:

https://github.com/CanonicalLtd/curtin/blob/ubuntu/18.2-10-g7afd77fa-0ubuntu1_18.10.1/curtin/commands/block_meta.py#L1036
    md_devname = block.dev_path(info.get('name'))
# ...
    mdadm.mdadm_create(md_devname, raidlevel,
                       device_paths, spare_device_paths,
                       info.get('mdname', ''))

https://github.com/CanonicalLtd/curtin/blob/ubuntu/18.2-10-g7afd77fa-0ubuntu1_18.10.1/curtin/block/__init__.py#L55-L62
def dev_path(devname):
    """
    convert device name to path in /dev
    """
    if devname.startswith('/dev/'):
        return devname
    else:
        return '/dev/' + devname

curtin: Installation started. (18.1)
third party drivers not installed or necessary.
An error occured handling 'os-raid': ProcessExecutionError - Unexpected error while running command.
Command: ['mdadm', '--create', '/dev/os-raid', '--run', '--homehost=block-storage-6', '--level=1', '--raid-devices=2', '/dev/sdf3', '/dev/sdh1']
Exit code: 1
Reason: -
Stdout: ''
Stderr: mdadm: Note: this array has metadata at the start and
            may not be suitable as a boot device. If you plan to
            store '/boot' on this device please ensure that
            your boot-loader understands md/v1.x metadata, or use
            --metadata=0.90
        mdadm: /dev/os-raid is an invalid name for an md device. Try /dev/md/os-raid

Unexpected error while running command.
Command: ['mdadm', '--create', '/dev/os-raid', '--run', '--homehost=block-storage-6', '--level=1', '--raid-devices=2', '/dev/sdf3', '/dev/sdh1']
Exit code: 1
Reason: -
Stdout: ''
Stderr: mdadm: Note: this array has metadata at the start and
            may not be suitable as a boot device. If you plan to
            store '/boot' on this device please ensure that
            your boot-loader understands md/v1.x metadata, or use
            --metadata=0.90
        mdadm: /dev/os-raid is an invalid name for an md device. Try /dev/md/os-raid

curtin: Installation failed with exception: Unexpected error while running command.
Command: ['curtin', 'block-meta', 'custom']
Exit code: 3
Reason: -
Stdout: An error occured handling 'os-raid': ProcessExecutionError - Unexpected error while running command.
        Command: ['mdadm', '--create', '/dev/os-raid', '--run', '--homehost=block-storage-6', '--level=1', '--raid-devices=2', '/dev/sdf3', '/dev/sdh1']
        Exit code: 1
        Reason: -
        Stdout: ''
        Stderr: mdadm: Note: this array has metadata at the start and
                    may not be suitable as a boot device. If you plan to
                    store '/boot' on this device please ensure that
                    your boot-loader understands md/v1.x metadata, or use
                    --metadata=0.90
                mdadm: /dev/os-raid is an invalid name for an md device. Try /dev/md/os-raid

        Unexpected error while running command.
        Command: ['mdadm', '--create', '/dev/os-raid', '--run', '--homehost=block-storage-6', '--level=1', '--raid-devices=2', '/dev/sdf3', '/dev/sdh1']
        Exit code: 1
        Reason: -
        Stdout: ''
        Stderr: mdadm: Note: this array has metadata at the start and
                    may not be suitable as a boot device. If you plan to
                    store '/boot' on this device please ensure that
                    your boot-loader understands md/v1.x metadata, or use
                    --metadata=0.90
                mdadm: /dev/os-raid is an invalid name for an md device. Try /dev/md/os-raid

Stderr: ''

Tags: cpe-onsite
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.