CentOS7的iSCSI targetd一直失敗 - Linux

By Mia
at 2016-01-16T12:00
at 2016-01-16T12:00
Table of Contents
我用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.
問題好像越來越大了,請問有人知道這是怎模回事嗎?
--
"Don't hate the player. Hate the game."
當看到哪個名人賺了大錢,領到高額補助或利息,不要去指責他,
而是要指責那個制度、創造那個制度的人,以及默許那個制度的人。
不然你認為一個人不領18%或是一個人不炒房價,就會改變整體環境嗎?
還不如改變【修改制度的人】,才能從根源改變一切。
--
很多時候超好用,但是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.
問題好像越來越大了,請問有人知道這是怎模回事嗎?
--
"Don't hate the player. Hate the game."
當看到哪個名人賺了大錢,領到高額補助或利息,不要去指責他,
而是要指責那個制度、創造那個制度的人,以及默許那個制度的人。
不然你認為一個人不領18%或是一個人不炒房價,就會改變整體環境嗎?
還不如改變【修改制度的人】,才能從根源改變一切。
--
Tags:
Linux
All Comments

By Rosalind
at 2016-01-20T11:12
at 2016-01-20T11:12

By Victoria
at 2016-01-24T02:01
at 2016-01-24T02:01
Related Posts
執行jar檔的問題...

By Adele
at 2016-01-15T03:55
at 2016-01-15T03:55
請問 "> syslog" 是什麼意思?

By Emily
at 2016-01-14T18:28
at 2016-01-14T18:28
LDAP 如何設定支援「目錄瀏覽」功能?

By Hedda
at 2016-01-14T09:37
at 2016-01-14T09:37
Linux Kenel版本

By Puput
at 2016-01-14T01:04
at 2016-01-14T01:04
netboot.xyz

By Jake
at 2016-01-14T00:29
at 2016-01-14T00:29