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

Proposed by Ryan Harper
Status: Merged
Approved by: Ryan Harper
Approved revision: 550a0c8ed4fdbfead586a15612a6b5a4e46b02af
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~raharper/curtin:fix/block-discover-use-mp-name
Merge into: curtin:master
Diff against target: 104 lines (+79/-0)
2 files modified
curtin/storage_config.py (+3/-0)
tests/unittests/test_storage_config.py (+76/-0)
Reviewer Review Type Date Requested Status
Dan Watkins (community) Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+382602@code.launchpad.net

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

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
Dan Watkins (oddbloke) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/curtin/storage_config.py b/curtin/storage_config.py
2index a7c25cb..885bf74 100644
3--- a/curtin/storage_config.py
4+++ b/curtin/storage_config.py
5@@ -457,9 +457,12 @@ class ProbertParser(object):
6 dm_mpath = blockdev.get('DM_MPATH')
7 dm_uuid = blockdev.get('DM_UUID')
8 dm_part = blockdev.get('DM_PART')
9+ dm_name = blockdev.get('DM_NAME')
10
11 if dm_mpath:
12 multipath = dm_mpath
13+ elif dm_name:
14+ multipath = dm_name
15 else:
16 # part1-mpath-30000000000000064
17 # mpath-30000000000000064
18diff --git a/tests/unittests/test_storage_config.py b/tests/unittests/test_storage_config.py
19index e365fad..1f2b833 100644
20--- a/tests/unittests/test_storage_config.py
21+++ b/tests/unittests/test_storage_config.py
22@@ -473,6 +473,82 @@ class TestBlockdevParser(CiTestCase):
23 result = self.bdevp.blockdev_to_id(blockdev)
24 self.assertEqual('disk-sda', result)
25
26+ def test_blockdev_find_mpath_members_checks_dm_name(self):
27+ """ BlockdevParser find_mpath_members uses dm_name if present."""
28+ dm14 = {
29+ "DEVTYPE": "disk",
30+ "DEVLINKS": "/dev/disk/by-id/dm-name-mpathb",
31+ "DEVNAME": "/dev/dm-14",
32+ "DEVTYPE": "disk",
33+ "DM_NAME": "mpathb",
34+ "DM_UUID": "mpath-360050768028211d8b000000000000062",
35+ "DM_WWN": "0x60050768028211d8b000000000000062",
36+ "MPATH_DEVICE_READY": "1",
37+ "MPATH_SBIN_PATH": "/sbin",
38+ }
39+ multipath = {
40+ "maps": [
41+ {
42+ "multipath": "360050768028211d8b000000000000061",
43+ "sysfs": "dm-11",
44+ "paths": "4"
45+ },
46+ {
47+ "multipath": "360050768028211d8b000000000000062",
48+ "sysfs": "dm-14",
49+ "paths": "4"
50+ },
51+ {
52+ "multipath": "360050768028211d8b000000000000063",
53+ "sysfs": "dm-15",
54+ "paths": "4"
55+ }],
56+ "paths": [
57+ {
58+ "device": "sdej",
59+ "serial": "0200a084762cXX00",
60+ "multipath": "mpatha",
61+ "host_wwnn": "0x20000024ff9127de",
62+ "target_wwnn": "0x5005076802065e38",
63+ "host_wwpn": "0x21000024ff9127de",
64+ "target_wwpn": "0x5005076802165e38",
65+ "host_adapter": "[undef]"
66+ },
67+ {
68+ "device": "sdel",
69+ "serial": "0200a084762cXX00",
70+ "multipath": "mpathb",
71+ "host_wwnn": "0x20000024ff9127de",
72+ "target_wwnn": "0x5005076802065e38",
73+ "host_wwpn": "0x21000024ff9127de",
74+ "target_wwpn": "0x5005076802165e38",
75+ "host_adapter": "[undef]"
76+ },
77+ {
78+ "device": "sdet",
79+ "serial": "0200a084762cXX00",
80+ "multipath": "mpatha",
81+ "host_wwnn": "0x20000024ff9127de",
82+ "target_wwnn": "0x5005076802065e37",
83+ "host_wwpn": "0x21000024ff9127de",
84+ "target_wwpn": "0x5005076802165e37",
85+ "host_adapter": "[undef]"
86+ },
87+ {
88+ "device": "sdev",
89+ "serial": "0200a084762cXX00",
90+ "multipath": "mpathb",
91+ "host_wwnn": "0x20000024ff9127de",
92+ "target_wwnn": "0x5005076802065e37",
93+ "host_wwpn": "0x21000024ff9127de",
94+ "target_wwpn": "0x5005076802165e37",
95+ "host_adapter": "[undef]"
96+ }],
97+ }
98+ self.bdevp.blockdev_data['/dev/dm-14'] = dm14
99+ self.probe_data['multipath'] = multipath
100+ self.assertEqual('disk-sdel', self.bdevp.blockdev_to_id(dm14))
101+
102 def test_blockdev_detects_dasd_device_id_and_vtoc_ptable(self):
103 self.probe_data = _get_data('probert_storage_dasd.json')
104 self.bdevp = BlockdevParser(self.probe_data)

Subscribers

People subscribed via source and target branches