[PATCH] conf: fix a failure when detaching a usb device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 #virsh detach-device $guest usb.xml
 error: Failed to detach device from usb2.xml
 error: operation failed: host usb device vendor=0x0951 \
 product=0x1625 not found

This regresstion is due to a typo in matching function. The first
argument is always the usb device that we are checking for. If the
usb xml file provided by user contains bus and device info, we try
to search it by them, otherwise, we use vendor and product info.

The bug occurred only when detaching a usb device with no bus and
device info provided in the usb xml file.
---
 src/conf/domain_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4cae0d3..2b2f35c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8541,7 +8541,7 @@ static int
 virDomainHostdevMatchSubsysUSB(virDomainHostdevDefPtr a,
                                virDomainHostdevDefPtr b)
 {
-    if (b->source.subsys.u.usb.bus && b->source.subsys.u.usb.device) {
+    if (a->source.subsys.u.usb.bus && a->source.subsys.u.usb.device) {
         /* specified by bus location on host */
         if (a->source.subsys.u.usb.bus == b->source.subsys.u.usb.bus &&
             a->source.subsys.u.usb.device == b->source.subsys.u.usb.device)
-- 
1.7.11.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]