()
| 1691 | } |
| 1692 | |
| 1693 | func (v *VGPUManager) validate() error { |
| 1694 | ctx := v.ctx |
| 1695 | |
| 1696 | gpuWorkloadConfig, err := getWorkloadConfig(ctx) |
| 1697 | if err != nil { |
| 1698 | return fmt.Errorf("error getting gpu workload config: %w", err) |
| 1699 | } |
| 1700 | log.Infof("GPU workload configuration: %s", gpuWorkloadConfig) |
| 1701 | |
| 1702 | err = createStatusFileWithContent(filepath.Join(outputDirFlag, workloadTypeStatusFile), gpuWorkloadConfig+"\n") |
| 1703 | if err != nil { |
| 1704 | return fmt.Errorf("error updating %s status file: %w", workloadTypeStatusFile, err) |
| 1705 | } |
| 1706 | |
| 1707 | if gpuWorkloadConfig != gpuWorkloadConfigVMVgpu { |
| 1708 | log.WithFields(log.Fields{ |
| 1709 | "gpuWorkloadConfig": gpuWorkloadConfig, |
| 1710 | }).Info("vGPU Manager not required on the node. Skipping validation.") |
| 1711 | return nil |
| 1712 | } |
| 1713 | |
| 1714 | // delete status file if already present |
| 1715 | err = deleteStatusFile(outputDirFlag + "/" + vGPUManagerStatusFile) |
| 1716 | if err != nil { |
| 1717 | return err |
| 1718 | } |
| 1719 | |
| 1720 | // delete status file if already present |
| 1721 | err = deleteStatusFile(outputDirFlag + "/" + hostVGPUManagerStatusFile) |
| 1722 | if err != nil { |
| 1723 | return err |
| 1724 | } |
| 1725 | |
| 1726 | hostDriver, err := v.runValidation(false) |
| 1727 | if err != nil { |
| 1728 | fmt.Println("vGPU Manager is not ready") |
| 1729 | return err |
| 1730 | } |
| 1731 | |
| 1732 | log.Info("Waiting for VFs to be available...") |
| 1733 | if err := waitForVFs(ctx, defaultVFWaitTimeout); err != nil { |
| 1734 | return fmt.Errorf("vGPU Manager VFs not ready: %w", err) |
| 1735 | } |
| 1736 | |
| 1737 | statusFile := vGPUManagerStatusFile |
| 1738 | if hostDriver { |
| 1739 | statusFile = hostVGPUManagerStatusFile |
| 1740 | } |
| 1741 | |
| 1742 | // create driver status file |
| 1743 | err = createStatusFile(outputDirFlag + "/" + statusFile) |
| 1744 | if err != nil { |
| 1745 | return err |
| 1746 | } |
| 1747 | return nil |
| 1748 | } |
| 1749 | |
| 1750 | func (v *VGPUManager) runValidation(silent bool) (hostDriver bool, err error) { |
no test coverage detected