[pve-devel] applied: [PATCH qemu-server] cfg2cmd: support USB 3 SPICE ports with 4.0 machine feature
Thomas Lamprecht
t.lamprecht at proxmox.com
Thu Sep 26 12:09:21 CEST 2019
The reason for why we did not do this in the first place was the fact
that the "usb3" flag could be set in older qemu-server versions, we
just ignored it but not filtered it out of the config..
That means there can be VMs out there which would now become a
different HW layout, and issue for migration and live-snapshot
restore.
But, actually, while the "usb3" property could be set it allowed to
start the VM in only if an additional USB devices was added to the VM
with USB2, or the VM uses "q35" based machine - as else no "ehci" was
available, and thus the "ignored" USB3 - SPICE could not get attached
anywhere -> QEMU chickened out.
And if a user had a configuration where this could started we have
still a bit luck, live-migration was not possible as the "can't
migrate VM which uses local devices:" check still hit, as in
qemu-server older than 6.0-8 we explicitly checked for "spice" when
seeing what usb device were not local, so a "spice,usb3=X" was always
(luckily) wrongly detected as local device -> migration was blocked.
So we only have one case left: restoring a live-snapshot. Here sadly
there seems no way out, it was possible to do with a "spice,usb3=1"
usb device, and thus all Snapshots taken on such VMs after they had a
clean restart on PVE 6 (to have a machine version >= 4.0) are broken
- but can be easily fixed by removing the "usb3=1" from the
problematic snapshot config.
As restoring a snapshot can be repeated more than once even on
failure without rendering the snapshot or VM permanently unusable,
this should be a reasonable compromise.
I strongly believe that the chance is so small that no one is
affected in practice and the property description mentioned that it
was not supported. If anybody is affected on snapshot restore we can
help them on a case-per-case basis.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
PVE/QemuServer.pm | 2 +-
test/cfg2cmd/spice-usb3.conf | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 00c6b58..8007c92 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3830,7 +3830,7 @@ sub config_to_command {
# usb devices
my $usb_dev_features = {};
- $usb_dev_features->{spice_usb3} = 1 if qemu_machine_feature_enabled($machine_type, $kvmver, 4, 1);
+ $usb_dev_features->{spice_usb3} = 1 if qemu_machine_feature_enabled($machine_type, $kvmver, 4, 0);
my @usbdevices = PVE::QemuServer::USB::get_usb_devices($conf, $usbdesc->{format}, $MAX_USB_DEVICES, $usb_dev_features);
push @$devices, @usbdevices if @usbdevices;
diff --git a/test/cfg2cmd/spice-usb3.conf b/test/cfg2cmd/spice-usb3.conf
index e6caccb..44ab6e0 100644
--- a/test/cfg2cmd/spice-usb3.conf
+++ b/test/cfg2cmd/spice-usb3.conf
@@ -1,5 +1,5 @@
# TEST: Test for SPICE with a USB3 based SPICE port added
-# QEMU_VERSION: 4.1.0
+# QEMU_VERSION: 4.0.0
cores: 2
memory: 768
name: spiceusb3
--
2.20.1
More information about the pve-devel
mailing list