Subject: [alpine-aports] [PATCH] main/open-iscsi: musl fix, second try. fixes bug #4802. added default config file.

From: Jann - Ove Risvik <[email-masked]>
Date: Wed, 20 Jul 2016 22:57:52 +0200

While making sure it didn't throw away legitimate unrecognised arguments I managed to break everything else... Not good. Didn't test it well enough. :/

I've also included the default config file. Previously the package didn't include all the config files needed to work out of the box.
---
 main/open-iscsi/APKBUILD         |  21 +--
 main/open-iscsi/iscsid.conf      | 304 +++++++++++++++++++++++++++++++++++++++
 main/open-iscsi/musl-fixes.patch |  21 ++-
 3 files changed, 332 insertions(+), 14 deletions(-)
 create mode 100644 main/open-iscsi/iscsid.conf

diff --git a/main/open-iscsi/APKBUILD b/main/open-iscsi/APKBUILD
index 47194e3..cd9a519 100644
--- a/main/open-iscsi/APKBUILD
+++ b/main/open-iscsi/APKBUILD
@@ -2,7 +2,7 @@
 pkgname=open-iscsi
 pkgver=2.0.873
 _realver=${pkgver%.*}-${pkgver##*.}
-pkgrel=4
+pkgrel=5
 pkgdesc="High performance, transport independent, multi-platform iSCSI initiator"
 url="http://www.open-iscsi.org"
 arch="all"
@@ -14,7 +14,8 @@ subpackages="$pkgname-doc"
 source="http://arch.p5n.pp.ru/~sergej/dl/$pkgname-${_realver}.tar.gz
 	musl-fixes.patch
 	iscsid.initd
-	iscsid.confd"
+	iscsid.confd
+	iscsid.conf"
 
 _builddir="$srcdir"/$pkgname-$_realver
 
@@ -45,17 +46,21 @@ package() {
 	mv $pkgdir/sbin/iscsid $pkgdir/usr/sbin
 	install -Dm755 "$srcdir"/iscsid.initd "$pkgdir"/etc/init.d/iscsid
 	install -Dm644 "$srcdir"/iscsid.confd "$pkgdir"/etc/conf.d/iscsid
+	install -Dm644 "$srcdir"/iscsid.conf "$pkgdir"/etc/iscsi/iscsid.conf
 }
 
 md5sums="8b8316d7c9469149a6cc6234478347f7  open-iscsi-2.0-873.tar.gz
-3b5e052956ba89b011b3383fe599de83  musl-fixes.patch
+93d493b1ad4fb2d246eb532446aa164d  musl-fixes.patch
 c6a0c15c0c21b13915179fb7e0cf0003  iscsid.initd
-b762b687d4628791b4362df22cf22d34  iscsid.confd"
+b762b687d4628791b4362df22cf22d34  iscsid.confd
+49c29d08c08e74699724f1fb3de21a6c  iscsid.conf"
 sha256sums="7dd9f2f97da417560349a8da44ea4fcfe98bfd5ef284240a2cc4ff8e88ac7cd9  open-iscsi-2.0-873.tar.gz
-6f55aa7c52c5bdefe67a8092b8d2c5a77536bd3b1b9f347fafa1f2cda94d9cd4  musl-fixes.patch
+57d6b4040a9b43c8a8864fb3e1c25ac48b78427265f4487744685a9a2b1b2954  musl-fixes.patch
 38edede472f478ce01f40e3557c315de3f3ecf1d0c0dbab2883517840a7186b5  iscsid.initd
-673bf4744efc3276d372587c996270821d39dcdc0bf27a13691ea6b0e814b6d0  iscsid.confd"
+673bf4744efc3276d372587c996270821d39dcdc0bf27a13691ea6b0e814b6d0  iscsid.confd
+0e1db9b03693a1090cfd7b28a790f83ec6615984608b0cf8465aa91db2437e23  iscsid.conf"
 sha512sums="4e67116cb7dd49381c9279645e5a661f05596ae6be3b832772089828b3764ca2d04b5dea1bcc337071efb52c3c75a6fb943136c659ee59500f3a198ed0dcea6b  open-iscsi-2.0-873.tar.gz
-a51b81d62b179ff17b3ade09873113ed16b207bcccdd02cd86c76911d4b890d7ff9e1103ec3168af78560d606910374afaa04fa3356fa9e9ad6b7142a69e06e6  musl-fixes.patch
+e45ce5deec9d3861568e0be3390827da525b523b6d0a47a99f85becb4416e3a26f5e17f077a891c43ae90e621fa8d357123b9b3573a731788fac2c12b40239a6  musl-fixes.patch
 e16d0abf117c0c282e98abb14893923609dc6078f770facd0578ad72ce6e3fc7b9c84a39628c1246d955ba6bb204fb902bcba6d5959ac755fee7e2a85da181df  iscsid.initd
-075bb9cb783be7ccbc799947e0e042b85310d40b3045141dc1be40ca84ed1cc0e1e54559df501c512c179e28375314b27a03c15d9a6d4b1cabd428b2279985d3  iscsid.confd"
+075bb9cb783be7ccbc799947e0e042b85310d40b3045141dc1be40ca84ed1cc0e1e54559df501c512c179e28375314b27a03c15d9a6d4b1cabd428b2279985d3  iscsid.confd
+3686d31c5642e611c0c0c61f0f42a33030a74b518a2a108f004b9bd34b2b98d8e29ee2416a5b9cc447ab0449bdc94158b2323d977e7b7d2930dd4dcf0866da68  iscsid.conf"
diff --git a/main/open-iscsi/iscsid.conf b/main/open-iscsi/iscsid.conf
new file mode 100644
index 0000000..ab4df53
--- /dev/null
+++ b/main/open-iscsi/iscsid.conf
@@ -0,0 +1,304 @@
+#
+# Open-iSCSI default configuration.
+# Could be located at /etc/iscsi/iscsid.conf or ~/.iscsid.conf
+#
+# Note: To set any of these values for a specific node/session run
+# the iscsiadm --mode node --op command for the value. See the README
+# and man page for iscsiadm for details on the --op command.
+#
+
+######################
+# iscsid daemon config
+######################
+# If you want iscsid to start the first time a iscsi tool
+# needs to access it, instead of starting it when the init
+# scripts run, set the iscsid startup command here. This
+# should normally only need to be done by distro package
+# maintainers.
+#
+# Default for Fedora and RHEL. (uncomment to activate).
+ iscsid.startup = /etc/init.d/iscsid start
+# 
+# Default for upstream open-iscsi scripts (uncomment to activate).
+#iscsid.startup = /sbin/iscsid
+
+
+#############################
+# NIC/HBA and driver settings
+#############################
+# open-iscsi can create a session and bind it to a NIC/HBA.
+# To set this up see the example iface config file.
+
+#*****************
+# Startup settings
+#*****************
+
+# To request that the iscsi initd scripts startup a session set to "automatic".
+# node.startup = automatic
+#
+# To manually startup the session set to "manual". The default is manual.
+node.startup = manual
+
+# For "automatic" startup nodes, setting this to "Yes" will try logins on each
+# available iface until one succeeds, and then stop.  The default "No" will try
+# logins on all availble ifaces simultaneously.
+node.leading_login = No
+
+# *************
+# CHAP Settings
+# *************
+
+# To enable CHAP authentication set node.session.auth.authmethod
+# to CHAP. The default is None.
+#node.session.auth.authmethod = CHAP
+
+# To set a CHAP username and password for initiator
+# authentication by the target(s), uncomment the following lines:
+#node.session.auth.username = username
+#node.session.auth.password = password
+
+# To set a CHAP username and password for target(s)
+# authentication by the initiator, uncomment the following lines:
+#node.session.auth.username_in = username_in
+#node.session.auth.password_in = password_in
+
+# To enable CHAP authentication for a discovery session to the target
+# set discovery.sendtargets.auth.authmethod to CHAP. The default is None.
+#discovery.sendtargets.auth.authmethod = CHAP
+
+# To set a discovery session CHAP username and password for the initiator
+# authentication by the target(s), uncomment the following lines:
+#discovery.sendtargets.auth.username = username
+#discovery.sendtargets.auth.password = password
+
+# To set a discovery session CHAP username and password for target(s)
+# authentication by the initiator, uncomment the following lines:
+#discovery.sendtargets.auth.username_in = username_in
+#discovery.sendtargets.auth.password_in = password_in
+
+# ********
+# Timeouts
+# ********
+#
+# See the iSCSI REAME's Advanced Configuration section for tips
+# on setting timeouts when using multipath or doing root over iSCSI.
+#
+# To specify the length of time to wait for session re-establishment
+# before failing SCSI commands back to the application when running
+# the Linux SCSI Layer error handler, edit the line.
+# The value is in seconds and the default is 120 seconds.
+# Special values:
+# - If the value is 0, IO will be failed immediately.
+# - If the value is less than 0, IO will remain queued until the session
+# is logged back in, or until the user runs the logout command.
+node.session.timeo.replacement_timeout = 120
+
+# To specify the time to wait for login to complete, edit the line.
+# The value is in seconds and the default is 15 seconds.
+node.conn[0].timeo.login_timeout = 15
+
+# To specify the time to wait for logout to complete, edit the line.
+# The value is in seconds and the default is 15 seconds.
+node.conn[0].timeo.logout_timeout = 15
+
+# Time interval to wait for on connection before sending a ping.
+node.conn[0].timeo.noop_out_interval = 5
+
+# To specify the time to wait for a Nop-out response before failing
+# the connection, edit this line. Failing the connection will
+# cause IO to be failed back to the SCSI layer. If using dm-multipath
+# this will cause the IO to be failed to the multipath layer.
+node.conn[0].timeo.noop_out_timeout = 5
+
+# To specify the time to wait for abort response before
+# failing the operation and trying a logical unit reset edit the line.
+# The value is in seconds and the default is 15 seconds.
+node.session.err_timeo.abort_timeout = 15
+
+# To specify the time to wait for a logical unit response
+# before failing the operation and trying session re-establishment
+# edit the line.
+# The value is in seconds and the default is 30 seconds.
+node.session.err_timeo.lu_reset_timeout = 30
+
+# To specify the time to wait for a target response
+# before failing the operation and trying session re-establishment
+# edit the line.
+# The value is in seconds and the default is 30 seconds.
+node.session.err_timeo.tgt_reset_timeout = 30
+
+
+#******
+# Retry
+#******
+
+# To specify the number of times iscsid should retry a login
+# if the login attempt fails due to the node.conn[0].timeo.login_timeout
+# expiring modify the following line. Note that if the login fails
+# quickly (before node.conn[0].timeo.login_timeout fires) because the network
+# layer or the target returns an error, iscsid may retry the login more than
+# node.session.initial_login_retry_max times.
+#
+# This retry count along with node.conn[0].timeo.login_timeout
+# determines the maximum amount of time iscsid will try to
+# establish the initial login. node.session.initial_login_retry_max is
+# multiplied by the node.conn[0].timeo.login_timeout to determine the
+# maximum amount.
+#
+# The default node.session.initial_login_retry_max is 8 and
+# node.conn[0].timeo.login_timeout is 15 so we have:
+#
+# node.conn[0].timeo.login_timeout * node.session.initial_login_retry_max =
+#								120 seconds
+#
+# Valid values are any integer value. This only
+# affects the initial login. Setting it to a high value can slow
+# down the iscsi service startup. Setting it to a low value can
+# cause a session to not get logged into, if there are distuptions
+# during startup or if the network is not ready at that time.
+node.session.initial_login_retry_max = 8
+
+################################
+# session and device queue depth
+################################
+
+# To control how many commands the session will queue set
+# node.session.cmds_max to an integer between 2 and 2048 that is also
+# a power of 2. The default is 128.
+node.session.cmds_max = 128
+
+# To control the device's queue depth set node.session.queue_depth
+# to a value between 1 and 1024. The default is 32.
+node.session.queue_depth = 32
+
+##################################
+# MISC SYSTEM PERFORMANCE SETTINGS
+##################################
+
+# For software iscsi (iscsi_tcp) and iser (ib_iser) each session
+# has a thread used to transmit or queue data to the hardware. For
+# cxgb3i you will get a thread per host.
+#
+# Setting the thread's priority to a lower value can lead to higher throughput
+# and lower latencies. The lowest value is -20. Setting the priority to
+# a higher value, can lead to reduced IO performance, but if you are seeing
+# the iscsi or scsi threads dominate the use of the CPU then you may want
+# to set this value higher.
+#
+# Note: For cxgb3i you must set all sessions to the same value, or the
+# behavior is not defined.
+#
+# The default value is -20. The setting must be between -20 and 20.
+node.session.xmit_thread_priority = -20
+
+
+#***************
+# iSCSI settings
+#***************
+
+# To enable R2T flow control (i.e., the initiator must wait for an R2T
+# command before sending any data), uncomment the following line:
+#
+#node.session.iscsi.InitialR2T = Yes
+#
+# To disable R2T flow control (i.e., the initiator has an implied
+# initial R2T of "FirstBurstLength" at offset 0), uncomment the following line:
+#
+# The defaults is No.
+node.session.iscsi.InitialR2T = No
+
+#
+# To disable immediate data (i.e., the initiator does not send
+# unsolicited data with the iSCSI command PDU), uncomment the following line:
+#
+#node.session.iscsi.ImmediateData = No
+#
+# To enable immediate data (i.e., the initiator sends unsolicited data
+# with the iSCSI command packet), uncomment the following line:
+#
+# The default is Yes
+node.session.iscsi.ImmediateData = Yes
+
+# To specify the maximum number of unsolicited data bytes the initiator
+# can send in an iSCSI PDU to a target, edit the following line.
+#
+# The value is the number of bytes in the range of 512 to (2^24-1) and
+# the default is 262144
+node.session.iscsi.FirstBurstLength = 262144
+
+# To specify the maximum SCSI payload that the initiator will negotiate
+# with the target for, edit the following line.
+#
+# The value is the number of bytes in the range of 512 to (2^24-1) and
+# the defauls it 16776192
+node.session.iscsi.MaxBurstLength = 16776192
+
+# To specify the maximum number of data bytes the initiator can receive
+# in an iSCSI PDU from a target, edit the following line.
+#
+# The value is the number of bytes in the range of 512 to (2^24-1) and
+# the default is 262144
+node.conn[0].iscsi.MaxRecvDataSegmentLength = 262144
+
+# To specify the maximum number of data bytes the initiator will send
+# in an iSCSI PDU to the target, edit the following line.
+#
+# The value is the number of bytes in the range of 512 to (2^24-1).
+# Zero is a special case. If set to zero, the initiator will use
+# the target's MaxRecvDataSegmentLength for the MaxXmitDataSegmentLength.
+# The default is 0.
+node.conn[0].iscsi.MaxXmitDataSegmentLength = 0
+
+# To specify the maximum number of data bytes the initiator can receive
+# in an iSCSI PDU from a target during a discovery session, edit the
+# following line.
+#
+# The value is the number of bytes in the range of 512 to (2^24-1) and
+# the default is 32768
+# 
+discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768
+
+# To allow the targets to control the setting of the digest checking,
+# with the initiator requesting a preference of enabling the checking, uncomment# one or both of the following lines:
+#node.conn[0].iscsi.HeaderDigest = CRC32C,None
+#node.conn[0].iscsi.DataDigest = CRC32C,None
+#
+# To allow the targets to control the setting of the digest checking,
+# with the initiator requesting a preference of disabling the checking,
+# uncomment one or both of the following lines:
+#node.conn[0].iscsi.HeaderDigest = None,CRC32C
+#node.conn[0].iscsi.DataDigest = None,CRC32C
+#
+# To enable CRC32C digest checking for the header and/or data part of
+# iSCSI PDUs, uncomment one or both of the following lines:
+#node.conn[0].iscsi.HeaderDigest = CRC32C
+#node.conn[0].iscsi.DataDigest = CRC32C
+#
+# To disable digest checking for the header and/or data part of
+# iSCSI PDUs, uncomment one or both of the following lines:
+#node.conn[0].iscsi.HeaderDigest = None
+#node.conn[0].iscsi.DataDigest = None
+#
+# The default is to never use DataDigests or HeaderDigests.
+#
+
+# For multipath configurations, you may want more than one session to be
+# created on each iface record.  If node.session.nr_sessions is greater
+# than 1, performing a 'login' for that node will ensure that the
+# appropriate number of sessions is created.
+node.session.nr_sessions = 1
+
+#************
+# Workarounds
+#************
+
+# Some targets like IET prefer after an initiator has sent a task
+# management function like an ABORT TASK or LOGICAL UNIT RESET, that
+# it does not respond to PDUs like R2Ts. To enable this behavior uncomment
+# the following line (The default behavior is Yes):
+node.session.iscsi.FastAbort = Yes
+
+# Some targets like Equalogic prefer that after an initiator has sent
+# a task management function like an ABORT TASK or LOGICAL UNIT RESET, that
+# it continue to respond to R2Ts. To enable this uncomment this line
+# node.session.iscsi.FastAbort = No
diff --git a/main/open-iscsi/musl-fixes.patch b/main/open-iscsi/musl-fixes.patch
index 910b485..f101eda 100644
--- a/main/open-iscsi/musl-fixes.patch
+++ b/main/open-iscsi/musl-fixes.patch
@@ -29,9 +29,17 @@
  #include <dirent.h>
  #include <limits.h>
  #include <sys/stat.h>
---- ./usr/iscsiadm.c.orig
-+++ ./usr/iscsiadm.c
-@@ -2553,7 +2553,10 @@ main(int argc, char **argv)
+--- ./usr/iscsiadm.c.orig	2012-05-21 02:59:24.000000000 +0200
++++ ./usr/iscsiadm.c	2016-07-20 22:00:54.430451701 +0200
+@@ -2403,6 +2403,7 @@ main(int argc, char **argv)
+ 	int tpgt = PORTAL_GROUP_TAG_UNKNOWN, killiscsid=-1, do_show=0;
+ 	int packet_size=32, ping_count=1, ping_interval=0;
+ 	int do_discover = 0, sub_mode = -1;
++	int argerror = 0;
+ 	struct sigaction sa_old;
+ 	struct sigaction sa_new;
+ 	struct list_head ifaces;
+@@ -2553,7 +2554,11 @@ main(int argc, char **argv)
  			return 0;
  		case 'h':
  			usage(0);
@@ -39,17 +47,18 @@
 +
 +		case '?':
 +			log_error("unrecognized character '%c'", optopt);
++			argerror = 1;
 +		}	
  
  		if (name && value) {
  			param = idbm_alloc_user_param(name, value);
-@@ -2568,8 +2571,7 @@ main(int argc, char **argv)
+@@ -2568,8 +2573,7 @@ main(int argc, char **argv)
  		}
  	}
  
 -	if (optopt) {
 -		log_error("unrecognized character '%c'", optopt);
-+	if (opterr) {
++	if (argerror) {
  		rc = ISCSI_ERR_INVAL;
  		goto free_ifaces;
- 	}
+ 	
-- 
2.8.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---