Merge ~raharper/curtin:fix/device-mapper-mpath-is-not-symlink into curtin:master

Proposed by Ryan Harper
Status: Merged
Approved by: Ryan Harper
Approved revision: 22172900d8090ba7f9e3110e80d9b63152d42cf7
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~raharper/curtin:fix/device-mapper-mpath-is-not-symlink
Merge into: curtin:master
Diff against target: 18 lines (+5/-1)
1 file modified
curtin/commands/block_meta.py (+5/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Dimitri John Ledkov (community) Approve
Dan Watkins (community) Approve
Review via email: mp+382776@code.launchpad.net

Commit message

block-meta: device mapper partitions may be block devices not links

In some cases the multipath library may create a block device which
is not a symbolic link to the device-mapper dev[1]. Curtin expects the
symlink. Remove the non-symlink file and allow kpartx to create it.

1. https://bugzilla.redhat.com/show_bug.cgi?id=869253

To post a comment you must log in.
Revision history for this message
Dan Watkins (oddbloke) wrote :

A couple of inline improvements requested, but those can follow after the RC change lands.

review: Approve
Revision history for this message
Ryan Harper (raharper) :
Revision history for this message
Dimitri John Ledkov (xnox) :
review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ryan Harper (raharper) wrote :

I'm doing some vmtests on the multipath scenarios, and then landing this.

Revision history for this message
Ryan Harper (raharper) wrote :

----------------------------------------------------------------------
Ran 156 tests in 1012.242s

OK (SKIP=20)
Wed, 22 Apr 2020 13:33:58 -0500: vmtest end [0] in 1016s

Revision history for this message
Dan Watkins (oddbloke) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/curtin/commands/block_meta.py b/curtin/commands/block_meta.py
2index 7fbd89f..5849e3d 100644
3--- a/curtin/commands/block_meta.py
4+++ b/curtin/commands/block_meta.py
5@@ -910,8 +910,12 @@ def partition_handler(info, storage_config):
6 if multipath.is_mpath_device(disk):
7 udevadm_settle() # allow partition creation to happen
8 # update device mapper table mapping to mpathX-partN
9- util.subp(['kpartx', '-v', '-a', '-s', '-p', '-part', disk])
10 part_path = disk + "-part%s" % partnumber
11+ # sometimes multipath lib creates a block device instead of
12+ # a udev symlink, remove this and allow kpartx to create it
13+ if os.path.exists(part_path) and not os.path.islink(part_path):
14+ util.del_file(part_path)
15+ util.subp(['kpartx', '-v', '-a', '-s', '-p', '-part', disk])
16 else:
17 part_path = block.dev_path(block.partition_kname(disk_kname,
18 partnumber))

Subscribers

People subscribed via source and target branches