On Fri, Sep 14, 2018 at 02:51:00PM +0200, Martin Wilck wrote:

Reviewed-by: Benjamin Marzinski <[email protected]>

> The nvme foreign code maps the NVMe subsys NQN to the "%n"
> wildcard ("alias"). Some real-world devices use very lengthy
> expressions for the subsys NQN (counted 95 characters on one
> system here), making the "multipath -ll" output hardly readable
> for humans. Use a shorter and more concise printout instead,
> based on the WWID only.
> 
> The subsys NQN is still available via the "%n" wildcard:
> "multipathd show maps format %n".
> 
> Signed-off-by: Martin Wilck <[email protected]>
> ---
>  libmultipath/foreign/nvme.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/libmultipath/foreign/nvme.c b/libmultipath/foreign/nvme.c
> index fca3235f..8887a755 100644
> --- a/libmultipath/foreign/nvme.c
> +++ b/libmultipath/foreign/nvme.c
> @@ -286,10 +286,18 @@ static int snprint_nvme_path(const struct gen_path *gp,
>       return 0;
>  }
>  
> +static int nvme_style(const struct gen_multipath* gm,
> +                   char *buf, int len, int verbosity)
> +{
> +     int n = snprintf(buf, len, "%%w [%%G]:%%d %%s");
> +
> +     return (n < len ? n : len - 1);
> +}
> +
>  static const struct gen_multipath_ops nvme_map_ops = {
>       .get_pathgroups = nvme_mp_get_pgs,
>       .rel_pathgroups = nvme_mp_rel_pgs,
> -     .style = generic_style,
> +     .style = nvme_style,
>       .snprint = snprint_nvme_map,
>  };
>  
> -- 
> 2.18.0

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to