← Back to team overview

curtin-dev team mailing list archive

[Merge] ~raharper/curtin:fix/multipath-nvme-name into curtin:master

 

Ryan Harper has proposed merging ~raharper/curtin:fix/multipath-nvme-name into curtin:master.

Commit message:
multipath: handle multipath nvme name fields correctly

NVME Multipath devices do not have typical mpath names, instead they
include colons and whitespace.  Handle this by adjusting the multipath
maps command output to single quote the name field like we do for the
other fields.

LP: #1878041


Requested reviews:
  Server Team CI bot (server-team-bot): continuous-integration
  curtin developers (curtin-dev)
Related bugs:
  Bug #1878041 in curtin: "installation fails creating user on large multipath system - multipathd show command times out in curtin log with 163 paths"
  https://bugs.launchpad.net/curtin/+bug/1878041

For more details, see:
https://code.launchpad.net/~raharper/curtin/+git/curtin/+merge/385830
-- 
Your team curtin developers is requested to review the proposed merge of ~raharper/curtin:fix/multipath-nvme-name into curtin:master.
diff --git a/curtin/block/multipath.py b/curtin/block/multipath.py
index 9c7f510..7ad1791 100644
--- a/curtin/block/multipath.py
+++ b/curtin/block/multipath.py
@@ -7,7 +7,7 @@ from curtin import udev
 SHOW_PATHS_FMT = ("device='%d' serial='%z' multipath='%m' host_wwpn='%N' "
                   "target_wwnn='%n' host_wwpn='%R' target_wwpn='%r' "
                   "host_adapter='%a'")
-SHOW_MAPS_FMT = "name=%n multipath='%w' sysfs='%d' paths='%N'"
+SHOW_MAPS_FMT = "name='%n' multipath='%w' sysfs='%d' paths='%N'"
 
 
 def _extract_mpath_data(cmd, show_verb):
diff --git a/tests/data/multipath-nvme.txt b/tests/data/multipath-nvme.txt
new file mode 100644
index 0000000..30b59e4
--- /dev/null
+++ b/tests/data/multipath-nvme.txt
@@ -0,0 +1 @@
+name='nqn.1994-11.com.samsung:nvme:PM1725a:HHHL:S3RVNA0J300208      :nsid.1' multipath='eui.335256304a3002080025384100000001' sysfs='nvme0n1' paths='1'
diff --git a/tests/unittests/test_block_multipath.py b/tests/unittests/test_block_multipath.py
index 2101eae..96cbcba 100644
--- a/tests/unittests/test_block_multipath.py
+++ b/tests/unittests/test_block_multipath.py
@@ -39,6 +39,20 @@ class TestMultipath(CiTestCase):
                          multipath.show_maps())
         self.m_subp.assert_called_with(expected, capture=True)
 
+    def test_show_maps_nvme(self):
+        """verify show_maps extracts mulitpath map data correctly."""
+        NVME_MP = multipath.util.load_file('tests/data/multipath-nvme.txt')
+        self.m_subp.return_value = (NVME_MP, "")
+        expected = ['multipathd', 'show', 'maps', 'raw', 'format',
+                    multipath.SHOW_MAPS_FMT]
+        self.assertEqual([
+            {'name':
+             ('nqn.1994-11.com.samsung:nvme:PM1725a:HHHL:S3RVNA0J300208      '
+              ':nsid.1'),
+             'multipath': 'eui.335256304a3002080025384100000001',
+             'sysfs': 'nvme0n1', 'paths': '1'}], multipath.show_maps())
+        self.m_subp.assert_called_with(expected, capture=True)
+
     def test_is_mpath_device_true(self):
         """is_mpath_device returns true if dev DM_UUID starts with mpath-"""
         self.m_udev.udevadm_info.return_value = {'DM_UUID': 'mpath-mpatha-foo'}