From 68b89d46a5a5bf153ca386f253a41f7a5fdcb31e Mon Sep 17 00:00:00 2001 From: Andy Grover Date: Sep 20 2012 23:54:50 +0000 Subject: Support /etc/tgt/conf.d/*.conf Signed-off-by: Andy Grover Signed-off-by: Pádraig Brady cherry-picked: fe43e53dfbb67f911cd8e748da406c7f93ad426c --- diff --git a/sample.conf b/sample.conf new file mode 100644 index 0000000..282a670 --- /dev/null +++ b/sample.conf @@ -0,0 +1,224 @@ +# This is a sample config file for tgt-admin. +# The files ending with '.conf' in this directory will be included. +# +# The "#" symbol disables the processing of a line. + + +# Sample target with one LUN only. Defaults to allow access for all initiators: + +# +# backing-store /dev/LVM/somedevice +# + + +# Similar, but we use "direct-store" instead of "backing-store". +# "direct-store" reads drive parameters with sg_inq command and sets them to +# the target. +# Parameters fatched with sg_inq are: +# - Vendor identification +# - Product identification +# - Product revision level +# - Unit serial number (if present) +# We also specify "incominguser". + +# +# direct-store /dev/sdd +# incominguser someuser secretpass12 +# + + +# An example with multiple LUNs, disabled write-cache (tgtd enables write-cache +# by default) and vendor identification set to "MyVendor" + +# +# backing-store /dev/LVM/somedevice1 # Becomes LUN 1 +# backing-store /dev/LVM/somedevice2 # Becomes LUN 2 +# backing-store /dev/LVM/somedevice3 # Becomes LUN 3 +# write-cache off +# vendor_id MyCompany Inc. +# + + +# Similar to the one above, but we fetch vendor_id, product_id, product_rev and +# scsi_sn from the disks. +# Vendor identification (vendor_id) is replaced in all disks by "MyVendor" + +# +# direct-store /dev/sdb # Becomes LUN 1 +# direct-store /dev/sdc # Becomes LUN 2 +# direct-store /dev/sdd # Becomes LUN 3 +# write-cache off +# vendor_id MyCompany Inc. +# + + +# Note that "first-device-first-lun numbering" will work only for simple +# scenarios above, where _only_ direct-store _or_ backing-store is used. +# If you mix backing-store and direct-store, then all backing-store entries +# are processed before direct-store-entries. + +# +# direct-store /dev/sdb # Becomes LUN 3 +# backing-store /dev/sdc # Becomes LUN 1 +# direct-store /dev/sdd # Becomes LUN 4 +# backing-store /dev/sde # Becomes LUN 2 +# + + +# Even more complicated example - each device has different parameters. +# You can use indentation to make the config file more readable. +# Note that LUNs will be assigned more or less randomly here (and still +# backing-store get LUNs assigned before drect-store). +# You can specify multiple mode_page parameters (they are commented out +# in this example). +# Note that some parameters (write-cache, scsi_sn) were specified "globally". +# "Global" parameters will be applied to all LUNs; they can be overwritten +# "locally", per LUN. +# If lun is not specified, it will be allocated automatically (first available). + +# + +# +# vendor_id VENDOR1 +# removable 1 +# device-type cd +# lun 1 +# + +# +# vendor_id VENDOR2 +# lun 2 +# + +# +# vendor_id back1 +# scsi_sn SERIAL +# write-cache on + # lun 3 # lun is commented out - will be allocated automatically +# + +# +# vendor_id back2 + #mode_page 8:0:18:0x10:0:0xff.... + #mode_page 8:0:18:0x10:0:0xff.... + #bs-type aio +# lun 15 +# + + # Some more parameters which can be specified locally or globally: + #scsi_id ... + #scsi_sn ... + #vendor_id ... + #product_id ... + #product_rev ... + #sense_format ... + #removable ... + #online ... + #path ... + #mode_page 8:0:18:0x10:0:0xff.... + #mode_page 8:0:18:0x10:0:0xff.... + #device-type ... + #bs-type ... # backing store type - default rdwr, can be aio, mmap, etc... + #allow-in-use yes # if specified globally, can't be overwritten locally + +# write-cache off +# scsi_sn multipath-10 + + # Parameters below are only global. They can't be configured per LUN. + # Only allow connections from 192.168.100.1 and 192.168.200.5 +# initiator-address 192.168.100.1 +# initiator-address 192.168.200.5 + + # Tuning parameters (global, per target) + #MaxRecvDataSegmentLength 8192 + #MaxXmitDataSegmentLength 8192 + #HeaderDigest None + #DataDigest None + #InitialR2T Yes + #MaxOutstandingR2T 1 + #ImmediateData Yes + #FirstBurstLength 65536 + #MaxBurstLength 262144 + #DataPDUInOrder Yes + #DataSequenceInOrder Yes + #ErrorRecoveryLevel 0 + #IFMarker No + #OFMarker No + #DefaultTime2Wait 2 + #DefaultTime2Retain 20 + #OFMarkInt Reject + #IFMarkInt Reject + #MaxConnections 1 + + # Allowed incoming users +# incominguser user1 secretpass12 +# incominguser user2 secretpass23 + + # Outgoing user +# outgoinguser userA secretpassA + +# + + +# The device will have lun 1 unless you specify something else +# +# backing-store /dev/LVM/somedevice +# lun 10 +# + + +# Devices which are in use (by system: mounted, for swap, part of RAID, or by +# userspace: dd, by tgtd for another target etc.) can't be used, unless you use +# --force flag or add 'allow-in-use yes' option +# +# backing-store /dev/LVM/somedevice +# allow-in-use yes +# + +# +# +# scsi_sn serial1 +# + +# +# scsi_sn serial2 +# + +# allow-in-use yes +# + + + + + +# Not supported configurations, and therefore, commented out: + +# +# backing-store /dev/LVM/somedevice1 +# backing-store /dev/LVM/somedevice2 +# lun 10 +# lun 11 +# + +# +# +# vendor_id VENDOR1 +# +# +# direct-store /dev/sdc +# + +# This one will break the parser: + +# +# +# vendor_id VENDOR1 +# +# +# direct-store /dev/sdc +# +# +# vendor_id VENDOR1 +# +# + diff --git a/scsi-target-utils.spec b/scsi-target-utils.spec index 6f8d7c3..259f84d 100644 --- a/scsi-target-utils.spec +++ b/scsi-target-utils.spec @@ -4,7 +4,7 @@ Name: scsi-target-utils Version: 1.0.24 -Release: 3%{?dist} +Release: 4%{?dist} Summary: The SCSI target daemon and utility programs Group: System Environment/Daemons @@ -14,6 +14,7 @@ Source0: https://github.com/fujita/tgt/tarball/v%{version} Source1: tgtd.service Source2: sysconfig.tgtd Source3: targets.conf +Source4: sample.conf Patch0: scsi-target-utils-redhatify-docs.patch Patch1: scsi-target-utils-remove-xsltproc-check.patch Patch2: scsi-target-utils-dynamic-link-iser.patch @@ -62,6 +63,7 @@ Extensions for RDMA (ISER) to scsi-target-utils. %{__install} -d %{buildroot}%{_mandir}/man8 %{__install} -d %{buildroot}%{_unitdir} %{__install} -d %{buildroot}%{_sysconfdir}/tgt +%{__install} -d %{buildroot}%{_sysconfdir}/tgt/conf.d %{__install} -d %{buildroot}%{_sysconfdir}/sysconfig %{__install} -p -m 0755 scripts/tgt-setup-lun %{buildroot}%{_sbindir} @@ -73,6 +75,7 @@ Extensions for RDMA (ISER) to scsi-target-utils. %{__install} -p -m 0644 doc/manpages/tgt-setup-lun.8 %{buildroot}/%{_mandir}/man8 %{__install} -p -m 0600 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/tgtd %{__install} -p -m 0600 %{SOURCE3} %{buildroot}%{_sysconfdir}/tgt +%{__install} -p -m 0600 %{SOURCE4} %{buildroot}%{_sysconfdir}/tgt/conf.d pushd usr %{__make} install %{?with_rdma:ISCSI_RDMA=1} DESTDIR=%{buildroot} sbindir=%{_sbindir} libdir=%{_libdir}/tgt @@ -112,6 +115,7 @@ fi %{_unitdir}/tgtd.service %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/tgtd %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/tgt/targets.conf +%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/tgt/conf.d/sample.conf %if 0%{?with_rdma} %files iser @@ -120,6 +124,10 @@ fi %changelog +* Fri Sep 21 2012 Andy Grover - 1.0.24-4 +- Add /etc/tgt/tgt.d directory, and move samples from target.conf + into tgt.d/samples.conf. See #643302, thanks ssato@redhat.com. + * Mon Aug 6 2012 Andy Grover - 1.0.24-3 - Fix typo in service file diff --git a/targets.conf b/targets.conf index 89c554e..bb1995e 100644 --- a/targets.conf +++ b/targets.conf @@ -1,238 +1,20 @@ # This is a sample config file for tgt-admin. -# By default, tgt-admin looks for its config file in /etc/tgt/targets.conf # # The "#" symbol disables the processing of a line. - # This one includes other config files: - -#include /etc/tgt/temp/*.conf - +include /etc/tgt/conf.d/*.conf # Set the driver. If not specified, defaults to "iscsi". - default-driver iscsi +# Set iSNS parameters, if needed +#iSNSServerIP 192.168.111.222 +#iSNSServerPort 3205 +#iSNSAccessControl On +#iSNS On # Continue if tgtadm exits with non-zero code (equivalent of # --ignore-errors command line option) #ignore-errors yes - -# Sample target with one LUN only. Defaults to allow access for all initiators: - -# -# backing-store /dev/LVM/somedevice -# - - -# Similar, but we use "direct-store" instead of "backing-store". -# "direct-store" reads drive parameters with sg_inq command and sets them to -# the target. -# Parameters fatched with sg_inq are: -# - Vendor identification -# - Product identification -# - Product revision level -# - Unit serial number (if present) -# We also specify "incominguser". - -# -# direct-store /dev/sdd -# incominguser someuser secretpass12 -# - - -# An example with multiple LUNs, disabled write-cache (tgtd enables write-cache -# by default) and vendor identification set to "MyVendor" - -# -# backing-store /dev/LVM/somedevice1 # Becomes LUN 1 -# backing-store /dev/LVM/somedevice2 # Becomes LUN 2 -# backing-store /dev/LVM/somedevice3 # Becomes LUN 3 -# write-cache off -# vendor_id MyCompany Inc. -# - - -# Similar to the one above, but we fetch vendor_id, product_id, product_rev and -# scsi_sn from the disks. -# Vendor identification (vendor_id) is replaced in all disks by "MyVendor" - -# -# direct-store /dev/sdb # Becomes LUN 1 -# direct-store /dev/sdc # Becomes LUN 2 -# direct-store /dev/sdd # Becomes LUN 3 -# write-cache off -# vendor_id MyCompany Inc. -# - - -# Note that "first-device-first-lun numbering" will work only for simple -# scenarios above, where _only_ direct-store _or_ backing-store is used. -# If you mix backing-store and direct-store, then all backing-store entries -# are processed before direct-store-entries. - -# -# direct-store /dev/sdb # Becomes LUN 3 -# backing-store /dev/sdc # Becomes LUN 1 -# direct-store /dev/sdd # Becomes LUN 4 -# backing-store /dev/sde # Becomes LUN 2 -# - - -# Even more complicated example - each device has different parameters. -# You can use indentation to make the config file more readable. -# Note that LUNs will be assigned more or less randomly here (and still -# backing-store get LUNs assigned before drect-store). -# You can specify multiple mode_page parameters (they are commented out -# in this example). -# Note that some parameters (write-cache, scsi_sn) were specified "globally". -# "Global" parameters will be applied to all LUNs; they can be overwritten -# "locally", per LUN. -# If lun is not specified, it will be allocated automatically (first available). - -# - -# -# vendor_id VENDOR1 -# removable 1 -# device-type cd -# lun 1 -# - -# -# vendor_id VENDOR2 -# lun 2 -# - -# -# vendor_id back1 -# scsi_sn SERIAL -# write-cache on - # lun 3 # lun is commented out - will be allocated automatically -# - -# -# vendor_id back2 - #mode_page 8:0:18:0x10:0:0xff.... - #mode_page 8:0:18:0x10:0:0xff.... - #bs-type aio -# lun 15 -# - - # Some more parameters which can be specified locally or globally: - #scsi_id ... - #scsi_sn ... - #vendor_id ... - #product_id ... - #product_rev ... - #sense_format ... - #removable ... - #online ... - #path ... - #mode_page 8:0:18:0x10:0:0xff.... - #mode_page 8:0:18:0x10:0:0xff.... - #device-type ... - #bs-type ... # backing store type - default rdwr, can be aio, mmap, etc... - #allow-in-use yes # if specified globally, can't be overwritten locally - -# write-cache off -# scsi_sn multipath-10 - - # Parameters below are only global. They can't be configured per LUN. - # Only allow connections from 192.168.100.1 and 192.168.200.5 -# initiator-address 192.168.100.1 -# initiator-address 192.168.200.5 - - # Tuning parameters (global, per target) - #MaxRecvDataSegmentLength 8192 - #MaxXmitDataSegmentLength 8192 - #HeaderDigest None - #DataDigest None - #InitialR2T Yes - #MaxOutstandingR2T 1 - #ImmediateData Yes - #FirstBurstLength 65536 - #MaxBurstLength 262144 - #DataPDUInOrder Yes - #DataSequenceInOrder Yes - #ErrorRecoveryLevel 0 - #IFMarker No - #OFMarker No - #DefaultTime2Wait 2 - #DefaultTime2Retain 20 - #OFMarkInt Reject - #IFMarkInt Reject - #MaxConnections 1 - - # Allowed incoming users -# incominguser user1 secretpass12 -# incominguser user2 secretpass23 - - # Outgoing user -# outgoinguser userA secretpassA - -# - - -# The device will have lun 1 unless you specify something else -# -# backing-store /dev/LVM/somedevice -# lun 10 -# - - -# Devices which are in use (by system: mounted, for swap, part of RAID, or by -# userspace: dd, by tgtd for another target etc.) can't be used, unless you use -# --force flag or add 'allow-in-use yes' option -# -# backing-store /dev/LVM/somedevice -# allow-in-use yes -# - -# -# -# scsi_sn serial1 -# - -# -# scsi_sn serial2 -# - -# allow-in-use yes -# - - - - - -# Not supported configurations, and therefore, commented out: - -# -# backing-store /dev/LVM/somedevice1 -# backing-store /dev/LVM/somedevice2 -# lun 10 -# lun 11 -# - -# -# -# vendor_id VENDOR1 -# -# -# direct-store /dev/sdc -# - -# This one will break the parser: - -# -# -# vendor_id VENDOR1 -# -# -# direct-store /dev/sdc -# -# -# vendor_id VENDOR1 -# -#