Re: iSCSI initiator tester wanted

From: Danny Braniss <danny_at_cs.huji.ac.il>
Date: Wed, 06 Jun 2007 18:00:39 +0300
> Quoting Danny Braniss <danny_at_cs.huji.ac.il>:
> > 	I'm in the last mile before crossing the beta->release line,
> > so I'd like to get some input, and update the list of targets it supports.
> > you can obtain the driver from:
> > 	ftp://ftp.cs.huji.ac.il/users/danny/freebsd/iscsi-2.0.92.tar.gz
> 
> Looks great! I've done some basic testing against our cluster of three 
> LeftHand Networks NSM 160's running SAN/iQ 6.6SP1. My machine is 
> running -CURRENT as of a couple days ago (with gcc 4.2 and symbol 
> versioning). I've tested previous snapshots of the driver against the 
> same SAN on this and another machine running -STABLE with good results.
> 
so i'm updating my Targets file.

> Is there anything specific you'd like tested? What connection 
> interruption scenarios does the driver try to recover from? I'm running 
> some backups to an iSCSI mount now. When that finishes (and my machine 
> is otherwise unoccupied) I'll play around with temporarily yanking the 
> ethernet cable and other fun tricks.
> 
it 'should' recover from network disconects, like pulling out cable, or
rebooting the target, but I think that this will only work if there is no
major activity - I better test this one again.
it should also flush buffers when you shut down the host, this was a major
pain with the old versions.

> Thanks for the Makefiles. Your blurb text incorrectly directs the 
> reader to run make in sys/dev/iscsi_initiator (which doesn't exist, and 
> there's no Makefile in sys/dev/iscsi). Obviously you meant 
> sys/modules/iscsi_initiator. Also, a line about running make in 
> iscontrol/ would be helpful, as would an install target in that 
> Makefile.
ok, fixed the 'typos', I also forgot the sample rc.d/iscsi, 
> 
> Do you have any suggestions on startup integration (rc script, fstab 
> magic, etc)? I know you said once before that that was hopefully coming 
> soon..
> 
this is an attempt:
#!/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

name=iscsi
rcvar=`set_rcvar`

command=/usr/local/sbin/iscontrol

iscsi_enable=${iscsi_enable:-"NO"}
iscsi_fstab=${iscsi_fstab:-"/etc/fstab.iscsi"}
iscsi_exports=${iscsi_exports:-"/etc/exports.iscsi"}

start_cmd="iscsi_start"
faststop_cmp="iscsi_stop"
stop_cmd="iscsi_stop"

iscsi_wait()
{
    dev=$1
    trap "echo 'wait loop cancelled'; exit 1" 2
    count=0
    while true; do
	if [ -c $dev ]; then
	    break;
	fi
	if [ $count -eq 0 ]; then
	     echo -n Waiting for ${dev}': '
	fi
	count=$((${count} + 1))
	if [ $count -eq 6 ]; then
	    echo ' Failed'
	    return 0
	    break
	fi
	echo -n '.'
	sleep 5;
    done
    echo '.'
    return 1
}

iscsi_start()
{
    #
    # load needed modules
    for m in iscsi_initiator geom_label; do
	kldstat -qm $m || kldload $m
    done

    sysctl debug.iscsi=2
    #
    # start iscontrol for each target
    if [ -n "${iscsi_targets}" ]; then
	for target in ${iscsi_targets}; do
	    ${command} ${rc_flags} -n ${target}
	done
    fi

    if [ -f "${iscsi_fstab}" ]; then
	while read spec file type opt t1 t2
	do
	  case ${spec} in
	  \#*|'')
		;;
	  *)
	  	if iscsi_wait ${spec}; then
		    break;
		fi
		echo type=$type spec=$spec file=$file
		fsck -p ${spec} && mount ${spec} ${file}
		;;
	  esac
	done < ${iscsi_fstab} 
    fi

    if [ -f "${iscsi_exports}" ]; then
	cat ${iscsi_exports} >> /etc/exports
	#/etc/rc.d/mountd reload does not work, why?
	kill -1 `cat /var/run/mountd.pid`
    fi
}

iscsi_stop()
{
    echo 'iscsi stopping'
    while read spec file type opt t1 t2
	do
	  case ${spec} in
	  \#*|'')
		;;
	  *)
	  	echo iscsi: umount $spec
	  	umount -fv $spec
		# and remove from the exports ...
		;;
	  esac
     done < ${iscsi_fstab} 
}

load_rc_config $name
run_rc_command "$1"
------
problems with the above script:
	- no background fsck
	- restart will mess the exports file
	- the wait loop should be replaced by something more deterministic.

> Thanks again. I'll post again if I manage to break something.
> 
Ok, but can't say I look forward to hear from you :-)

	danny
Received on Wed Jun 06 2007 - 13:00:46 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:11 UTC