How to set eh_deadline and eh_timeout persistently, using a udev rule

117 篇文章 0 订阅

https://access.redhat.com/solutions/3209481

 SOLUTION 已验证 - 已更新 2018年九月27日06:38 - 

English 

环境

  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7

问题

  • Need to set eh_deadline and eh_timeout
  • Settings need to be persistent

决议

These settings can be easily applied through udev rules. The eh_deadline setting and eh_timeout setting are different in that they are applied through different /sys/class directories, scsi_host and scsi_device, respectively. We can use the information gathered by udev and stored in the udev database to create a rule that can persistently set these values based on any number of attributes.

To get the full udev attribute list that contains eh_deadline, the command udevadm info --attribute-walk --path can be used. In this example, we have 2-2port HBAs, one Emulex and one QLogic. They correspond to host2(QLogic), host3(QLogic), host4(Emulex), and host5(Emulex). Sample attribute gathering output for host2:

Raw

[root@host]# udevadm info --attribute-walk --path=/sys/class/scsi_host/host2

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:09.0/0000:04:00.0/host2/scsi_host/host2':
    KERNEL=="host2"
    SUBSYSTEM=="scsi_host"
    DRIVER==""
    ATTR{unique_id}=="2"
    ATTR{host_busy}=="0"
    ATTR{cmd_per_lun}=="3"
    ATTR{can_queue}=="2038"
    ATTR{sg_tablesize}=="1024"
    ATTR{unchecked_isa_dma}=="0"
    ATTR{proc_name}=="(null)"
    ATTR{state}=="running"
    ATTR{supported_mode}=="Initiator"
    ATTR{active_mode}=="Initiator"
    ATTR{prot_capabilities}=="0"
    ATTR{prot_guard_type}=="0"
    ATTR{eh_deadline}=="20"
    ATTR{driver_version}=="8.07.00.26.06.8-k"
    ATTR{fw_version}=="7.03.00 (9496)"
    ATTR{serial_num}=="LFC0441N81107"
    ATTR{isp_name}=="ISP2432"
    ATTR{isp_id}=="0000 0000 0000 0000"
    ATTR{model_name}=="QLE2462"
    ATTR{model_desc}=="QLogic 4GB FC Dual-Port PCI-E HBA for IBM System x"
    ATTR{pci_info}=="PCIe (2.5GT/s x4)"
    ATTR{link_state}=="Link Up - F_Port"
    ATTR{zio}=="Disabled"
    ATTR{zio_timer}=="200 us"
    ATTR{beacon}=="Disabled"
    ATTR{optrom_bios_version}=="2.16"
    ATTR{optrom_efi_version}=="2.27"
    ATTR{optrom_fcode_version}=="3.13"
    ATTR{optrom_fw_version}=="5.03.06 1154"
.......snip



And to get the full udev attribute list that contains eh_timeout, the below commands can be used. Only using device 4:0:0:1 in this example.

Raw

[root@dell-per510-2 ~]# udevadm info --attribute-walk --path=/sys/class/scsi_device/4:0:0:1

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:0a.0/0000:05:00.0/host4/rport-4:0-2/target4:0:0/4:0:0:1/scsi_device/4:0:0:1':
    KERNEL=="4:0:0:1"
    SUBSYSTEM=="scsi_device"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:0a.0/0000:05:00.0/host4/rport-4:0-2/target4:0:0/4:0:0:1':
    KERNELS=="4:0:0:1"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{device_blocked}=="0"
    ATTRS{type}=="0"
    ATTRS{scsi_level}=="5"
    ATTRS{vendor}=="NETAPP  "
    ATTRS{model}=="LUN             "
    ATTRS{rev}=="7350"
    ATTRS{state}=="running"
    ATTRS{timeout}=="30"
    ATTRS{eh_timeout}=="9"
    ATTRS{iocounterbits}=="32"
    ATTRS{iorequest_cnt}=="0xd633a"
    ATTRS{iodone_cnt}=="0xd633a"
    ATTRS{ioerr_cnt}=="0x10"
    ATTRS{modalias}=="scsi:t-0x00"
    ATTRS{evt_media_change}=="0"
    ATTRS{evt_inquiry_change_reported}=="0"
    ATTRS{evt_capacity_change_reported}=="0"
    ATTRS{evt_soft_threshold_reached}=="0"
    ATTRS{evt_mode_parameter_change_reported}=="0"
    ATTRS{evt_lun_change_reported}=="0"
    ATTRS{dh_state}=="alua"
    ATTRS{queue_depth}=="127"
    ATTRS{queue_ramp_up_period}=="120000"
    ATTRS{queue_type}=="none"

  looking at parent device '/devices/pci0000:00/0000:00:0a.0/0000:05:00.0/host4/rport-4:0-2/target4:0:0':
    KERNELS=="target4:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:0a.0/0000:05:00.0/host4/rport-4:0-2':
    KERNELS=="rport-4:0-2"
    SUBSYSTEMS==""
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:0a.0/0000:05:00.0/host4':
    KERNELS=="host4"
    SUBSYSTEMS=="scsi"
    DRIVERS==""
......snip



Using the information gained by the previous commands, we can build a udev rule to set our values. Each HBA should have a unique serial number, so as an example, we will set the eh_deadline by using this identifier. The below rule, added to /etc/udev/rules.d/99-eh_timers.rules will set both QLogic ports to an eh_deadline of 30 and both Emulex ports to an eh_deadline of 60. It will also set the individual path 4:0:1:1 to a eh_timeout of 15.

Raw

ACTION!="add|change", GOTO="eh_end"

KERNEL=="host*", SUBSYSTEM=="scsi_host", ATTR{serial_num}=="LFC0441N81107", ATTR{eh_deadline}="30"
KERNEL=="host*", SUBSYSTEM=="scsi_host", ATTR{serialnum}=="VM64133127", ATTR{eh_deadline}="60"

KERNEL=="4:0:1:1", SUBSYSTEM=="scsi_device", ATTR{device/eh_timeout}="15"
LABEL="eh_end"



As a second example we will set all ports on all adapters to an eh_deadline of 90 and all scsi devices to an eh_timeout of 5.

Raw

ACTION!="add|change", GOTO="eh_end"

KERNEL=="host[2-5]", SUBSYSTEM=="scsi_host", ATTR{eh_deadline}="90"
SUBSYSTEM=="scsi_device", KERNELS=="host[2-5]", ATTR{device/eh_timeout}="5"

LABEL="eh_end"



To apply the rules, a reload and a trigger should be used (reboot will set as well). Reload the ruleset and database:

Raw

#RHEL6
[root@host]# udevadm control --reload-rules
#RHEL7
[root@host]# udevadm control --reload



Trigger an add event:

Raw

[root@host]# udevadm trigger --subsystem-match=scsi_host
[root@host]# udevadm trigger --subsystem-match=scsi_device



Mapping a scsi(x) in RHEL6 or host(x) in RHEL7 to a particular HBA or HBA port should be as easy as checking /var/log/dmesg:

Raw

[root@host]# grep "scsi[2-5] " /var/log/dmesg
[    2.755820] scsi2 : qla2xxx
[    3.080129] scsi3 : qla2xxx
[    3.596644] scsi4 : Emulex LPe11000 PCIe Fibre Channel Adapter  on PCI bus 05 device 00 irq 41
[    5.117922] scsi5 : Emulex LPe11000 PCIe Fibre Channel Adapter  on PCI bus 05 device 01 irq 39



For additional, detailed mappings the below can be used:

Raw

[root@host]# yum -y install sysfstools
[root@host]# systool -v -c scsi_host
[root@host]# systool -v -c scsi_device



Note: To set dev_loss_tmo or fast_io_fail_tmo via a udev rule, please use How to set dev_loss_tmo and fast_io_fail_tmo persistently, using a udev rule.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值