[pve-devel] [PATCH qemu-server] fix #2697: map netdev_add options to correct json types

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Apr 21 18:02:07 CEST 2020


there is some issue with hot-plugging queues (with and without your 
patch):

- virtio NIC, no queues set, start VM OR
- virtio NIC, queues X set, start VM
- change NIC to have a queues value of Y

400 Parameter verification failed.
net0: hotplug problem - error on hot-unplugging device 'net0'

- no NIC, start VM
- add NIC with queues value

no problem

- change NIC to have a different or no queues value

no problem

but besides this-pre-existing problem this seems to work for older Qemu 
binaries as well.

On April 21, 2020 4:01 pm, Dominik Csapak wrote:
> netdev_add is now a proper qmp command, which means that it verifies
> the parameter types properly
> 
> instead of sending strings, we now have to choose the correct
> types for the parameters
> 
> bool for vhost
> and uint64 for queues
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> i checked and i found no other parameter or qmp call that needs
> changing, but maybe someone else can also check this, just to be sure
> 
>  PVE/QemuServer.pm | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 37c7320..030e04b 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -4047,6 +4047,14 @@ sub qemu_netdevadd {
>      my $netdev = print_netdev_full($vmid, $conf, $arch, $device, $deviceid, 1);
>      my %options =  split(/[=,]/, $netdev);
>  
> +    if (defined(my $vhost = $options{vhost})) {
> +	$options{vhost} = JSON::boolean(PVE::JSONSchema::parse_boolean($vhost));
> +    }
> +
> +    if (defined(my $queues = $options{queues})) {
> +	$options{queues} = $queues + 0;
> +    }
> +
>      mon_cmd($vmid, "netdev_add",  %options);
>      return 1;
>  }
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 




More information about the pve-devel mailing list