()
| 1878 | } |
| 1879 | |
| 1880 | func (v *VGPUDevices) validate() error { |
| 1881 | ctx := v.ctx |
| 1882 | |
| 1883 | gpuWorkloadConfig, err := getWorkloadConfig(ctx) |
| 1884 | if err != nil { |
| 1885 | return fmt.Errorf("error getting gpu workload config: %w", err) |
| 1886 | } |
| 1887 | log.Infof("GPU workload configuration: %s", gpuWorkloadConfig) |
| 1888 | |
| 1889 | err = createStatusFileWithContent(filepath.Join(outputDirFlag, workloadTypeStatusFile), gpuWorkloadConfig+"\n") |
| 1890 | if err != nil { |
| 1891 | return fmt.Errorf("error updating %s status file: %w", workloadTypeStatusFile, err) |
| 1892 | } |
| 1893 | |
| 1894 | if gpuWorkloadConfig != gpuWorkloadConfigVMVgpu { |
| 1895 | log.WithFields(log.Fields{ |
| 1896 | "gpuWorkloadConfig": gpuWorkloadConfig, |
| 1897 | }).Info("vgpu devices not required on the node. Skipping validation.") |
| 1898 | return nil |
| 1899 | } |
| 1900 | |
| 1901 | // delete status file if already present |
| 1902 | err = deleteStatusFile(outputDirFlag + "/" + vGPUDevicesStatusFile) |
| 1903 | if err != nil { |
| 1904 | return err |
| 1905 | } |
| 1906 | |
| 1907 | err = v.runValidation() |
| 1908 | if err != nil { |
| 1909 | return err |
| 1910 | } |
| 1911 | log.Info("Validation completed successfully - vGPU devices present on the host") |
| 1912 | |
| 1913 | // create status file |
| 1914 | err = createStatusFile(outputDirFlag + "/" + vGPUDevicesStatusFile) |
| 1915 | if err != nil { |
| 1916 | return err |
| 1917 | } |
| 1918 | |
| 1919 | return nil |
| 1920 | } |
| 1921 | |
| 1922 | func (v *VGPUDevices) runValidation() error { |
| 1923 | nvmdev := nvmdev.New() |
no test coverage detected