ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
923a60
From 14ca846073e3b7accb71012a9612d0a7cb6b5ea6 Mon Sep 17 00:00:00 2001
923a60
From: gwendalcr <gwendal@chromium.org>
923a60
Date: Wed, 20 Jun 2018 16:54:05 +0200
923a60
Subject: [PATCH] rules: Add MODEL_ID for NVMe device (#7037)
923a60
923a60
To mimic MODEL_ID variable built for ATA and SCSI devices, add rules
923a60
to add MODEL_ID variable for NVMe devices.
923a60
923a60
TEST: Check on a system with NVMe device that MODEL_ID variable is
923a60
present:
923a60
 udevadm info --query=all -n /dev/nvme0n1p1 | grep ID_MODEL
923a60
and
923a60
 udevadm info --query=all -n /dev/nvme0n1p1 | grep ID_MODEL
923a60
return:
923a60
E: ID_MODEL=SAMSUNG...
923a60
923a60
(cherry picked from commit e2c2d70ba7cc7497b03c4a377bfb529035540aa7)
923a60
923a60
Resolves: #1397264
923a60
---
923a60
 rules/60-persistent-storage.rules | 6 ++++--
923a60
 1 file changed, 4 insertions(+), 2 deletions(-)
923a60
923a60
diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
923a60
index ba619633b7..4aae97a9fb 100644
923a60
--- a/rules/60-persistent-storage.rules
923a60
+++ b/rules/60-persistent-storage.rules
923a60
@@ -28,10 +28,12 @@ KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{wwid}=="?*"
923a60
 
923a60
 KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{serial}=="?*", ENV{ID_SERIAL_SHORT}="$attr{serial}"
923a60
 KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{wwid}=="?*", ENV{ID_WWN}="$attr{wwid}"
923a60
-KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{model}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_SERIAL}="$attr{model}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}", OPTIONS="string_escape=replace"
923a60
+KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{model}=="?*", ENV{ID_MODEL}="$attr{model}"
923a60
+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}", OPTIONS="string_escape=replace"
923a60
 
923a60
 KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{serial}=="?*", ENV{ID_SERIAL_SHORT}="$attr{serial}"
923a60
-KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{model}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_SERIAL}="$attr{model}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}-part%n", OPTIONS="string_escape=replace"
923a60
+KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{model}=="?*", ENV{ID_MODEL}="$attr{model}"
923a60
+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", OPTIONS="string_escape=replace"
923a60
 
923a60
 # virtio-blk
923a60
 KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}"