]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: automatically set model type='virtio' for interface type='vhostuser'
authorLaine Stump <laine@redhat.com>
Sun, 9 Feb 2025 23:23:03 +0000 (18:23 -0500)
committerLaine Stump <laine@redhat.com>
Mon, 17 Feb 2025 04:58:35 +0000 (23:58 -0500)
Both vdpa and vhostuser require that the guest device be virtio, and
for interface type='vdpa', we already set <model type='virtio'/> if it
is unspecified in the input XML, so let's be just as courteous for
interface type='vhostuser'.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_postparse.c

index 20ee333e0d646e84f79cbea52c5ff70a4015af59..49009ae2e4d61c31f75a558c6965c8cf5e09d64b 100644 (file)
@@ -100,7 +100,8 @@ qemuDomainDeviceNetDefPostParse(virDomainNetDef *net,
                                 const virDomainDef *def,
                                 virQEMUCaps *qemuCaps)
 {
-    if (net->type == VIR_DOMAIN_NET_TYPE_VDPA &&
+    if ((net->type == VIR_DOMAIN_NET_TYPE_VDPA ||
+         net->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER) &&
         !virDomainNetGetModelString(net)) {
         net->model = VIR_DOMAIN_NET_MODEL_VIRTIO;
     } else if (net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&