参考文档
VMware官方文档:配置iSCSI适配器和存储
华为配置指南:VMware ESXi下的主机连通性指南
如下图所示,VMware配置iSCSI存储,需要将物理网卡绑定到VMKernel适配器上,之后再将VMKernel适配器绑定到iSCSI适配器上,再使用iSCSI适配器发起iSCSI连接操作即可
选择esxi主机,右键选择添加网络
-VMKernel网络适配器
-新建标准交换机
,添加物理适配器选择对应物理网卡,设置VMKernel端口属性及IP地址
选择esxi主机,选择配置
-存储适配器
-iSCSI适配器
-网络端口绑定
,将VMKernel适配器绑定到iSCSI适配器上,之后发起连接即可
当存在多个iscsi集群多个块设备对接同一个VMware环境时,需要保证块设备的唯一性,避免识别为同一个设备
controller_tid
由1开始递增,scsi_id
由00010000开始递增,而VMware存储设备编号由naa.60000000000000000e000000
+scsi_id
拼接而成controller_tid
参数值时,scsi_id
和scsi_sn
都会随着改变,故只需要保持controller_tid
值唯一即可(取值范围为1~1024)tgtadm --mode logicalunit --op update --tid --lun --params scsi_id=,scsi_sn=
命令修改scsi_id
和scsi_sn
参数值[root@storage01 ~]# tgt-admin -s | grep "SCSI"
SCSI ID: IET 00010001
SCSI SN: beaf11
[root@esxi01:~] esxcli storage core device list | grep "Display Name"
Display Name:ceph iSCSI Disk (naa.60000000000000000e00000000010001)
controller_tid
不重复,重启tgt服务[root@storage01 ~]# cat /etc/tgt/conf.d/vcluster.conf
lun 1
vendor_id ceph
block-size 512
lbppbe 0
initiator-address 172.16.21.85
bs-type rbd
controller_tid 11
[root@storage01 ~]# systemctl restart tgt
[root@esxi01:~] esxcli storage core device list | grep "Display Name"
Display Name: SCST_BIO iSCSI Disk (eui.393030616263662d)
t10_dev_id
、usn
两个参数控制,类似scsi_id
和scsi_sn
信息t10_dev_id
、usn
不重复,重载scst配置scstadmin -set_dev_attr -attributes t10_dev_id=
scstadmin -set_dev_attr -attributes usn=
scstadmin -write_config /etc/scst.conf
[root@storage01 ~]# cat /etc/scst.conf
# Automatically generated by SCST Configurator v3.5.0.
HANDLER vdisk_blockio {
DEVICE rbd01 {
filename /dev/rbd/rbd/rbd01
size 4398046511104
t10_dev_id 00300000-rbd01
usn 00300000
}
}
TARGET_DRIVER copy_manager {
TARGET copy_manager_tgt {
LUN 0 rbd01
}
}
TARGET_DRIVER iscsi {
enabled 1
TARGET iqn.vcluster.com:target0001 {
enabled 1
rel_tgt_id 1
LUN 0 rbd01
}
}
[root@node176 ~]# scstadmin -list_dev_attr rbd01 -driver iscsi -nonkey
Collecting current configuration: done.
Attribute Value Writable KEY
-----------------------------------------------------------------------------------------------------
active 1 Yes No
bind_alua_state 1 Yes No
block 0 0 Yes No
blocksize 512 No No
cluster_mode 0 Yes No
dump_prs Yes No
eui64_id Yes No
expl_alua 0 Yes No
filename /dev/rbd/rbd/rbd01 Yes Yes
gen_tp_soft_threshold_reached_UA Yes No
handler vdisk_blockio No No
inq_vend_specific Yes No
max_tgt_dev_commands 64 Yes No
naa_id Yes No
numa_node_id -1 Yes No
nv_cache 0 No No
opt_trans_len 4194304 Yes No
pr_file_name /var/lib/scst/pr/rbd01 Yes No
prod_id rbd01 Yes No
prod_rev_lvl 350 Yes No
read_only 0 No No
removable 0 No No
resync_size Yes No
rotational 1 No No
scsi_device_name Yes No
size 4398046511104 Yes Yes
size_mb 4194304 Yes No
sync Yes No
t10_dev_id 00300000-rbd01 Yes Yes
t10_vend_id SCST_BIO Yes No
thin_provisioned 1 No No
threads_num 1 Yes No
threads_pool_type per_initiator Yes No
tst 1 No No
type 0 No No
type_string Direct-access device (e.g., magnetic disk) No No
usn 00300000 Yes Yes
vend_specific_id 900abcf-rbd01 Yes No
write_through 0 No No