Re: [PATCH RFC] support multiple target instances

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Trying again, if it gets through the spamfilter this time...


List,

The part of the patch where we control the management channel seems to
have been lost/forgotten.

Please find a patch attached that contains an updated version Or's
patch for specifying the management channel
to allow us to run multiple instances of tgtd concurrently.

This can be useful in testing since on very powerful machines, the
single thread for the eventloop reaches 100% of one core, this caps
performance.

It also adds documentation for this new argument for tgtd and tgtadm.


On Fri, Sep 25, 2009 at 6:03 PM, ronnie sahlberg
<ronniesahlberg@xxxxxxxxx> wrote:
> On Fri, Sep 25, 2009 at 4:24 PM, FUJITA Tomonori
> <fujita.tomonori@xxxxxxxxxxxxx> wrote:
>> On Fri, 25 Sep 2009 11:07:23 +1000
>> ronnie sahlberg <ronniesahlberg@xxxxxxxxx> wrote:
>>
>>> On Fri, Sep 25, 2009 at 10:09 AM, FUJITA Tomonori
>>> <fujita.tomonori@xxxxxxxxxxxxx> wrote:
>>> > On Thu, 24 Sep 2009 18:07:24 +0300
>>> > Or Gerlitz <ogerlitz@xxxxxxxxxxxx> wrote:
>>> >
>>> >> FUJITA Tomonori wrote:
>>> >> > I know that but it doesn't sound good to me. How can you handle isns_port?
>>> >> > tgtd --port=3260 --iscsi=isns-port=1000
>>> >> > tgtd --iscsi=iscsi-port=3260,isns-port=1000
>>> >> > The latter looks more consistent to me.
>>> >>
>>> >> I am fine with both approaches
>>> >
>>> > Everyone, other opinions?
>>> >
>>>
>>> I think it would make more sense to separate the port specified for
>>> the mgmt channel from the iscsi related ports.
>>> since it may be desireable to also run multiple instances of tgtd for
>>> fcoe as well and then --iscsi-port would not make sense.
>>
>> Yeah, agreed. I don't fancy '--port' much though. It's a bit too
>> generic. I prefer something like '--mport' (or '--manage-port').
>
> Maybe use --socket
> That is what I use in ctdb/ctdbd to override the default domain socket
> to use to send mgmt commands to the daemon.
>

Attachment: 0001-Based-on-Or-Gerlitz-patch-from.patch.gz
Description: GNU Zip compressed data

From 195cd847e5a667854111cc5c93283c69f2097826 Mon Sep 17 00:00:00 2001
From: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
Date: Wed, 24 Feb 2010 14:00:05 +1100
Subject: [PATCH] Based on Or Gerlitz patch from
 http://lists.wpkg.org/pipermail/stgt/2009-September/003207.html

Add support to tgtd and tgtadm to specify which command port to use
for the management channel.
This allows running multiple instances of tgtd on teh same host,
each using a unique command channel.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
---
 doc/htmlpages/tgtadm.8.html |   12 ++++++++----
 doc/htmlpages/tgtd.8.html   |   19 +++++++++++++------
 doc/manpages/tgtadm.8       |   13 +++++++++----
 doc/manpages/tgtd.8         |   13 ++++++++++---
 doc/tgtadm.8.xml            |   12 +++++++++++-
 doc/tgtd.8.xml              |   15 +++++++++++++++
 usr/mgmt.c                  |    7 +++++--
 usr/tgtadm.c                |   38 ++++++++++++++++++++++++--------------
 usr/tgtd.c                  |   10 +++++++++-
 9 files changed, 104 insertions(+), 35 deletions(-)

diff --git a/doc/htmlpages/tgtadm.8.html b/doc/htmlpages/tgtadm.8.html
index 9fa8329..28671eb 100644
--- a/doc/htmlpages/tgtadm.8.html
+++ b/doc/htmlpages/tgtadm.8.html
@@ -1,7 +1,11 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>tgtadm</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="tgtadm.8"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>tgtadm &#8212; Linux SCSI Target Administration Utility</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">tgtadm --lld [driver] --op [operation] --mode [mode] [OPTION]...</code> </p></div></div><div class="refsect1" lang="en"><a name="id2475948"></a><h2>DESCRIPTION</h2><p>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>tgtadm</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="tgtadm.8"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>tgtadm &#8212; Linux SCSI Target Administration Utility</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">tgtadm [--mgmt-port NNNN] --lld [driver] --op [operation] --mode [mode] [OPTION]...</code> </p></div></div><div class="refsect1" lang="en"><a name="id2475960"></a><h2>DESCRIPTION</h2><p>
       tgtadm is used to monitor and modify everything about Linux SCSI target
       software: targets, volumes, etc.
-    </p></div><div class="refsect1" lang="en"><a name="id2475959"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term"><code class="option">--lld [driver] --op new --mode target --tid=[id] --targetname [name]</code></span></dt><dd><p>
+    </p></div><div class="refsect1" lang="en"><a name="id2475971"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term"><code class="option">--mgmt-port NNNN</code></span></dt><dd><p>
+	    It is possible to run multiple concurrent instances of tgtd
+	    on a host. This argument is used to control which instance
+	    the tgtadm command will operate on.
+          </p></dd><dt><span class="term"><code class="option">--lld [driver] --op new --mode target --tid=[id] --targetname [name]</code></span></dt><dd><p>
 	    add a new target with [id] and [name].
           </p></dd><dt><span class="term"><code class="option">--lld [driver] --op delete --mode target --tid=[id]</code></span></dt><dd><p>
 	    delete specific target with [id]. The target must have no active I_T nexus.
@@ -28,9 +32,9 @@
 	    display version and exit.
           </p></dd><dt><span class="term"><code class="option">--help</code></span></dt><dd><p>
 	    display a list of available options and exits.
-          </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2476142"></a><h2>SEE ALSO</h2><p>
+          </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2476171"></a><h2>SEE ALSO</h2><p>
       tgtd(8), tgt-admin(8), tgt-setup-lun(8).
       <a class="ulink" href="http://stgt.sourceforge.net/"; target="_top">http://stgt.sourceforge.net/</a>
-    </p></div><div class="refsect1" lang="en"><a name="id2476157"></a><h2>REPORTING BUGS</h2><p>
+    </p></div><div class="refsect1" lang="en"><a name="id2476185"></a><h2>REPORTING BUGS</h2><p>
       Report bugs to &lt;stgt@xxxxxxxxxxxxxxx&gt;
     </p></div></div></body></html>
diff --git a/doc/htmlpages/tgtd.8.html b/doc/htmlpages/tgtd.8.html
index 47cdda8..bd6f317 100644
--- a/doc/htmlpages/tgtd.8.html
+++ b/doc/htmlpages/tgtd.8.html
@@ -1,19 +1,26 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>tgtd</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="tgtd.8"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>tgtd &#8212; The SCSI Target Daemon</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">tgtd</code> </p></div><div class="cmdsynopsis"><p><code class="command">tgtd</code>  [-d --debug &lt;INTEGER&gt;] [-f --foregound] [-h --help] [--iscsi &lt;...&gt;]</p></div></div><div class="refsect1" lang="en"><a name="id2475936"></a><h2>DESCRIPTION</h2><p>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>tgtd</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="tgtd.8"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>tgtd &#8212; The SCSI Target Daemon</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">tgtd</code> </p></div><div class="cmdsynopsis"><p><code class="command">tgtd</code>  [-d --debug &lt;INTEGER&gt;] [-p --mgmt-port &lt;INTEGER&gt;] [-f --foregound] [-h --help] [--iscsi &lt;...&gt;]</p></div></div><div class="refsect1" lang="en"><a name="id2475958"></a><h2>DESCRIPTION</h2><p>
       Tgtd is a SCSI Target daemon. It can be used to provide iSCSI target
       service to a network.
-    </p></div><div class="refsect1" lang="en"><a name="id2475947"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">-d --debug &lt;INTEGER&gt;</span></dt><dd><p>
+    </p></div><div class="refsect1" lang="en"><a name="id2475969"></a><h2>OPTIONS</h2><div class="variablelist"><dl><dt><span class="term">-d --debug &lt;INTEGER&gt;</span></dt><dd><p>
             Set to non-zero value to activate additional debugging messages to
 	    be logged.
           </p></dd><dt><span class="term">-f --foreground</span></dt><dd><p>
             Run the daemon in the foreground.
           </p></dd><dt><span class="term">-h --help</span></dt><dd><p>
             Print help text to the screen.
+          </p></dd><dt><span class="term">-p --mgmt-port &lt;INTEGER&gt;</span></dt><dd><p>
+	    This comamnd is used to specify the management port to use for
+	    this instance of tgtd. This allows to run multiple instances of 
+	    TGTD on a host.
+          </p><p>
+	    TGTADM has a matching argument to control which instance to conenct
+	    to.
           </p></dd><dt><span class="term">--iscsi &lt;...&gt;</span></dt><dd><p>
 	    ISCSI specific options.
             See the ISCSI section below for options specific to this frontend.
-          </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2476014"></a><h2>ISCSI options</h2><p>
+          </p></dd></dl></div></div><div class="refsect1" lang="en"><a name="id2476057"></a><h2>ISCSI options</h2><p>
       These parameters apply only to the iSCSI frontend.
-    </p><div class="refsect2" lang="en"><a name="id2476024"></a><h3>portal=&lt;ip-address[:port]&gt;</h3><p>
+    </p><div class="refsect2" lang="en"><a name="id2476066"></a><h3>portal=&lt;ip-address[:port]&gt;</h3><p>
 	This option is used to bind tgtd to a specific ip-address/portal and/or
 	port. By default tgtd will bind to port 3260 on the wildcard address.
       </p><p>
@@ -21,10 +28,10 @@
       </p><pre class="screen">
 	tgtd --iscsi portal=192.0.2.1:3260
       </pre><p>
-      </p></div></div><div class="refsect1" lang="en"><a name="id2476048"></a><h2>SEE ALSO</h2><p>
+      </p></div></div><div class="refsect1" lang="en"><a name="id2476090"></a><h2>SEE ALSO</h2><p>
       tgtadm(8), tgt-admin(8), tgt-setup-lun(8).
       <a class="ulink" href="http://stgt.sourceforge.net/"; target="_top">http://stgt.sourceforge.net/</a>
-    </p></div><div class="refsect1" lang="en"><a name="id2476062"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
+    </p></div><div class="refsect1" lang="en"><a name="id2476105"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
 This program is free software; you can redistribute it and/or modify<br>
 it under the terms of the GNU General Public License as published by<br>
 the Free Software Foundation; either version 2 of the License, or (at<br>
diff --git a/doc/manpages/tgtadm.8 b/doc/manpages/tgtadm.8
index c0568c0..5a9d07e 100644
--- a/doc/manpages/tgtadm.8
+++ b/doc/manpages/tgtadm.8
@@ -1,11 +1,11 @@
 .\"     Title: tgtadm
 .\"    Author: 
 .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 02/18/2010
+.\"      Date: 02/24/2010
 .\"    Manual: 
 .\"    Source: 
 .\"
-.TH "TGTADM" "8" "02/18/2010" "" ""
+.TH "TGTADM" "8" "02/24/2010" "" ""
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
@@ -13,13 +13,18 @@
 .SH "NAME"
 tgtadm - Linux SCSI Target Administration Utility
 .SH "SYNOPSIS"
-.HP 65
-\fBtgtadm \-\-lld [driver] \-\-op [operation] \-\-mode [mode] [OPTION]\.\.\.\fR
+.HP 84
+\fBtgtadm [\-\-mgmt\-port NNNN] \-\-lld [driver] \-\-op [operation] \-\-mode [mode] [OPTION]\.\.\.\fR
 .SH "DESCRIPTION"
 .PP
 tgtadm is used to monitor and modify everything about Linux SCSI target software: targets, volumes, etc\.
 .SH "OPTIONS"
 .PP
+\fB\-\-mgmt\-port NNNN\fR
+.RS 4
+It is possible to run multiple concurrent instances of tgtd on a host\. This argument is used to control which instance the tgtadm command will operate on\.
+.RE
+.PP
 \fB\-\-lld [driver] \-\-op new \-\-mode target \-\-tid=[id] \-\-targetname [name]\fR
 .RS 4
 add a new target with [id] and [name]\.
diff --git a/doc/manpages/tgtd.8 b/doc/manpages/tgtd.8
index dd33a2d..f38f871 100644
--- a/doc/manpages/tgtd.8
+++ b/doc/manpages/tgtd.8
@@ -1,11 +1,11 @@
 .\"     Title: tgtd
 .\"    Author: 
 .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 02/18/2010
+.\"      Date: 02/24/2010
 .\"    Manual: 
 .\"    Source: 
 .\"
-.TH "TGTD" "8" "02/18/2010" "" ""
+.TH "TGTD" "8" "02/24/2010" "" ""
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
@@ -16,7 +16,7 @@ tgtd - The SCSI Target Daemon
 .HP 5
 \fBtgtd\fR
 .HP 5
-\fBtgtd\fR [\-d\ \-\-debug\ <INTEGER>] [\-f\ \-\-foregound] [\-h\ \-\-help] [\-\-iscsi\ <\.\.\.>]
+\fBtgtd\fR [\-d\ \-\-debug\ <INTEGER>] [\-p\ \-\-mgmt\-port\ <INTEGER>] [\-f\ \-\-foregound] [\-h\ \-\-help] [\-\-iscsi\ <\.\.\.>]
 .SH "DESCRIPTION"
 .PP
 Tgtd is a SCSI Target daemon\. It can be used to provide iSCSI target service to a network\.
@@ -37,6 +37,13 @@ Run the daemon in the foreground\.
 Print help text to the screen\.
 .RE
 .PP
+\-p \-\-mgmt\-port <INTEGER>
+.RS 4
+This comamnd is used to specify the management port to use for this instance of tgtd\. This allows to run multiple instances of TGTD on a host\.
+.sp
+TGTADM has a matching argument to control which instance to conenct to\.
+.RE
+.PP
 \-\-iscsi <\.\.\.>
 .RS 4
 ISCSI specific options\. See the ISCSI section below for options specific to this frontend\.
diff --git a/doc/tgtadm.8.xml b/doc/tgtadm.8.xml
index 9d01df7..8b795a9 100644
--- a/doc/tgtadm.8.xml
+++ b/doc/tgtadm.8.xml
@@ -14,7 +14,7 @@
 
 <refsynopsisdiv>
 	<cmdsynopsis>
-		<command>tgtadm --lld [driver] --op [operation] --mode [mode] [OPTION]...</command>
+		<command>tgtadm [--mgmt-port NNNN] --lld [driver] --op [operation] --mode [mode] [OPTION]...</command>
 	</cmdsynopsis>
 	
 </refsynopsisdiv>
@@ -31,6 +31,16 @@
     <title>OPTIONS</title>
 
     <variablelist>
+      <varlistentry><term><option>--mgmt-port NNNN</option></term>
+        <listitem>
+          <para>
+	    It is possible to run multiple concurrent instances of tgtd
+	    on a host. This argument is used to control which instance
+	    the tgtadm command will operate on.
+          </para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry><term><option>--lld [driver] --op new --mode target --tid=[id] --targetname [name]</option></term>
         <listitem>
           <para>
diff --git a/doc/tgtd.8.xml b/doc/tgtd.8.xml
index c88a888..2372034 100644
--- a/doc/tgtd.8.xml
+++ b/doc/tgtd.8.xml
@@ -20,6 +20,7 @@
 	<cmdsynopsis>
 		<command>tgtd</command>
 		<arg choice="opt">-d --debug &lt;INTEGER&gt;</arg>
+		<arg choice="opt">-p --mgmt-port &lt;INTEGER&gt;</arg>
 		<arg choice="opt">-f --foregound</arg>
 		<arg choice="opt">-h --help</arg>
 		<arg choice="opt">--iscsi &lt;...&gt;</arg>
@@ -64,6 +65,20 @@
         </listitem>
       </varlistentry>
 
+      <varlistentry><term>-p --mgmt-port &lt;INTEGER&gt;</term>
+        <listitem>
+          <para>
+	    This comamnd is used to specify the management port to use for
+	    this instance of tgtd. This allows to run multiple instances of 
+	    TGTD on a host.
+          </para>
+          <para>
+	    TGTADM has a matching argument to control which instance to conenct
+	    to.
+          </para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry><term>--iscsi &lt;...&gt;</term>
         <listitem>
           <para>
diff --git a/usr/mgmt.c b/usr/mgmt.c
index 7801ab0..e8594fa 100644
--- a/usr/mgmt.c
+++ b/usr/mgmt.c
@@ -554,8 +554,10 @@ out:
 
 int ipc_init(void)
 {
+	extern short mgmt_port;
 	int fd, err;
 	struct sockaddr_un addr;
+	char path[256];
 
 	fd = socket(AF_LOCAL, SOCK_STREAM, 0);
 	if (fd < 0) {
@@ -563,10 +565,11 @@ int ipc_init(void)
 		return -1;
 	}
 
-	unlink(TGT_IPC_NAMESPACE);
+	sprintf(path, "%s.%d", TGT_IPC_NAMESPACE, mgmt_port);
+	unlink(path);
 	memset(&addr, 0, sizeof(addr));
 	addr.sun_family = AF_LOCAL;
-	strncpy(addr.sun_path, TGT_IPC_NAMESPACE, sizeof(addr.sun_path));
+	strncpy(addr.sun_path, path, sizeof(addr.sun_path));
 
 	err = bind(fd, (struct sockaddr *) &addr, sizeof(addr));
 	if (err) {
diff --git a/usr/tgtadm.c b/usr/tgtadm.c
index dd46985..d19ad73 100644
--- a/usr/tgtadm.c
+++ b/usr/tgtadm.c
@@ -122,10 +122,11 @@ struct option const long_options[] = {
 	{"bus", required_argument, NULL, 'B'},
 	{"device-type", required_argument, NULL, 'Y'},
 	{"outgoing", no_argument, NULL, 'O'},
+	{"mgmt-port", required_argument, NULL, 'R'},
 	{NULL, 0, NULL, 0},
 };
 
-static char *short_options = "dhL:o:m:t:s:c:l:n:v:b:E:T:I:u:p:H:P:B:Y:O";
+static char *short_options = "dhL:o:m:t:s:c:l:n:v:b:E:T:I:u:p:H:P:B:Y:O:R";
 
 static void usage(int status)
 {
@@ -174,6 +175,7 @@ Linux SCSI Target Framework Administration Utility, version %s\n\
   --lld [driver] --mode account --op unbind --tid=[id] --user=[name]\n\
                         delete the specific account having [name] from specific\n\
                         target.\n\
+  --mgmt-port NNNN      use mgmt port NNNN\n\
   --help                display this help and exit\n\
 \n\
 Report bugs to <stgt@xxxxxxxxxxxxxxx>.\n", TGT_VERSION);
@@ -181,10 +183,14 @@ Report bugs to <stgt@xxxxxxxxxxxxxxx>.\n", TGT_VERSION);
 	exit(status == 0 ? 0 : EINVAL);
 }
 
+/* default port to use for the mgmt channel */
+static short int mgmt_port = 0;
+
 static int ipc_mgmt_connect(int *fd)
 {
 	int err;
 	struct sockaddr_un addr;
+	char path[256];
 
 	*fd = socket(AF_LOCAL, SOCK_STREAM, 0);
 	if (*fd < 0) {
@@ -194,7 +200,8 @@ static int ipc_mgmt_connect(int *fd)
 
 	memset(&addr, 0, sizeof(addr));
 	addr.sun_family = AF_LOCAL;
-	strncpy(addr.sun_path, TGT_IPC_NAMESPACE, sizeof(addr.sun_path));
+	sprintf(path, "%s.%d", TGT_IPC_NAMESPACE, mgmt_port);
+	strncpy(addr.sun_path, path, sizeof(addr.sun_path));
 
 	err = connect(*fd, (struct sockaddr *) &addr, sizeof(addr));
 	if (err < 0)
@@ -518,6 +525,9 @@ int main(int argc, char **argv)
 		case 'O':
 			ac_dir = ACCOUNT_TYPE_OUTGOING;
 			break;
+		case 'R':
+			mgmt_port = strtol(optarg, NULL, 10);
+			break;
 		case 'd':
 			debug = 1;
 			break;
@@ -551,7 +561,7 @@ int main(int argc, char **argv)
 		}
 		switch (op) {
 		case OP_NEW:
-			rc = verify_mode_params(argc, argv, "LmotT");
+			rc = verify_mode_params(argc, argv, "LmotTR");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -564,7 +574,7 @@ int main(int argc, char **argv)
 			break;
 		case OP_DELETE:
 		case OP_SHOW:
-			rc = verify_mode_params(argc, argv, "Lmot");
+			rc = verify_mode_params(argc, argv, "LmotR");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -573,7 +583,7 @@ int main(int argc, char **argv)
 			break;
 		case OP_BIND:
 		case OP_UNBIND:
-			rc = verify_mode_params(argc, argv, "LmotIBH");
+			rc = verify_mode_params(argc, argv, "LmotIBHR");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -587,7 +597,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_UPDATE:
-			rc = verify_mode_params(argc, argv, "Lmotnv");
+			rc = verify_mode_params(argc, argv, "LmotnvR");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -609,7 +619,7 @@ int main(int argc, char **argv)
 	if (mode == MODE_ACCOUNT) {
 		switch (op) {
 		case OP_NEW:
-			rc = verify_mode_params(argc, argv, "Lmoup");
+			rc = verify_mode_params(argc, argv, "LmoupR");
 			if (rc) {
 				eprintf("logicalunit mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -621,7 +631,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_SHOW:
-			rc = verify_mode_params(argc, argv, "Lmo");
+			rc = verify_mode_params(argc, argv, "LmoR");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -629,7 +639,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_DELETE:
-			rc = verify_mode_params(argc, argv, "Lmou");
+			rc = verify_mode_params(argc, argv, "LmouR");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -637,7 +647,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_BIND:
-			rc = verify_mode_params(argc, argv, "LmotuO");
+			rc = verify_mode_params(argc, argv, "LmotuOR");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -653,7 +663,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_UNBIND:
-			rc = verify_mode_params(argc, argv, "Lmou");
+			rc = verify_mode_params(argc, argv, "LmouR");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -686,7 +696,7 @@ int main(int argc, char **argv)
 		}
 		switch (op) {
 		case OP_NEW:
-			rc = verify_mode_params(argc, argv, "LmotlbEY");
+			rc = verify_mode_params(argc, argv, "LmotlbEYR");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -699,7 +709,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_DELETE:
-			rc = verify_mode_params(argc, argv, "Lmotl");
+			rc = verify_mode_params(argc, argv, "LmotlR");
 			if (rc) {
 				eprintf("target mode: option '-%c' is not "
 					  "allowed/supported\n", rc);
@@ -707,7 +717,7 @@ int main(int argc, char **argv)
 			}
 			break;
 		case OP_UPDATE:
-			rc = verify_mode_params(argc, argv, "LmotlP");
+			rc = verify_mode_params(argc, argv, "LmotlPR");
 			if (rc) {
 				eprintf("option '-%c' not supported in "
 					"logicalunit mode\n", rc);
diff --git a/usr/tgtd.c b/usr/tgtd.c
index 9d89f73..00257d3 100644
--- a/usr/tgtd.c
+++ b/usr/tgtd.c
@@ -50,12 +50,13 @@ static LIST_HEAD(tgt_sched_events_list);
 static struct option const long_options[] =
 {
 	{"foreground", no_argument, 0, 'f'},
+	{"mgmt-port", required_argument, 0, 'p'},
 	{"debug", required_argument, 0, 'd'},
 	{"help", no_argument, 0, 'h'},
 	{0, 0, 0, 0},
 };
 
-static char *short_options = "fd:h";
+static char *short_options = "fd:hp";
 
 static void usage(int status)
 {
@@ -66,6 +67,7 @@ static void usage(int status)
 		printf("\
 Target framework daemon, version %s\n\
   -f, --foreground        make the program run in the foreground\n\
+  -p, --mgmt-port NNNN    use port NNNN for the mgmt channel\n\
   -d, --debug debuglevel  print debugging information\n\
   -h, --help              display this help and exit\n\
 ", TGT_VERSION);
@@ -73,6 +75,9 @@ Target framework daemon, version %s\n\
 	exit(status);
 }
 
+/* Default TGT mgmt port */
+short int mgmt_port = 0;
+
 static void signal_catch(int signo) {
 }
 
@@ -377,6 +382,9 @@ int main(int argc, char **argv)
 		case 'f':
 			is_daemon = 0;
 			break;
+		case 'p':
+			mgmt_port = atoi(optarg);
+			break;
 		case 'd':
 			is_debug = atoi(optarg);
 			break;
-- 
1.5.4.3


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux