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

Daniel P. Berrangé berrange at redhat.com
Wed Jan 6 10:37:56 UTC 2021


On Wed, Jan 06, 2021 at 10:47:23AM +0100, 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 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 ||

The !! makes sense here as we don't want to compare the actual pointer
values.

> +        (!!olddev->virtio && !!newdev->virtio &&

The !! is redundant here as we simply care if they are non-NULL.

> +         (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;
> +   }

With the redundant !! removed

Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list