summaryrefslogtreecommitdiff
path: root/net/aoe/files/aoe.in
blob: 154f5bc9942102c1aaeae8166709646473c2224d (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
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: netdisks
# REQUIRE: NETWORKING sysctl
# KEYWORD: nojail

. /etc/rc.subr

name="aoe"
rcvar=aoe_enable
start_cmd="aoe_start"
stop_cmd=":"

# discover the AoE devices on requested interfaces and tell vinum
# about the disks requested
aoe_start()
{
	echo -n 1>&2 "Starting AoE:"
	if [ -z "${aoe_iflist}" ]; then
		echo 2>&1 " aoe_start: unset aoe_iflist."
		return
	fi
	sysctl net.aoe > /dev/null 2>&1
	if [ $? -eq 1 ]; then   
		kldconfig -mf %%PREFIX%%/lib/aoe
		kldload aoe > /dev/null 2>&1
	fi
	if [ $? -eq 0 ]; then
		# Make sure the net interfaces are "up"
		for i in ${aoe_iflist}; do
			echo -n  1>&2 " $i"
			ifconfig $i up
		done
		echo 1>&2 "."

		# give the interfaces a chance to come up
		sleep 3 
		sysctl net.aoe.wc=${aoe_wc} > /dev/null 2>&1
		sysctl net.aoe.iflist="${aoe_iflist}" > /dev/null 2>&1
		sleep 1 
		sysctl net.aoe.devices

		# Needs to be updated for gvinum
		#if checkyesno start_vinum; then
		#if [ -n "${aoe_vinum_drives}" ]; then
		#	vinum read "${aoe_vinum_drives}"
		#fi
                #fi
		echo -n 1>&2 "Mounting AoE blades:"

		for i in ${aoe_mounts}; do
			echo -n  1>&2 " $i"
			mount $i
		done
		echo 1>&2 "."
	else
		echo 1>&2 Failure initializing AoE
	fi
}

load_rc_config $name
run_rc_command "$1"