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

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Jul 5 09:26:25 CEST 2016


applied

On Mon, Jul 04, 2016 at 03:24:20PM +0200, Dominik Csapak wrote:
> 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>
> ---
> changes from v1:
>  * used an coherent way of disabling the usb hotplug codepaths
>  PVE/QemuServer.pm | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index b6ad27a..da26efe 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -3273,6 +3273,10 @@ sub vm_deviceplug {
>  
>      } elsif ($deviceid =~ m/^usb(\d+)$/) {
>  
> +	die "usb hotplug currently not reliable\n";
> +	# since we can't reliably hot unplug all added usb devices
> +	# and usb passthrough disables live migration
> +	# we disable usb hotplugging for now 
>  	qemu_deviceadd($vmid, PVE::QemuServer::USB::print_usbdevice_full($conf, $deviceid, $device));
>  
>      } elsif ($deviceid =~ m/^(virtio)(\d+)$/) {
> @@ -3372,6 +3376,10 @@ sub vm_deviceunplug {
>  
>      } elsif ($deviceid =~ m/^usb\d+$/) {
>  
> +	die "usb hotplug currently not reliable\n";
> +	# when unplugging usb devices this way, 
> +	# there may be remaining usb controllers/hubs
> +	# so we disable it for now
>  	qemu_devicedel($vmid, $deviceid);
>  	qemu_devicedelverify($vmid, $deviceid);
>  
> @@ -3910,6 +3918,9 @@ sub vmconfig_hotplug_pending {
>  		    vm_deviceunplug($vmid, $conf, $opt);
>  		}
>  	    } elsif ($opt =~ m/^usb\d+/) {
> +		die "skip\n";
> +		# since we cannot reliably hot unplug usb devices
> +		# we are disabling it
>  		die "skip\n" if !$hotplug_features->{usb} || $conf->{$opt} =~ m/spice/i;
>  		vm_deviceunplug($vmid, $conf, $opt);
>  	    } elsif ($opt eq 'vcpus') {
> @@ -3963,6 +3974,9 @@ sub vmconfig_hotplug_pending {
>  		    vm_deviceunplug($vmid, $conf, $opt);
>  		}
>  	    } elsif ($opt =~ m/^usb\d+$/) {
> +		die "skip\n";
> +		# since we cannot reliably hot unplug usb devices
> +		# we are disabling it
>  		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;
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 




More information about the pve-devel mailing list