[問題] CentOS7的iSCSI targetd一直失敗

作者: LIAR (玻璃做的大叔)   2016-01-16 12:00:11
我用CentOS-7-x86_64-LiveGNOME-1511.iso 跑live DVD,救援資料用iSCSI
很多時候超好用,但是CentOS6用tgtd都沒問題,現在7版改用targetd,
卻一直失敗。
/> 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]
/> backstores/block create disk1 /dev/sda
Created block storage object disk1 using /dev/sda.
/> ls
o- / ................................... [...]
o- backstores ........................ [...]
| o- block ............ [Storage Objects: 1]
| | o- disk1 ............................. [/dev/sda (119.2GiB) write-thru
deactivated]
| o- fileio ........... [Storage Objects: 0]
| o- pscsi ............ [Storage Objects: 0]
| o- ramdisk .......... [Storage Objects: 0]
o- iscsi ...................... [Targets: 0]
o- loopback ................... [Targets: 0]
/> cd /iscsi
/iscsi> create
Created target iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.68682c0a98f5.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/iscsi> ls
o- iscsi ........................ [Targets: 1]
o- iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.68682c0a98f5
.............. [TPGs: 1]
o- tpg1 ........... [no-gen-acls, no-auth]
o- acls ...................... [ACLs: 0]
o- luns ...................... [LUNs: 0]
o- portals ................ [Portals: 1]
o- 0.0.0.0:3260 ................. [OK]
/iscsi> iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.68682c0a98f5/tpg1/luns
create /backstores/block/disk1
Created LUN 0.
/iscsi> ls
o- iscsi ........................ [Targets: 1]
o- iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.68682c0a98f5
.............. [TPGs: 1]
o- tpg1 ........... [no-gen-acls, no-auth]
o- acls ...................... [ACLs: 0]
o- luns ...................... [LUNs: 1]
| o- lun0 ..... [block/disk1 (/dev/sda)]
o- portals ................ [Portals: 1]
o- 0.0.0.0:3260 ................. [OK]
/iscsi> iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.68682c0a98f5/tpg1/acls
create iqn.1991-05.com.microsoft:a-pc
Created Node ACL for iqn.1991-05.com.microsoft:a-pc
Created mapped LUN 0.
我的WIN7的initiator 是iqn.1991-05.com.microsoft:a-pc,以前都不用設定的
/iscsi> ls
o- iscsi ........................ [Targets: 1]
o- iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.68682c0a98f5
.............. [TPGs: 1]
o- tpg1 ........... [no-gen-acls, no-auth]
o- acls ...................... [ACLs: 1]
| o- iqn.1991-05.com.microsoft:a-pc ..............................
[Mapped LUNs: 1]
| o- mapped_lun0 ........................................ [lun0
block/disk1 (rw)]
o- luns ...................... [LUNs: 1]
| o- lun0 ..... [block/disk1 (/dev/sda)]
o- portals ................ [Portals: 1]
o- 0.0.0.0:3260 ................. [OK]
/iscsi> cd ..
/> saveconfig
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
/> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
以上是targetcli設定狀況,現在我要看status
[root@localhost ~]# systemctl start targetd
[root@localhost ~]# systemctl status targetd
● targetd.service - targetd storage array API daemon
Loaded: loaded (/usr/lib/systemd/system/targetd.service; disabled; vendor
preset: disabled)
Active: failed (Result: exit-code) since Sat 2016-01-16 04:41:07 CET; 2s
ago
Process: 11824 ExecStart=/usr/bin/targetd (code=exited, status=255)
Main PID: 11824 (code=exited, status=255)
Jan 16 04:41:07 localhost systemd[1]: Started targetd storage array API
daemon.
Jan 16 04:41:07 localhost systemd[1]: Starting targetd storage array API
daemon...
Jan 16 04:41:07 localhost targetd[11824]: CRITICAL:root:password not set in
/etc/target/targetd.yaml
Jan 16 04:41:07 localhost systemd[1]: targetd.service: main process exited,
code=exited, status=255/n/a
Jan 16 04:41:07 localhost systemd[1]: Unit targetd.service entered failed
state.
Jan 16 04:41:07 localhost systemd[1]: targetd.service failed.
我搞不懂/etc/target/targetd.yaml是要幹嘛,但我還是把root密碼丟進去再啟動
[root@localhost ~]# systemctl start targetd
[root@localhost ~]# systemctl status targetd
● targetd.service - targetd storage array API daemon
Loaded: loaded (/usr/lib/systemd/system/targetd.service; disabled; vendor
preset: disabled)
Active: failed (Result: exit-code) since Sat 2016-01-16 04:43:37 CET;
639ms ago
Process: 11920 ExecStart=/usr/bin/targetd (code=exited, status=1/FAILURE)
Main PID: 11920 (code=exited, status=1/FAILURE)
Jan 16 04:43:37 localhost targetd[11920]: File "/usr/bin/targetd", line 24,
in <module>
Jan 16 04:43:37 localhost targetd[11920]: sys.exit(main())
Jan 16 04:43:37 localhost targetd[11920]: File
"/usr/lib/python2.7/site-packages/targetd/main.py", line 209, in main
Jan 16 04:43:37 localhost targetd[11920]: load_config(default_config_path)
Jan 16 04:43:37 localhost targetd[11920]: File
"/usr/lib/python2.7/site-packages/targetd/main.py", line 170, in load_config
Jan 16 04:43:37 localhost targetd[11920]: config[key] = value
Jan 16 04:43:37 localhost targetd[11920]: TypeError: 'str' object does not
support item assignment
Jan 16 04:43:37 localhost systemd[1]: targetd.service: main process exited,
code=exited, status=1/FAILURE
Jan 16 04:43:37 localhost systemd[1]: Unit targetd.service entered failed
state.
Jan 16 04:43:37 localhost systemd[1]: targetd.service failed.
問題好像越來越大了,請問有人知道這是怎模回事嗎?
作者: rein (rein)   2016-01-16 17:54:00
yaml 丟上來看看, 看起來是 config parse 問題有點像這個 https://github.com/docker/compose/issues/127

Links booklink

Contact Us: admin [ a t ] ucptt.com