teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0401-rules-introduce-disk-by-id-model_serial-symlinks-for.patch

1abbee
From 1e61121501f79e654a36bf2efb6a987f6a11c262 Mon Sep 17 00:00:00 2001
1abbee
From: Michal Sekletar <msekletar@users.noreply.github.com>
1abbee
Date: Wed, 17 Aug 2016 14:10:28 +0200
1abbee
Subject: [PATCH] rules: introduce disk/by-id (model_serial) symlinks for NVMe
1abbee
 drives (#3974)
1abbee
1abbee
$ ls -l /dev/disk/by-id/nvme*
1abbee
lrwxrwxrwx. 1 root root 13 Aug 17 04:25 /dev/disk/by-id/nvme-HUSPR3216AHP301_STM0001B6780 -> ../../nvme0n1
1abbee
lrwxrwxrwx. 1 root root 15 Aug 17 04:25 /dev/disk/by-id/nvme-HUSPR3216AHP301_STM0001B6780-part1 -> ../../nvme0n1p1
1abbee
1abbee
https://github.com/systemd/systemd/issues/1453
1abbee
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=779ff75617099f4defe14e20443b95019a4c5ae8
1abbee
1abbee
Cherry-picked from: a5110c90303cf455db5062faef34d5724d12e2e9
1abbee
Related: #1274651
1abbee
---
1abbee
 rules/60-persistent-storage.rules | 6 ++++++
1abbee
 1 file changed, 6 insertions(+)
1abbee
1abbee
diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
c62b8e
index cc01acb163..74f8f21f3a 100644
1abbee
--- a/rules/60-persistent-storage.rules
1abbee
+++ b/rules/60-persistent-storage.rules
1abbee
@@ -26,6 +26,12 @@ ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
1abbee
 KERNEL=="nvme*[0-9]n*[0-9]", ATTR{wwid}=="?*", SYMLINK+="disk/by-id/nvme-$attr{wwid}"
1abbee
 KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{wwid}=="?*", SYMLINK+="disk/by-id/nvme-$attr{wwid}-part%n"
1abbee
 
1abbee
+KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{serial}=="?*", ENV{ID_SERIAL_SHORT}="$attr{serial}"
1abbee
+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}"
1abbee
+
1abbee
+KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{serial}=="?*", ENV{ID_SERIAL_SHORT}="$attr{serial}"
1abbee
+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"
1abbee
+
1abbee
 # virtio-blk
1abbee
 KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}"
1abbee
 KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n"