Firbre channel由于其专用性,相较传统iSCSI网络,能极大地提高Fabric的传输效率和速度,因此在传统中

高端存储上得到广泛的应用。搭建基于Fibre channel的存储服务,要求对Fibre channel 底层传输协议有一

定了解,还要求熟悉Fibre channel的软件堆栈层次,此外还要求清楚一般存储服务管理中的hostLUN

host group之间的关系。


本文总结了实际使用过程中碰到的和驱动堆栈相关问题,加深了我们队Fibre channel的底层软件堆栈的

理解。


1. Fibre channel 的软件堆栈


根据Linux storage stack diagram中的描述,在最近linux系统上fibre channel的驱动堆栈如下面截图所示:


[Fibre channel 实战之一] 驱动堆栈和创建target常见问题_第1张图片


其中target_core_pscsi驱动模块和SCSI mid layer 交互,入下面的层次图所示:


[Fibre channel 实战之一] 驱动堆栈和创建target常见问题_第2张图片


下面在实际机器上看到的驱动依赖关系,也印证了上面的层次:


[root@localhost ~]# lsmod | grep scsi

scsi_transport_fc     59960  2 qla2xxx,tcm_qla2xxx

scsi_tgt              20027  1 scsi_transport_fc

target_core_pscsi     18810  0

iscsi_target_mod     296307  1

target_core_mod      312037  9 target_core_iblock,tcm_qla2xxx,target_core_pscsi,iscsi_target_mod,tcm_loop

scsi_transport_sas    41034  1 mpt3sas

[root@localhost ~]# lsmod | grep qla2xxx

tcm_qla2xxx           31370  3

qla2xxx              598010  1 tcm_qla2xxx

scsi_transport_fc     59960  2 qla2xxx,tcm_qla2xxx

target_core_mod      312037  9 target_core_iblock,tcm_qla2xxx,target_core_pscsi,iscsi_target_mod,tcm_loop

[root@localhost ~]# lsmod | grep core

target_core_iblock    18177  0

target_core_pscsi     18810  0

coretemp              13435  0

edac_core             57650  1 sb_edac

mfd_core              13435  1 lpc_ich

target_core_mod      312037  9 target_core_iblock,tcm_qla2xxx,target_core_pscsi,iscsi_target_mod,tcm_loop

i2c_core              40325  6 ast,drm,igb,i2c_i801,drm_kms_helper,i2c_algo_bit

pps_core              19106  1 ptp

[root@localhost ~]# lsmod | grep iblock

target_core_iblock    18177  0

target_core_mod      312037  9 target_core_iblock,tcm_qla2xxx,target_core_pscsi,iscsi_target_mod,tcm_loop

[root@localhost ~]#


2.使用过程中的常见问题


在尝试用targetcli创建target实例的过程中,会使用到上面驱动层次中的各个模块,因此如果在此过程中出

现任何问题,需要及时检查驱动加载状态和内核的输出信息,再结合targetcli命令运行失败的输出,就能

帮助我们快速定位问题。


2.1 Could not create Qla2xxxFabricModule in configFS.

Fabric module name: qla2xxx

ConfigFS path: /sys/kernel/config/target/qla2xxx

Allowed WWN types: naa

Allowed WWNs list: naa.2100000e1e1b0190, naa.2100000e1e1b0191

Fabric module features: acls

Corresponding kernel module: tcm_qla2xxxt

/qla2xxx> create 21:00:00:0e:1e:1b:01:90

Could not create Qla2xxxFabricModule in configFS.


原因没有加载:tcm_qla2xxx

解决办法:

modprobe tcm_qla2xxx


2.看不到FC fabric

Copyright 2011-2013 by Datera, Inc and others.

For help on commands, type 'help'.


/> ls

o- / ......................................................................................................................... [...]

o- backstores .............................................................................................................. [...]

| o- block .................................................................................................. [Storage Objects: 0]

| o- fileio ................................................................................................. [Storage Objects: 0]

| o- pscsi .................................................................................................. [Storage Objects: 0]

| o- ramdisk ................................................................................................ [Storage Objects: 0]

o- iscsi ............................................................................................................ [Targets: 0]

o- loopback ......................................................................................................... [Targets: 0]

/> quit

Command not found quit

/> exit

Global pref auto_save_on_exit=true

Last 10 configs saved in /etc/target/backup.

Configuration saved to /etc/target/saveconfig.json

原因:tcm_qla2xxx没加载:


[root@localhost myfc]# lsmod | grep qla2xxx

qla2xxx              614431  0

scsi_transport_fc     68189  1 qla2xxx

[root@localhost myfc]# lsmod | grep tcm_qla2xxx


3.target里面不能创建configFS


现象如下图所示:


[Fibre channel 实战之一] 驱动堆栈和创建target常见问题_第3张图片


检查驱动,发现tcm_qla2xxx.koqla2xxx.ko都已经加载,问题是qla2xxx.ko支持target模式和initiator模式,在存储服务器上必须根据target模式加载,可以参考下面的命令重新加载:

modprobe -r qla2xxx

modprobe qla2xxx qlini_mode=”disabled”