Re: Using iscsi with multiple targets

2008-07-15 Thread Sven Willenberger
On Mon, 2008-07-14 at 11:29 +0300, Danny Braniss wrote:
> > 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   filestart   length
> > extent0 /dev/da10   465GB
> > extent1 /dev/da20   465GB
> > extent2 /dev/da30   465GB
> > 
> > # targetflags   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
> > at scbus0 target 0 lun 0 (pass0,da0)
> > at scbus0 target 1 lun 0 (pass1,da1)
> > at scbus0 target 2 lun 0 (pass2,da2)
> > at scbus0 target 3 lun 0 (pass3,da3)
> > at scbus1 target 0 lun 0 (da5,pass5)
> > at scbus1 target 1 lun 0 (da6,pass6)
> > at scbus1 target 2 lun 0 (da4,pass4)
> > 
> > 
> > [ /sbin/iscontrol -n data1 ]
> > da4 at iscsi0 bus 0 target 0 lun 0
> > da4:  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:  Fixed Direct Access SCSI-3 device
> > da5 at iscsi0 bus 0 target 1 lun 0
> > da5:  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:  Fixed Direct Access SCSI-3 device
> > da5 at iscsi0 bus 0 target 0 lun 0
> > da5:  Fixed Direct Access SCSI-3 device
> > da6 at iscsi0 bus 0 target 1 lun 0
> > da6:  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.
> 
> Hi Sven,
>   I just tried it here, and it seems that at the end all is ok :-)
> I think the lost/removing/found has something to do to iscontrol calling
> camcontrol rescan - I will check this later, but the end result is that
> you should have all /dev/da's.
>   I don't see any reasonable safe way to tie a scsi# (/dev/dan),
> except to label (see glabel) the disk.
>   The startup script is, at the moment, not trivial, but I'm attaching
> it, so someone can suggest improvements :-)
> #!/bin/sh
> 
> # PROVIDE: iscsi
> # REQUIRE: NETWORKING
> # BEFORE:  DAEMON
> # KEYWORD: nojail shutdown
> 
> #
> # Add the following lines to /etc/rc.conf to enable iscsi:
> #
> # iscsi_enable="YES"
> # iscsi_fstab="/etc/fstab.iscsi"
> 
> . /etc/rc.subr
> . /cs/share/etc/rc.subr
> 
> name=iscsi
> rcvar=`set_rcvar`
> 
> command=/sbin/iscontrol
> 
> iscsi_enable=${iscsi_enable:-"NO"}
> iscsi_fstab=${iscsi_fstab:-"/etc/fstab.iscsi"}
> iscsi_exports=${iscsi_exports:-"/etc/exports.iscsi"}
> iscsi_debug=${iscsi_debug:-0}
> start_cmd="iscsi_start"
> faststop_cmp

Re: Using iscsi with multiple targets

2008-07-14 Thread Danny Braniss
> 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   filestart   length
> extent0 /dev/da10   465GB
> extent1 /dev/da20   465GB
> extent2 /dev/da30   465GB
> 
> # targetflags   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
> at scbus0 target 0 lun 0 (pass0,da0)
> at scbus0 target 1 lun 0 (pass1,da1)
> at scbus0 target 2 lun 0 (pass2,da2)
> at scbus0 target 3 lun 0 (pass3,da3)
> at scbus1 target 0 lun 0 (da5,pass5)
> at scbus1 target 1 lun 0 (da6,pass6)
> at scbus1 target 2 lun 0 (da4,pass4)
> 
> 
> [ /sbin/iscontrol -n data1 ]
> da4 at iscsi0 bus 0 target 0 lun 0
> da4:  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:  Fixed Direct Access SCSI-3 device
> da5 at iscsi0 bus 0 target 1 lun 0
> da5:  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:  Fixed Direct Access SCSI-3 device
> da5 at iscsi0 bus 0 target 0 lun 0
> da5:  Fixed Direct Access SCSI-3 device
> da6 at iscsi0 bus 0 target 1 lun 0
> da6:  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.

Hi Sven,
I just tried it here, and it seems that at the end all is ok :-)
I think the lost/removing/found has something to do to iscontrol calling
camcontrol rescan - I will check this later, but the end result is that
you should have all /dev/da's.
I don't see any reasonable safe way to tie a scsi# (/dev/dan),
except to label (see glabel) the disk.
The startup script is, at the moment, not trivial, but I'm attaching
it, so someone can suggest improvements :-)
#!/bin/sh

# PROVIDE: iscsi
# REQUIRE: NETWORKING
# BEFORE:  DAEMON
# KEYWORD: nojail shutdown

#
# Add the following lines to /etc/rc.conf to enable iscsi:
#
# iscsi_enable="YES"
# iscsi_fstab="/etc/fstab.iscsi"

. /etc/rc.subr
. /cs/share/etc/rc.subr

name=iscsi
rcvar=`set_rcvar`

command=/sbin/iscontrol

iscsi_enable=${iscsi_enable:-"NO"}
iscsi_fstab=${iscsi_fstab:-"/etc/fstab.iscsi"}
iscsi_exports=${iscsi_exports:-"/etc/exports.iscsi"}
iscsi_debug=${iscsi_debug:-0}
start_cmd="iscsi_start"
faststop_cmp="iscsi_stop"
stop_cmd="iscsi_stop"

start_precmd="iscontrol_precmd"
iscontrol_prog=${iscontrol_prog:-"iscontrol"}
iscontrol_log=${iscontrol_log:-"/var/log/$iscontrol_prog"}
iscontrol_syslog=${iscontrol_syslog:-"644  3 100  * JC"}

iscontrol_precmd()
{
setup_syslog "$iscontrol_prog" "$iscontrol_log" "$iscontrol_syslog"
}

Using iscsi with multiple targets

2008-07-13 Thread Sven W

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   filestart   length
extent0 /dev/da10   465GB
extent1 /dev/da20   465GB
extent2 /dev/da30   465GB

# targetflags   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
at scbus0 target 0 lun 0 (pass0,da0)
at scbus0 target 1 lun 0 (pass1,da1)
at scbus0 target 2 lun 0 (pass2,da2)
at scbus0 target 3 lun 0 (pass3,da3)
at scbus1 target 0 lun 0 (da5,pass5)
at scbus1 target 1 lun 0 (da6,pass6)
at scbus1 target 2 lun 0 (da4,pass4)


[ /sbin/iscontrol -n data1 ]
da4 at iscsi0 bus 0 target 0 lun 0
da4:  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:  Fixed Direct Access SCSI-3 device
da5 at iscsi0 bus 0 target 1 lun 0
da5:  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:  Fixed Direct Access SCSI-3 device
da5 at iscsi0 bus 0 target 0 lun 0
da5:  Fixed Direct Access SCSI-3 device
da6 at iscsi0 bus 0 target 1 lun 0
da6:  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
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"