libmultipath: Fix information not shown when first path is down.
PATCH 1/1 libmultipath: Fix information not shown when first path is down.
vendor_id and product_id information are not shown when displaying multipath topology if the first path is down.
0QEMU_QEMU_HARDDISK_HELLOWORLD dm-0 , <--- Missing vendor and product
size=10G features='0' hwhandler='0' wp=rw |-+- policy='service-time 0' prio=0 status=active
| `- #:#:#:# - #:# active undef running
`-+- policy='service-time 0' prio=0 status=enabled
`- 2:0:1:0 sdd 8:48 active undef running
This happens because we only look at the first_path when printing the topology. This patch looks at every slot in the path vector until we find one with the correct value.
--- libmultipath/print.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
libmultipath/print.c +14 -5
@@ -248,11 +248,20 @@ snprint_multipath_uuid (char * buff, size_t len, struct multipath * mpp)static int snprint_multipath_vpr (char * buff,size_t len,struct multipath * mpp) { -struct path * pp =first_path (mpp); -if (!pp) -return 0 ; -return snprintf (buff, len,"%s,%s" , - pp->vendor_id, pp->product_id); +struct pathgroup * pgp; +struct path * pp; +int i, j; + + vector_foreach_slot(mpp->pg, pgp, i) { +if (!pgp) +continue ; + vector_foreach_slot(pgp->paths, pp, j) { +if (strlen (pp->vendor_id) &&strlen (pp->product_id)) +return snprintf (buff, len,"%s,%s" , + pp->vendor_id, pp->product_id); + } + } +return snprintf (buff, len,"##,##" ); } static int
Signature · 1 line
2.1.0
Christophe Varoqui
AppliedApplied,
Thanks.
Quoted 60 lines · Gabriel Krisman Bertazi
vendor_idandproduct_idinformation are not shown when displaying multipath topology if the first path is down.0QEMU_QEMU_HARDDISK_HELLOWORLD dm-0 , <--- Missing vendor and product
size=10G features='0' hwhandler='0' wp=rw |-+- policy='service-time 0' prio=0 status=active
| `- #:#:#:# - #:# active undef running
`-+- policy='service-time 0' prio=0 status=enabled
`- 2:0:1:0 sdd 8:48 active undef runningThis happens because we only look at the
first_pathwhen printing the topology. This patch looks at every slot in the path vector until we find one with the correct value.Signed-off-by Gabriel Krisman Bertazi <[email protected]>--- libmultipath/print.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)libmultipath/print.c +14
-5@@ -248,11 +248,20 @@ snprint_multipath_uuid (char * buff, size_t len, struct multipath * mpp)static int snprint_multipath_vpr (char * buff,size_t len,struct multipath * mpp) { -struct path * pp =first_path (mpp); -if (!pp) -return 0 ; -return snprintf (buff, len,"%s,%s" , - pp->vendor_id, pp->product_id); +struct pathgroup * pgp; +struct path * pp; +int i, j; + + vector_foreach_slot(mpp->pg, pgp, i) { +if (!pgp) +continue ; + vector_foreach_slot(pgp->paths, pp, j) { +if (strlen (pp->vendor_id) &&strlen (pp->product_id)) +return snprintf (buff, len,"%s,%s" , + pp->vendor_id, pp->product_id); + } + } +return snprintf (buff, len,"##,##" );}
static int
--
2.1.0--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel