Blame SOURCES/0002-Fix-handling-of-gen2-disks-with-udev-rules-1954.patch

4420af
From a5af5690f0df9cb12fc46f8f14e4beba7c3aeae8 Mon Sep 17 00:00:00 2001
06517b
From: Vitaly Kuznetsov <vkuznets@redhat.com>
06517b
Date: Thu, 13 Aug 2020 08:43:58 +0200
4420af
Subject: Fix handling of gen2 disks with udev rules (#1954)
06517b
06517b
RH-Author: Vitaly Kuznetsov <vkuznets@redhat.com>
06517b
Message-id: <20200810082500.479999-1-vkuznets@redhat.com>
06517b
Patchwork-id: 98129
06517b
O-Subject: [RHEL8.3 WALinuxAgent PATCH] Fix handling of gen2 disks with udev rules (#1954)
06517b
Bugzilla: 1859037
06517b
RH-Acked-by: Cathy Avery <cavery@redhat.com>
06517b
RH-Acked-by: Mohammed Gamal <mgamal@redhat.com>
06517b
06517b
commit d33f1f810728dbe4e2891149936195d1ec7aaa27
06517b
Author: Thomas Stringer <thstring@microsoft.com>
06517b
Date:   Mon Jul 20 14:24:22 2020 -0400
06517b
06517b
    Fix handling of gen2 disks with udev rules (#1954)
06517b
06517b
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
06517b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
06517b
---
06517b
 config/66-azure-storage.rules | 40 +++++++++++++++++++++++-----------------
06517b
 1 file changed, 23 insertions(+), 17 deletions(-)
06517b
06517b
diff --git a/config/66-azure-storage.rules b/config/66-azure-storage.rules
06517b
index 5fb3693..cf94807 100644
06517b
--- a/config/66-azure-storage.rules
06517b
+++ b/config/66-azure-storage.rules
06517b
@@ -1,28 +1,34 @@
06517b
-ACTION=="add|change", SUBSYSTEM=="block", ENV{ID_VENDOR}=="Msft", ENV{ID_MODEL}=="Virtual_Disk", GOTO="azure_disk"
06517b
-GOTO="azure_end"
06517b
+# Azure specific rules.
06517b
+ACTION!="add|change", GOTO="walinuxagent_end"
06517b
+SUBSYSTEM!="block", GOTO="walinuxagent_end"
06517b
+ATTRS{ID_VENDOR}!="Msft", GOTO="walinuxagent_end"
06517b
+ATTRS{ID_MODEL}!="Virtual_Disk", GOTO="walinuxagent_end"
06517b
 
06517b
-LABEL="azure_disk"
06517b
-# Root has a GUID of 0000 as the second value
06517b
-# The resource/resource has GUID of 0001 as the second value
06517b
-ATTRS{device_id}=="?00000000-0000-*", ENV{fabric_name}="root", GOTO="azure_names"
06517b
-ATTRS{device_id}=="?00000000-0001-*", ENV{fabric_name}="resource", GOTO="azure_names"
06517b
-ATTRS{device_id}=="?00000001-0001-*", ENV{fabric_name}="BEK", GOTO="azure_names"
06517b
-# Wellknown SCSI controllers
06517b
+# Match the known ID parts for root and resource disks.
06517b
+ATTRS{device_id}=="?00000000-0000-*", ENV{fabric_name}="root", GOTO="wa_azure_names"
06517b
+ATTRS{device_id}=="?00000000-0001-*", ENV{fabric_name}="resource", GOTO="wa_azure_names"
06517b
+
06517b
+# Gen2 disk.
06517b
 ATTRS{device_id}=="{f8b3781a-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi0", GOTO="azure_datadisk"
06517b
+# Create symlinks for data disks attached.
06517b
 ATTRS{device_id}=="{f8b3781b-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi1", GOTO="azure_datadisk"
06517b
 ATTRS{device_id}=="{f8b3781c-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi2", GOTO="azure_datadisk"
06517b
 ATTRS{device_id}=="{f8b3781d-1e82-4818-a1c3-63d806ec15bb}", ENV{fabric_scsi_controller}="scsi3", GOTO="azure_datadisk"
06517b
-GOTO="azure_end"
06517b
+GOTO="walinuxagent_end"
06517b
 
06517b
-# Retrieve LUN number for datadisks
06517b
+# Parse out the fabric n ame based off of scsi indicators.
06517b
 LABEL="azure_datadisk"
06517b
-ENV{DEVTYPE}=="partition", PROGRAM="/bin/sh -c 'readlink /sys/class/block/%k/../device|cut -d: -f4'", ENV{fabric_name}="$env{fabric_scsi_controller}/lun$result", GOTO="azure_names"
06517b
-PROGRAM="/bin/sh -c 'readlink /sys/class/block/%k/device|cut -d: -f4'", ENV{fabric_name}="$env{fabric_scsi_controller}/lun$result", GOTO="azure_names"
06517b
-GOTO="azure_end"
06517b
+ENV{DEVTYPE}=="partition", PROGRAM="/bin/sh -c 'readlink /sys/class/block/%k/../device|cut -d: -f4'", ENV{fabric_name}="$env{fabric_scsi_controller}/lun$result"
06517b
+ENV{DEVTYPE}=="disk", PROGRAM="/bin/sh -c 'readlink /sys/class/block/%k/device|cut -d: -f4'", ENV{fabric_name}="$env{fabric_scsi_controller}/lun$result"
06517b
+
06517b
+ENV{fabric_name}=="scsi0/lun0", ENV{fabric_name}="root"
06517b
+ENV{fabric_name}=="scsi0/lun1", ENV{fabric_name}="resource"
06517b
+# Don't create a symlink for the cd-rom.
06517b
+ENV{fabric_name}=="scsi0/lun2", GOTO="walinuxagent_end"
06517b
 
06517b
-# Create the symlinks
06517b
-LABEL="azure_names"
06517b
+# Create the symlinks.
06517b
+LABEL="wa_azure_names"
06517b
 ENV{DEVTYPE}=="disk", SYMLINK+="disk/azure/$env{fabric_name}"
06517b
 ENV{DEVTYPE}=="partition", SYMLINK+="disk/azure/$env{fabric_name}-part%n"
06517b
 
06517b
-LABEL="azure_end"
06517b
+LABEL="walinuxagent_end"
06517b
-- 
06517b
1.8.3.1
06517b