From: Baptiste Daroussin Date: Mon, 8 Jun 2026 08:10:39 +0000 (+0200) Subject: virpci: don't fail VFIO passthrough when modules.alias is missing X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=2cb57390babbbfcbfaf44b84dbb3700625cc3ef7;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Peter Krempa Reviewed-by: Michal Privoznik --- diff --git a/src/util/virpci.c b/src/util/virpci.c index 642717d23c..98e030b92c 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -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;