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

Proposed by Ryan Harper
Status: Merged
Approved by: Chad Smith
Approved revision: d3dc8caa4378f6dbd002ad73a77748a7c4463027
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~raharper/curtin:fix/multipath-nvme-name
Merge into: curtin:master
Diff against target: 45 lines (+16/-1)
3 files modified
curtin/block/multipath.py (+1/-1)
tests/data/multipath-nvme.txt (+1/-0)
tests/unittests/test_block_multipath.py (+14/-0)
Reviewer Review Type Date Requested Status
Chad Smith Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+385830@code.launchpad.net

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

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Chad Smith (chad.smith) wrote :

LGTM, thanks @rharper.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/curtin/block/multipath.py b/curtin/block/multipath.py
2index 9c7f510..7ad1791 100644
3--- a/curtin/block/multipath.py
4+++ b/curtin/block/multipath.py
5@@ -7,7 +7,7 @@ from curtin import udev
6 SHOW_PATHS_FMT = ("device='%d' serial='%z' multipath='%m' host_wwpn='%N' "
7 "target_wwnn='%n' host_wwpn='%R' target_wwpn='%r' "
8 "host_adapter='%a'")
9-SHOW_MAPS_FMT = "name=%n multipath='%w' sysfs='%d' paths='%N'"
10+SHOW_MAPS_FMT = "name='%n' multipath='%w' sysfs='%d' paths='%N'"
11
12
13 def _extract_mpath_data(cmd, show_verb):
14diff --git a/tests/data/multipath-nvme.txt b/tests/data/multipath-nvme.txt
15new file mode 100644
16index 0000000..30b59e4
17--- /dev/null
18+++ b/tests/data/multipath-nvme.txt
19@@ -0,0 +1 @@
20+name='nqn.1994-11.com.samsung:nvme:PM1725a:HHHL:S3RVNA0J300208 :nsid.1' multipath='eui.335256304a3002080025384100000001' sysfs='nvme0n1' paths='1'
21diff --git a/tests/unittests/test_block_multipath.py b/tests/unittests/test_block_multipath.py
22index 2101eae..96cbcba 100644
23--- a/tests/unittests/test_block_multipath.py
24+++ b/tests/unittests/test_block_multipath.py
25@@ -39,6 +39,20 @@ class TestMultipath(CiTestCase):
26 multipath.show_maps())
27 self.m_subp.assert_called_with(expected, capture=True)
28
29+ def test_show_maps_nvme(self):
30+ """verify show_maps extracts mulitpath map data correctly."""
31+ NVME_MP = multipath.util.load_file('tests/data/multipath-nvme.txt')
32+ self.m_subp.return_value = (NVME_MP, "")
33+ expected = ['multipathd', 'show', 'maps', 'raw', 'format',
34+ multipath.SHOW_MAPS_FMT]
35+ self.assertEqual([
36+ {'name':
37+ ('nqn.1994-11.com.samsung:nvme:PM1725a:HHHL:S3RVNA0J300208 '
38+ ':nsid.1'),
39+ 'multipath': 'eui.335256304a3002080025384100000001',
40+ 'sysfs': 'nvme0n1', 'paths': '1'}], multipath.show_maps())
41+ self.m_subp.assert_called_with(expected, capture=True)
42+
43 def test_is_mpath_device_true(self):
44 """is_mpath_device returns true if dev DM_UUID starts with mpath-"""
45 self.m_udev.udevadm_info.return_value = {'DM_UUID': 'mpath-mpatha-foo'}

Subscribers

People subscribed via source and target branches