Skip to content

Commit

Permalink
Merge pull request #1243 from jlebon/pr/udev-nvme-whitespace-symlink
Browse files Browse the repository at this point in the history
overlay: add 30rhcos-nvme-compat-udev
  • Loading branch information
openshift-merge-robot committed Apr 5, 2023
2 parents 30413c8 + 6cf9878 commit d20d4c7
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 1 deletion.
1 change: 1 addition & 0 deletions common.yaml
Expand Up @@ -22,6 +22,7 @@ ostree-layers:
- overlay/20platform-chrony
- overlay/21dhcp-chrony
- overlay/25azure-udev-rules
- overlay/30rhcos-nvme-compat-udev

arch-include:
x86_64:
Expand Down
2 changes: 2 additions & 0 deletions overlay.d/30rhcos-nvme-compat-udev/statoverride
@@ -0,0 +1,2 @@
# Config file for overriding permission bits on overlay files/dirs
# Format: =<file mode in decimal> <absolute path to a file or directory>
@@ -0,0 +1,13 @@
#!/bin/bash

# NVMe by-id/ symlinks changed wrt leading spaces from RHEL8 to RHEL9:
# https://issues.redhat.com/browse/OCPBUGS-11375
# https://github.com/systemd/systemd/issues/27155

# This rule adds back the previous symlinks for backwards compatibility. We want
# it in the initramfs in case there are Ignition configs which referenced the
# old symlinks.

install() {
inst_multiple /usr/lib/udev/rules.d/61-persistent-storage-nvme-compat.rules
}
@@ -0,0 +1,20 @@
# NVMe by-id/ symlinks changed wrt leading spaces from RHEL8 to RHEL9:
# https://issues.redhat.com/browse/OCPBUGS-11375
# https://github.com/systemd/systemd/issues/27155

# This rule adds back the previous symlinks for backwards compatibility.

# They're the same as the regular rules in 60-persistent-storage.rules, except
# they don't include the `OPTIONS="string_escape=replace"` directive.

ACTION=="remove", GOTO="persistent_storage_nvme_compat_end"
ENV{UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG}=="1", GOTO="persistent_storage_nvme_compat_end"
SUBSYSTEM!="block", GOTO="persistent_storage_nvme_compat_end"

KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", \
ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}"

KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", \
ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}-part%n"

LABEL="persistent_storage_nvme_compat_end"
16 changes: 15 additions & 1 deletion overlay.d/README.md
Expand Up @@ -39,9 +39,23 @@ lands in downstream packages. See upstream thread:
https://listengine.tuxfamily.org/chrony.tuxfamily.org/chrony-dev/2020/05/msg00022.html

25rhcos-azure-udev
-------------
------------------

We want to provide Azure udev rules as part of the initrd, so that Ignition
is able to detect disks and act on them. The WALinuxAgent-udev has been
changed to install udev rules into the initramfs, but that change isn't
in el8 yet. This can be dropped when moving to el9.

30rhcos-nvme-compat-udev
------------------------

NVMe by-id/ symlinks changed wrt leading spaces from RHEL8 to RHEL9:
https://issues.redhat.com/browse/OCPBUGS-11375
https://github.com/systemd/systemd/issues/27155

This overlay ships a rule that adds back the previous symlinks for backwards
compatibility. TBD when we can drop this, e.g. by having layered software use
the `eui` links instead or pivoting to GPT partition UUIDs. Customers may have
also manually typed the old symlink in their Ignition configs and other k8s
resources though. Those would require some communication before we can rip this
out.
27 changes: 27 additions & 0 deletions tests/kola/disk/nvme-compat-symlink
@@ -0,0 +1,27 @@
#!/bin/bash
## kola:
## exclusive: true
## additionalDisks: ["1G:channel=nvme,serial= foobar"]
## platforms: qemu
#
# By default coreos-generate-iscsi-initiatorname.service is active on RHCOS,
# inactive on FCOS
# https://github.com/openshift/os/pull/453

set -xeuo pipefail

. $KOLA_EXT_DATA/commonlib.sh

# the canonical symlink
s=/dev/disk/by-id/nvme-QEMU_NVMe_Ctrl_____foobar
if ! test -L "${s}"; then
fatal "missing canonical symlink ${s}"
fi

# the compat symlink
s=/dev/disk/by-id/nvme-QEMU_NVMe_Ctrl__foobar
if ! test -L "${s}"; then
fatal "missing compat symlink ${s}"
fi

ok "nvme compat symlink"

0 comments on commit d20d4c7

Please sign in to comment.