]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainChangeNet: Check changed virtio network driver options
authorTim Wiederhake <twiederh@redhat.com>
Wed, 6 Jan 2021 11:12:40 +0000 (12:12 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 6 Jan 2021 14:33:49 +0000 (15:33 +0100)
Changes to a virtio network device such as
  <interface type="network">
    <model type="virtio"/>
    <driver iommu="on" ats="on"/> <!-- this line added -->
    ...
  </interface>
were quietly dismissed by `virsh update-device ... --live`.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_hotplug.c

index ec5c5220001fc4643840c2cb8dcaa30bc3fd4949..f336a90c8eb55f74f0e86c19740f0ea6801bd69d 100644 (file)
@@ -3600,6 +3600,16 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
         goto cleanup;
     }
 
+    if (!!olddev->virtio != !!newdev->virtio ||
+        (olddev->virtio && newdev->virtio &&
+         (olddev->virtio->iommu != newdev->virtio->iommu ||
+          olddev->virtio->ats != newdev->virtio->ats ||
+          olddev->virtio->packed != newdev->virtio->packed))) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("cannot modify virtio network device driver options"));
+           goto cleanup;
+   }
+
     /* data: this union will be examined later, after allocating new actualdev */
     /* virtPortProfile: will be examined later, after allocating new actualdev */