Diff comments:

> diff --git a/curtin/block/nvme.py b/curtin/block/nvme.py
> new file mode 100644
> index 0000000..d1e0e59
> --- /dev/null
> +++ b/curtin/block/nvme.py
> @@ -0,0 +1,40 @@
> +# This file is part of curtin. See LICENSE file for copyright and license 
> info.
> +
> +from typing import Any, Iterator
> +
> +from curtin.log import LOG
> +
> +
> +def _iter_nvme_controllers(cfg) -> Iterator[dict[str, Any]]:

This needs to be typing.Dict not dict for focal I think.

> +    if not cfg:
> +        cfg = {}
> +
> +    if 'storage' in cfg:
> +        if not isinstance(cfg['storage'], dict):
> +            sconfig = {}
> +        else:
> +            sconfig = cfg['storage'].get('config', [])
> +    else:
> +        sconfig = cfg.get('config', [])
> +
> +    if not sconfig or not isinstance(sconfig, list):
> +        LOG.warning('Configuration dictionary did not contain'
> +                    ' a storage configuration.')
> +        return
> +
> +    for item in sconfig:
> +        if item['type'] == 'nvme_controller':
> +            yield item
> +
> +
> +def get_nvme_controllers_from_config(
> +        cfg, *, exclude_pcie=False) -> list[dict[str, Any]]:

Same here.

> +    '''Parse a curtin storage config and return a list of
> +    NVMe controllers. If exclude_pcie is True, only return controllers that 
> do
> +    not use PCIe transport.'''
> +    controllers = _iter_nvme_controllers(cfg)
> +
> +    if not exclude_pcie:
> +        return list(controllers)
> +
> +    return [ctrler for ctrler in controllers if ctrler['transport'] != 
> 'pcie']


-- 
https://code.launchpad.net/~ogayot/curtin/+git/curtin/+merge/462257
Your team curtin developers is requested to review the proposed merge of 
~ogayot/curtin:nvme-stas-of-only into curtin:master.


-- 
Mailing list: https://launchpad.net/~curtin-dev
Post to     : curtin-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~curtin-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to