How to setup preferred path with multipath

Environment

Red Hat Enterprise Linux 7
device-mapper-multipath
LUNs with ALUA enabled

Issue

All paths for a LUN are grouped all together even though they come with different priority from the external storage.

The output of "multipath -ll" shows something like the following:

mpatha (360021868018107e0c000000000000098) dm-16 IBM     ,2145
size=100G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=30 status=active
  |- 8:0:1:18 sdv                 65:80      active ready  running
  |- 9:0:2:18 sded                128:80     active ready  running
  |- 8:0:3:18 sdby                68:192     active ready  running
  `- 9:0:3:18 sdgf                131:176    active ready  running

But something similar to the following is expected:

mpatha (360021868018107e0c000000000000098) dm-16 IBM     ,2145
size=100G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=10 status=active
  |- 8:0:1:18 sdv                 65:80      active ready  running
  |- 9:0:2:18 sded                128:80     active ready  running
`-+- policy='round-robin 0' prio=50 status=active
  |- 8:0:3:18 sdby                68:192     active ready  running
  `- 9:0:3:18 sdgf                131:176    active ready  running

Resolution

  • Edit the multipath.conf file
  • Remove the path_grouping_policy from the configuration of the affected LUN in the multipath.conf file, so that it will look like the following:
multipaths {
     multipath {
          wwid                    360021868018107e0c000000000000098
          alias                   mpatha
          path_selector           "round-robin 0"
          failback                immediate
          rr_weight               priorities
          no_path_retry           5
     }
}
  • Restart the multipath service

Root Cause

This is because the option "path_grouping_policy" is configured as "multibus":

multipaths {
     multipath {
          wwid                    360021868018107e0c000000000000098
          alias                   mpatha
          path_grouping_policy    multibus
          path_selector           "round-robin 0"
          failback                immediate
          rr_weight               priorities
          no_path_retry           5
     }
}

From the documentation, the value "multibus" means that all paths will be grouped in one priority group:

path_grouping_policy    
          Specifies the default path grouping policy to apply to unspecified multipaths. Possible values include:
                    failover: 1 path per priority group.
                    multibus: all valid paths in 1 priority group.
                    group_by_serial: 1 priority group per detected serial number.
                    group_by_prio: 1 priority group per path priority value. Priorities are determined by callout programs specified as global, per-controller, or per-multipath options.
                    group_by_node_name: 1 priority group per target node name. Target node names are fetched in /sys/class/fc_transport/target*/node_name.
                    The default value is failover. 

Diagnostic Steps

Check the returned ports/priority for each device in order to confirm that they need to be grouped differently. The output of multipath -ll is showing the following:

Jan 12 11:54:50 | reported target port group is 1
Jan 12 11:54:50 | aas = 01 [active/non-optimized]
Jan 12 11:54:50 | sdv: alua prio = 10      <===== ALUA priority of this path

Jan 12 11:54:50 | reported target port group is 1
Jan 12 11:54:50 | aas = 01 [active/non-optimized]
Jan 12 11:54:50 | sded: alua prio = 10      <===== ALUA priority of this path

Jan 12 11:54:50 | reported target port group is 0
Jan 12 11:54:50 | aas = 00 [active/optimized]
Jan 12 11:54:50 | sdby: alua prio = 50      <===== ALUA priority of this path

Jan 12 11:54:50 | reported target port group is 0
Jan 12 11:54:50 | aas = 00 [active/optimized]
Jan 12 11:54:50 | sdgf: alua prio = 50      <===== ALUA priority of this path