1abbee
From 8ed606212fb3e82c12b1fcea8500a5dfe4f89393 Mon Sep 17 00:00:00 2001
1abbee
From: Michal Sekletar <msekleta@redhat.com>
1abbee
Date: Thu, 1 Sep 2016 12:42:05 +0200
1abbee
Subject: [PATCH] rules: fix for possible whitespace in the "model" attribute
1abbee
1abbee
Without this the rules would create multiple wrong symlinks, because
1abbee
SYMLINK treats strings with spaces as a list of links to create.
1abbee
1abbee
Suggested-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
1abbee
1abbee
Cherry-picked from: f41c12825db7460429c857ccc0e545bd631a62a0
1abbee
Related: #1274651
1abbee
---
1abbee
 rules/60-persistent-storage.rules | 4 ++--
1abbee
 1 file changed, 2 insertions(+), 2 deletions(-)
1abbee
1abbee
diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules
181b3f
index 74f8f21f3..06e3329cc 100644
1abbee
--- a/rules/60-persistent-storage.rules
1abbee
+++ b/rules/60-persistent-storage.rules
1abbee
@@ -27,10 +27,10 @@ KERNEL=="nvme*[0-9]n*[0-9]", ATTR{wwid}=="?*", SYMLINK+="disk/by-id/nvme-$attr{w
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
+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"
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
+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"
1abbee
 
1abbee
 # virtio-blk
1abbee
 KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}"