
On 07/01/2011 11:30 PM, ghostwcy wrote:
At 2011-7-1 18:24, Guannan Ren write:
the "virsh nodedev-reattch" command could return successfully, but the pci device is still bound to pci-stub driver. The reason is noddev-reattach trys to use the variables set by nodedev-dettach commands. Becuase these variables is not persistent, this is not we expected. the patch try to fix it.
I do not agree with this patch. You should read this mail: https://www.redhat.com/archives/libvir-list/2011-April/msg00315.html
This patch will cause regression about hotpluging host pci device.
I think the problem is that: the init value of these variables is wrong. We can fix this bug by modifing pciGetDevice() or its caller.
I read the patch, it introduced the mechanism to check whether the device is bound to pci-stub when we write dev-id to new_id if a new device with this ID is hotpluggged, or if a probe is triggered for such a device, I think my patch kept it working. The overall idea is as follows: If the device is already bound to pci-stub, then do nothing. If not, try to write dev-id to "new_id", then check the state of its driver(hotplug issue) Unbind from its original driver , then bind to pci-stub driver Anyway, we should write dev-id to "remove_id" to protect the device from causing problems when reattaching it. About fixing the problem from pciGetDevice(), unless we feedback the state of pci device to libvirtd but I don't think it is easier.