RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 587072 - [PATCH] Fix tgt-admin logic error with shared accounts in targets.conf
Summary: [PATCH] Fix tgt-admin logic error with shared accounts in targets.conf
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: scsi-target-utils
Version: 6.1
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Mike Christie
QA Contact: Red Hat Kernel QE team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-04-28 19:52 UTC by Dax Kelson
Modified: 2010-11-10 22:23 UTC (History)
2 users (show)

Fixed In Version: scsi-target-utils-1.0.4-0.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-11-10 22:23:57 UTC
Target Upstream Version:
Embargoed:


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

Description Dax Kelson 2010-04-28 19:52:55 UTC
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 20:27:04 UTC
Thanks for the patch and problem analysis.

Adding devel ack and proposing for RHEL 6.0.

Comment 3 RHEL Program Management 2010-04-28 20:57:14 UTC
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 15:25:43 UTC
Thanks again for the patch Dax!. Merged in scsi-target-utils-1.0.4-0.el6.

Comment 6 michal novacek 2010-09-16 16:25:34 UTC
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 22:23:57 UTC
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.