qemu: Deny all but VFIO PCI backends in hostdev prepare phase

We used to support KVM and VFIO style of PCI assignment. The
former was dropped in v5.7.0-rc1~103 and thus we only support
VFIO. All other backends lead to an error (see
qemuBuildPCIHostdevDevProps(), or qemuBuildPCIHostdevDevStr() as
it used to be called in the era of aforementioned commit).

Might as well report the error in prepare phase and save hassle
of proceeding with device preparation (e.g. in case of hotplug
overriding the device's driver, setting seclabels, etc.).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Michal Privoznik 2023-04-24 12:12:57 +02:00
parent 2020c7e821
commit 59962b69b5

View File

@ -11331,7 +11331,14 @@ qemuDomainPrepareHostdevPCI(virDomainHostdevDef *hostdev,
return false;
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("QEMU does not support device assignment mode '%1$s'"),
virDomainHostdevSubsysPCIBackendTypeToString(*backend));
return false;
default:
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
virReportEnumRangeError(virDomainHostdevSubsysPCIBackendType, *backend);
break;
}