Bug 1510834

Summary: multipath does not distribute the unpriv-SGIO setting to its child devices [rhel-7.4.z]
Product: Red Hat Enterprise Linux 7 Reporter: Oneata Mircea Teodor <toneata>
Component: device-mapper-multipathAssignee: Ben Marzinski <bmarzins>
Status: CLOSED ERRATA QA Contact: Lin Li <lilin>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 7.3CC: agk, ailan, amureini, bmarzins, boruvka.michal, heinzm, jbrassow, knoel, lijin, lilin, loberman, lvm-team, michen, msnitzer, mtessun, nsoffer, pbonzini, phou, prajnoha, rhandlin, vanhoof, ykaul, ylavi
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: device-mapper-multipath-0.4.9-111.el7.2 Doc Type: Enhancement
Doc Text:
DM Multipath now recognizes the prkeys_file option, which configures the reservation key for the paths of a multipath device. With this option, you can now use the mpathpersist utility without knowing ahead of time what reservation keys will be used and without adding them to the multipath.conf configuration file. As a result, it is now easier to use the mpathpersist utility to manage multipath persistent reservations in multiple setups.
Story Points: ---
Clone Of: 1452210 Environment:
Last Closed: 2018-01-25 11:39:30 UTC Type: ---
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: 1452210    
Bug Blocks:    

Description Oneata Mircea Teodor 2017-11-08 10:13:39 UTC
This bug has been copied from bug #1452210 and has been proposed to be backported to 7.4 z-stream (EUS).

Comment 2 Ben Marzinski 2017-11-08 23:27:59 UTC
unpriv_sgio and prkey file code backported

Comment 8 Lin Li 2017-11-21 03:15:28 UTC
Verified on device-mapper-multipath-0.4.9-111.el7_4.2
1, # rpm -qa |grep multipath
device-mapper-multipath-libs-0.4.9-111.el7_4.2.x86_64
device-mapper-multipath-devel-0.4.9-111.el7_4.2.x86_64
device-mapper-multipath-debuginfo-0.4.9-111.el7_4.2.x86_64
device-mapper-multipath-0.4.9-111.el7_4.2.x86_64
device-mapper-multipath-sysvinit-0.4.9-111.el7_4.2.x86_64

2,  #man multipath.conf
       unpriv_sgio      If set to yes, multipath will set  upriv_sgio  on  the
                        multipath device and all its paths, when it is created
                        or reloaded. The default is no

       prkeys_file      The full pathname of the prkeys file, which is used by
                        multipathd  to  keep track of the reservation key used
                        for a specific WWID, when reservation_key  is  set  to
                        file.  Defaults to /etc/multipath/prkeys

       reservation_key  This  is the service action reservation key used      by  mpathpersist.  It must be set for all multipath devices using persistent reservations, and it must be the same as the RESERVATION KEY field of  the
 PERSISTENT  RESERVE  OUT  parameter list which contains an 8-byte value provided by the application client to the device server to identify the I_T nexus.

                        Alternatively, this can be set to file, which will store the RESERVATION KEY registered  by  mpath‐persist  in the prkeys_file. multipathd will then use this key to register additional paths as they
appear.  When the registration is removed, the RESERVATION KEY is removed from the prkeys_file.  It is unset by default.

3, multipathd show config |grep unpriv_sgio
defaults {
	unpriv_sgio no      <----------- The default is no
}

4, edit /etc/multipath.conf
# cat /etc/multipath.conf 
defaults {
    polling_interval            5
    no_path_retry               4
    user_friendly_names         no
    flush_on_last_del           yes
    fast_io_fail_tmo            5
    dev_loss_tmo                30
    max_fds                     4096
    unpriv_sgio                 yes    <-------------------set yes
    reservation_key             file   <-------------------set file
}


5, # service multipathd reload
Reloading multipathd configuration (via systemctl):  [  OK  ]

6,# multipath -ll 360a98000324669436c2b45666c567871
360a98000324669436c2b45666c567871 dm-6 NETAPP  ,LUN             
size=2.0G features='4 queue_if_no_path pg_init_retries 50 retain_attached_hw_handle' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 1:0:1:2 sdi 8:128 active ready running
| `- 4:0:0:2 sdn 8:208 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 1:0:0:2 sdd 8:48  active ready running
  `- 4:0:1:2 sds 65:32 active ready running

7,# mpathpersist -oGS 1a2c3a4a5d /dev/mapper/360a98000324669436c2b45666c567871

8,# cat /etc/multipath/prkeys
# Multipath persistent reservation keys, Version : 1.0
# NOTE: this file is automatically maintained by the multipathd program.
# You should not need to edit this file in normal circumstances.
#
# Format:
# prkey wwid
#
0x000000000000000f 360a98000324669436c2b45666c56786f
0x0000001a2c3a4a5d 360a98000324669436c2b45666c567871   <----------prkey is 1a2c3a4a5d 

9,# mpathpersist -oGK 1a2c3a4a5d /dev/mapper/360a98000324669436c2b45666c567871
Nov 20 21:33:58 | 360a98000324669436c2b45666c567871: reservation_key = 0x1a2c3a4a5d (config file default) (from prkeys file)

10,# cat /etc/multipath/prkeys
# Multipath persistent reservation keys, Version : 1.0
# NOTE: this file is automatically maintained by the multipathd program.
# You should not need to edit this file in normal circumstances.
#
# Format:
# prkey wwid
#
0x000000000000000f 360a98000324669436c2b45666c56786f
#x0000001a2c3a4a5d 360a98000324669436c2b45666c567871  <-----the line is commented with '#'


=================================================================
11,# multipath -ll 360a98000324669436c2b45666c567875
360a98000324669436c2b45666c567875 dm-8 NETAPP  ,LUN             
size=2.0G features='4 queue_if_no_path pg_init_retries 50 retain_attached_hw_handle' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| |- 1:0:1:4 sdk 8:160 active ready running
| `- 4:0:0:4 sdp 8:240 active ready running
`-+- policy='service-time 0' prio=10 status=enabled
  |- 1:0:0:4 sdf 8:80  active ready running
  `- 4:0:1:4 sdu 65:64 active ready running

12,# mpathpersist -oGS ffffffffffff /dev/mapper/360a98000324669436c2b45666c567875

13,# cat /etc/multipath/prkeys
# Multipath persistent reservation keys, Version : 1.0
# NOTE: this file is automatically maintained by the multipathd program.
# You should not need to edit this file in normal circumstances.
#
# Format:
# prkey wwid
#
0x000000000000000f 360a98000324669436c2b45666c56786f
#x0000001a2c3a4a5d 360a98000324669436c2b45666c567871
0x0999999999999fff 360a98000324669436c2b45666c567873
0x0000ffffffffffff 360a98000324669436c2b45666c567875   <------the prkey is ffffffffffff 

14,# mpathpersist -oGK ffffffffffff /dev/mapper/360a98000324669436c2b45666c567875
Nov 20 21:42:42 | 360a98000324669436c2b45666c567875: reservation_key = 0xffffffffffff (config file default) (from prkeys file)

15,# cat /etc/multipath/prkeys# Multipath persistent reservation keys, Version : 1.0
# NOTE: this file is automatically maintained by the multipathd program.
# You should not need to edit this file in normal circumstances.
#
# Format:
# prkey wwid
#
0x000000000000000f 360a98000324669436c2b45666c56786f
#x0000001a2c3a4a5d 360a98000324669436c2b45666c567871
0x0999999999999fff 360a98000324669436c2b45666c567873
#x0000ffffffffffff 360a98000324669436c2b45666c567875  <-----the line is commented with '#'


Exception testing
======================================================================
16, # mpathpersist -oGS foo /dev/mapper/360a98000324669436c2b45666c567875
bad argument to '--param-sark'

17, # mpathpersist -oGS dfgftjhyfjfh /dev/mapper/360a98000324669436c2b45666c567875
bad argument to '--param-sark'

18, # mpathpersist -oGS 888888888888888888888888888 /dev/mapper/360a98000324669436c2b45666c567875
bad argument to '--param-sark'

19,# cat /etc/multipath/prkeys
# Multipath persistent reservation keys, Version : 1.0
# NOTE: this file is automatically maintained by the multipathd program.
# You should not need to edit this file in normal circumstances.
#
# Format:
# prkey wwid
#
0x000000000000000f 360a98000324669436c2b45666c56786f
#x0000001a2c3a4a5d 360a98000324669436c2b45666c567871
0x0999999999999fff 360a98000324669436c2b45666c567873
#x0000ffffffffffff 360a98000324669436c2b45666c567875

20, # mpathpersist -oGK hdgdhjygk /dev/mapper/360a98000324669436c2b45666c567875
bad argument to '--param-rk'

21, # mpathpersist -oGK foo /dev/mapper/360a98000324669436c2b45666c567875
bad argument to '--param-rk'

22,# mpathpersist -oGS 8987788664544345 /dev/mapper/360a98000324669436c2b45666c567875

23,# cat /etc/multipath/prkeys
# Multipath persistent reservation keys, Version : 1.0
# NOTE: this file is automatically maintained by the multipathd program.
# You should not need to edit this file in normal circumstances.
#
# Format:
# prkey wwid
#
0x000000000000000f 360a98000324669436c2b45666c56786f
#x0000001a2c3a4a5d 360a98000324669436c2b45666c567871
0x0999999999999fff 360a98000324669436c2b45666c567873
0x8987788664544345 360a98000324669436c2b45666c567875

24,#mpathpersist -oGK 8 /dev/mapper/360a98000324669436c2b45666c567875
Nov 20 21:52:12 | 360a98000324669436c2b45666c567875: reservation_key = 0x8987788664544345 (config file default) (from prkeys file)
Nov 20 21:52:12 | 360a98000324669436c2b45666c567875: configured reservation key doesn't match: 0x8987788664544345
PR out: command failed

25,# mpathpersist -oGK 8987788664544345 /dev/mapper/360a98000324669436c2b45666c567875
Nov 20 21:53:58 | 360a98000324669436c2b45666c567875: reservation_key = 0x8987788664544345 (config file default) (from prkeys file)

26, # cat /etc/multipath/prkeys# Multipath persistent reservation keys, Version : 1.0
# NOTE: this file is automatically maintained by the multipathd program.
# You should not need to edit this file in normal circumstances.
#
# Format:
# prkey wwid
#
0x000000000000000f 360a98000324669436c2b45666c56786f
#x0000001a2c3a4a5d 360a98000324669436c2b45666c567871
0x0999999999999fff 360a98000324669436c2b45666c567873
#x8987788664544345 360a98000324669436c2b45666c567875

Comment 11 errata-xmlrpc 2018-01-25 11:39:30 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://access.redhat.com/errata/RHEA-2018:0142