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>
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;