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

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