Bug 1299651

Summary: Add machine-readable/parseable output option to multipath command
Product: Red Hat Enterprise Linux 7 Reporter: Ben Marzinski <bmarzins>
Component: device-mapper-multipathAssignee: Ben Marzinski <bmarzins>
Status: CLOSED ERRATA QA Contact: Lin Li <lilin>
Severity: medium Docs Contact: Milan Navratil <mnavrati>
Priority: unspecified    
Version: 7.1CC: agk, bdonahue, bmarzins, dwysocha, heinzm, lilin, mnavrati, msnitzer, prajnoha, prockai, rbalakri, scott.rochford, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: device-mapper-multipath-0.4.9-87.el7 Doc Type: Release Note
Doc Text:
*multipathd* now supports raw format mode in *multipathd* formatted output commands The *multipathd* formatted output commands now offer `raw` format mode, which removes the headers and additional padding between fields. Support for additional format wildcards has been added as well. Raw format mode makes it easier to collect and parse information about multipath devices, particularly for use in scripting.
Story Points: ---
Clone Of: 1145442 Environment:
Last Closed: 2016-11-04 08:16:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1145442, 1303770, 1310185, 1376206    
Bug Blocks: 1295577, 1313485    

Comment 1 Ben Marzinski 2016-02-26 22:54:26 UTC
Added

multipathd show paths raw format <fmt>

and

multipathd show maps raw format <fmt>

commands to remove headers and padding from the command output.

Comment 2 Lin Li 2016-04-22 14:49:09 UTC
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.

Comment 5 errata-xmlrpc 2016-11-04 08:16:49 UTC
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