[libvirt PATCH] qemuDomainChangeNet: Check changed virtio network driver options

Tim Wiederhake twiederh at redhat.com
Wed Jan 6 09:47:23 UTC 2021


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 at redhat.com>
---
 src/qemu/qemu_hotplug.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 57635cd419..c385bde4bf 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -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 */
 
-- 
2.26.2




More information about the libvir-list mailing list