-
Notifications
You must be signed in to change notification settings - Fork 4
/
check.go
50 lines (40 loc) · 1020 Bytes
/
check.go
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
package app
import (
"os"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
"github.com/longhorn/cli/pkg/checker"
"github.com/longhorn/cli/pkg/pkgmgr"
)
func PreflightCheckCmd(pkgMgrType pkgmgr.PackageManagerType) cli.Command {
return cli.Command{
Name: "check",
Flags: []cli.Flag{},
Usage: "Check environment",
Action: func(c *cli.Context) {
if err := check(c, pkgMgrType); err != nil {
logrus.WithError(err).Fatalf("Failed to run command")
}
},
}
}
func check(_ *cli.Context, pkgMgrType pkgmgr.PackageManagerType) error {
ckr, err := checker.NewChecker(pkgMgrType)
if err != nil {
return err
}
ckr.CheckIscsidService()
ckr.CheckMultipathService()
ckr.CheckNFSv4Support()
ckr.CheckPackagesInstalled(false)
if os.Getenv("ENABLE_SPDK") == "true" {
instructionSets := map[string][]string{
"amd64": {"sse4_2"},
}
ckr.CheckCpuInstructionSet(instructionSets)
ckr.CheckHugePages()
ckr.CheckPackagesInstalled(true)
ckr.CheckModulesLoaded(true)
}
return nil
}