← Back to team overview

curtin-dev team mailing list archive

[Merge] ~raharper/curtin:fix/block-discover-use-mp-name into curtin:master

 

Ryan Harper has proposed merging ~raharper/curtin:fix/block-discover-use-mp-name into curtin:master.

Commit message:
block-discover: handle missing multipath 'path' data, use DM_NAME

Probert's multipath data (maps and paths) is not always complete.
In some systems, the paths output may not include the required
mpath friendly name and instead use a serial number.  In such
cases we can also check DM_NAME in the multipath device udev data
to extract the multipath_id that we can use to search for a member
device.

LP: #1873728

Requested reviews:
  curtin developers (curtin-dev)
Related bugs:
  Bug #1873728 in curtin: "install on power server with excessive disks fails Invalid dep_id"
  https://bugs.launchpad.net/curtin/+bug/1873728

For more details, see:
https://code.launchpad.net/~raharper/curtin/+git/curtin/+merge/382602
-- 
Your team curtin developers is requested to review the proposed merge of ~raharper/curtin:fix/block-discover-use-mp-name into curtin:master.
diff --git a/curtin/storage_config.py b/curtin/storage_config.py
index a7c25cb..885bf74 100644
--- a/curtin/storage_config.py
+++ b/curtin/storage_config.py
@@ -457,9 +457,12 @@ class ProbertParser(object):
             dm_mpath = blockdev.get('DM_MPATH')
             dm_uuid = blockdev.get('DM_UUID')
             dm_part = blockdev.get('DM_PART')
+            dm_name = blockdev.get('DM_NAME')
 
             if dm_mpath:
                 multipath = dm_mpath
+            elif dm_name:
+                multipath = dm_name
             else:
                 # part1-mpath-30000000000000064
                 # mpath-30000000000000064
diff --git a/tests/unittests/test_storage_config.py b/tests/unittests/test_storage_config.py
index e365fad..1f2b833 100644
--- a/tests/unittests/test_storage_config.py
+++ b/tests/unittests/test_storage_config.py
@@ -473,6 +473,82 @@ class TestBlockdevParser(CiTestCase):
         result = self.bdevp.blockdev_to_id(blockdev)
         self.assertEqual('disk-sda', result)
 
+    def test_blockdev_find_mpath_members_checks_dm_name(self):
+        """ BlockdevParser find_mpath_members uses dm_name if present."""
+        dm14 = {
+            "DEVTYPE": "disk",
+            "DEVLINKS": "/dev/disk/by-id/dm-name-mpathb",
+            "DEVNAME": "/dev/dm-14",
+            "DEVTYPE": "disk",
+            "DM_NAME": "mpathb",
+            "DM_UUID": "mpath-360050768028211d8b000000000000062",
+            "DM_WWN": "0x60050768028211d8b000000000000062",
+            "MPATH_DEVICE_READY": "1",
+            "MPATH_SBIN_PATH": "/sbin",
+        }
+        multipath = {
+            "maps": [
+                {
+                    "multipath": "360050768028211d8b000000000000061",
+                    "sysfs": "dm-11",
+                    "paths": "4"
+                },
+                {
+                    "multipath": "360050768028211d8b000000000000062",
+                    "sysfs": "dm-14",
+                    "paths": "4"
+                },
+                {
+                    "multipath": "360050768028211d8b000000000000063",
+                    "sysfs": "dm-15",
+                    "paths": "4"
+                }],
+            "paths": [
+                {
+                    "device": "sdej",
+                    "serial": "0200a084762cXX00",
+                    "multipath": "mpatha",
+                    "host_wwnn": "0x20000024ff9127de",
+                    "target_wwnn": "0x5005076802065e38",
+                    "host_wwpn": "0x21000024ff9127de",
+                    "target_wwpn": "0x5005076802165e38",
+                    "host_adapter": "[undef]"
+                },
+                {
+                    "device": "sdel",
+                    "serial": "0200a084762cXX00",
+                    "multipath": "mpathb",
+                    "host_wwnn": "0x20000024ff9127de",
+                    "target_wwnn": "0x5005076802065e38",
+                    "host_wwpn": "0x21000024ff9127de",
+                    "target_wwpn": "0x5005076802165e38",
+                    "host_adapter": "[undef]"
+                },
+                {
+                    "device": "sdet",
+                    "serial": "0200a084762cXX00",
+                    "multipath": "mpatha",
+                    "host_wwnn": "0x20000024ff9127de",
+                    "target_wwnn": "0x5005076802065e37",
+                    "host_wwpn": "0x21000024ff9127de",
+                    "target_wwpn": "0x5005076802165e37",
+                    "host_adapter": "[undef]"
+                },
+                {
+                    "device": "sdev",
+                    "serial": "0200a084762cXX00",
+                    "multipath": "mpathb",
+                    "host_wwnn": "0x20000024ff9127de",
+                    "target_wwnn": "0x5005076802065e37",
+                    "host_wwpn": "0x21000024ff9127de",
+                    "target_wwpn": "0x5005076802165e37",
+                    "host_adapter": "[undef]"
+                }],
+        }
+        self.bdevp.blockdev_data['/dev/dm-14'] = dm14
+        self.probe_data['multipath'] = multipath
+        self.assertEqual('disk-sdel', self.bdevp.blockdev_to_id(dm14))
+
     def test_blockdev_detects_dasd_device_id_and_vtoc_ptable(self):
         self.probe_data = _get_data('probert_storage_dasd.json')
         self.bdevp = BlockdevParser(self.probe_data)

Follow ups