Bug 1445536

Summary: targetd create_export fails to map lun to an initiator acl if lun is already mapped in the target.
Product: Red Hat Enterprise Linux 7 Reporter: Clark Hale <chale>
Component: targetdAssignee: Tony Asleson <tasleson>
Status: CLOSED ERRATA QA Contact: Martin Hoyer <mhoyer>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: bdonahue, chale, rspazzol, tasleson, xhe
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 20:43:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Modification of client script to induce issue
none
Patch to correct the issue none

Description Clark Hale 2017-04-25 21:56:40 UTC
Created attachment 1274032 [details]
Modification of client script to induce issue

Description of problem:

create_export will not create a mapped LUN for an initiator if that same lun is mapped to a different initiator.

Version-Release number of selected component (if applicable):


How reproducible:

Reproducible every time.

Steps to Reproduce:

These two targetd API calls will show the bug:
jsonrequest('export_create', dict(pool=pool, vol='test18', initiator_wwn='iqn.2006-03.com.wtf.ohyeah:661', lun=1))
jsonrequest('export_create', dict(pool=pool, vol='test18', initiator_wwn='iqn.2006-03.com.wtf.ohyeah:662', lun=1))

More detailed steps:

1. Setup a host with targetd
2. Modify the attached client script to suit the test environment, specifically
line 46-53:
user = "admin"
password = "redhat"
host = '172.31.0.127'
port = 18700
path = '/targetrpc'
id_num = 1
ssl = False
pool = 'my_vg'

3. Execute client script
4. Observe output on iscsi server.


Actual results:
/iscsi/iqn.20...uto/tpg1/acls> ls
o- acls ............................................................................ [ACLs: 2]
  o- iqn.2006-03.com.wtf.ohyeah:661 ......................................... [Mapped LUNs: 1]
  | o- mapped_lun1 ............................................ [lun0 block/my_vg:test18 (rw)]
  o- iqn.2006-03.com.wtf.ohyeah:662 ......................................... [Mapped LUNs: 0]

Expected results:
o- acls ............................................................................ [ACLs: 2]
  o- iqn.2006-03.com.wtf.ohyeah:661 ......................................... [Mapped LUNs: 1]
  | o- mapped_lun1 ............................................ [lun0 block/my_vg:test18 (rw)]
  o- iqn.2006-03.com.wtf.ohyeah:662 ......................................... [Mapped LUNs: 1]
    o- mapped_lun1 ............................................ [lun0 block/my_vg:test18 (rw)]


Additional info:

Comment 2 Clark Hale 2017-04-25 22:08:49 UTC
Created attachment 1274034 [details]
Patch to correct the issue

This patch should fix the issue, by looking at both if a mapped lun exists in the target AND if that LUN is mapped in an initiator acl.

Comment 3 Tony Asleson 2017-04-26 20:19:28 UTC
Upstream PR merged: https://github.com/open-iscsi/targetd/pull/20

Comment 6 Martin Hoyer 2017-05-29 11:15:17 UTC
Tested with targetd-0.8.6-1.el7.
No regression found.

Comment 7 errata-xmlrpc 2017-08-01 20:43:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1982