curtin-dev team mailing list archive
-
curtin-dev team
-
Mailing list archive
-
Message #02110
[Merge] ~mwhudson/curtin:always-devpath into curtin:master
Michael Hudson-Doyle has proposed merging ~mwhudson/curtin:always-devpath into curtin:master.
Commit message:
block_meta: have get_path_to_storage_volume always return device node
Specifically, return /dev/dm-X for device-mapper paths, not /dev/mapper/foo.
This should fix the multipath reuse vmtests.
Requested reviews:
curtin developers (curtin-dev)
For more details, see:
https://code.launchpad.net/~mwhudson/curtin/+git/curtin/+merge/415876
I took a look at the failing vmtests and I think this is the only change needed for curtin (vs changes to test data or code).
Curtin really needs a block device object.
--
Your team curtin developers is requested to review the proposed merge of ~mwhudson/curtin:always-devpath into curtin:master.
diff --git a/curtin/commands/block_meta.py b/curtin/commands/block_meta.py
index f3f19dc..7edcb17 100644
--- a/curtin/commands/block_meta.py
+++ b/curtin/commands/block_meta.py
@@ -441,15 +441,16 @@ def get_path_to_storage_volume(volume, storage_config):
# Find path to block device
if vol.get('type') == "partition":
partnumber = determine_partition_number(vol.get('id'), storage_config)
- disk_block_path = get_path_to_storage_volume(vol.get('device'),
- storage_config)
- if disk_block_path.startswith('/dev/mapper/mpath'):
- volume_path = disk_block_path + '-part%s' % partnumber
+ disk_block_path = get_path_to_storage_volume(
+ vol.get('device'), storage_config)
+ mpath_id = multipath.get_mpath_id_from_device(disk_block_path)
+ if mpath_id is not None:
+ volume_path = '/dev/mapper/%s-part%s' % (mpath_id, partnumber)
else:
disk_kname = block.path_to_kname(disk_block_path)
partition_kname = block.partition_kname(disk_kname, partnumber)
volume_path = block.kname_to_path(partition_kname)
- devsync_vol = os.path.join(disk_block_path)
+ devsync_vol = disk_block_path
elif vol.get('type') == "disk":
# Get path to block device for disk. Device_id param should refer
@@ -543,8 +544,9 @@ def get_path_to_storage_volume(volume, storage_config):
devsync_vol = volume_path
devsync(devsync_vol)
- LOG.debug('return volume path %s', volume_path)
- return volume_path
+ real_path = os.path.realpath(volume_path)
+ LOG.debug('return volume path %s -> %s', volume_path, real_path)
+ return real_path
DEVS = set()
Follow ups