Static load balancing in Device-Mapper Multipathing (DM-MPIO)
This document (3858277) is provided subject to the disclaimer at the end of this document.
This path priority settings should be persistent even after a reboot.
These path priority settings should be restored once the preferred paths are
available again. After a path failure for example.
This script would be a shell script which gets a selector defined by you and the variable %n passed. This script has to be invoked explicitly with /bin/sh, so the line in/etc/multipath.confwould read:
prio_callout "/bin/sh /usr/sbin/path_priority %n SELECTOR"
assuming that the script is /usr/sbin/path_priority. Please keep in mind that you will have to replace SELECTOR with Information to be used to find the path.
if [ -e /sys/block/$1/device ]; then
target=$(ls -l /sys/block/$1/device | tr / "\n" | grep .:.:.:)
if [ $(echo $target | grep $selector) ]; then
$1 is %n which is the block device passed from the multipathd to the script, which would read something like sdaj for example.
$2 is SELECTOR which is not set yet. The script parses /sys/block/$1/device and looks for an entry with .:.:.: which would be Host : Bus : Target : Lun of the device.
Based on this you write your SELECTOR, for example 3:0, which would mean Host scsi3 Channel 0 as preferred path.
You can deduce your own selector by checking cat /proc/scsi/scsi
If this script is called it will set a default priority of 1 and then get the Host / Bus / Target / Lun from the block device passed from %n and check whether SELECTOR matches with this information. If selector matches, then the priority will be set to 4 and then returned via the final echo $prio.
Test system with SELECTOR set to 3:0
prio_callout "/bin/sh /usr/sbin/path_priority %n 3:0"
snippet from multipath -v3 output:
getprio = /bin/sh /usr/sbin/path_priority %n 3:0 (controler setting)
reformated callout = /bin/sh /usr/sbin/path_priority sdct 3:0
prio = 4
uid = 36006048000028350131253594d303338 (cache)
===== path info sdcu (mask 0x3f) =====
device sdcu is on bus scsi
bus = 1
dev_t = 70:32
size = 17677440
vendor = EMC
product = SYMMETRIX
rev = 5267
h:b:t:l = 3:0:0:25
multipath -ll(different partition)
\_ round-robin 0 [prio=8][active]
\_ 3:0:0:35 sdde 70:192 [active][ready]
\_ 3:0:1:35 sdes 129:64 [active][ready]
\_ round-robin 0 [prio=2][enabled]
\_ 2:0:0:35 sdac 65:192 [active][ready]
\_ 2:0:1:35 sdbq 68:64 [active][ready]
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:3858277
- Creation Date: 06-Feb-2007
- Modified Date:05-Mar-2021
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com