Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

4.5. 配置文件设备

表 4.3 “设备属性” shows the attributes that you can set for each individual storage device in the devices section of the multipath.conf configuration file. These attributes are used by DM Multipath unless they are overwritten by the attributes specified in the multipaths section of the multipath.conf file for paths that contain the device. These attributes override the attributes set in the defaults section of the multipath.conf file.
Many devices that support multipathing are included by default in a multipath configuration. For information on the default configuration value, including supported devices, run either of the following commands.
# multipathd show config
# multipath -t 
You probably will not need to modify the values for these devices, but if you do you can overwrite the default values by including an entry in the configuration file for the device that overwrites those values. You can copy the device configuration defaults for the device that the multipathd show config command displays and override the values that you want to change.
To add a device that is not configured automatically by default to this section of the configuration file, you need to set the vendor and product parameters. You can find these values by looking at /sys/block/device_name/device/vendor and /sys/block/device_name/device/model where device_name is the device to be multipathed, as in the following example:
# cat /sys/block/sda/device/vendor
WINSYS  
# cat /sys/block/sda/device/model
SF2372
The additional parameters to specify depend on your specific device. If the device is active/active, you will usually not need to set additional parameters. You may want to set path_grouping_policy to multibus. Other parameters you may need to set are no_path_retry and rr_min_io, as described in 表 4.3 “设备属性”.
If the device is active/passive, but it automatically switches paths with I/O to the passive path, you need to change the checker function to one that does not send I/O to the path to test if it is working (otherwise, your device will keep failing over). This almost always means that you set the path_checker to tur; this works for all SCSI devices that support the Test Unit Ready command, which most do.
If the device needs a special command to switch paths, then configuring this device for multipath requires a hardware handler kernel module. The current available hardware handler is emc. If this is not sufficient for your device, you may not be able to configure the device for multipath.

表 4.3. 设备属性

属性描述
vendor 指定 device 采用的存储设备的零售商名称,例如 COMPAQ
product 指定 device 属性使用的存储设备产品名,比如 HSV110 (C) COMPAQ
revision Specifies the product revision identifier of the storage device.
product_blacklist 根据产品指定用来将设备列入黑名单的常规表达式。
alias_prefix The user_friendly_names prefix to use for this device type, instead of the default "mpath".
hardware_handler
Specifies a module that will be used to perform hardware specific actions when switching path groups or handling I/O errors. Possible values include:
1 emc: hardware handler for EMC storage arrays.
1 alua: hardware handler for SCSI-3 ALUA arrays.
1 hp_sw: hardware handler for Compaq/HP controllers.
1 rdac: hardware handler for the LSI/Engenio RDAC controllers.
path_grouping_policy
指定用于未指定路径的默认路径分组策略,可能的值包括:
failover = 每个优先组群有一个路径
multibus = 所有有效路径在一个优先组群中
group_by_serial = 每个检测到的系列号有一个优先组群
group_by_prio = 每个路径优先值有一个优先组群
group_by_node_name = 每个目标节点名有一个优先组群
path_selector
Specifies the default algorithm to use in determining what path to use for the next I/O operation. Possible values include:
round-robin 0: Loop through every path in the path group, sending the same amount of I/O to each.
queue-length 0: Send the next bunch of I/O down the path with the least number of outstanding I/O requests.
service-time 0: Send the next bunch of I/O down the path with the shortest estimated service time, which is determined by dividing the total size of the outstanding I/O to each path by its relative throughput.
path_checker
Specifies the default method used to determine the state of the paths. Possible values include:
readsector0: Read the first sector of the device.
tur: Issue a TEST UNIT READY to the device.
emc_clariion: Query the EMC Clariion specific EVPD page 0xC0 to determine the path.
hp_sw: Check the path state for HP storage arrays with Active/Standby firmware.
rdac: Check the path stat for LSI/Engenio RDAC storage controller.
directio: Read the first sector with direct I/O.
features
The default extra features of multipath devices, using the format: "number_of_features_plus_arguments feature1 ...".
Possible values for features include:
queue_if_no_path, which is the same as setting no_path_retry to queue. For information on issues that may arise when using this feature, see 第 5.6 节 “Issues with queue_if_no_path feature”.
retain_attached_hw_handler: If this parameter is set to yes and the SCSI layer has already attached a hardware handler to the path device, multipath will not force the device to use the hardware_handler specified by the multipath.conf file. If the SCSI layer has not attached a hardware handler, multipath will continue to use its configured hardware handler as usual.
pg_init_retries n: Retry path group initialization up to n times before failing where 1 <= n <= 50.
pg_init_delay_msecs n: Wait n milliseconds between path group initialization retries where 0 <= n <= 60000.
prio
Specifies the default function to call to obtain a path priority value. For example, the ALUA bits in SPC-3 provide an exploitable prio value. Possible values include:
const: Set a priority of 1 to all paths.
emc: Generate the path priority for EMC arrays.
alua: Generate the path priority based on the SCSI-3 ALUA settings. As of Red Hat Enterprise Linux 7.3, if you specify prio "alua exclusive_pref_bit" in your device configuration, multipath will create a path group that contains only the path with the pref bit set and will give that path group the highest priority.
ontap: Generate the path priority for NetApp arrays.
rdac: Generate the path priority for LSI/Engenio RDAC controller.
hp_sw: Generate the path priority for Compaq/HP controller in active/standby mode.
hds: Generate the path priority for Hitachi HDS Modular storage arrays.
failback
Manages path group failback.
A value of immediate specifies immediate failback to the highest priority path group that contains active paths.
A value of manual specifies that there should not be immediate failback but that failback can happen only with operator intervention.
A value of followover specifies that automatic failback should be performed when the first path of a path group becomes active. This keeps a node from automatically failing back when another node requested the failover.
大于 0 的数字值指定推迟出错切换,以秒表示。
rr_weight If set to priorities, then instead of sending rr_min_io requests to a path before calling path_selector to choose the next path, the number of requests to send is determined by rr_min_io times the path's priority, as determined by the prio function. If set to uniform, all path weights are equal.
no_path_retry
A numeric value for this attribute specifies the number of times the system should attempt to use a failed path before disabling queuing.
fail 值表明立即失败,无需排队。
queue 值表明在路径修复前不应停止排队。
rr_min_io Specifies the number of I/O requests to route to a path before switching to the next path in the current path group. This setting is only for systems running kernels older that 2.6.31. Newer systems should use rr_min_io_rq. The default value is 1000.
rr_min_io_rq Specifies the number of I/O requests to route to a path before switching to the next path in the current path group, using request-based device-mapper-multipath. This setting should be used on systems running current kernels. On systems running kernels older than 2.6.31, use rr_min_io. The default value is 1.
fast_io_fail_tmo The number of seconds the SCSI layer will wait after a problem has been detected on an FC remote port before failing I/O to devices on that remote port. This value should be smaller than the value of dev_loss_tmo. Setting this to off will disable the timeout. The fast_io_fail_tmo option overrides the values of the recovery_tmo and replacement_timeout options. For details, see 第 4.6 节 “iSCSI and DM Multipath overrides”.
dev_loss_tmo The number of seconds the SCSI layer will wait after a problem has been detected on an FC remote port before removing it from the system. Setting this to infinity will set this to 2147483647 seconds,or 68 years.
flush_on_last_del If set to yes, the multipathd daemon will disable queuing when the last path to a device has been deleted.
user_friendly_names If set to yes, specifies that the system should use the /etc/multipath/bindings file to assign a persistent and unique alias to the multipath, in the form of mpathn. If set to no, specifies that the system should use use the WWID as the alias for the multipath. In either case, what is specified here will be overridden by any device-specific aliases you specify in the multipaths section of the configuration file. The default value is no.
retain_attached_hw_handler If this parameter is set to yes and the SCSI layer has already attached a hardware handler to the path device, multipath will not force the device to use the hardware_handler specified by the multipath.conf file. If the SCSI layer has not attached a hardware handler, multipath will continue to use its configured hardware handler as usual. The default value is no.
detect_prio If this is set to yes, multipath will first check if the device supports ALUA, and if so it will automatically assign the device the alua prioritizer. If the device does not support ALUA, it will determine the prioritizer as it always does.
uid_attribute Provides a unique path identifier.
delay_watch_checks (Red Hat Enterprise Linux Release 7.2 and later) If set to a value greater than 0, the multipathd daemon will watch paths that have recently become valid for the specified number of checks. If they fail again while they are being watched, when they next become valid they will not be used until they have stayed up for the number of consecutive checks specified with delay_wait_checks. This allows you to keep paths that may be unreliable from immediately being put back into use as soon as they come back online.
delay_wait_checks (Red Hat Enterprise Linux Release 7.2 and later) If set to a value greater than 0, when a device that has recently come back online fails again within the number of checks specified with delay_watch_checks, the next time it comes back online it will be marked and delayed and it will not be used until it has passed the number of checks specified in delay_wait_checks.
deferred_remove If set to yes, multipathd will do a deferred remove instead of a regular remove when the last path device has been deleted. This ensures that if a multipathed device is in use when a regular remove is performed and the remove fails, the device will automatically be removed when the last user closes the device.
skip_kpartx (Red Hat Enterprise Linux Release 7.3 and later) If set to yes, kpartx will not automatically create partitions on the device. This allows users to create a multipath device without creating partitions, even if the device has a partition table.
max_sectors_kb (Red Hat Enterprise Linux Release 7.4 and later) Sets the max_sectors_kb device queue parameter to the specified value on all underlying paths of a multipath device before the multipath device is first activated. When a multipath device is created, the device inherits the max_sectors_kb value from the path devices. Manually raising this value for the multipath device or lowering this value for the path devices can cause multipath to create I/O operations larger than the path devices allow. Using the max_sectors_kb parameter is an easy way to set these values before a multipath device is created on top of the path devices and prevent invalid-sized I/O operations from being passed If this parameter is not set by the user, the path devices have it set by their device driver, and the multipath device inherits it from the path devices.
detect_path_checker (Red Hat Enterprise Linux Release 7.4 and later) If set to yes, multipath will try to detect if the device supports ALUA. If so, the device will automatically use the tur path checker. If not, the path_checker will be selected as usual.
all_devs When this parameter is set to yes, all of the options set in this device configuration will override the values for those options in all of the other device configurations, both the ones in the configuration file and the built-in defaults.
all_tg_pt (Red Hat Enterprise Linux Release 7.6 and later) If this option is set to yes, when mpathpersist registers keys it will treat a key registered from one host to one target port as going from one host to all target ports. This must be set to yes to successfully use mpathpersist on arrays that automatically set and clear registration keys on all target ports from a host, instead of per target port per host.
以下示例显示了多路径配置文件的 device 条目。
#	}
#	device {
#		vendor			"COMPAQ  "
#		product			"MSA1000         "
#		path_grouping_policy	multibus
#		path_checker		tur
#		rr_weight		priorities
#	}
#}
The following configuration sets no_path_retry to fail for all of the built-in device configurations.
devices {
	device {
		all_devs yes
		no_path_retry fail
	}
}