Bug 1006077 - targetcli fails when attempt to list non standard block device partitions
targetcli fails when attempt to list non standard block device partitions
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: python-rtslib (Show other bugs)
19
x86_64 Linux
unspecified Severity medium
: ---
: ---
Assigned To: Andy Grover
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-09 20:29 EDT by Dave Jiang
Modified: 2013-10-02 21:15 EDT (History)
2 users (show)

See Also:
Fixed In Version: python-rtslib-2.1.fb40-1.fc19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-29 20:31:28 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dave Jiang 2013-09-09 20:29:48 EDT
Description of problem:
When using a block partition that is non-standard such as NVME device, targetcli fails to locate the sysfs size file. 

Version-Release number of selected component (if applicable):
targetcli-2.1.fb26-1.fc19.noarch

How reproducible:

Steps to Reproduce:
1. run targetcli
2. cd /backstores/block
3. create nvme0 /dev/nvme0n1p5
4. ls

Actual results:
/backstores/block> create nvme0 /dev/nvme0n1p5
Created block storage object nvme0 using /dev/nvme0n1p5.
/backstores/block> ls
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/configshell/shell.py", line 990, in run_interactive
    self._cli_loop()
  File "/usr/lib/python2.7/site-packages/configshell/shell.py", line 813, in _cli_loop
    self.run_cmdline(cmdline)
  File "/usr/lib/python2.7/site-packages/configshell/shell.py", line 934, in run_cmdline
    self._execute_command(path, command, pparams, kparams)
  File "/usr/lib/python2.7/site-packages/configshell/shell.py", line 909, 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/configshell/node.py", line 714, in ui_command_ls
    tree = self._render_tree(target, depth=depth)
  File "/usr/lib/python2.7/site-packages/configshell/node.py", line 865, in _render_tree
    + self._render_tree(children[i], margin, depth)
  File "/usr/lib/python2.7/site-packages/configshell/node.py", line 769, in _render_tree
    (description, is_healthy) = root.summary()
  File "/usr/lib/python2.7/site-packages/targetcli/ui_backstore.py", line 423, in summary
    return ("%s (%s) %s%s %s" % (so.udev_path, bytes_to_human(so.size),
  File "/usr/lib/python2.7/site-packages/rtslib/tcm.py", line 707, in _get_size
    return get_blockdev_size(self._parse_info('device')) * int(self._parse_info('SectorSize'))
  File "/usr/lib/python2.7/site-packages/rtslib/utils.py", line 124, in get_blockdev_size
    return int(fread("/sys/block/%s/%s/size" % (m.groups()[0], m.group())))
  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/p/p5/size'

Expected results:
/backstores/block> ls
o- block ................................................. [Storage Objects: 1]
  o- nvme0 ...................... [/dev/nvme0n1p5 (2.0GiB) write-thru activated]

Additional info:
Essentially in /usr/lib/python2.7/site-packages/rtslib/utils.py:122 where it does the regular expression search match it is not able to handle anything besides generic block devices such as /dev/sdN and /dev/hdN. A non typical block device naming such as NVME breaks that search pattern. It should end up reading:
/sys/block/nvme0n1/nvme0n1p5/size and not /sys/block/p/p5/size.
Comment 1 Fedora Update System 2013-09-10 13:44:51 EDT
python-rtslib-2.1.fb38-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/python-rtslib-2.1.fb38-1.fc19
Comment 2 Fedora Update System 2013-09-10 13:45:01 EDT
python-rtslib-2.1.fb38-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/python-rtslib-2.1.fb38-1.fc20
Comment 3 Fedora Update System 2013-09-10 13:45:10 EDT
python-rtslib-2.1.fb38-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/python-rtslib-2.1.fb38-1.fc18
Comment 4 Fedora Update System 2013-09-10 21:59:54 EDT
Package python-rtslib-2.1.fb38-1.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-rtslib-2.1.fb38-1.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-16355/python-rtslib-2.1.fb38-1.fc18
then log in and leave karma (feedback).
Comment 5 Dave Jiang 2013-09-11 13:01:02 EDT
I tested and it's fixed. Thanks!
Comment 6 Fedora Update System 2013-09-11 14:30:47 EDT
python-rtslib-2.1.fb39-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/python-rtslib-2.1.fb39-1.fc19
Comment 7 Fedora Update System 2013-09-11 14:31:04 EDT
python-rtslib-2.1.fb39-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/python-rtslib-2.1.fb39-1.fc18
Comment 8 Fedora Update System 2013-09-11 14:31:13 EDT
python-rtslib-2.1.fb39-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/python-rtslib-2.1.fb39-1.fc20
Comment 9 Fedora Update System 2013-09-23 18:08:07 EDT
python-rtslib-2.1.fb40-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/python-rtslib-2.1.fb40-1.fc19
Comment 10 Fedora Update System 2013-09-23 18:08:17 EDT
python-rtslib-2.1.fb40-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/python-rtslib-2.1.fb40-1.fc18
Comment 11 Fedora Update System 2013-09-23 18:08:26 EDT
python-rtslib-2.1.fb40-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/python-rtslib-2.1.fb40-1.fc20
Comment 12 Fedora Update System 2013-09-29 20:31:28 EDT
python-rtslib-2.1.fb40-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 13 Fedora Update System 2013-10-02 21:08:25 EDT
python-rtslib-2.1.fb40-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 14 Fedora Update System 2013-10-02 21:15:39 EDT
python-rtslib-2.1.fb40-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.