target fails to start with IPv6 portals in config file

Bug #1643069 reported by Kevin Otte
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
rtslib (Ubuntu)
New
Undecided
Unassigned

Bug Description

The service startup ate the traceback, so I keyed it in by hand:
>>> import rtslib
>>> config = rtslib.Config()
>>> config.load("/etc/target/scsi_target.lio", allow_new_attrs=True)
>>> list(config.apply())
No handlers could be found for logger "Config"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/rtslib/config.py", line 717, in apply
    apply_create_obj(obj)
  File "/usr/lib/python2.7/dist-packages/rtslib/config_live.py", line 420, in apply_create_obj
    port = int(port)
ValueError: invalid literal for int() with base 10: 'e0:a0f4:121::4:3260'

/usr/lib/python2.7/dist-packages/rtslib/config_live.py:
351:def apply_create_obj(obj):
...
419: (address, _, port) = obj.key[1].partition(':')
420: port = int(port)

Naively splitting on colon will not work for IPv6 addresses.

I am reluctant to file another bug upstream having discovered that Datera appears not to be maintaining this code anymore and Debian is in the process of including the -fb versions.

Tags: patch
Revision history for this message
Kevin Otte (nivex) wrote :

FWIW, changing that partition to an rpartition will at least get things online.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "config_live.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Kevin Otte (nivex) wrote :

I just tested this with targetcli-fb in 17.10 and it gleefully allowed me to add a portal for an address that isn't even on the system, but I do see it listening in "ss -a -6" output. I guess this at least avoids the problem of upgrading my server from 16.04 -> 18.04 when the time comes. Sadly it looks as though 16.04 will be forever broken.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.