()
| 1631 | } |
| 1632 | |
| 1633 | func (v *VfioPCI) validate() error { |
| 1634 | ctx := v.ctx |
| 1635 | |
| 1636 | gpuWorkloadConfig, err := getWorkloadConfig(ctx) |
| 1637 | if err != nil { |
| 1638 | return fmt.Errorf("error getting gpu workload config: %w", err) |
| 1639 | } |
| 1640 | log.Infof("GPU workload configuration: %s", gpuWorkloadConfig) |
| 1641 | |
| 1642 | err = createStatusFileWithContent(filepath.Join(outputDirFlag, workloadTypeStatusFile), gpuWorkloadConfig+"\n") |
| 1643 | if err != nil { |
| 1644 | return fmt.Errorf("error updating %s status file: %w", workloadTypeStatusFile, err) |
| 1645 | } |
| 1646 | |
| 1647 | if gpuWorkloadConfig != gpuWorkloadConfigVMPassthrough { |
| 1648 | log.WithFields(log.Fields{ |
| 1649 | "gpuWorkloadConfig": gpuWorkloadConfig, |
| 1650 | }).Info("vfio-pci not required on the node. Skipping validation.") |
| 1651 | return nil |
| 1652 | } |
| 1653 | |
| 1654 | // delete status file if already present |
| 1655 | err = deleteStatusFile(outputDirFlag + "/" + vfioPCIStatusFile) |
| 1656 | if err != nil { |
| 1657 | return err |
| 1658 | } |
| 1659 | |
| 1660 | err = v.runValidation() |
| 1661 | if err != nil { |
| 1662 | return err |
| 1663 | } |
| 1664 | log.Info("Validation completed successfully - all devices are bound to vfio-pci") |
| 1665 | |
| 1666 | // delete status file is already present |
| 1667 | err = createStatusFile(outputDirFlag + "/" + vfioPCIStatusFile) |
| 1668 | if err != nil { |
| 1669 | return err |
| 1670 | } |
| 1671 | return nil |
| 1672 | } |
| 1673 | |
| 1674 | func (v *VfioPCI) runValidation() error { |
| 1675 | nvpci := nvpci.New() |
no test coverage detected