Vojtech Trefny 8d495e
From d7708bca72f4a7d0bfa732912e2087bd6aa8f379 Mon Sep 17 00:00:00 2001
Vojtech Trefny 8d495e
From: Steffen Maier <maier@linux.ibm.com>
Vojtech Trefny 8d495e
Date: Thu, 23 Feb 2023 13:28:50 +0100
Vojtech Trefny 8d495e
Subject: [PATCH] add udev-builtin-path_id property to zfcp-attached SCSI disks
Vojtech Trefny 8d495e
Vojtech Trefny 8d495e
so anaconda can use it to display path_id information for multipath
Vojtech Trefny 8d495e
members
Vojtech Trefny 8d495e
Vojtech Trefny 8d495e
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Vojtech Trefny 8d495e
---
Vojtech Trefny 8d495e
 blivet/devices/disk.py           | 2 ++
Vojtech Trefny 8d495e
 blivet/populator/helpers/disk.py | 1 +
Vojtech Trefny 8d495e
 tests/unit_tests/tags_test.py    | 2 +-
Vojtech Trefny 8d495e
 3 files changed, 4 insertions(+), 1 deletion(-)
Vojtech Trefny 8d495e
Vojtech Trefny 8d495e
diff --git a/blivet/devices/disk.py b/blivet/devices/disk.py
Vojtech Trefny 8d495e
index 8842b4dc..746f6d58 100644
Vojtech Trefny 8d495e
--- a/blivet/devices/disk.py
Vojtech Trefny 8d495e
+++ b/blivet/devices/disk.py
Vojtech Trefny 8d495e
@@ -556,10 +556,12 @@ class ZFCPDiskDevice(DiskDevice):
Vojtech Trefny 8d495e
             :keyword hba_id: ???
Vojtech Trefny 8d495e
             :keyword wwpn: ???
Vojtech Trefny 8d495e
             :keyword fcp_lun: ???
Vojtech Trefny 8d495e
+            :keyword id_path: string from udev-builtin-path_id
Vojtech Trefny 8d495e
         """
Vojtech Trefny 8d495e
         self.hba_id = kwargs.pop("hba_id")
Vojtech Trefny 8d495e
         self.wwpn = kwargs.pop("wwpn")
Vojtech Trefny 8d495e
         self.fcp_lun = kwargs.pop("fcp_lun")
Vojtech Trefny 8d495e
+        self.id_path = kwargs.pop("id_path")
Vojtech Trefny 8d495e
         DiskDevice.__init__(self, device, **kwargs)
Vojtech Trefny 8d495e
         self._clear_local_tags()
Vojtech Trefny 8d495e
         self.tags.add(Tags.remote)
Vojtech Trefny 8d495e
diff --git a/blivet/populator/helpers/disk.py b/blivet/populator/helpers/disk.py
Vojtech Trefny 8d495e
index cf20d302..92e85688 100644
Vojtech Trefny 8d495e
--- a/blivet/populator/helpers/disk.py
Vojtech Trefny 8d495e
+++ b/blivet/populator/helpers/disk.py
Vojtech Trefny 8d495e
@@ -223,6 +223,7 @@ class ZFCPDevicePopulator(DiskDevicePopulator):
Vojtech Trefny 8d495e
     def _get_kwargs(self):
Vojtech Trefny 8d495e
         kwargs = super(ZFCPDevicePopulator, self)._get_kwargs()
Vojtech Trefny 8d495e
 
Vojtech Trefny 8d495e
+        kwargs["id_path"] = udev.device_get_path(self.data)
Vojtech Trefny 8d495e
         for attr in ['hba_id', 'wwpn', 'fcp_lun']:
Vojtech Trefny 8d495e
             kwargs[attr] = udev.device_get_zfcp_attribute(self.data, attr=attr)
Vojtech Trefny 8d495e
 
Vojtech Trefny 8d495e
diff --git a/tests/unit_tests/tags_test.py b/tests/unit_tests/tags_test.py
Vojtech Trefny 8d495e
index 49a2d72e..15fa2a40 100644
Vojtech Trefny 8d495e
--- a/tests/unit_tests/tags_test.py
Vojtech Trefny 8d495e
+++ b/tests/unit_tests/tags_test.py
Vojtech Trefny 8d495e
@@ -72,7 +72,7 @@ class DeviceTagsTest(unittest.TestCase):
Vojtech Trefny 8d495e
         fcoe_device = FcoeDiskDevice('test6', nic=None, identifier=None, id_path=None)
Vojtech Trefny 8d495e
         self.assertIn(Tags.remote, fcoe_device.tags)
Vojtech Trefny 8d495e
         self.assertNotIn(Tags.local, fcoe_device.tags)
Vojtech Trefny 8d495e
-        zfcp_device = ZFCPDiskDevice('test7', hba_id=None, wwpn=None, fcp_lun=None)
Vojtech Trefny 8d495e
+        zfcp_device = ZFCPDiskDevice('test7', hba_id=None, wwpn=None, fcp_lun=None, id_path=None)
Vojtech Trefny 8d495e
         self.assertIn(Tags.remote, zfcp_device.tags)
Vojtech Trefny 8d495e
         self.assertNotIn(Tags.local, zfcp_device.tags)
Vojtech Trefny 8d495e
 
Vojtech Trefny 8d495e
-- 
Vojtech Trefny 8d495e
2.43.0
Vojtech Trefny 8d495e