3 # osd_login : This script is part of the autologin feature
4 # mandated by the pnfs-objects standard.
5 # It is called from objlayoutdriver.ko in the kernel.
7 # Copyright (C) 2012, Sachin Bhamare <sbhamare@panasas.com>
8 # Copyright (C) 2012, Boaz Harrosh <bharrosh@panasas.com>
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License version 2 as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26 PATH="/sbin:/usr/sbin:/bin:/usr/bin"
28 iscsiadm=/sbin/iscsiadm
41 echo "Usage: $0 -u <URI> -o <OSDNAME> -s <SYSTEMID>"
43 echo "-u target uri e.g. iscsi://<ip>:<port>"
44 echo "-o osdname of the target OSD"
45 echo "-s systemid of the target OSD"
56 # parse the input arguments
57 while getopts "u:o:s:" options; do
61 s ) systemid=$OPTARG;;
73 protocol=`echo $uri | awk -F ':' '{print $1}'`
74 portal=`echo $uri | awk -F '//' '{print $2}'`
83 if kill -9 $PARENT_PID; then
84 echo "watchdog : Timed out (>$timeout seconds) while login into $portal" | logger -t "osd_login"
86 echo "watchdog: exiting .."
93 if ! $iscsiadm -m discovery -o nonpersistent -t sendtargets -p $1 --login; then
94 echo "$iscsiadm -m discovery -t sendtargets -p $1 --login returned error $? !"
99 echo "============= osd_login ========="
102 echo "protocol: $protocol"
103 echo "portal: $portal"
105 watchdog $WATCHDOG_TIMEOUT $portal &
110 login_iscsi_osd $portal |& logger -t "osd_login"
113 echo "Error: protocol $protocol not supported !" | logger -t "osd_login"
117 kill -9 $watchdog_pid