Bug 727786

Summary: [tgtadm] don't fail service reload in case target already exits
Product: Red Hat Enterprise Linux 6 Reporter: Haim <hateya>
Component: scsi-target-utilsAssignee: Andy Grover <agrover>
Status: CLOSED WORKSFORME QA Contact: Bruno Goncalves <bgoncalv>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2CC: bgoncalv, dnaori, hateya, jkt, mgoldboi, qcai, yeylon
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-23 14:26:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
tgtadm logs none

Description Haim 2011-08-03 08:53:53 UTC
Created attachment 516460 [details]
tgtadm logs

Description of problem:

case:

sometimes, when I try to create new targets, service reload fails, running with bash -x reviles that it tries to create new target:

tgtadm -C 0 --lld iscsi --op new --mode target --tid 12 -T ErrorHandling-T1

and fail on tgtadm: this target already exists. 

Target actually already exists, and in this case i created different target called ErrorHandling-T21 and ErrorHandling-T22.

1) I don't understand why tgt use command to create new target if its already exits.
2) I think we should not fail service reload on such case, as its not harmful, its more problematic that user can'r reload. 

workaround:

tgtadm --lld iscsi --mode target --op delete --tid 12

reload service.

Comment 3 Andy Grover 2011-10-03 23:03:55 UTC
Does fixing bug 736740 resolve this bug as well?

Comment 4 David Naori 2011-10-04 14:24:23 UTC
changed the script manually in /usr/sbin/tgt-admin

+				$tgtadm_output_tid{$target} = $next_tid;
-	process_targets;

but from the line numbers i could tell that the upstream script is different.

* with those changes i still see the problem.

[root@filer03 ~]# tgt-admin --update ALL
tgtadm: this target already exists
Command:
	tgtadm -C 0 --lld iscsi --op new --mode target --tid 98 -T david
exited with code: 22.

can you please provide a scratch build or the upstream git? this way we would be able test it with the same code.

Comment 5 Andy Grover 2011-10-04 17:16:01 UTC
sure, http://people.redhat.com/agrover/files/test_rpms/scsi-target-utils-1.0.14-3test1.el6.x86_64.rpm

So, this is the same issue as bug 736740? Or is this one about running tgtadm directly?

Comment 6 RHEL Program Management 2011-10-07 16:05:15 UTC
Since RHEL 6.2 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 7 Haim 2012-01-08 07:10:24 UTC
(In reply to comment #5)
> sure,
> http://people.redhat.com/agrover/files/test_rpms/scsi-target-utils-1.0.14-3test1.el6.x86_64.rpm
> 
> So, this is the same issue as bug 736740? Or is this one about running tgtadm
> directly?

Andy, as we don't have a consistent repro of the problem, I cannot provide you the needed info if it does/doesn't fix the problem, however, i'm willing to patch my server with attached rpm and work with it extensively this week, if it does't reproduce then we can close down the bug.

Comment 8 Haim 2012-01-10 08:12:15 UTC
(In reply to comment #5)
> sure,
> http://people.redhat.com/agrover/files/test_rpms/scsi-target-utils-1.0.14-3test1.el6.x86_64.rpm
> 
> So, this is the same issue as bug 736740? Or is this one about running tgtadm
> directly?

Andy, installed scratch rpms and I still get the problem after adding new target and trying reload the service: 

tgtadm -C 0 --lld iscsi --op new --mode target --tid 246 -T rvaknin_igor
exited with code: 22

scsi-target-utils-1.0.14-3test1.el6.x86_64