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+).
Created attachment 453673 [details] example of rpm spec changes
Created attachment 453675 [details] modified version of targets.conf: all comments of target examples are removed.
Created attachment 453677 [details] /etc/tgt/conf.d/sample.conf: sample target configurations
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
lets get this in F17.
Thanks Satoh-san, rpm updated and building for rawhide (F18) now.
Any chance we could backport this to F17 and RHEL6 ? It would simplify OpenStack Folsom installation for one thing.
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.
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.
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
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
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.
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.
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?
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?
comment 15 sounds good to me. Supports upgrade and traditional scripts that munge targets.conf
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
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
Package scsi-target-utils-1.0.24-5.fc17: * should fix your issue, * was pushed to the Fedora 17 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing scsi-target-utils-1.0.24-5.fc17' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2012-14975/scsi-target-utils-1.0.24-5.fc17 then log in and leave karma (feedback).
Now, I have scsi-target-utils-1.0.32-1.fc18.x86_64. Looks like the tgt-admin --execute (or --update) starts the parsing (as expected by most documentation) with the tgt/targets.conf and in this way it will never read the /etc/tgt/conf.d/*. When restart the tgtd it starts with the tgt/tgtd.conf and read everything, but it is too late for cinder.. As a workaround now I have just one line in the tgtd.conf which includes the targets.conf which includes the /etc/tgt/conf.d/*.conf ... pretty long chain :) I think if we change the tgt-admin behavior to start with the tgtd.conf causes more confusion, since /etc/tgt/targets.conf expected by most users.
Created attachment 639693 [details] possible fix to comment 20 Thanks for looking into that Attila. So is systemd using stale settings on update? Perhaps this is addressed with this patch?
The systemd using the correct IMHO. When you strace -Ff -e open tgt-admin --execute you can see does it read the cinders config files (2>&1 | grep conf[.]d) or not. I expect it to read it. This is important. The cinder uses the --update , which implies config re-parse like with --execute. cinder does not restart the tgtd. I just saw a _manual_ restart caused only to read the cinder configs, but I expect it reread without touching the systemd. The tgt-admin --update <..> MUST reread the cinder configs. Cinder expects it. If you need more detailed examples, let me know.
Created attachment 640036 [details] fix for comment 20 Oh, tgt-admin itself hardcodes /etc/tgt/targets.conf rather than reading the /etc/sysconfig value. That was unexpected. This patch should get it working.
scsi-target-utils-1.0.32-2.fc18 has been submitted as an update for Fedora 18. https://admin.fedoraproject.org/updates/scsi-target-utils-1.0.32-2.fc18
scsi-target-utils-1.0.24-6.fc17 has been submitted as an update for Fedora 17. https://admin.fedoraproject.org/updates/scsi-target-utils-1.0.24-6.fc17
scsi-target-utils-1.0.32-2.fc18 has been pushed to the Fedora 18 stable repository. If problems still persist, please make note of it in this bug report.
scsi-target-utils-1.0.24-6.fc17 has been pushed to the Fedora 17 stable repository. If problems still persist, please make note of it in this bug report.