Skip to content

Commit

Permalink
faq: clean up dynamic secondary device example
Browse files Browse the repository at this point in the history
We don't need to use an overcomplicated env unit dropin here. We can
just label the filesystem with a stable name and use that to refer to
the device in the mount unit.

Related: coreos/fedora-coreos-tracker#1732
  • Loading branch information
jlebon committed May 16, 2024
1 parent 8e6ac83 commit 1f86e83
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ systemd:
DefaultDependencies=false
After=systemd-udev-settle.service
Before=local-fs-pre.target
ConditionPathExists=!/etc/secondary-dev.env
ConditionPathExists=!/etc/found-secondary-device
# break boot if we fail
OnFailure=emergency.target
Expand All @@ -360,8 +360,7 @@ systemd:
Before=local-fs.target
[Mount]
EnvironmentFile=/etc/secondary-dev.env
What=$VAR_LIB_FOOBAR_DEV
What=/dev/disk/by-label/foobar
Where=/var/lib/foobar
Type=xfs
Expand All @@ -381,9 +380,9 @@ storage:
for serial in foobar bazboo; do
blkdev=/dev/disk/by-id/virtio-$serial
if [ -b "$blkdev" ]; then
mkfs.xfs -f "$blkdev"
mkfs.xfs -f "$blkdev" -L foobar
echo "Found secondary block device $blkdev" >&2
echo "VAR_LIB_FOOBAR_DEV=$blkdev" > /etc/secondary-dev.env
touch /etc/found-secondary-device
exit
fi
done
Expand All @@ -394,6 +393,8 @@ storage:
Note this approach uses `After=systemd-udev-settle.service` which is not usually desirable as it may slow down boot. Another related approach is writing a udev rule to create a more stable symlink instead of this dynamic systemd service + script approach.

This script is also written in a way that also makes it compatible to be used day-2 via a MachineConfig.

The larger issue tracking machine-specific MachineConfigs is at https://github.com/openshift/machine-config-operator/issues/1720.

## Q: Does RHCOS support the use of `NetworkManager` keyfiles? Does RHCOS support the use of `ifcfg` files?
Expand Down

0 comments on commit 1f86e83

Please sign in to comment.