36e8a3
From 0c5b8096cb23701f8048dba33a38e1b55249cab3 Mon Sep 17 00:00:00 2001
36e8a3
From: Michal Sekletar <msekleta@redhat.com>
36e8a3
Date: Wed, 28 Mar 2018 17:22:30 +0200
36e8a3
Subject: [PATCH] rules: introduce old-style by-path symlinks for FCP based
36e8a3
 SCSI devices
36e8a3
36e8a3
Related: #1523227
36e8a3
---
36e8a3
 rules/40-redhat.rules | 20 ++++++++++++++++++++
36e8a3
 1 file changed, 20 insertions(+)
36e8a3
36e8a3
diff --git a/rules/40-redhat.rules b/rules/40-redhat.rules
4bff0a
index c3df320234..8ac96933c3 100644
36e8a3
--- a/rules/40-redhat.rules
36e8a3
+++ b/rules/40-redhat.rules
36e8a3
@@ -15,3 +15,23 @@ SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_target", TEST!="[module/sg]", RUN+="/sbin
36e8a3
 
36e8a3
 # Rule for prandom character device node permissions
36e8a3
 KERNEL=="prandom", MODE="0644"
36e8a3
+
36e8a3
+# Rules for creating the ID_PATH for SCSI devices based on the CCW bus
36e8a3
+# using the form: ccw-<BUS_ID>-zfcp-<WWPN>:<LUN>
36e8a3
+#
36e8a3
+ACTION=="remove", GOTO="zfcp_scsi_device_end"
36e8a3
+
36e8a3
+#
36e8a3
+# Set environment variable "ID_ZFCP_BUS" to "1" if the devices
36e8a3
+# (both disk and partition) are SCSI devices based on FCP devices
36e8a3
+#
36e8a3
+KERNEL=="sd*", SUBSYSTEMS=="ccw", DRIVERS=="zfcp", ENV{.ID_ZFCP_BUS}="1"
36e8a3
+
36e8a3
+# For SCSI disks
36e8a3
+KERNEL=="sd*[!0-9]", SUBSYSTEMS=="scsi", ENV{.ID_ZFCP_BUS}=="1", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-path/ccw-$attr{hba_id}-zfcp-$attr{wwpn}:$attr{fcp_lun}"
36e8a3
+
36e8a3
+
36e8a3
+# For partitions on a SCSI disk
36e8a3
+KERNEL=="sd*[0-9]", SUBSYSTEMS=="scsi", ENV{.ID_ZFCP_BUS}=="1", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-path/ccw-$attr{hba_id}-zfcp-$attr{wwpn}:$attr{fcp_lun}-part%n"
36e8a3
+
36e8a3
+LABEL="zfcp_scsi_device_end"