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)
--wait - with a --login will wait (with timeout) until the loggedin
device is available.
How can it be done?
Boaz
> Does that answer your question?
>
--
You received this message because you are subscribed to the Google Groups
"open-iscsi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/open-iscsi?hl=en.