MCPcopy Create free account
hub / github.com/NVIDIA/gpu-operator / validate

Method validate

cmd/nvidia-validator/main.go:1204–1254  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1202}
1203
1204func (m *MOFED) validate() error {
1205 // If GPUDirectRDMA is disabled, skip validation
1206 if os.Getenv(GPUDirectRDMAEnabledEnvName) != "true" {
1207 log.Info("GPUDirect RDMA is disabled, skipping MOFED driver validation...")
1208 return nil
1209 }
1210
1211 // Check node labels for Mellanox devices and MOFED driver status file
1212 kubeConfig, err := rest.InClusterConfig()
1213 if err != nil {
1214 log.Errorf("Error getting config cluster - %s\n", err.Error())
1215 return err
1216 }
1217
1218 kubeClient, err := kubernetes.NewForConfig(kubeConfig)
1219 if err != nil {
1220 log.Errorf("Error getting k8s client - %s\n", err.Error())
1221 return err
1222 }
1223
1224 // update k8s client for the mofed driver validation
1225 m.setKubeClient(kubeClient)
1226
1227 present, err := m.isMellanoxDevicePresent()
1228 if err != nil {
1229 log.Errorf("Error trying to retrieve Mellanox device - %s\n", err.Error())
1230 return err
1231 }
1232 if !present {
1233 log.Info("No Mellanox device label found, skipping MOFED driver validation...")
1234 return nil
1235 }
1236
1237 // delete status file is already present
1238 err = deleteStatusFile(outputDirFlag + "/" + mofedStatusFile)
1239 if err != nil {
1240 return err
1241 }
1242
1243 err = m.runValidation(false)
1244 if err != nil {
1245 return err
1246 }
1247
1248 // delete status file is already present
1249 err = createStatusFile(outputDirFlag + "/" + mofedStatusFile)
1250 if err != nil {
1251 return err
1252 }
1253 return nil
1254}
1255
1256func (m *MOFED) runValidation(silent bool) error {
1257 // check for mlx5_core module to be loaded

Callers 1

validateComponentFunction · 0.95

Calls 6

setKubeClientMethod · 0.95
runValidationMethod · 0.95
deleteStatusFileFunction · 0.85
createStatusFileFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected