blob: 2a47f2ac0ddd315f233e6dfb5fafc979c2a047d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# This file is tasked with testing for the existence of the ibmvscsis driver
# and configuring the ibmvscsi server properly as indicated by the config file
# located at /etc/ibmvscsis.conf
#
DRIVER=ibmvscsis
SYSFS=/sys/bus/vio/drivers/ibmvscsis
CONFIG=/etc/ibmvscsis.conf
depend() {
need logger
provide ibmvscsis
}
checkconfig() {
if [ ! -e ${CONFIG} ] ; then
eerror " ${CONFIG} does not exist."
return 1
fi
}
checkmodule_load() {
# The existence of $SYSFS indicates that the module has been loaded or that
# the driver is at least built into the kernel.
if [ ! -e ${SYSFS} ] ; then
ewarn " Module ${DRIVER} is not loaded, attempting to load it"
/sbin/modprobe ${DRIVER} &> /dev/null && return 0
eerror " Failed to load module ${DRIVER}"
return 1
fi
}
checkmodule() {
# The existence of $SYSFS indicates that the module has been loaded or that
# the driver is at least built into the kernel.
if [ ! -e ${SYSFS} ] ; then
eerror " Module ${DRIVER} is not loaded"
return 1
fi
}
start() {
ebegin "Starting vscsiadmin"
checkconfig || return 1
checkmodule_load || return 1
/usr/sbin/vscsiadmin -start &> /dev/null
eend $? "Failed to start vscsiadmin"
}
stop() {
ebegin "Stopping vscsiadmin"
checkmodule || return 1
/usr/sbin/vscsiadmin -stop &> /dev/null
eend $? "Failed to stop vscsiadmin"
}
status() {
checkmodule || return 1
/usr/sbin/vscsiadmin -status
}
restart() {
stop
start
}
|