Bug 908368

Summary: targetcli: How to access different LUNs using different IQNs.
Product: Red Hat Enterprise Linux 7 Reporter: Bruno Goncalves <bgoncalv>
Component: targetcliAssignee: Andy Grover <agrover>
Status: CLOSED NOTABUG QA Contact: Bruno Goncalves <bgoncalv>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: nyewale
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-24 11:58:12 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
targetcli ls output none

Description Bruno Goncalves 2013-02-06 14:30:07 UTC
I'm trying to configure LIO to provide different LUNs depending on iqn.

I think I'm making something wrong there, would you know what is the problem?

I'm trying to login with iqn mapped to tpg2
(iqn.1994-05.com.redhat:storage-initiator2) and I only want to access tpg2 LUN.

targetcli /iscsi/iqn.1994-05.com.redhat:storage-target ls
o- iqn.1994-05.com.redhat:storage-target
....................................................................................
[2 TPGs]
o- tpg1
................................................................................................................
[enabled]
| o- acls
................................................................................................................
[1 ACL]
| | o- iqn.1994-05.com.redhat:storage-initiator1-boot
.................................................................. [2
Mapped LUNs]
| | o- mapped_lun0
......................................................................... [lun0
block/storage-initiator1-boot (rw)]
| | o- mapped_lun1
...........................................................................
[lun1 block/storage-initiator1-io (rw)]
| o- luns
...............................................................................................................
[2 LUNs]
| | o- lun0 .....................................................
[block/storage-initiator1-boot (/dev/iscsi_backend/storage-initiator1-boot)]
| | o- lun1 .........................................................
[block/storage-initiator1-io (/dev/iscsi_backend/storage-initiator1-io)]
| o- portals
..........................................................................................................
[1 Portal]
| o- [::0]:3260
...........................................................................................................
[OK]
o- tpg2
................................................................................................................
[enabled]
o- acls
................................................................................................................
[1 ACL]
| o- iqn.1994-05.com.redhat:storage-initiator2
......................................................................... [1
Mapped LUN]
| o- mapped_lun0
.............................................................................
[lun0 block/storage-initiator2 (rw)]
o- luns
................................................................................................................
[1 LUN]
| o- lun0 .............................................................
[block/storage-initiator2 (/dev/iscsi_backend/storage-initiator2)]
o- portals
..........................................................................................................
[1 Portal]
o- [::0]:3260
...........................................................................................................
[OK]

----
Feb 4 14:59:25 storage-target kernel: [338881.456551] iSCSI Initiator
Node: iqn.1994-05.com.redhat:storage-initiator2 is not authorized to access
iSCSI target portal group: 1.
Feb 4 14:59:25 storage-target kernel: [338881.519016] iSCSI Login
negotiation failed.
Feb 4 14:59:25 storage-target kernel: [338881.542073] iSCSI Initiator
Node: iqn.1994-05.com.redhat:storage-initiator2 is not authorized to access
iSCSI target portal group: 1.
Feb 4 14:59:25 storage-target kernel: [338881.602433] iSCSI Login
negotiation failed.

Comment 2 Bruno Goncalves 2013-02-06 14:37:06 UTC
Created attachment 693961 [details]
targetcli ls output

Comment 3 Bruno Goncalves 2013-02-06 14:38:32 UTC
rpm -q targetcli
targetcli-2.0rc1.fb19-1.el7.noarch

Comment 4 Andy Grover 2013-02-19 22:28:30 UTC
I think you should be able to use a single TPG, but just map different luns to each initiator via separate ACLs?

Also, separate TPGs should not allow you to use the same NetworkPortal for both, I think this is only slightly related but will be fixed in kernel 3.9 most likely.

Comment 5 Bruno Goncalves 2013-03-11 15:12:51 UTC
It seems to work. The only problem when having more than one ACL per TPG is that every new LUN that is created on TPG is automatically mapped to all ACLS...

Comment 6 Andy Grover 2013-03-21 23:10:28 UTC
Ah ok, for that do "set global auto_add_mapped_luns=false".

Comment 7 Bruno Goncalves 2013-04-24 11:58:12 UTC
perfect, it does work.