Bug 1299651 - Add machine-readable/parseable output option to multipath command
Add machine-readable/parseable output option to multipath command
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: device-mapper-multipath (Show other bugs)
7.1
All Linux
unspecified Severity medium
: rc
: ---
Assigned To: Ben Marzinski
Lin Li
Milan Navratil
:
Depends On: 1145442 1303770 1310185 1376206
Blocks: 1313485 1295577
  Show dependency treegraph
 
Reported: 2016-01-18 16:55 EST by Ben Marzinski
Modified: 2016-11-04 04:16 EDT (History)
13 users (show)

See Also:
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 04:16:49 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Comment 1 Ben Marzinski 2016-02-26 17:54:26 EST
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 10:49:09 EDT
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 04:16:49 EDT
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

Note You need to log in before you can comment on or make changes to this bug.