Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overlay.d: add udev rule for creating stable symlink to boot disk #1308

Merged
merged 1 commit into from
Feb 2, 2022

Conversation

nikita-dubrovskii
Copy link
Contributor

@nikita-dubrovskii nikita-dubrovskii commented Oct 26, 2021

Creates '/dev/disk/coreos-root-disk' symlink to boot disk for
use by Ignition config, therefore 'storage.disks' section
could be defined without hardcoding /dev/sda, /dev/vda, etc.

Issue: coreos/fedora-coreos-tracker#759

Copy link
Contributor

@bgilbert bgilbert left a comment

Choose a reason for hiding this comment

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

In general, this looks great. Some questions about dependencies, and I'm not sure about the partx/trigger/settle part.

Comment on lines 9 to 14
for dev in $(lsblk -o NAME --noheadings --nodeps --list --paths); do
partx -u ${dev}
done

udevadm trigger
udevadm settle
Copy link
Contributor

Choose a reason for hiding this comment

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

What problem is this code solving? Is there a more targeted way of doing it than retriggering every device?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for some reason on s390x WWN is not always present in lsblk output, so this udev/partx code is used to mitigate that problem

@bgilbert
Copy link
Contributor

bgilbert commented Nov 4, 2021

Also, I agree with coreos/coreos-assembler#2517 (comment) that the kola test should move into this repo.

@nikita-dubrovskii
Copy link
Contributor Author

Also, I agree with coreos/coreos-assembler#2517 (comment) that the kola test should move into this repo.

done.

@nikita-dubrovskii
Copy link
Contributor Author

coreos/ignition#1278

Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

Can we use boot instead of root? It's mostly equivalent because all we care about for this is pre-ignition-disks in which case boot and root are on the same disk. But I like boot because that's what #1269 targets, so we know we'll only have a single boot filesystem.

Comment on lines 10 to 13
ok() {
echo "ok" "$@"
}

fatal() {
echo "$@" >&2
exit 1
}
Copy link
Member

Choose a reason for hiding this comment

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

Check out the other tests which use commonlib.sh to get these functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

other ignition tests use copy-paste )

@nikita-dubrovskii nikita-dubrovskii changed the title overlay.d: create symlink to the disk holding root partition overlay.d: add udev rule for creating stable symlink to boot disk Jan 31, 2022
jlebon
jlebon previously approved these changes Feb 1, 2022
if [[ "$name" =~ ${disk}p?[[:digit:]] ]] && [[ -e "/sys/block/$disk/$name/start" ]];
then
eval $(udevadm info --query=property -n /dev/$name | grep -e ID_FS_LABEL -e PARTNAME)
if [[ "${ID_FS_LABEL:-}" == "$label" ]] || [[ "${PARTNAME:-}" == "$label" ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

ID_FS_LABEL is not always available.

Ahh OK. Hmm, that's unfortunate. Using the partition name rather than the filesystem label is not as good because we have expectations around the latter but not necessarily the former (e.g. I don't think anything would actually break if we have multiple partitions labeled boot). OTOH, it's not unreasonable to extend our requirement to partition names. So... let's roll with it!

Creates '/dev/disk/coreos-boot-disk' symlink to boot disk for
use by Ignition config, therefore 'storage.disks' section
could be defined without hardcoding /dev/sda, /dev/vda, etc.

Issue: coreos/fedora-coreos-tracker#759

Signed-off-by: Nikita Dubrovskii <nikita@linux.ibm.com>
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants