targetcli /backstores/fileio create fails for LVM devices with uppercase names
Issue
- Attempting to create a new fileio device through targetcli against an LVM device fails.
- The error message (for an LVM volume named 'somelvname' with some or all letters in upper case) is:
IOError: [Errno 2] No such file or directory: '/sys/block/somelvmname/size'
- In more detail, here is the full python traceback for an LVM volume named TESTVG-testlv :
[root@rhel70 ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
testlv TESTVG -wi-ao---- 8.00g
root rhel -wi-ao---- 13.71g
swap rhel -wi-ao---- 820.00m
[root@rhel70 ~]# targetcli /backstores/fileio create test /dev/mapper/TESTVG-testlv
Note: block backstore preferred for best results
Traceback (most recent call last):
File "/usr/bin/targetcli", line 89, in <module>
main()
File "/usr/bin/targetcli", line 72, in main
shell.run_cmdline(" ".join(sys.argv[1:]))
File "/usr/lib/python2.7/site-packages/configshell/shell.py", line 891, in run_cmdline
self._execute_command(path, command, pparams, kparams)
File "/usr/lib/python2.7/site-packages/configshell/shell.py", line 866, in _execute_command
result = target.execute_command(command, pparams, kparams)
File "/usr/lib/python2.7/site-packages/targetcli/ui_node.py", line 87, in execute_command
pparams, kparams)
File "/usr/lib/python2.7/site-packages/configshell/node.py", line 1417, in execute_command
result = method(*pparams, **kparams)
File "/usr/lib/python2.7/site-packages/targetcli/ui_backstore.py", line 355, in ui_command_create
% (name, so.size))
File "/usr/lib/python2.7/site-packages/rtslib/tcm.py", line 611, in _get_size
return (get_blockdev_size(self._parse_info('File')) *
File "/usr/lib/python2.7/site-packages/rtslib/utils.py", line 127, in get_blockdev_size
return get_size("/sys/block/%s" % name)
File "/usr/lib/python2.7/site-packages/rtslib/utils.py", line 120, in get_size
sect_size = int(fread("%s/size" % path))
File "/usr/lib/python2.7/site-packages/rtslib/utils.py", line 88, in fread
with open(path, 'r') as file_fd:
IOError: [Errno 2] No such file or directory: '/sys/block/testvg-testlv/size'
Environment
- RHEL7.0GA
- targetcli-2.1.fb34-1.el7.noarch
- python-rtslib-2.1.fb46-1.el7.noarch
- lvm2-2.02.105-14.el7.x86_64
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.