← Back to team overview

curtin-dev team mailing list archive

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

 

Ryan Harper has proposed merging ~raharper/curtin:fix/device-mapper-mpath-is-not-symlink into curtin:master.

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

Requested reviews:
  curtin developers (curtin-dev)

For more details, see:
https://code.launchpad.net/~raharper/curtin/+git/curtin/+merge/382776
-- 
Your team curtin developers is requested to review the proposed merge of ~raharper/curtin:fix/device-mapper-mpath-is-not-symlink into curtin:master.
diff --git a/curtin/commands/block_meta.py b/curtin/commands/block_meta.py
index 7fbd89f..5849e3d 100644
--- a/curtin/commands/block_meta.py
+++ b/curtin/commands/block_meta.py
@@ -910,8 +910,12 @@ def partition_handler(info, storage_config):
         if multipath.is_mpath_device(disk):
             udevadm_settle()  # allow partition creation to happen
             # update device mapper table mapping to mpathX-partN
-            util.subp(['kpartx', '-v', '-a', '-s', '-p', '-part', disk])
             part_path = disk + "-part%s" % partnumber
+            # sometimes multipath lib creates a block device instead of
+            # a udev symlink, remove this and allow kpartx to create it
+            if os.path.exists(part_path) and not os.path.islink(part_path):
+                util.del_file(part_path)
+            util.subp(['kpartx', '-v', '-a', '-s', '-p', '-part', disk])
         else:
             part_path = block.dev_path(block.partition_kname(disk_kname,
                                                              partnumber))

Follow ups