Red Hat Bugzilla – Bug 1299651
Add machine-readable/parseable output option to multipath command
Last modified: 2016-11-04 04:16:49 EDT
Added multipathd show paths raw format <fmt> and multipathd show maps raw format <fmt> commands to remove headers and padding from the command output.
Verified on device-mapper-multipath-0.4.9-89.el7 1). [root@storageqe-84 ~]# multipathd show paths format "%w %i %d %t %o %T" uuid hcil dev dm_st dev_st chk_st 360fff19abdd9552f8a36e5355226ba27 3:0:0:0 sdb active running ready 360fff19abdd9552f8a36e5355226ba27 4:0:0:0 sdc active running ready 3600508b1001c1eff28d1c3b503a59df1 0:0:0:0 sda undef running ready [root@storageqe-84 ~]# multipathd show paths raw format "%w %i %d %t %o %T" 360fff19abdd9552f8a36e5355226ba27 3:0:0:0 sdb active running ready 360fff19abdd9552f8a36e5355226ba27 4:0:0:0 sdc active running ready 3600508b1001c1eff28d1c3b503a59df1 0:0:0:0 sda undef running ready 2). [root@storageqe-84 ~]# multipathd show maps format "%n %w %d %s" name uuid sysfs vend/prod/rev mpatha 360fff19abdd9552f8a36e5355226ba27 dm-0 EQLOGIC ,100E-00 [root@storageqe-84 ~]# multipathd show maps raw format "%n %w %d %s" mpatha 360fff19abdd9552f8a36e5355226ba27 dm-0 EQLOGIC ,100E-00 test result: From step 1 and step 2, # multipathd show paths raw format $FMT and # multipathd show maps raw format $FMT work the same as the non-raw versions, but without headers and extra padding being added to the output. 3). [root@storageqe-84 ~]# multipathd show paths format "%z %m %N %n %R %r %a" serial multipath host WWNN target WWNN host WWPN target WWPN host adapter 60FFF19ABDD9552F8A36E5355226BA27 mpatha [undef] iqn.2001-05.com.equallogic:0-af1ff6-2f55d9bd9-27ba265235e5368a- [undef] [undef] 10.34.80.26 60FFF19ABDD9552F8A36E5355226BA27 mpatha [undef] iqn.2001-05.com.equallogic:0-af1ff6-2f55d9bd9-27ba265235e5368a- [undef] [undef] 10.34.80.27 0014380305DFE90 [orphan] [undef] [undef] [undef] [undef] [undef] [root@storageqe-84 ~]# multipathd show paths raw format "%z %m %N %n %R %r %a" 60FFF19ABDD9552F8A36E5355226BA27 mpatha [undef] iqn.2001-05.com.equallogic:0-af1ff6-2f55d9bd9-27ba265235e5368a- [undef] [undef] 10.34.80.26 60FFF19ABDD9552F8A36E5355226BA27 mpatha [undef] iqn.2001-05.com.equallogic:0-af1ff6-2f55d9bd9-27ba265235e5368a- [undef] [undef] 10.34.80.27 0014380305DFE90 [orphan] [undef] [undef] [undef] [undef] [undef] 4). [root@storageqe-84 ~]# multipathd show paths raw format %z 60FFF19ABDD9552F8A36E5355226BA27 60FFF19ABDD9552F8A36E5355226BA27 0014380305DFE90 [root@storageqe-84 ~]# multipathd show paths raw format %m mpatha mpatha [orphan] [root@storageqe-84 ~]# multipathd show paths raw format %N [undef] [undef] [undef] [root@storageqe-84 ~]# multipathd show paths raw format %n iqn.2001-05.com.equallogic:0-af1ff6-2f55d9bd9-27ba265235e5368a- iqn.2001-05.com.equallogic:0-af1ff6-2f55d9bd9-27ba265235e5368a- [undef] [root@storageqe-84 ~]# multipathd show paths raw format %R [undef] [undef] [undef] [root@storageqe-84 ~]# multipathd show paths raw format %r [undef] [undef] [undef] [root@storageqe-84 ~]# multipathd show paths raw format %a 10.34.80.26 10.34.80.27 [undef] test result: From step 3 and step 4, the %z, %m, %N, %n, %R, %r, and %a path format wildcards work as expected.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2016-2536.html