[stgt] Limiting the number of ISCSI-Sessions per target

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Mon Oct 20 04:49:54 CEST 2008


On Fri, 17 Oct 2008 18:05:14 +0200
"Dr. Volker Jaenisch" <volker.jaenisch at inqbus.de> wrote:

> Hello stgt developers!
> 
> I have a HA XEN-setup based on ISCSI devices [tgtd (target) and
> open-iscsi (initiator)]
> as physical devices for the XEN DomUs.
> 
> In case of a split-Brain in the HA-System more than one machine may
> fetch a iSCSI-Session and may try to bring up a XEN-VM on it. This will seriously damage the
> filesystem.
> 
> Therefore I like to limit the number of iSCSI sessions to one 
> session per target, simultaneously
> 
> Is there a way to limit the number of ISCSI-Sessions per Target-ID?
> I found the MaxConnection-Parameter but it limits only the number of
> connections within a single iSCSI-Session.

Yeah, MaxConnection is iSCSI legitimate parameter.


> Is there something alike - say a MaxSession-Parameter?

There is no standard way to do such. IET used to support MaxSessions
parameter to limit the maximum number of sessions per target. We could
add the same feature to tgt, but IET disables the feature now. Anyone
can recall why? Well, probably I disabled it but I can't recall
anything.

Anyway, I guess that just limiting only one session per target works
for your case. The following patch works meanwhile?


diff --git a/usr/target.c b/usr/target.c
index dc30c87..91085dc 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -248,6 +248,9 @@ int it_nexus_create(int tid, uint64_t itn_id, int host_no, char *info)
 
 	target = target_lookup(tid);
 
+	if (!list_empty(&target->it_nexus_list))
+		return -EEXIST;
+
 	itn = zalloc(sizeof(*itn));
 	if (!itn)
 		return -ENOMEM;
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list