CentOS7的iSCSI targetd一直失敗 - Linux

Mia avatar
By Mia
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%或是一個人不炒房價,就會改變整體環境嗎?
還不如改變【修改制度的人】,才能從根源改變一切。

--
Tags: Linux

All Comments

Rosalind avatar
By Rosalind
at 2016-01-20T11:12
yaml 丟上來看看, 看起來是 config parse 問題
Victoria avatar
By Victoria
at 2016-01-24T02:01
有點像這個 https://github.com/docker/compose/issues/127

執行jar檔的問題...

Adele avatar
By Adele
at 2016-01-15T03:55
我在mint跟lubuntu下,執行xxx.jar檔, 在mint下只要 $./xxx.jar 就可以直接執行 可是在lubuntu下卻要 $java -jar xxx.jar才能執行, 想問問是不是linux下有什麼環境設定可以更改嗎? 當然 ...

請問 "> syslog" 是什麼意思?

Emily avatar
By Emily
at 2016-01-14T18:28
因為GOOGLE好像不能搜尋and#39;andgt;and#39;這個符號... 是在這篇文章提到的 http://askubuntu.com/questions/515146/very-large-log-files-what-should-i-do 話說新電腦才在灌必要的程式而已,syslog跟 ke ...

LDAP 如何設定支援「目錄瀏覽」功能?

Hedda avatar
By Hedda
at 2016-01-14T09:37
最近想要弄個LDAP Server 玩玩通訊錄管理 看看能不能取代掉現在去AD抓資料的現況 抓到LDAP SERVER的資料是OK 但是在outlook 裡面,就算輸入了搜尋基礎 還是沒辦法一次全部列出所有的人員 必須要自己輸入部分關鍵字去搜尋,這對USER來說挺不方便的 翻了一下網路的文章,似乎是要LDA ...

Linux Kenel版本

Puput avatar
By Puput
at 2016-01-14T01:04
※ 引述《FierceBreast (兇奴王者)》之銘言: : 1.) : 2.X 3.X 4.X的主要差別? 每一個版本都有差別, 但主要差別... 呃, 沒有 2.6.x 跑了一段時間後, Linus 就決定跳到 3.x 請參考: https://lkml.org/lkml/2011/5/29/20 ...

netboot.xyz

Jake avatar
By Jake
at 2016-01-14T00:29
剛剛看到,超酷的 http://netboot.xyz/ 以後不用去下載發行板的 net install iso 了 從此裝任何系統只要有這個就好了 而且才 1MB ,可以隨便塞 pxe 映像又更小,300 多K 比如 pxe 丟進路由器的 dnsmasq (這個絕對有內建) 我想板友應該很多手邊是 op ...