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"
39
echo "Usage: $0 -u <URI> -o <OSDNAME> -s <SYSTEMID>"
41
echo "-u target uri e.g. iscsi://<ip>:<port>"
42
echo "-o osdname of the target OSD"
43
echo "-s systemid of the target OSD"
54
# parse the input arguments
55
while getopts "u:o:s:" options; do
59
s ) systemid=$OPTARG;;
71
protocol=`echo $uri | awk -F ':' '{print $1}'`
72
portal=`echo $uri | awk -F '//' '{print $2}'`
81
if kill -9 $PARENT_PID; then
82
echo "watchdog : Timed out (>$timeout seconds) while login into $portal" | logger -t "osd_login"
84
echo "watchdog: exiting .."
91
if ! iscsiadm -m discovery -o nonpersistent -t sendtargets -p $1 --login; then
92
echo "iscsiadm -m discovery -t sendtargets -p $1 --login returned error $? !"
97
echo "============= osd_login ========="
100
echo "protocol: $protocol"
101
echo "portal: $portal"
103
watchdog $WATCHDOG_TIMEOUT $portal &
108
login_iscsi_osd $portal |& logger -t "osd_login"
111
echo "Error: protocol $protocol not supported !" | logger -t "osd_login"
115
kill -9 $watchdog_pid