-
Notifications
You must be signed in to change notification settings - Fork 233
/
preflight_windows.go
75 lines (67 loc) · 2.42 KB
/
preflight_windows.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package preflight
import "github.com/code-ready/crc/pkg/crc/logging"
var hypervPreflightChecks = [...]PreflightCheck{
{
configKeySuffix: "check-administrator-user",
checkDescription: "Checking if running as normal user",
check: checkIfRunningAsNormalUser,
fixDescription: "crc should be ran as a normal user",
flags: NoFix,
},
{
configKeySuffix: "check-windows-version",
checkDescription: "Checking Windows 10 release",
check: checkVersionOfWindowsUpdate,
fixDescription: "Please manually update your Windows 10 installation",
flags: NoFix,
},
{
configKeySuffix: "check-hyperv-installed",
checkDescription: "Checking if Hyper-V is installed and operational",
check: checkHyperVInstalled,
fixDescription: "Installing Hyper-V",
fix: fixHyperVInstalled,
},
{
configKeySuffix: "check-user-in-hyperv-group",
checkDescription: "Checking if user is a member of the Hyper-V Administrators group",
check: checkIfUserPartOfHyperVAdmins,
fixDescription: "Adding user to the Hyper-V Administrators group",
fix: fixUserPartOfHyperVAdmins,
},
{
configKeySuffix: "check-hyperv-service-running",
checkDescription: "Checking if Hyper-V service is enabled",
check: checkHyperVServiceRunning,
fixDescription: "Enabling Hyper-V service",
fix: fixHyperVServiceRunning,
},
{
configKeySuffix: "check-hyperv-switch",
checkDescription: "Checking if the Hyper-V virtual switch exist",
check: checkIfHyperVVirtualSwitchExists,
fixDescription: "Unable to perform Hyper-V administrative commands. Please make sure to re-login or reboot your system",
flags: NoFix,
},
}
func getPreflightChecks() []PreflightCheck {
checks := []PreflightCheck{}
checks = append(checks, genericPreflightChecks[:]...)
checks = append(checks, hypervPreflightChecks[:]...)
return checks
}
// StartPreflightChecks performs the preflight checks before starting the cluster
func StartPreflightChecks() {
doPreflightChecks(getPreflightChecks())
}
// SetupHost performs the prerequisite checks and setups the host to run the cluster
func SetupHost() {
doFixPreflightChecks(getPreflightChecks())
}
func RegisterSettings() {
doRegisterSettings(getPreflightChecks())
}
func CleanUpHost() {
logging.Warn("Cleanup is not supported for Windows")
doCleanUpPreflightChecks(getPreflightChecks())
}