summaryrefslogtreecommitdiff
path: root/sys-cluster/lustre/files/lustre-client.initd
blob: 80341f46bbb635e772cb981612425abb22416a9f (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
#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

description="Load lustre modules"

extra_commands="checkmodule"

depend() {
        need lnet
        before netmount
}

checkmodule() {
        local LOADED="$(lctl modules | awk -F"/" /lustre/'{print $2F}')"
        for mod in ${LOADED[@]}; do
                ewarn "Module is still loaded: ${mod}"
                eend $*
        done
}

start() {
        if [ "${RC_CMD}" = "restart" ];
        then
                einfo "Restarting Lustre..."
                checkmodule
        fi

        ebegin "Loading Lustre modules..."
        modprobe lustre
        eend $*
}

stop() {
        local LMODULES=( "lustre" "osc" "mgc" "lmv" "fld" "mdc" "fid" "lov" "ptlrpc" )
        ebegin "Trying to unmount all Lustre fs"
        umount -a -t lustre
        eend $*
        einfo "Unloading lustre modules:"
        for mod in ${LMODULES[@]}; do
                ebegin "... ${mod}"
                modprobe -r ${mod}
                eend $*
        done

        checkmodule
}