-
Notifications
You must be signed in to change notification settings - Fork 217
/
validation_id.go
129 lines (123 loc) · 7.59 KB
/
validation_id.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package host
import (
"net/http"
"github.com/openshift/assisted-service/internal/common"
"github.com/openshift/assisted-service/models"
"github.com/pkg/errors"
)
type validationID models.HostValidationID
const (
IsMediaConnected = validationID(models.HostValidationIDMediaConnected)
IsConnected = validationID(models.HostValidationIDConnected)
HasInventory = validationID(models.HostValidationIDHasInventory)
IsMachineCidrDefined = validationID(models.HostValidationIDMachineCidrDefined)
BelongsToMachineCidr = validationID(models.HostValidationIDBelongsToMachineCidr)
HasMinCPUCores = validationID(models.HostValidationIDHasMinCPUCores)
HasMinValidDisks = validationID(models.HostValidationIDHasMinValidDisks)
HasMinMemory = validationID(models.HostValidationIDHasMinMemory)
HasCPUCoresForRole = validationID(models.HostValidationIDHasCPUCoresForRole)
HasMemoryForRole = validationID(models.HostValidationIDHasMemoryForRole)
IsHostnameUnique = validationID(models.HostValidationIDHostnameUnique)
IsHostnameValid = validationID(models.HostValidationIDHostnameValid)
IsIgnitionDownloadable = validationID(models.HostValidationIDIgnitionDownloadable)
BelongsToMajorityGroup = validationID(models.HostValidationIDBelongsToMajorityGroup)
IsPlatformNetworkSettingsValid = validationID(models.HostValidationIDValidPlatformNetworkSettings)
IsNTPSynced = validationID(models.HostValidationIDNtpSynced)
IsTimeSyncedBetweenHostAndService = validationID(models.HostValidationIDTimeSyncedBetweenHostAndService)
SucessfullOrUnknownContainerImagesAvailability = validationID(models.HostValidationIDContainerImagesAvailable)
AreLsoRequirementsSatisfied = validationID(models.HostValidationIDLsoRequirementsSatisfied)
AreOdfRequirementsSatisfied = validationID(models.HostValidationIDOdfRequirementsSatisfied)
AreCnvRequirementsSatisfied = validationID(models.HostValidationIDCnvRequirementsSatisfied)
AreLvmRequirementsSatisfied = validationID(models.HostValidationIDLvmRequirementsSatisfied)
AreMceRequirementsSatisfied = validationID(models.HostValidationIDMceRequirementsSatisfied)
AreMtvRequirementsSatisfied = validationID(models.HostValidationIDMtvRequirementsSatisfied)
AreOscRequirementsSatisfied = validationID(models.HostValidationIDOscRequirementsSatisfied)
SufficientOrUnknownInstallationDiskSpeed = validationID(models.HostValidationIDSufficientInstallationDiskSpeed)
HasSufficientNetworkLatencyRequirementForRole = validationID(models.HostValidationIDSufficientNetworkLatencyRequirementForRole)
HasSufficientPacketLossRequirementForRole = validationID(models.HostValidationIDSufficientPacketLossRequirementForRole)
HasDefaultRoute = validationID(models.HostValidationIDHasDefaultRoute)
IsAPIDomainNameResolvedCorrectly = validationID(models.HostValidationIDAPIDomainNameResolvedCorrectly)
IsAPIInternalDomainNameResolvedCorrectly = validationID(models.HostValidationIDAPIIntDomainNameResolvedCorrectly)
IsAppsDomainNameResolvedCorrectly = validationID(models.HostValidationIDAppsDomainNameResolvedCorrectly)
IsReleaseDomainNameResolvedCorrectly = validationID(models.HostValidationIDReleaseDomainNameResolvedCorrectly)
CompatibleWithClusterPlatform = validationID(models.HostValidationIDCompatibleWithClusterPlatform)
IsDNSWildcardNotConfigured = validationID(models.HostValidationIDDNSWildcardNotConfigured)
DiskEncryptionRequirementsSatisfied = validationID(models.HostValidationIDDiskEncryptionRequirementsSatisfied)
NonOverlappingSubnets = validationID(models.HostValidationIDNonOverlappingSubnets)
VSphereHostUUIDEnabled = validationID(models.HostValidationIDVsphereDiskUUIDEnabled)
CompatibleAgent = validationID(models.HostValidationIDCompatibleAgent)
NoSkipInstallationDisk = validationID(models.HostValidationIDNoSkipInstallationDisk)
NoSkipMissingDisk = validationID(models.HostValidationIDNoSkipMissingDisk)
NoIPCollisionsInNetwork = validationID(models.HostValidationIDNoIPCollisionsInNetwork)
NoIscsiNicBelongsToMachineCidr = validationID(models.HostValidationIDNoIscsiNicBelongsToMachineCidr)
AreNodeFeatureDiscoveryRequirementsSatisfied = validationID(models.HostValidationIDNodeFeatureDiscoveryRequirementsSatisfied)
AreNvidiaGPURequirementsSatisfied = validationID(models.HostValidationIDNvidiaGpuRequirementsSatisfied)
ArePipelinesRequirementsSatisfied = validationID(models.HostValidationIDPipelinesRequirementsSatisfied)
AreServiceMeshRequirementsSatisfied = validationID(models.HostValidationIDServicemeshRequirementsSatisfied)
AreServerLessRequirementsSatisfied = validationID(models.HostValidationIDServerlessRequirementsSatisfied)
AreOpenShiftAIRequirementsSatisfied = validationID(models.HostValidationIDOpenshiftAiRequirementsSatisfied)
AreAuthorinoRequirementsSatisfied = validationID(models.HostValidationIDAuthorinoRequirementsSatisfied)
IsMtuValid = validationID(models.HostValidationIDMtuValid)
)
func (v validationID) category() (string, error) {
switch v {
case IsConnected,
IsMediaConnected,
IsMachineCidrDefined,
BelongsToMachineCidr,
IsIgnitionDownloadable,
BelongsToMajorityGroup,
IsNTPSynced,
IsTimeSyncedBetweenHostAndService,
SucessfullOrUnknownContainerImagesAvailability,
HasSufficientNetworkLatencyRequirementForRole,
HasSufficientPacketLossRequirementForRole,
HasDefaultRoute,
IsAPIDomainNameResolvedCorrectly,
IsAPIInternalDomainNameResolvedCorrectly,
IsPlatformNetworkSettingsValid,
IsAppsDomainNameResolvedCorrectly,
IsDNSWildcardNotConfigured,
NonOverlappingSubnets,
IsReleaseDomainNameResolvedCorrectly,
NoIPCollisionsInNetwork,
IsMtuValid,
NoIscsiNicBelongsToMachineCidr:
return "network", nil
case HasInventory,
HasMinCPUCores,
HasMinValidDisks,
HasMinMemory,
SufficientOrUnknownInstallationDiskSpeed,
HasCPUCoresForRole,
HasMemoryForRole,
IsHostnameUnique,
IsHostnameValid,
CompatibleWithClusterPlatform,
VSphereHostUUIDEnabled,
DiskEncryptionRequirementsSatisfied,
CompatibleAgent,
NoSkipInstallationDisk,
NoSkipMissingDisk:
return "hardware", nil
case AreLsoRequirementsSatisfied,
AreOdfRequirementsSatisfied,
AreCnvRequirementsSatisfied,
AreLvmRequirementsSatisfied,
AreMceRequirementsSatisfied,
AreMtvRequirementsSatisfied,
AreNodeFeatureDiscoveryRequirementsSatisfied,
AreNvidiaGPURequirementsSatisfied,
ArePipelinesRequirementsSatisfied,
AreServiceMeshRequirementsSatisfied,
AreServerLessRequirementsSatisfied,
AreOpenShiftAIRequirementsSatisfied,
AreAuthorinoRequirementsSatisfied,
AreOscRequirementsSatisfied:
return "operators", nil
}
return "", common.NewApiError(http.StatusInternalServerError, errors.Errorf("Unexpected validation id %s", string(v)))
}
func (v validationID) String() string {
return string(v)
}