[pve-devel] [PATCH v2 qemu-server] print_vga_device: fix qxl displays on Linux guests

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Nov 19 17:24:51 CET 2019


On 11/19/19 4:18 PM, Aaron Lauterer wrote:
> with pve-qemu-4.0.1-3 or higher it was not possible in a spice remote
> session to enable more displays on the fly in linux guests.
> 
> Adding the `max_outputs` parameter to the qxl device manually restores
> the functionality.
> 
> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
> ---
> v1 -> v2: change `my $max_outputs` from undef to empty string so it
> behaves nicely in the return string if not needed
> 
>  PVE/QemuServer.pm                | 10 +++++++++-
>  test/cfg2cmd/spice-usb3.conf.cmd |  2 +-
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 11e7169..9c90655 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2184,9 +2184,17 @@ sub print_vga_device {
>  	$type = 'virtio-gpu';
>      }
>      my $vgamem_mb = $vga->{memory};
> +
> +    my $max_outputs = '';
>      if ($qxlnum) {
>  	$type = $id ? 'qxl' : 'qxl-vga';
> +
> +	if ($conf->{ostype} =~ m/^l(?=\d)/) {

$ostype can be undefined, it's optional in the schema.
While the default is not clear, it's behavior is like other or l2*,
so let's just allow this as true for this branch - if one has qxl
set and it's working this should be OK.

> +	    # set max outputs so linux can have up to 4 qxl displays with one device
> +	    $max_outputs = ",max_outputs=4";

this will break live-migration, resets the VM.. please put this
behind a qemu machine feature enabled guard for 4.1

> +	}
>      }
> +
>      die "no devicetype for $vga->{type}\n" if !$type;
>  
>      my $memory = "";
> @@ -2218,7 +2226,7 @@ sub print_vga_device {
>  	$pciaddr = print_pci_addr($vgaid, $bridges, $arch, $machine);
>      }
>  
> -    return "$type,id=${vgaid}${memory}${pciaddr}";
> +    return "$type,id=${vgaid}${memory}${max_outputs}${pciaddr}";
>  }
>  
>  sub drive_is_cloudinit {
> diff --git a/test/cfg2cmd/spice-usb3.conf.cmd b/test/cfg2cmd/spice-usb3.conf.cmd
> index 627c077..d10ba9a 100644
> --- a/test/cfg2cmd/spice-usb3.conf.cmd
> +++ b/test/cfg2cmd/spice-usb3.conf.cmd
> @@ -21,7 +21,7 @@
>    -device 'nec-usb-xhci,id=xhci,bus=pci.1,addr=0x1b' \
>    -chardev 'spicevmc,id=usbredirchardev1,name=usbredir' \
>    -device 'usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=xhci.0' \
> -  -device 'qxl-vga,id=vga,bus=pci.0,addr=0x2' \
> +  -device 'qxl-vga,id=vga,max_outputs=4,bus=pci.0,addr=0x2' \
>    -device 'virtio-serial,id=spice,bus=pci.0,addr=0x9' \
>    -chardev 'spicevmc,id=vdagent,name=vdagent' \
>    -device 'virtserialport,chardev=vdagent,name=com.redhat.spice.0' \
> 





More information about the pve-devel mailing list