Re: Specify controller tid in targets.conf

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


On Wed, 15 Jun 2011, Tomasz Chmielewski wrote:

> On 15.06.2011 16:53, Fredrik Åslund wrote:
> > Is there a way to specify the tid of a target controller in targets.conf?
> 
> There isn't any, it's just iterated at the moment.
> 
> 
> > By default, tid 1 is used by tgt-admin. This means that all instances of
> > tgtd at different servers will have the same SCSI ID (and SCSI SN),
> > confusing iSCSI initiators (as VMware).
> >
> > This patch will allow targets.conf to include:
> 
> It looks/works well, although interesting things can happen if one tries 
> to set several targets with the same tid (or, add new etc.)...
> 
> Can you also update the targets.conf.example file (comment + usage example)?
> 
Will this do?

--
diff -ruN tgt-1.0.17.orig/conf/examples/targets.conf.example tgt-1.0.17/conf/examples/targets.conf.example
--- tgt-1.0.17.orig/conf/examples/targets.conf.example  2011-05-30 02:54:07.000000000 +0200
+++ tgt-1.0.17/conf/examples/targets.conf.example       2011-06-16 09:18:28.000000000 +0200
@@ -181,6 +181,8 @@
     # Outgoing user
     outgoinguser userA secretpassA
 
+    # TID of controller
+    controller_tid 10
 </target>
 
 
@@ -211,20 +213,29 @@
     allow-in-use yes
 </target>
 
+# Specify controller TID of target
+# Must be unique for all targets
+# To reduce risk of duplicating controller TIDs, specify TID for all targets
+# or none
+<target iqn.2008-09.com.example:server.target9>
+    backing-store /dev/LVM/somedevice
+    allow-in-use yes
+    controller_tid 10
+</target>
 
 
 
 
 # Not supported configurations, and therefore, commented out:
 
-#<target iqn.2008-09.com.example:server.target9>
+#<target iqn.2008-09.com.example:server.badtarget1>
 #    backing-store /dev/LVM/somedevice1
 #    backing-store /dev/LVM/somedevice2
 #    lun 10
 #    lun 11
 #</target>
 
-#<target iqn.2008-09.com.example:server.target10>
+#<target iqn.2008-09.com.example:server.badtarget2>
 #    <direct-store /dev/sdd>
 #        vendor_id VENDOR1
 #    </direct-store>
@@ -234,7 +245,7 @@
 
 # This one will break the parser:
 
-#<target iqn.2008-09.com.example:server.target11>
+#<target iqn.2008-09.com.example:server.badtarget3>
 #    <direct-store /dev/sdd>
 #        vendor_id VENDOR1
 #    </direct-store>
diff -ruN tgt-1.0.17.orig/scripts/tgt-admin tgt-1.0.17/scripts/tgt-admin
--- tgt-1.0.17.orig/scripts/tgt-admin   2011-05-30 02:54:07.000000000 +0200
+++ tgt-1.0.17/scripts/tgt-admin        2011-06-16 09:19:48.000000000 +0200
@@ -284,6 +284,10 @@
                                                $data_key = make_key($target_options_ref, "lun", "allow-in-use");
                                        }
 
+                                       if (defined $target_options{"controller_tid"}) {
+                                               $next_tid = $target_options{"controller_tid"};
+                                       }
+
                                        if (not defined $target_options{"driver"}) {
                                                $target_options{"driver"} = $default_driver;
                                        }
--

/Fredrik

> 
> -- 
> Tomasz Chmielewski
> http://wpkg.org
> 

Fredrik Åslund
----------------------------------
Systemadministratör
IT-stöd och systemutveckling (ITS)
Umeå universitet
901 87 Umeå
----------------------------------
Telefon: +46 (0)90 786 65 43
Mobil:   +46 (0)70 303 78 36
----------------------------------
fredrik.aslund@xxxxxxxxxx
www.its.umu.se

[Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [XFree86]     [Video Devices]

Add to Google Powered by Linux