public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server 1/2] tests: cfg2cmd: add test for audio device
@ 2025-04-04  9:43 Dominik Csapak
  2025-04-04  9:43 ` [pve-devel] [PATCH qemu-server 2/2] vnc: connect to audio device if there is one Dominik Csapak
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2025-04-04  9:43 UTC (permalink / raw)
  To: pve-devel

this was not covered by any other test

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 test/cfg2cmd/audio.conf     | 15 +++++++++++++++
 test/cfg2cmd/audio.conf.cmd | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 test/cfg2cmd/audio.conf
 create mode 100644 test/cfg2cmd/audio.conf.cmd

diff --git a/test/cfg2cmd/audio.conf b/test/cfg2cmd/audio.conf
new file mode 100644
index 00000000..3f1dd467
--- /dev/null
+++ b/test/cfg2cmd/audio.conf
@@ -0,0 +1,15 @@
+# TEST: Simple test for a basic configuration with an audio device
+audio0: device=ich9-intel-hda,driver=none
+bootdisk: scsi0
+cores: 3
+ide2: none,media=cdrom
+memory: 768
+name: simple
+net0: virtio=A2:C0:43:77:08:A0,bridge=vmbr0
+numa: 0
+ostype: l26
+scsi0: local:8006/vm-8006-disk-0.qcow2,discard=on,size=104858K
+scsihw: virtio-scsi-pci
+smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465
+sockets: 1
+vmgenid: c773c261-d800-4348-9f5d-167fadd53cf8
diff --git a/test/cfg2cmd/audio.conf.cmd b/test/cfg2cmd/audio.conf.cmd
new file mode 100644
index 00000000..add6f55d
--- /dev/null
+++ b/test/cfg2cmd/audio.conf.cmd
@@ -0,0 +1,37 @@
+/usr/bin/kvm \
+  -id 8006 \
+  -name 'simple,debug-threads=on' \
+  -no-shutdown \
+  -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \
+  -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 '3,sockets=1,cores=3,maxcpus=3' \
+  -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=on' \
+  -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
+  -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 'usb-tablet,id=tablet,bus=uhci.0,port=1' \
+  -device 'ich9-intel-hda,id=audiodev0,bus=pci.2,addr=0xc' \
+  -device 'hda-micro,id=audiodev0-codec0,bus=audiodev0.0,cad=0,audiodev=none-backend0' \
+  -device 'hda-duplex,id=audiodev0-codec1,bus=audiodev0.0,cad=1,audiodev=none-backend0' \
+  -audiodev 'none,id=none-backend0' \
+  -device 'VGA,id=vga,bus=pci.0,addr=0x2' \
+  -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \
+  -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \
+  -drive 'if=none,id=drive-ide2,media=cdrom,aio=io_uring' \
+  -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200' \
+  -device 'virtio-scsi-pci,id=scsihw0,bus=pci.0,addr=0x5' \
+  -drive 'file=/var/lib/vz/images/8006/vm-8006-disk-0.qcow2,if=none,id=drive-scsi0,discard=on,format=qcow2,cache=none,aio=io_uring,detect-zeroes=unmap' \
+  -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=100' \
+  -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:77:08:A0,netdev=net0,bus=pci.0,addr=0x12,id=net0,rx_queue_size=1024,tx_queue_size=256,bootindex=300' \
+  -machine 'type=pc+pve0'
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] [PATCH qemu-server 2/2] vnc: connect to audio device if there is one
  2025-04-04  9:43 [pve-devel] [PATCH qemu-server 1/2] tests: cfg2cmd: add test for audio device Dominik Csapak
@ 2025-04-04  9:43 ` Dominik Csapak
  0 siblings, 0 replies; 2+ messages in thread
From: Dominik Csapak @ 2025-04-04  9:43 UTC (permalink / raw)
  To: pve-devel

this is in preparation of noVNC audio support. For that to work we have
to connect vnc to the audiodev, else qemu does not know which device
to encode audio from. Since we only can have one audio device, simply
use that if it exists.

This works simultaneously for SPICE and VNC. Live migration is not
impacted, since it's only a logical change and not a hardware change.
(Tested live-migration multiple times in both directions, worked without
any issues).

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 PVE/QemuServer.pm           | 4 +++-
 test/cfg2cmd/audio.conf.cmd | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 96786a96..dfdbee99 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3706,7 +3706,9 @@ sub config_to_command {
 	push @$cmd, '-display', 'egl-headless,gl=core' if $vga->{type} eq 'virtio-gl'; # VIRGL
 
 	my $socket = PVE::QemuServer::Helpers::vnc_socket($vmid);
-	push @$cmd,  '-vnc', "unix:$socket,password=on";
+	my $audioconf = conf_has_audio($conf);
+	my $audiodev = defined($audioconf) ? ",audiodev=$audioconf->{backend_id}" : "";
+	push @$cmd,  '-vnc', "unix:$socket,password=on$audiodev";
     } else {
 	push @$cmd, '-vga', 'none' if $vga->{type} eq 'none';
 	push @$cmd, '-nographic';
diff --git a/test/cfg2cmd/audio.conf.cmd b/test/cfg2cmd/audio.conf.cmd
index add6f55d..7014bf51 100644
--- a/test/cfg2cmd/audio.conf.cmd
+++ b/test/cfg2cmd/audio.conf.cmd
@@ -12,7 +12,7 @@
   -smp '3,sockets=1,cores=3,maxcpus=3' \
   -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=on' \
+  -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on,audiodev=none-backend0' \
   -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \
   -m 768 \
   -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-04  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-04  9:43 [pve-devel] [PATCH qemu-server 1/2] tests: cfg2cmd: add test for audio device Dominik Csapak
2025-04-04  9:43 ` [pve-devel] [PATCH qemu-server 2/2] vnc: connect to audio device if there is one Dominik Csapak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal