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