From 4d316a63c7c08dabbceac0082dbe01bacfe23469 Mon Sep 17 00:00:00 2001 From: Aaron Lauterer Date: Tue, 8 Oct 2019 17:56:15 +0200 Subject: [PATCH] cfg2cmd: fix serial-bus for spice foldersharing Thanks to Gilberto Nunes for finding a bug where the VM would not start with foldersharing enabled and the qemu agent option disabled [0]. The cause was that the device org.spice-space.webdav.0 would not find a virtio-serial-bus in this situation. Since we always create a virtio-serial-bus for the spice vdagent it seems sensible to use that also for the foldersharing device by moving it in front of the other spice devices. [0]: https://pve.proxmox.com/pipermail/pve-devel/2019-October/039441.html Signed-off-by: Aaron Lauterer --- PVE/QemuServer.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 8376260..61d7d12 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -4017,6 +4017,11 @@ sub config_to_command { my $pfamily = PVE::Tools::get_host_address_family($nodename); my @nodeaddrs = PVE::Tools::getaddrinfo_all('localhost', family => $pfamily); die "failed to get an ip address of type $pfamily for 'localhost'\n" if !@nodeaddrs; + + push @$devices, '-device', "virtio-serial,id=spice$pciaddr"; + push @$devices, '-chardev', "spicevmc,id=vdagent,name=vdagent"; + push @$devices, '-device', "virtserialport,chardev=vdagent,name=com.redhat.spice.0"; + my $localhost = PVE::Network::addr_to_ip($nodeaddrs[0]->{addr}); $spice_port = PVE::Tools::next_spice_port($pfamily, $localhost); @@ -4029,11 +4034,6 @@ sub config_to_command { my $spice_opts = "tls-port=${spice_port},addr=$localhost,tls-ciphers=HIGH,seamless-migration=on"; $spice_opts .= ",streaming-video=$spice_enhancement->{videostreaming}" if $spice_enhancement->{videostreaming}; push @$devices, '-spice', "$spice_opts"; - - push @$devices, '-device', "virtio-serial,id=spice$pciaddr"; - push @$devices, '-chardev', "spicevmc,id=vdagent,name=vdagent"; - push @$devices, '-device', "virtserialport,chardev=vdagent,name=com.redhat.spice.0"; - } # enable balloon by default, unless explicitly disabled -- 2.39.2