From 1f86e836268ee8ca77b31bd93803632ebf0e3a12 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Thu, 16 May 2024 14:40:23 -0400 Subject: [PATCH] faq: clean up dynamic secondary device example 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: https://github.com/coreos/fedora-coreos-tracker/issues/1732 --- docs/faq.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index 5c2fdac5..677e57ba 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -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 @@ -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 @@ -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 @@ -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?