[Pkg-iscsi-maintainers] Bug#609582: Patches for generic iscsitarget options

Robbert Rijkse robbert at sestary.net
Tue May 24 22:37:15 UTC 2011


Hi Ritesh,

I needed to be able to bind iscsitarget to a specific address and have 
created two patches with the changes I made to get this to work. The 
patch allows for the address, port and any other options to be specified 
in the defaults file.

Please let me know there is anything else you need.

Robbert


The defaults file

--- iscsitarget.bak     2011-05-24 18:03:26.002213954 -0400
+++ iscsitarget 2011-05-24 18:24:02.461203346 -0400
@@ -1 +1,15 @@
+# Start iscsitarget from init.d script?
+# Only allowed values are "true" and "false"
  ISCSITARGET_ENABLE=true
+
+# Bind iscsitarget to a specific address
+# Default: Listen on any address
+# ISCSITARGET_ADDRESS=''
+
+# Change the port iscsitarget listens on
+# Default: Listen on port 3260
+# ISCSITARGET_PORT='3260'
+
+# Extra options to give iscsitarget?
+# Possibilities can be found by running man ietd.
+# ISCSITARGET_OPTS=''

The init file

--- iscsitarget.bak     2011-05-24 18:11:27.758213907 -0400
+++ iscsitarget 2011-05-24 18:33:37.453713838 -0400
@@ -18,6 +18,9 @@
  . /lib/lsb/init-functions # log_{warn,failure}_msg

  ISCSITARGET_ENABLE=false
+ISCSITARGET_ADDRESS=''
+ISCSITARGET_PORT=''
+ISCSITARGET_OPTS=''
  ISCSITARGET_DEFAULTS_FILE=/etc/default/iscsitarget

  if [ -s "$ISCSITARGET_DEFAULTS_FILE" ]; then
@@ -44,7 +47,13 @@
                 log_end_msg 1
                 exit $RETVAL
         fi
-       start-stop-daemon --start --exec $DAEMON --quiet --oknodo
+       if [ -n $ISCSITARGET_ADDRESS ] ; then
+               ISCSITARGET_OPTS="`echo $ISCSITARGET_OPTS` -a 
$ISCSITARGET_ADDRESS"
+       fi
+       if [ -n $ISCSITARGET_PORT ] ; then
+               ISCSITARGET_OPTS="`echo $ISCSITARGET_OPTS` -p 
$ISCSITARGET_PORT"
+       fi
+       start-stop-daemon --start --exec $DAEMON --quiet --oknodo -- 
$ISCSITARGET_OPTS
         RETVAL=$?
         if [ $RETVAL = "0" ]; then
                 log_end_msg 0





More information about the Pkg-iscsi-maintainers mailing list