我正在尝试设置 iSCSI 目标:
[root@localhost /]# targetcli
targetcli shell version 2.1.fb37
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/> cd backstores/fileio
/backstores/fileio> create disk01 /iscsi_disks/disk01.img 5G
Created fileio disk01 with size 5368709120
/backstores/fileio> cd /iscsi
/iscsi> create iqn.2015-06.world.server:storage.target01
Created target iqn.2015-06.world.server:storage.target01.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/iscsi> cd iqn.2015-06.world.server:storage.target01/tpg1/luns
/iscsi/iqn.20...t01/tpg1/luns> create /backstores/fileio/disk01
Created LUN 0.
/iscsi/iqn.20...t01/tpg1/luns> cd ../acls
/iscsi/iqn.20...t01/tpg1/acls> create iqn.2015-06.world.server:www.server.world
Created Node ACL for iqn.2015-06.world.server:www.server.world
Created mapped LUN 0.
/iscsi/iqn.20...t01/tpg1/acls> cd iqn.2015-06.world.server:www.server.world/
/iscsi/iqn.20....server.world> set auth userid=foo
Parameter userid is now 'foo'.
/iscsi/iqn.20....server.world> set auth password=bar
Parameter password is now 'bar'.
/iscsi/iqn.20....server.world> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
[root@localhost /]# service iscsid restart
Redirecting to /bin/systemctl restart iscsid.service
[root@localhost /]# service iscsi restart
Redirecting to /bin/systemctl restart iscsi.service
结构如下(在新窗口中打开图像以查看完整尺寸):
发现似乎工作正常:
[root@linuxbox ~]# iscsiadm -m discovery -t sendtargets -p 10.0.0.60
10.0.0.60:3260,1 iqn.2015-06.world.server:storage.target01
但是,当我尝试连接时,我收到此授权失败消息:
[root@linuxbox ~]# iscsiadm -m node --targetname "iqn.2015-06.world.server:storage.target01" --portal "10.0.0.60:3260" --login
Logging in to [iface: default, target: iqn.2015-06.world.server:storage.target01, portal: 10.0.0.60,3260] (multiple)
iscsiadm: Could not login to [iface: default, target: iqn.2015-06.world.server:storage.target01, portal: 10.0.0.60,3260].
iscsiadm: initiator reported error (24 - iSCSI login failed due to authorization failure)
iscsiadm: Could not log into all portals
答案1
就我而言,启动器的 iqn 存在问题 - 我编辑了文件/etc/iscsi/initiatorname.iscsi
并运行, 但仍然在目标service iscsi restart
中看到错误:/etc/messages
Dec 2 14:51:05 iscsi-target-vm kernel: iSCSI Initiator Node: iqn.1994-05.com.redhat:47fbcf58e10 is not authorized to access iSCSI target portal group: 1.
12 月 2 日 14:51:05 iscsi-target-vm 内核:iSCSI 登录协商失败。`
所以解决方案是service iscsid restart
在启动器上运行以重新加载 iqn。
答案2
在客户端计算机上,您必须编辑initiatorname
文件中的
initiatorname.iscsi
.名称是作为 ACL 创建的 iqn。
$ vi /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2015-06.world.server:www.server.world