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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxx>


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 :|




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux