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
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):
457 dm_mpath = blockdev.get('DM_MPATH')457 dm_mpath = blockdev.get('DM_MPATH')
458 dm_uuid = blockdev.get('DM_UUID')458 dm_uuid = blockdev.get('DM_UUID')
459 dm_part = blockdev.get('DM_PART')459 dm_part = blockdev.get('DM_PART')
460 dm_name = blockdev.get('DM_NAME')
460461
461 if dm_mpath:462 if dm_mpath:
462 multipath = dm_mpath463 multipath = dm_mpath
464 elif dm_name:
465 multipath = dm_name
463 else:466 else:
464 # part1-mpath-30000000000000064467 # part1-mpath-30000000000000064
465 # mpath-30000000000000064468 # 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):
473 result = self.bdevp.blockdev_to_id(blockdev)473 result = self.bdevp.blockdev_to_id(blockdev)
474 self.assertEqual('disk-sda', result)474 self.assertEqual('disk-sda', result)
475475
476 def test_blockdev_find_mpath_members_checks_dm_name(self):
477 """ BlockdevParser find_mpath_members uses dm_name if present."""
478 dm14 = {
479 "DEVTYPE": "disk",
480 "DEVLINKS": "/dev/disk/by-id/dm-name-mpathb",
481 "DEVNAME": "/dev/dm-14",
482 "DEVTYPE": "disk",
483 "DM_NAME": "mpathb",
484 "DM_UUID": "mpath-360050768028211d8b000000000000062",
485 "DM_WWN": "0x60050768028211d8b000000000000062",
486 "MPATH_DEVICE_READY": "1",
487 "MPATH_SBIN_PATH": "/sbin",
488 }
489 multipath = {
490 "maps": [
491 {
492 "multipath": "360050768028211d8b000000000000061",
493 "sysfs": "dm-11",
494 "paths": "4"
495 },
496 {
497 "multipath": "360050768028211d8b000000000000062",
498 "sysfs": "dm-14",
499 "paths": "4"
500 },
501 {
502 "multipath": "360050768028211d8b000000000000063",
503 "sysfs": "dm-15",
504 "paths": "4"
505 }],
506 "paths": [
507 {
508 "device": "sdej",
509 "serial": "0200a084762cXX00",
510 "multipath": "mpatha",
511 "host_wwnn": "0x20000024ff9127de",
512 "target_wwnn": "0x5005076802065e38",
513 "host_wwpn": "0x21000024ff9127de",
514 "target_wwpn": "0x5005076802165e38",
515 "host_adapter": "[undef]"
516 },
517 {
518 "device": "sdel",
519 "serial": "0200a084762cXX00",
520 "multipath": "mpathb",
521 "host_wwnn": "0x20000024ff9127de",
522 "target_wwnn": "0x5005076802065e38",
523 "host_wwpn": "0x21000024ff9127de",
524 "target_wwpn": "0x5005076802165e38",
525 "host_adapter": "[undef]"
526 },
527 {
528 "device": "sdet",
529 "serial": "0200a084762cXX00",
530 "multipath": "mpatha",
531 "host_wwnn": "0x20000024ff9127de",
532 "target_wwnn": "0x5005076802065e37",
533 "host_wwpn": "0x21000024ff9127de",
534 "target_wwpn": "0x5005076802165e37",
535 "host_adapter": "[undef]"
536 },
537 {
538 "device": "sdev",
539 "serial": "0200a084762cXX00",
540 "multipath": "mpathb",
541 "host_wwnn": "0x20000024ff9127de",
542 "target_wwnn": "0x5005076802065e37",
543 "host_wwpn": "0x21000024ff9127de",
544 "target_wwpn": "0x5005076802165e37",
545 "host_adapter": "[undef]"
546 }],
547 }
548 self.bdevp.blockdev_data['/dev/dm-14'] = dm14
549 self.probe_data['multipath'] = multipath
550 self.assertEqual('disk-sdel', self.bdevp.blockdev_to_id(dm14))
551
476 def test_blockdev_detects_dasd_device_id_and_vtoc_ptable(self):552 def test_blockdev_detects_dasd_device_id_and_vtoc_ptable(self):
477 self.probe_data = _get_data('probert_storage_dasd.json')553 self.probe_data = _get_data('probert_storage_dasd.json')
478 self.bdevp = BlockdevParser(self.probe_data)554 self.bdevp = BlockdevParser(self.probe_data)

Subscribers

People subscribed via source and target branches