← Back to team overview

curtin-dev team mailing list archive

Re: [Merge] ~mwhudson/curtin:fix-multipath-partition-verification-2 into curtin:master

 


Diff comments:

> diff --git a/curtin/block/__init__.py b/curtin/block/__init__.py
> index 0cf0866..eca69d8 100644
> --- a/curtin/block/__init__.py
> +++ b/curtin/block/__init__.py
> @@ -158,9 +158,6 @@ def sys_block_path(devname, add=None, strict=True):
>      devname = os.path.normpath(devname)
>      if devname.startswith('/dev/') and not os.path.exists(devname):
>          LOG.warning('block.sys_block_path: devname %s does not exist', devname)
> -    (parent, partnum) = get_blockdev_for_partition(devname, strict=strict)
> -    if partnum:
> -        toks.append(path_to_kname(parent))

OK.  vmtest will shake out anything funny, with like bcache or other layered stuff.  But I think it should be fine.

>  
>      toks.append(path_to_kname(devname))
>  
> @@ -421,6 +418,14 @@ def get_blockdev_for_partition(devpath, strict=True):
>      if strict and not os.path.exists(syspath):
>          raise OSError("%s had no syspath (%s)" % (devpath, syspath))
>  
> +    dm_name_path = os.path.join(syspath, 'dm/name')
> +    if os.path.exists(dm_name_path):
> +        dm_name = util.load_file(dm_name_path).rstrip()
> +        if '-part' in dm_name:
> +            parent_name, ptnum = dm_name.rsplit('-part', 1)
> +            parent_path = os.path.realpath('/dev/mapper/' + parent_name)
> +            return (parent_path, ptnum)

This is still for multipath partitions, which are really disks, but get called partitions by dm/multipath naming convention, right?  Can we move this to a function (either in curtin/block/__init__.py or curtin/block/multipath.py; either is fine; and will make it easier to mock.

> +
>      ptpath = os.path.join(syspath, "partition")
>      if not os.path.exists(ptpath):
>          return (rpath, None)


-- 
https://code.launchpad.net/~mwhudson/curtin/+git/curtin/+merge/396462
Your team curtin developers is requested to review the proposed merge of ~mwhudson/curtin:fix-multipath-partition-verification-2 into curtin:master.


References