]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Deny all but VFIO PCI backends in hostdev prepare phase
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 24 Apr 2023 10:12:57 +0000 (12:12 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 25 Apr 2023 10:36:30 +0000 (12:36 +0200)
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>
src/qemu/qemu_domain.c

index 58cd3dd710b5d3612cc74dc90c82a32e052a757e..8dc9305b2a79fe9be7d66f1c1fefedc077adad38 100644 (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;
     }