1. Environmental Hardware Information
Machine as Target end (PC)
HBA Card: QLogic
Wwn1:21:00:00:1b:32:81:6e:f1
System: Ubuntu 15.04 Server
Machine as initiator end (PC server)
System: XenServer
Hba:qlogic
wwn1:21:00:00:1b:32:98:7d:1b
FC Switch: Brocade 200E
2. Switch configuration
1) View the WWWN number corresponding to the switch port
Swd77:admin> Switchshow
Switchname:swd77
switchtype:34.0
Switchstate:online
Switchmode:native
Switchrole:principal
Switchdomain:1
Switchid:fffc01
Switchwwn:10:00:00:05:1e:64:9d:86
Zoning:on (EZYXCFG)
Switchbeacon:off
Area Port Media Speed State Proto
=====================================
0 0 ID N2 Online f-port 21:00:00:1b:32:98:7d:1b//Connect 192.168.1.88 host (XenServer) HBA Card
1 1 ID N4 Online f-port 21:00:00:1b:32:8a:8a:c4//Connect 192.168.1.150
2 2 ID N4 no_light
3 3 ID N4 no_light
4 4 ID N4 Online f-port 21:00:00:1b:32:81:6e:f1//Connect 192.168.1.17 DELL pc
5 5 ID N4 no_light
2) View zone configuration
So the port is already in a zone and there is no need to change it.
Swd77:admin> zoneshow
Defined configuration:
cfg: ezyxcfg Ezyxarray
zone: Ezyxarray
1, 0; 1, 1; 1, 2; 1, 3; 1, 4; 1, 5; 1, 6; 1,7
Effective configuration:
Cfg:ezyxcfg
Zone:ezyxarray
1,0
The
The
1,3
1,4
1,5
1,6
1,7
Swd77:admin>
---------------------------------------------------------------------------
3. Configure the TARGETCLI service to simulate the storage array
1) Install operating system ubuntu15.04 Desktop version
2) create partition/dev/sda4, size 816G, and mount in/data directory
Mkdir/data
Mount-t Ext4/dev/sda4/data
[email protected]: ~$ df-h
Filesystem Size used Avail use% mounted on
/DEV/SDA1 94G 6.6G 83G 8%/
/DEV/SDA4 816G 30G 744G 4%/data
/dev/sda3 454M 41M 386M 10%/boot
3) configuration Targetcli
(1) Installation targetcli
Apt-get Install TARGETCLI
(2) Mount Configfs
The TARGETCLI configuration needs to be Configfs, so the Configfs module must be loaded into the kernel. Mount the Configfs to/sys/kernel/config:
Mount-t Configfs Configfs/sys/kernel/config
(3) Set HBA card to target mode
Vi/etc/modprobe.d/qla2xxx.conf
Options qla2xxx qlini_mode= "disabled"
(4) After updating Initramfs
sudo update-initramfs-u-K all
(5) Restart the machine
sudo reboot
(6) Check that the Qla2xxx module is installed in the TARGETCLI.
The following qla2xxx output is normal.
targetcli
/> ls
O/... ... .... ... .... ... .... ... .... ... .... ..... ..... .... ..... ... .. ..... ........, ..., ... and .....-...... [...]
o-backstores ... ..... ..... .... ..... ..... .... ............................ [...]
| O-fileio ..... ..... ............................. [0 Storage Object]
| o-iblock ..... ..... ............................. [0 Storage Object]
| O-pscsi .... ..... ..... ........................... [0 Storage Object]
| o-rd_dr .... ..... ..... ........................... [0 Storage Object]
| o-rd_mcp ..... ..... ............................. [0 Storage Object]
o-ib_srpt ... ..... ..... .... ..... ..... ............................. [0 Target]
o-iscsi ... ..... ..... .... ..... ..... .... ............................ [0 Target]
O-loopback ..... ..... ..... ..... ..... ... .. ...........-.....-.......... [0 Target]
o-qla2xxx ... ..... ..... .... ..... ..... ............................. [0 Target]
/>
Below you can divide the storage space and LUN mapping
(7) Create a FileIO backstore from a file.
$SU-//Get root permissions
#TARGETCLI
/backstores
/backstores> fileio/create name=test_file file_or_dev=/data/fileio_1 size=810g
The size of the file is the size of the generated LUN
Create WWN ' s in targetcli
/> qla2xxx/create 21:00:00:1b:32:81:6e:f1 //native WWWN, equivalent to the front port of the storage array wwwn
Here you need to make a connection to the WWN you just created and the backstore you created earlier. Use the commands under LUNs
/qla2xxx/21:00:00:1b:32:81:6e:f1/luns/create/backstores/fileio/test_file
We need to create a list of ACLs ' s (Access Control list) so that the machine that needs to use this storage can have permission to use this LUNs.
The WWN we need here is the WWN of the machine that needs to access the LUNs, not the native
/QLA2XXX/21:00:00:1B:32:81:6E:F1/ACLS Create 21:00:00:1B:32:98:7D:1B//Map LUNs to 192.168.1.88 corresponding WWWN
/QLA2XXX/21:00:00:1B:32:81:6E:F1/ACLS Create 21:00:00:1B:32:8A:8A:C4 //Map LUNs to 192.168.1.150 corresponding WWWN
Save Configuration
Saveconfig
The error will be similar to "Configerror:unknown value type ' qla2xxx_wwn ' when validating 21:00:00:24:ff:0e:7c:f5"
Open another window to modify a configuration
vi/usr/share/pyshared/rtslib/config.py
elif Val_type = = ' NAA ':
If IS_VALID_WWN (' Naa ', value):
Valid_value = value
Added later
elif Val_type = = ' QLA2XXX_WWN ':
If IS_VALID_WWN (' qla2xxx_wwn ', value):
Valid_value = value
vi/usr/share/pyshared/rtslib/utils.py
and Re.match (
"[0-9a-fa-f]{8} (-[0-9a-fa-f]{4}) {3}-[0-9a-fa-f]{12}$", WWN):
Return True
Add to
elif Wwn_type = = ' Qla2xxx_wwn ' \
and Re.match (
"[0-9a-fa-f]{2} (: [0-9a-fa-f]{2}) {7}$", WWN):
Return True
Once again saveconfig the configuration is successfully added, so configure the following
650) this.width=650; "title=" 1.png "style=" HEIGHT:355PX;WIDTH:737PX; "alt=" Wkiol1aobjzx3toaaablqwz2fl8678.png "src= "Http://s2.51cto.com/wyfs02/M01/7A/64/wKioL1aobjzx3ToAAABlqWz2fL8678.png" width= "1097" height= "405"/>
4.initator side Scan
After completion, scan in XenServer.
"Reference Document"
TARGETCLI Build Fibre Channel (FC) target
http://blog.csdn.net/kyle__shaw/article/details/45227607
Linux FC SAN Storage server builds SCSI Target (HBA card)
Transfer from "It Elite": http://www.itnpc.com/news/web/144599886824970.html
Fresh Wei
2016-01-27
This article is from "My Me" blog, please be sure to keep this source http://237085.blog.51cto.com/227085/1739225
Using the Linux analog FC storage Array (TARGETCLI)