Skip to content

Commit

Permalink
30ignition: clean up Ignition stages ordering
Browse files Browse the repository at this point in the history
First, put the order of the stages in every unit file. Then, make sure
to include both the appropriate `After=` and `Before=` in accordance
with the unit's place in the chain. There's redundancy there, but it
makes it really obvious and explicit how they go together.
  • Loading branch information
jlebon committed May 19, 2020
1 parent ee9fcda commit 142bfda
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
3 changes: 3 additions & 0 deletions dracut/30ignition/ignition-disks.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ Documentation=https://github.com/coreos/ignition
ConditionPathExists=/etc/initrd-release
DefaultDependencies=false
Before=ignition-complete.target

# Stage order: setup -> fetch -> disks -> mount -> files.
After=ignition-fetch.service
Before=ignition-mount.service

# This stage runs between `basic.target` and `initrd-root-device.target`,
# see https://www.freedesktop.org/software/systemd/man/bootup.html
Expand Down
7 changes: 5 additions & 2 deletions dracut/30ignition/ignition-fetch.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ DefaultDependencies=false
Before=ignition-complete.target
After=basic.target

# Run after ignition-setup has run because ignition-setup
# may copy in new/different ignition configs for us to consume.
# Stage order: setup -> fetch -> disks -> mount -> files.
# We run after the setup stage has run because it may copy in new/different
# ignition configs for us to consume.
After=ignition-setup-base.service
After=ignition-setup-user.service
Before=ignition-disks.service


# Network may be used to fetch userdata content.
After=network.target
Expand Down
3 changes: 1 addition & 2 deletions dracut/30ignition/ignition-files.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ ConditionPathExists=/etc/initrd-release
DefaultDependencies=false
Before=ignition-complete.target

# We need all the filesystems already mounted.
Requires=ignition-mount.service
# Stage order: setup -> fetch -> disks -> mount -> files.
After=ignition-mount.service

# Run before initrd-parse-etc so that we can drop files it then picks up.
Expand Down
7 changes: 5 additions & 2 deletions dracut/30ignition/ignition-mount.service
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ After=initrd-root-fs.target
# Make sure root filesystem is remounted read-write if needed
After=ignition-remount-sysroot.service

# This is guaranteed through After=initrd-root-fs.target but just to
# be explicit.
# Stage order: setup -> fetch -> disks -> mount -> files.
# We need to make sure the partitions and filesystems are set up before
# mounting. This is also guaranteed through After=initrd-root-fs.target but
# just to be explicit.
After=ignition-disks.service
Before=ignition-files.service

[Service]
Type=oneshot
Expand Down
5 changes: 2 additions & 3 deletions dracut/30ignition/ignition-setup-base.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ ConditionPathExists=/etc/initrd-release
DefaultDependencies=false
Before=ignition-complete.target

Before=local-fs-pre.target
Before=ignition-disks.service
Before=ignition-files.service
# Stage order: setup -> fetch -> disks -> mount -> files.
Before=ignition-fetch.service

[Service]
Type=oneshot
Expand Down
5 changes: 2 additions & 3 deletions dracut/30ignition/ignition-setup-user.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ ConditionPathExists=/etc/initrd-release
DefaultDependencies=false
Before=ignition-complete.target

Before=local-fs-pre.target
Before=ignition-disks.service
Before=ignition-files.service
# Stage order: setup -> fetch -> disks -> mount -> files.
Before=ignition-fetch.service

# On diskful boots, ignition-generator adds Requires/After on
# dev-disk-by\x2dlabel-boot.device.
Expand Down

0 comments on commit 142bfda

Please sign in to comment.