ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
923a60
From d913c83db4d3271a400173dfee55078335055e86 Mon Sep 17 00:00:00 2001
923a60
From: Ming Lin <minggr@gmail.com>
923a60
Date: Fri, 29 Apr 2016 04:02:57 -0700
923a60
Subject: [PATCH] rules: add NVMe rules (#3136)
923a60
923a60
Add NVMe rules using the "wwid" attribute.
923a60
923a60
root@target:~# cat /sys/block/nvme0n1/wwid
923a60
eui.3825004235000591
923a60
923a60
root@target:~# ls /dev/disk/by-id/ -l |grep nvme
923a60
lrwxrwxrwx 1 root root 13 Apr 27 16:08 nvme-eui.3825004235000591 -> ../../nvme0n1
923a60
lrwxrwxrwx 1 root root 15 Apr 27 16:08 nvme-eui.3825004235000591-part1 -> ../../nvme0n1p1
923a60
lrwxrwxrwx 1 root root 15 Apr 27 16:08 nvme-eui.3825004235000591-part2 -> ../../nvme0n1p2
923a60
923a60
Cherry-picked from: 427a28ecbe0eb170e651e0530ab58d6e6f6c498c
923a60
Resolves: #1274651
923a60
---
923a60
 rules/60-persistent-storage.rules | 4 ++++
923a60
 1 file changed, 4 insertions(+)
923a60
923a60
diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
923a60
index 71ab974844..cc01acb163 100644
923a60
--- a/rules/60-persistent-storage.rules
923a60
+++ b/rules/60-persistent-storage.rules
923a60
@@ -22,6 +22,10 @@ TEST=="whole_disk", GOTO="persistent_storage_end"
923a60
 # for partitions import parent information
923a60
 ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
923a60
 
923a60
+# NVMe
923a60
+KERNEL=="nvme*[0-9]n*[0-9]", ATTR{wwid}=="?*", SYMLINK+="disk/by-id/nvme-$attr{wwid}"
923a60
+KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{wwid}=="?*", SYMLINK+="disk/by-id/nvme-$attr{wwid}-part%n"
923a60
+
923a60
 # virtio-blk
923a60
 KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}"
923a60
 KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n"