Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jul 2008 13:53:02 -0400
From:      Sven W <sven@dmv.com>
To:        freebsd-stable@freebsd.org
Subject:   Using iscsi with multiple targets
Message-ID:  <487A40FE.7030102@dmv.com>

next in thread | raw e-mail | index | archive | help
FreeBSD 7.0

I have 2 machines with identical configurations/hardware, let's call them A (master) 
and B (slave). I have installed iscsi-target from ports and have set up 3 targets 
representing the 3 drives I wish to be connected to from A.

The Targets file:
# extents       file                    start   length
extent0         /dev/da1                0       465GB
extent1         /dev/da2                0       465GB
extent2         /dev/da3                0       465GB

# target        flags   storage         netmask
target0         rw      extent0         192.168.0.1/24
target1         rw      extent1         192.168.0.1/24
target2         rw      extent2         192.168.0.1/24

I then start up iscsi_target and all is good.

Now on A I have set up my /etc/iscsi.conf file as follows:

# cat /etc/iscsi.conf
data1 {
         targetaddress=192.168.0.252
         targetname=iqn.1994-04.org.netbsd.iscsi-target:target0
         initiatorname=iqn.2005-01.il.ac.huji.cs::BSD-2-1.sven.local
}
data2 {
         targetaddress=192.168.0.252
         targetname=iqn.1994-04.org.netbsd.iscsi-target:target1
         initiatorname=iqn.2005-01.il.ac.huji.cs::BSD-2-1.sven.local
}
data3 {
         targetaddress=192.168.0.252
         targetname=iqn.1994-04.org.netbsd.iscsi-target:target2
         initiatorname=iqn.2005-01.il.ac.huji.cs::BSD-2-1.sven.local
}

So far so good, now come the issues. First of all, it would appear that with 
iscontrol one can only start one "named" session at a time; for example
/sbin/iscontrol -n data1
/sbin/iscontrol -n data2
/sbin/isconrtol -n data3

I guess that is ok, except that each invocation of iscontrol resets the other 
sessions. Here is the camcontrol and dmesg output from running the above 3 commands.

# camcontrol devlist
<AMCC 9550SXU-8L DISK 3.08>        at scbus0 target 0 lun 0 (pass0,da0)
<AMCC 9550SXU-8L DISK 3.08>        at scbus0 target 1 lun 0 (pass1,da1)
<AMCC 9550SXU-8L DISK 3.08>        at scbus0 target 2 lun 0 (pass2,da2)
<AMCC 9550SXU-8L DISK 3.08>        at scbus0 target 3 lun 0 (pass3,da3)
<NetBSD NetBSD iSCSI 0>            at scbus1 target 0 lun 0 (da5,pass5)
<NetBSD NetBSD iSCSI 0>            at scbus1 target 1 lun 0 (da6,pass6)
<NetBSD NetBSD iSCSI 0>            at scbus1 target 2 lun 0 (da4,pass4)


[ /sbin/iscontrol -n data1 ]
da4 at iscsi0 bus 0 target 0 lun 0
da4: <NetBSD NetBSD iSCSI 0> Fixed Direct Access SCSI-3 device

[ /sbin/iscontrol -n data2 ]
(da4:iscsi0:0:0:0): lost device
(da4:iscsi0:0:0:0): removing device entry
da4 at iscsi0 bus 0 target 0 lun 0
da4: <NetBSD NetBSD iSCSI 0> Fixed Direct Access SCSI-3 device
da5 at iscsi0 bus 0 target 1 lun 0
da5: <NetBSD NetBSD iSCSI 0> Fixed Direct Access SCSI-3 device

[ /sbin/iscontrol -n data3 ]
(da4:iscsi0:0:0:0): lost device
(da4:iscsi0:0:0:0): removing device entry
(da5:iscsi0:0:1:0): lost device
(da5:iscsi0:0:1:0): removing device entry
da4 at iscsi0 bus 0 target 2 lun 0
da4: <NetBSD NetBSD iSCSI 0> Fixed Direct Access SCSI-3 device
da5 at iscsi0 bus 0 target 0 lun 0
da5: <NetBSD NetBSD iSCSI 0> Fixed Direct Access SCSI-3 device
da6 at iscsi0 bus 0 target 1 lun 0
da6: <NetBSD NetBSD iSCSI 0> Fixed Direct Access SCSI-3 device


It would appear that rather than appending the new device to the end of the "da" 
devices, it starts to do some type of naming queue after the second device. If I am 
to use these devices in any type of automated setup, how can make sure that after 
these commands, "da6" will always be target 1 (i.e. /dev/da2 on the slave machine).

Next, there is no "startup" script for iscontrol - would that simply have to be 
added the system or is there a way with sysctl that it could be done. The plan here 
is use gmirror such that /dev/da1 on A is mirrored with the /dev/da1 on B using iscsi.

Sven



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?487A40FE.7030102>