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

Tim Wiederhake posted 1 patch 2 weeks, 5 days ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20210106111240.51995-1-twiederh@redhat.com
src/qemu/qemu_hotplug.c | 10 ++++++++++
1 file changed, 10 insertions(+)

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

Posted by Tim Wiederhake 2 weeks, 5 days ago
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 | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 57635cd419..6371d53871 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

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

Posted by Michal Privoznik 2 weeks, 5 days ago
On 1/6/21 12:12 PM, Tim Wiederhake wrote:
> 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 | 10 ++++++++++
>   1 file changed, 10 insertions(+)

Pushed.

Michal