Bug 861249

Summary: some enhancements to tgt's configuration files
Product: Red Hat Enterprise Linux 6 Reporter: Andy Grover <agrover>
Component: scsi-target-utilsAssignee: Andy Grover <agrover>
Status: CLOSED WONTFIX QA Contact: Bruno Goncalves <bgoncalv>
Severity: medium Docs Contact:
Priority: low    
Version: 6.5CC: agrover, bgoncalv, pbrady, ssato, terje.rosten
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 643302 Environment:
Last Closed: 2014-11-21 17:00:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 643302    
Bug Blocks:    

Description Andy Grover 2012-09-27 23:22:54 UTC
+++ This bug was initially created as a clone of Bug #643302 +++

Description of problem:

It is possible to use the "include" directive in /etc/tgt/targets.conf to load custom configs other than /etc/tgt/targets.conf and there is a line "... include ..." in it.

Unfortunately, the line is written as just a comment and users have to write the line anyhow to add their configuration files to customize.


Instead, how about changing it like followings?

0. add the line 'include /etc/tgt/conf.d/*.conf' in targets.conf
1. create /etc/tgt/conf.d by default.

and optionally

2. add /etc/tgt/conf.d/sample.conf (its content came from targets.conf in RPM)


And, users only have to add their custom config files to add iscsi targets and there is no need to modify files provided by the scsi-target-utils' RPM at all.

Also it would be possible that users make their custom rpm only contains custom configuration files under /etc/tgt/conf.d and all they have to do is to install the RPM to complete the iscsi target setup.

I will post some example files to accomplish this.



Version-Release number of selected component (if applicable):
1.0.1-3.fc13.x86_64 (but I guess it should be applicable to others in F14/RHEL 6+).

--- Additional comment from ssato on 2010-10-15 01:35:33 PDT ---

Created attachment 453673 [details]
example of rpm spec changes

--- Additional comment from ssato on 2010-10-15 01:38:48 PDT ---

Created attachment 453675 [details]
modified version of targets.conf: all comments of target examples are removed.

--- Additional comment from ssato on 2010-10-15 01:39:57 PDT ---

Created attachment 453677 [details]
/etc/tgt/conf.d/sample.conf: sample target configurations

--- Additional comment from fedora-admin-xmlrpc on 2011-06-30 15:03:45 PDT ---

This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

--- Additional comment from agrover on 2011-12-20 13:06:15 PST ---

lets get this in F17.

--- Additional comment from agrover on 2012-08-07 16:53:54 PDT ---

Thanks Satoh-san, rpm updated and building for rawhide (F18) now.

--- Additional comment from p on 2012-09-20 05:29:04 PDT ---

Any chance we could backport this to F17 and RHEL6 ?
It would simplify OpenStack Folsom installation for one thing.

--- Additional comment from agrover on 2012-09-20 14:11:17 PDT ---

F17 sure. Do you by any chance want to handle that one?

RHEL6 more difficult, we may want to clone this bug and handle separately if this is something that OpenStack would really like.

--- Additional comment from pbrady on 2012-09-20 15:47:06 PDT ---

OK I'll have a look at updating F17.

OpenStack would really like to:

  include /var/lib/cinder/volumes/*
  include /var/lib/nova/volumes/*

However adding that to /etc/tgt/targets.conf on package install/upgrade is very awkward. Do you perhaps have tricks to easily enable that without supporting /etc/tgt/conf.d/ ? Otherwise it would be really nice to have on RHEL.

thanks.

--- Additional comment from updates on 2012-09-20 17:23:20 PDT ---

scsi-target-utils-1.0.24-4.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/scsi-target-utils-1.0.24-4.fc17

--- Additional comment from ssato on 2012-09-20 19:05:39 PDT ---

This may be a off topic, but:

(In reply to comment #9)
> OK I'll have a look at updating F17.
> 
> OpenStack would really like to:
> 
>   include /var/lib/cinder/volumes/*
>   include /var/lib/nova/volumes/*
> 
> However adding that to /etc/tgt/targets.conf on package install/upgrade is
> very awkward. Do you perhaps have tricks to easily enable that without
> supporting /etc/tgt/conf.d/ ? Otherwise it would be really nice to have on
> RHEL.
> 
> thanks.

How about nesting includes ? That is, for example,

/etc/tgt/targets.conf:

include /etc/tgt/conf.d/*.conf


/etc/tgt/conf.d/cinder.conf:

include /etc/cinder/volumes.d/*.conf


/etc/tgt/conf.d/nova.conf:

include /etc/nova/volumes.d/*.conf


I'm not sure if tgt-admin (perl's Config::General module) supports
nesting includes but it looks so:
  http://search.cpan.org/dist/Config-General/General.pm

--- Additional comment from pbrady on 2012-09-21 02:11:56 PDT ---

Yep that's what I intend to do on F17 and F18.

My question was directed to installations that didn't support /etc/tgt/conf.d
I.E. it looks very awkward, so it would be great to support this config option
automatically on RHEL 6 too.

thanks.

--- Additional comment from updates on 2012-09-23 16:50:18 PDT ---

scsi-target-utils-1.0.24-4.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

--- Additional comment from p on 2012-09-26 16:26:48 PDT ---

Created attachment 617838 [details]
allow conf.d files to include directories

When testing this it was noticed that perl's Config::General does not recursively expand globs, only doing so on the first level. I've added a query about that at:
https://rt.cpan.org/Public/Bug/Display.html?id=79869

In the meantime though we could still support the setup detailed in comment 11
by enabling the IncludeDirectories option as done in the attached patch.

Would it be OK if I updated Fedora 17 and Fedora 18 with that tweak?

--- Additional comment from agrover on 2012-09-26 18:06:36 PDT ---

That change looks good, but there's another issue I'd also like to fix, to put this all firmly to rest.

I'm concerned that if the system admin has modified targets.conf then the new targets.conf with the new include directive will be installed as .rpmnew, and thus stuff in tgt/conf.d/* won't get picked up. Perhaps we need to have tgt-admin actually start with a stub .conf that just includes tgt/targets.conf and tgt/conf.d/* to ensure this doesn't happen?

--- Additional comment from p on 2012-09-27 01:26:25 PDT ---

comment 15 sounds good to me.
Supports upgrade and traditional scripts that munge targets.conf

--- Additional comment from updates on 2012-09-27 10:18:58 PDT ---

scsi-target-utils-1.0.30-4.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/scsi-target-utils-1.0.30-4.fc18

--- Additional comment from updates on 2012-09-27 10:20:07 PDT ---

scsi-target-utils-1.0.24-5.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/scsi-target-utils-1.0.24-5.fc17

Comment 2 RHEL Program Management 2012-09-27 23:27:54 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

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