anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0638-rules-Add-MODEL_ID-for-NVMe-device-7037.patch

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