Bug 587072 - [PATCH] Fix tgt-admin logic error with shared accounts in targets.conf
[PATCH] Fix tgt-admin logic error with shared accounts in targets.conf
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: scsi-target-utils (Show other bugs)
6.1
All Linux
low Severity medium
: rc
: ---
Assigned To: Mike Christie
Red Hat Kernel QE team
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-28 15:52 EDT by Dax Kelson
Modified: 2010-11-10 17:23 EST (History)
2 users (show)

See Also:
Fixed In Version: scsi-target-utils-1.0.4-0.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-11-10 17:23:57 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Fix tgt-admin logic error with shared accounts in targets.conf (2.56 KB, patch)
2010-04-28 15:52 EDT, Dax Kelson
no flags Details | Diff

  None (edit)
Description Dax Kelson 2010-04-28 15:52:55 EDT
Created attachment 409951 [details]
Fix tgt-admin logic error with shared accounts in targets.conf

Description of problem:

I tried creating a targets.conf with multiple targets, all with the same
outgoing account. This is a valid (and typical) configuration.

Snippet from my targets.conf:

<target iqn.1999-07.com.gurulabs:station1>
        backing-store /srv/iscsi-luns/station1
        incominguser station1 letmein
        outgoinguser server1 itsreallyme
</target>

<target iqn.1999-07.com.gurulabs:station2>
        backing-store /srv/iscsi-luns/station2
        incominguser station2 letmein
        outgoinguser server1 itsreallyme
</target>

<target iqn.1999-07.com.gurulabs:station3>
        backing-store /srv/iscsi-luns/station3
        incominguser station3 letmein
        outgoinguser server1 itsreallyme
</target>

The current logic in tgt-admin doesn't support having the same account (incoming
or outgoing) defined on multiple targets. The current logic always
deletes an account and then adds an account when processing each target. The delete removes the account from any already configured targets. The end result is only the last target processed will have account configured.

Attached is a tested patch to support the configuration above. I've sent the patch upstream already.

The tgt-admin in RHEL5 suffers from the same problem.
Comment 2 Mike Christie 2010-04-28 16:27:04 EDT
Thanks for the patch and problem analysis.

Adding devel ack and proposing for RHEL 6.0.
Comment 3 RHEL Product and Program Management 2010-04-28 16:57:14 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.
Comment 4 Mike Christie 2010-05-05 11:25:43 EDT
Thanks again for the patch Dax!. Merged in scsi-target-utils-1.0.4-0.el6.
Comment 6 michal novacek 2010-09-16 12:25:34 EDT
Verified that the patch for /usr/sbin/tgt-admin (bash script) is included in scsi-target-utils-1.0.4-3.el6 and that the same incoming and outgoing user can be created for multiple targets with similar config that the reported shows.

# cat /etc/tgt/targets.conf 
default-driver iscsi

<target iqn.2001-04.com.storageqe-05-a>
	backing-store /dev/loop0
	incominguser station1 letmein
	outgoinguser server1 itsreallyme
</target>
<target iqn.2001-04.com.storageqe-05-b>
	backing-store /dev/loop0
	incominguser station1 letmein
	outgoinguser server1 itsreallyme
</target>
<target iqn.2001-04.com.storageqe-05-c>
	backing-store /dev/loop0
	incominguser station1 letmein
	outgoinguser server1 itsreallyme
</target>

# service tgtd restart
Stopping SCSI target daemon:                               [  OK  ]
Starting SCSI target daemon:                               [  OK  ]

# tgt-admin --show
Target 1: iqn.2001-04.com.storageqe-05-a
...
    Account information:
        station1
        server1 (outgoing)
    ACL information:
        ALL
Target 2: iqn.2001-04.com.storageqe-05-b
...
    Account information:
        station1
        server1 (outgoing)
    ACL information:
        ALL
Target 3: iqn.2001-04.com.storageqe-05-c
...
    Account information:
        station1
        server1 (outgoing)
    ACL information:
        ALL
Comment 8 releng-rhel@redhat.com 2010-11-10 17:23:57 EST
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.

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