usb-hub can not be detached when detach usb device from VM

Bug #1586611 reported by Michael liu
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
QEMU
Invalid
Undecided
Michael liu

Bug Description

I give a host usb device to guest in the way of using "virsh attach-device" cmd. In guest os,use "lsusb" cmd I can see two devices have been added,one is usb device and the other is usb-hub(0409:55aa NEC Corp. Hub).
when I use "virsh detach-device" detach the usb device,in guest os the usb-hub was still exists.
It can create a bad impression when operating the VM,for example,suspend and resume the VM,qemu would report that:

2016-05-24T12:03:54.434369Z qemu-kvm: Unknown savevm section or instance '0000:00:01.2/2/usb-hub' 0

2016-05-24T12:03:54.434742Z qemu-kvm: load of migration failed: Invalid argument

From qemu's code,it can be sure that the usb-hub is generated by qemu,but could not be seen in xml file of libvirt. So when executing the migration of VM or resuming VM after suspended,it report error like "Unknown savevm section or instance '0000:00:01.2/2/usb-hub' 0"

summary: - usb-hub can not be detached when detach usb VM
+ usb-hub can not be detached when detach usb from VM
summary: - usb-hub can not be detached when detach usb from VM
+ usb-hub can not be detached when detach usb device from VM
description: updated
Revision history for this message
Michael liu (ztehypervisor) wrote :

I found that when I attached an usb device to the VM, the VM would add an usb-hub automatically if there was no usb-hub.
After adding an usb-hub,the VM assigned a port to the actual usb device. When detaching the usb device,the qemu only detach the port,without detaching the usb-hub.So when doing action like migrating or suspending/resumming,the VM will fail.

Revision history for this message
Michael liu (ztehypervisor) wrote :

Try detach the usb-hub device by the virsh detach-device usb-hub.xml?

description: updated
Changed in qemu:
assignee: nobody → Michael liu (ztehypervisor)
Revision history for this message
LiChunlin (lichl) wrote :

The usb-hub device should be deleted when the usb device was detached. When do you fix this bug?

Revision history for this message
Gerd Hoffmann (kraxel-redhat) wrote :

Use a newer libvirt version which manages usb addressing and assigns usb devices to usb ports. This is required to make sure the physical device tree is the same after vmsave/vmload or live migration.

Changed in qemu:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.