rhel7中,targetcli使用两位数的分区名字(比如sda10)而导致的问题:
[root@host1 ~]# fdisk -l /dev/sda
[root@host1 ~]# targetcli
targetcli shell version 2.1.fb41
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/backstores/block> ls
o- block ................ [Storage Objects: 0]
/backstores/block> create dev=/dev/sda5 ocr_hdd_1
Created block storage object ocr_hdd_1 using /dev/sda5.
/backstores/block> create dev=/dev/sda6 ocr_hdd_2
Created block storage object ocr_hdd_2 using /dev/sda6.
/backstores/block> create dev=/dev/sda7 ocr_hdd_3
Created block storage object ocr_hdd_3 using /dev/sda7.
/backstores/block> create dev=/dev/sda8 fra_hdd_1
Created block storage object fra_hdd_1 using /dev/sda8.
/backstores/block> create dev=/dev/sda9 fra_hdd_2
Created block storage object fra_hdd_2 using /dev/sda9.
/backstores/block> create dev=/dev/sda10 fra_hdd_3 ------>>>注意此处的sda10
Created block storage object fra_hdd_3 using /dev/sda10.
/backstores/block> create dev=/dev/nvme0n1 data_ssd_1
Created block storage object data_ssd_1 using /dev/nvme0n1.
/backstores/block> create dev=/dev/nvme1n1 data_ssd_2
Created block storage object data_ssd_2 using /dev/nvme1n1.
/backstores/block> create dev=/dev/nvme2n1 data_ssd_3
Created block storage object data_ssd_3 using /dev/nvme2n1.
/backstores/block> ls----------------------->>>>ls命令
Traceback (most recent call last):
File "/usr/bin/targetcli", line 121, in <module>
main()
File "/usr/bin/targetcli", line 111, in main
shell.run_interactive()
File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 894, in run_interactive
self._cli_loop()
File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 723, in _cli_loop
self.run_cmdline(cmdline)
File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 837, in run_cmdline
self._execute_command(path, command, pparams, kparams)
File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 812, in _execute_command
result = target.execute_command(command, pparams, kparams)
File "/usr/lib/python2.7/site-packages/configshell_fb/node.py", line 1411, in execute_command
return method(*pparams, **kparams)
File "/usr/lib/python2.7/site-packages/configshell_fb/node.py", line 710, in ui_command_ls
tree = self._render_tree(target, depth=depth)
File "/usr/lib/python2.7/site-packages/configshell_fb/node.py", line 861, in _render_tree
+ self._render_tree(children[i], margin, depth)
File "/usr/lib/python2.7/site-packages/configshell_fb/node.py", line 765, in _render_tree
(description, is_healthy) = root.summary()
File "/usr/lib/python2.7/site-packages/targetcli/ui_backstore.py", line 540, in summary
return ("%s (%s) %s%s %s" % (so.udev_path, bytes_to_human(so.size),
File "/usr/lib/python2.7/site-packages/rtslib_fb/tcm.py", line 703, in _get_size
return get_size_for_disk_name(self._parse_info('device')) * int(self._parse_info('SectorSize'))
File "/usr/lib/python2.7/site-packages/rtslib_fb/utils.py", line 162, in get_size_for_disk_name
return get_size("/sys/block/%s/%s" % (disk, m.group()), True)
File "/usr/lib/python2.7/site-packages/rtslib_fb/utils.py", line 141, in get_size
sect_size = int(fread("%s/size" % path))
File "/usr/lib/python2.7/site-packages/rtslib_fb/utils.py", line 90, in fread
with open(path, 'r') as file_fd:
IOError: [Errno 2] No such file or directory: '/sys/block/sda1/sda10/size'------------ls命令的报错!
[root@host1 ~]#
根据redhat.com文章:targetcli causes calltrace with the particular partition names which include 2 digits
建议:
Currently, there is no package to fix this issue. Red Hat is handling this issue in RHBZ#1312270
The workaround is to avoid creation iqn with the partition whose name contains two digits.
好吧,遇到bug了。不用sda10了,于是执行如下的命令:
[root@host1 ~]# targetcli
targetcli shell version 2.1.fb41
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/>cd backstores/block
/backstores/block> delete fra_hdd_3
Deleted storage object fra_hdd_3.
/backstores/block> ls------------->>>>>能正常显示了!
o- block ................ [Storage Objects: 8]
o- data_ssd_1 ................ [/dev/nvme0n1 (745.2GiB) write-thru deactivated]
o- data_ssd_2 ................ [/dev/nvme1n1 (745.2GiB) write-thru deactivated]
o- data_ssd_3 ................ [/dev/nvme2n1 (745.2GiB) write-thru deactivated]
o- fra_hdd_1 ................ [/dev/sda8 (300.0GiB) write-thru deactivated]
o- fra_hdd_2 ................ [/dev/sda9 (300.0GiB) write-thru deactivated]
o- ocr_hdd_1 ................ [/dev/sda5 (10.0GiB) write-thru deactivated]
o- ocr_hdd_2 ................ [/dev/sda6 (10.0GiB) write-thru deactivated]
o- ocr_hdd_3 ................ [/dev/sda7 (10.0GiB) write-thru deactivated]
/backstores/block>