Skip to content
This repository has been archived by the owner on Sep 18, 2020. It is now read-only.

dracut: add module to assemble root raid array #130

Merged
merged 1 commit into from
Aug 23, 2017

Conversation

ajeddeloh
Copy link
Contributor

Add a udev rule to auto-assemble raid devices belonging to an array
ending in ROOT. This allows the root filesystem to be found when it's on
a raid array.

# only arrays that might contain the root filesystem. Arrays that contain
# the root filesystem should have a name suffixed with ROOT so we can find them.

# These rules compliment the rules in 64-md-raid-assembly, only adding the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: complement


# Don't process any events if anaconda is running as anaconda brings up
# raid devices manually
ENV{ANACONDA}=="?*", GOTO="md_inc_end"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can skip testing for the Fedora/RHEL installer.

However, this does point to a problem: we don't want to assemble RAID devices during first boot if Ignition is going to clobber the partitions. We should disable autorun if coreos.first_boot is set. In that case the Ignition config must mention any RAID needed for the root filesystem or we will fail to boot, but it seems plausible that we wouldn't support reusing an existing root RAID while running Ignition for unrelated reasons.

We'll also want a kola test for this.

@@ -0,0 +1,45 @@
# do not edit this file, it will be overwritten on update
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file is initramfs-only, so this can be dropped.


LABEL="md_inc"

# Only auto-assembly drives in arrays with a name ending with ROOT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assemble

Also, update name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, update name.

What do you mean by this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not ROOT anymore.

ENV{ID_FS_TYPE}=="isw_raid_member", GOTO="md_inc"
GOTO="md_inc_end"

LABEL="md_inc"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's prefix label names so there's no possibility of collision.


# Only auto-assembly drives in arrays with a name ending with ROOT
IMPORT{program}="/sbin/mdadm --examine --export $devnode"
ENV{MD_NAME}!="*-hasroot", GOTO="md_inc_end"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update commit message to match.


# Since dracut 24, drives are not auto-assembled. We need to auto-assemble
# only arrays that might contain the root filesystem. Arrays that contain
# the root filesystem should have a name suffixed with ROOT so we can find them.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update name.

# do not edit this file, it will be overwritten on update

# Since dracut 24, drives are not auto-assembled. We need to auto-assemble
# only arrays that might contain the root filesystem. Arrays that contain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain in the comment why we want only those arrays.

ENV{MD_NAME}!="*-hasroot", GOTO="md_inc_end"

# remember you can limit what gets auto/incrementally assembled by
# mdadm.conf(5)'s 'AUTO' and selectively whitelist using 'ARRAY'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment not relevant to the initramfs; drop.

@ajeddeloh
Copy link
Contributor Author

ajeddeloh commented Aug 22, 2017

https://github.com/coreos/ignition/blob/master/internal/exec/stages/disks/disks.go#L203 Seems to refer to a related issue. Do you think it's referring to the fact that raid arrays are started before ignition is run and thus their components are unvailable or something else? If it is, we can get rid of that fixme as well.

@bgilbert
Copy link
Contributor

I think it's referring to the initramfs autorunning a different array with the same name as the one we're creating. We can probably drop the comment, but maybe first we should test creating a new array with the same name as an existing and non-overlapping one.

# Ignition may want to clobber partitions used in a raid array, so
# skip assembling them in that case.
IMPORT{cmdline}="coreos.first_boot"
ENV{coreos.first_boot}=="1", GOTO="root_md_inc_end"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coreos.first_boot can have truthy values other than 1. detected will be typical, but the full set of rules are here.

IMPORT{cmdline}="nodmraid"

ENV{nodmraid}=="?*", GOTO="root_md_inc_end"
ENV{ID_FS_TYPE}=="ddf_raid_member", GOTO="root_md_inc"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On further reflection, I think the DDF/IMSM stuff can all be dropped. DDF doesn't appear to have device names; IMSM won't run in qemu but I don't think it does either; and we probably don't want to support root-on-FakeRAID anyway.

SUBSYSTEM!="block", GOTO="root_md_inc_end"

# Ignition may want to clobber partitions used in a raid array, so
# skip assembling them in that case.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that case being that Ignition is going to run.

@ajeddeloh
Copy link
Contributor Author

ajeddeloh commented Aug 23, 2017

Updated to handle coreos.first_boot correctly, removed fakeraid stuff, did a little cleanup. And capitalized Ignition in comments/commit messages.

Add a udev rule to auto-assemble raid devices belonging to an array
ending in -hasroot. This allows the root filesystem to be found when
it's on a raid array.

Also don't auto-assemble when running Ignition since Ignition may want
to modify a partition in a raid array.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants