[pve-devel] [PATCH qemu-server] disable usb hotplug for now

Dominik Csapak d.csapak at proxmox.com
Thu Jun 23 11:20:07 CEST 2016


we have a few problems with hotplug at the moment:
qemu may add usb hubs when adding usb devices but fails to remove them
when removing the usb device (this is a qemu bug)

also when starting a guest with a usb device we add ehci and uchi
controllers, which we cannot hot unplug

with those devices, it is impossible to live migrate the guest
to another host, meaning even if you remove all usb devices,
the migrate fails

so we deactivate usb hotplugging for now

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/QemuServer.pm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index b6ad27a..3df8f84 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3273,7 +3273,8 @@ sub vm_deviceplug {
 
     } elsif ($deviceid =~ m/^usb(\d+)$/) {
 
-	qemu_deviceadd($vmid, PVE::QemuServer::USB::print_usbdevice_full($conf, $deviceid, $device));
+	die "usb hotplug currently not reliable\n";
+	#qemu_deviceadd($vmid, PVE::QemuServer::USB::print_usbdevice_full($conf, $deviceid, $device));
 
     } elsif ($deviceid =~ m/^(virtio)(\d+)$/) {
 
@@ -3372,8 +3373,7 @@ sub vm_deviceunplug {
 
     } elsif ($deviceid =~ m/^usb\d+$/) {
 
-	qemu_devicedel($vmid, $deviceid);
-	qemu_devicedelverify($vmid, $deviceid);
+	die "usb hotplug currently not reliable\n";
 
     } elsif ($deviceid =~ m/^(virtio)(\d+)$/) {
 
@@ -3911,6 +3911,8 @@ sub vmconfig_hotplug_pending {
 		}
 	    } elsif ($opt =~ m/^usb\d+/) {
 		die "skip\n" if !$hotplug_features->{usb} || $conf->{$opt} =~ m/spice/i;
+		# usb hotplug unreliable
+		die "skip\n";
 		vm_deviceunplug($vmid, $conf, $opt);
 	    } elsif ($opt eq 'vcpus') {
 		die "skip\n" if !$hotplug_features->{cpu};
@@ -3966,6 +3968,8 @@ sub vmconfig_hotplug_pending {
 		die "skip\n" if !$hotplug_features->{usb} || $value =~ m/spice/i;
 		my $d = eval { PVE::JSONSchema::parse_property_string($usbdesc->{format}, $value) };
 		die "skip\n" if !$d;
+		# usb hotplug unreliable
+		die "skip\n";
 		qemu_usb_hotplug($storecfg, $conf, $vmid, $opt, $d);
 	    } elsif ($opt eq 'vcpus') {
 		die "skip\n" if !$hotplug_features->{cpu};
-- 
2.1.4




More information about the pve-devel mailing list