On 07/14/2010 12:56 PM, Boaz Harrosh wrote:
On 07/14/2010 08:23 PM, Mike Christie wrote:
On 07/14/2010 10:49 AM, Boaz Harrosh wrote:
On 07/14/2010 05:52 PM, Mike Christie wrote:
On 07/14/2010 05:30 AM, HIMANSHU wrote:
How can we know error status of iscsiadm commands like
discovery,login,logout.

I think,all of them directly returns corresponding success/failure
messages.

so mostly I can just fire the commands without checking any error
codes after it?


If you run

iscsiadm -m node .... -l

iscsiadm should return a error code like other programs. If you wanted
to see it you could do

iscsiadm -m node .... -l
echo $?


Speaking of which. When I want to completely run from a script file
I currently have two ugly loops

after starting the iscsi service and before I can iscsiadm I must do:

start_iscsi_intiator()
{
        if ! service $ISCSI status; then
                service iscsi start ;

                until cat /sys/class/iscsi_transport/tcp/handle 2>/dev/null ; do
                        sleep 1;
                done
        fi
}

Effectively wait for the /sys/class/iscsi_transport/tcp/handle file to appear

And after login but before I can actually start banging on my scsi device I 
need:
login_iscsi()
{
        echo login into: $IP_ISCSI
        $iscsiadm -m discovery -t sendtargets -p $IP_ISCSI --login;

        until ls $DEV_ISCSI 2>/dev/null; do sleep 1; done
}

Effectively wait for the device to appear. This one is particularly nasty
because it assumes that I know what $DEV_ISCSI will be.

Would we want to add a --wait-server and --wait switches to iscsiadm
--wait-server   - will wait for the iscsi-kernel-modules and iscsid server
                    to stabilize. (until some timeout)


Not sure. When service iscsi start is run, it will eventually load the
modules. The script does not return until modprobe has returned and
modprobe does not return until the kernel module module_init function
and those do not return until it has run the sysfs functions that create
the files you are waiting on. So are you saying that once module_init
has completed the files are not accessible right away?


OK, so I just got lucky here probably, since I'm doing a sleep 1;
so the first iteration fails then a 1 sec wait is good enough. I think
what happens is that the iscsid server is not yet ready for communication
with iscsiadm. I'll remove the wait and run with debug-on see what actually
fails.


Oh yeah, Hannes had thought he saw what you are seeing too. Different sysfs files though. I thought they should be created/ready by the time we return from the module_init functions. I might be wrong or there might be a bug in the sysfs code? I did not hear back from Hannes.

--
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.

Reply via email to