From dd51418e45c1168dc791fc1b202be0e235dd4365 Mon Sep 17 00:00:00 2001 From: wanyaoqi <18528551+wanyaoqi@users.noreply.github.com> Date: Mon, 21 Aug 2023 12:32:17 +0800 Subject: [PATCH] fix(host): gpu probe miss 3d type gpu (#17805) --- pkg/hostman/hostinfo/hostinfo.go | 6 ++++++ pkg/hostman/isolated_device/gpu.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/hostman/hostinfo/hostinfo.go b/pkg/hostman/hostinfo/hostinfo.go index 96710d7bf6..70ed34df9e 100644 --- a/pkg/hostman/hostinfo/hostinfo.go +++ b/pkg/hostman/hostinfo/hostinfo.go @@ -2032,6 +2032,12 @@ func (h *SHostInfo) getNicsOvsOffloadInterfaces(nics []string) ([]isolated_devic } func (h *SHostInfo) probeSyncIsolatedDevices() (*jsonutils.JSONArray, error) { + for _, driver := range []string{"vfio", "vfio_iommu_type1", "vfio-pci"} { + if out, err := procutils.NewRemoteCommandAsFarAsPossible("modprobe", driver).Output(); err != nil { + log.Errorf("failed probe driver %s: %s %s", driver, out, err) + } + } + offloadNics, err := h.getNicsOvsOffloadInterfaces(options.HostOptions.OvsOffloadNics) if err != nil { return nil, err diff --git a/pkg/hostman/isolated_device/gpu.go b/pkg/hostman/isolated_device/gpu.go index a57833fc5b..a1e1952f1f 100644 --- a/pkg/hostman/isolated_device/gpu.go +++ b/pkg/hostman/isolated_device/gpu.go @@ -370,7 +370,7 @@ func (d *PCIDevice) IsBootVGA() (bool, error) { } func (d *PCIDevice) forceBindVFIOPCIDriver(useBootVGA bool) error { - if !utils.IsInStringArray(d.ClassCode, []string{CLASS_CODE_VGA, CLASS_CODE_VGA}) { + if !utils.IsInStringArray(d.ClassCode, []string{CLASS_CODE_VGA, CLASS_CODE_3D}) { return nil } isBootVGA, err := d.IsBootVGA()