Bug 676326

Summary: [target] changes made from CLI should be saved
Product: Red Hat Enterprise Linux 6 Reporter: Max Benenson <mbenenso>
Component: scsi-target-utilsAssignee: Andy Grover <agrover>
Status: CLOSED DEFERRED QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: high Docs Contact:
Priority: high    
Version: 6.0CC: agrover
Target Milestone: rcKeywords: FutureFeature, Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-16 17:28:15 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
targets.conf file none

Description Max Benenson 2011-02-09 14:38:19 UTC
Created attachment 477830 [details]
targets.conf file

Description of problem:
Currently there is no way to add/edit/remove the target and store the new configuration in targets.conf file using CLI (the only way is manually modify the file). Simple service reload or host reboot will restore the old configuration stored in targets.conf. Looks like tgt-admin utility unable to store the modifications made on targets.

Version-Release number of selected component (if applicable):
scsi-target-utils-1.0.4-3.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Create lv
2. Create target
3. Add lun
4. Service tgtg reload
5. tgt-admin --force --delete tid=1
  
Actual results:
The target with id 1 remains in targets.conf file

Expected results:
Should remove the target with id 1 from the targets.conf file

Additional info:
Attached targets.conf file

Comment 2 Andy Grover 2011-03-08 19:36:16 UTC
Hi, please list exact commands used for steps 1-3, thanks.

Comment 3 Max Benenson 2011-03-15 21:36:33 UTC
(In reply to comment #2)
> Hi, please list exact commands used for steps 1-3, thanks.

1. lvcreate -L 50G -n /dev/vg_autofiler01/test_lv
2 and 3. vim /etc/tgt/targets.conf and add the following:
    <target iqn.2001-04.com.test_target>
        <backing-store /dev/vg_autofiler01/test_lv>
            scsi_id 11223344
            scsi_sn 99887766
        </backing-store>
    </target>

Comment 4 RHEL Program Management 2011-04-04 02:04:30 UTC
Since RHEL 6.1 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 5 Andy Grover 2011-06-06 19:57:37 UTC
I think this is working as intended, targets.conf should only be modified by the user, not by the daemon.

Comment 6 Max Benenson 2011-06-07 05:51:58 UTC
(In reply to comment #5)
> I think this is working as intended, targets.conf should only be modified by
> the user, not by the daemon.

Are you seriously? Should be modified by the user? But this is a wrong way, users are error-prone and may destroy targets mistakenly or introduce a typo that will affect the whole tgt service. I faced such situations several times since multiple users had granted access to the targets.conf file on a storage machine.

Of course you can say that the access to this file should be restricted to a single administrator only, but why to edit it manually at all? As an effort of our RHEV Automation team I wrote a simple parser which handles this file, so I believe that such experienced programmers as you are guys can handle this file from the code also.

Let's take NetApp [1] for example or stmfadm [2] on Solaris. They are not exposing any kind of configuration file to the end user, they are using CLI to change and update target/lun configurations persistently. IMHO such persistent CLI for TGT is a MUST HAVE feature.

[1]: http://ecserv1.uwaterloo.ca/netapp/man/man1/na_lun.1.html
[2]: http://www.unix.com/man-page/OpenSolaris/1m/stmfadm/

Comment 7 Andy Grover 2011-06-07 17:14:16 UTC
The good news is that TCM, the new target arch, will have persistent configuration like you describe. That's what we're moving towards.

But, tgt-admin was not designed for this. If it was, targets.conf would be under /var instead of /etc, and wouldn't be user-editable, similar to the two other utilities you mentioned. It's extremely unlikely tgt-admin will make this change.

I'm going to retarget this bug towards the feature being in our TCM support.

Comment 8 Andy Grover 2011-08-16 17:28:15 UTC
This will be there in RHEL 7 when we move to kernel target.