mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
virpci: don't fail VFIO passthrough when modules.alias is missing
When modules.alias is not available (e.g. monolithic kernel), virPCIDeviceFindBestVFIOVariant() would fail, causing the entire PCI device detach to abort. Instead, log a warning and return success with no variant found, allowing the caller to fall back to the generic vfio-pci driver. Signed-off-by: Baptiste Daroussin <baptiste.daroussin@ovhcloud.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
1 parent
1729178da1
commit
2cb57390ba
1 file changed
+6
@@ -1549,6 +1549,12 @@ virPCIDeviceFindBestVFIOVariant(virPCIDevice *dev,
|
||||
|
||||
uname(&unameInfo);
|
||||
modulesAliasPath = g_strdup_printf("/lib/modules/%s/modules.alias", unameInfo.release);
|
||||
if (!virFileExists(modulesAliasPath)) {
|
||||
/* on monolithic kernel this file does not exist */
|
||||
VIR_DEBUG("modules.alias not available (%s), skipping VFIO variant detection",
|
||||
modulesAliasPath);
|
||||
return 0;
|
||||
}
|
||||
if (virFileReadAll(modulesAliasPath, 8 * 1024 * 1024, &modulesAliasContent) < 0)
|
||||
return -1;
|
||||
|
||||
|
||||
Reference in new issue
Block a user