diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 561a54fb..a4895242 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -2177,7 +2177,7 @@ my $vga_map = { }; sub print_vga_device { - my ($conf, $vga, $arch, $machine, $id, $qxlnum, $bridges) = @_; + my ($conf, $vga, $arch, $kvmver, $machine, $id, $qxlnum, $bridges) = @_; my $type = $vga_map->{$vga->{type}}; if ($arch eq 'aarch64' && defined($type) && $type eq 'virtio-vga') { @@ -2191,7 +2191,9 @@ sub print_vga_device { if (!$conf->{ostype} || $conf->{ostype} =~ m/^(?:l\d\d)|(?:other)$/) { # set max outputs so linux can have up to 4 qxl displays with one device - $max_outputs = ",max_outputs=4"; + if (qemu_machine_feature_enabled($machine, $kvmver, 4, 1)) { + $max_outputs = ",max_outputs=4"; + } } } @@ -3855,7 +3857,7 @@ sub config_to_command { push @$cmd, '-no-reboot' if defined($conf->{reboot}) && $conf->{reboot} == 0; if ($vga->{type} && $vga->{type} !~ m/^serial\d+$/ && $vga->{type} ne 'none'){ - push @$devices, '-device', print_vga_device($conf, $vga, $arch, $machine_type, undef, $qxlnum, $bridges); + push @$devices, '-device', print_vga_device($conf, $vga, $arch, $kvmver, $machine_type, undef, $qxlnum, $bridges); my $socket = vnc_socket($vmid); push @$cmd, '-vnc', "unix:$socket,password"; } else { @@ -3927,7 +3929,7 @@ sub config_to_command { if ($qxlnum > 1) { if ($winversion){ for(my $i = 1; $i < $qxlnum; $i++){ - push @$devices, '-device', print_vga_device($conf, $vga, $arch, $machine_type, $i, $qxlnum, $bridges); + push @$devices, '-device', print_vga_device($conf, $vga, $arch, $kvmver, $machine_type, $i, $qxlnum, $bridges); } } else { # assume other OS works like Linux diff --git a/test/cfg2cmd/spice-linux-4.1.conf b/test/cfg2cmd/spice-linux-4.1.conf new file mode 100644 index 00000000..24d26767 --- /dev/null +++ b/test/cfg2cmd/spice-linux-4.1.conf @@ -0,0 +1,11 @@ +# TEST: Test for SPICE with SPICE with max_outputs +# QEMU_VERSION: 4.1.0 +cores: 2 +memory: 768 +name: spicelinux +net0: virtio=A2:C0:43:67:08:A1,bridge=vmbr0 +ostype: l26 +scsihw: virtio-scsi-pci +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +vmgenid: c773c261-d800-4348-9f5d-167fadd53cf8 +vga: qxl diff --git a/test/cfg2cmd/spice-linux-4.1.conf.cmd b/test/cfg2cmd/spice-linux-4.1.conf.cmd new file mode 100644 index 00000000..158e73b5 --- /dev/null +++ b/test/cfg2cmd/spice-linux-4.1.conf.cmd @@ -0,0 +1,30 @@ +/usr/bin/kvm \ + -id 8006 \ + -name spicelinux \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server,nowait' \ + -mon 'chardev=qmp,mode=control' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' \ + -mon 'chardev=qmp-event,mode=control' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ + -smp '2,sockets=1,cores=2,maxcpus=2' \ + -nodefaults \ + -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ + -vnc unix:/var/run/qemu-server/8006.vnc,password \ + -cpu kvm64,+lahf_lm,+sep,+kvm_pv_unhalt,+kvm_pv_eoi,enforce \ + -m 768 \ + -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \ + -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \ + -device 'vmgenid,guid=c773c261-d800-4348-9f5d-167fadd53cf8' \ + -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.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' \ + -spice 'tls-port=61000,addr=127.0.0.1,tls-ciphers=HIGH,seamless-migration=on' \ + -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \ + -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ + -netdev 'type=tap,id=net0,ifname=tap8006i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' \ + -device 'virtio-net-pci,mac=A2:C0:43:67:08:A1,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300' \ + -machine 'type=pc' diff --git a/test/cfg2cmd/spice-usb3.conf.cmd b/test/cfg2cmd/spice-usb3.conf.cmd index d10ba9ab..627c0777 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,max_outputs=4,bus=pci.0,addr=0x2' \ + -device 'qxl-vga,id=vga,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' \