]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Don't delete USB device on failed qemuPrepareHostdevUSBDevices
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 17 May 2012 11:40:52 +0000 (13:40 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 17 May 2012 11:40:52 +0000 (13:40 +0200)
If qemuPrepareHostdevUSBDevices fail it will roll back devices added
to the driver list of used devices. However, if it may fail because
the device is being used already. But then again - with roll back.
Therefore don't try to remove a usb device manually if the function
fail. Although, we want to remove the device if any operation
performed afterwards fail.

src/qemu/qemu_hotplug.c

index 9b608162fecee3074b1de8afe4e9c6539605fed2..dfca7e2efc4cfd715dee555a5e0074b9f42684ac 100644 (file)
@@ -1173,8 +1173,10 @@ int qemuDomainAttachHostDevice(struct qemud_driver *driver,
             goto cleanup;
         }
 
-        if (qemuPrepareHostdevUSBDevices(driver, vm->def->name, list) < 0)
+        if (qemuPrepareHostdevUSBDevices(driver, vm->def->name, list) < 0) {
+            usb = NULL;
             goto cleanup;
+        }
 
         usbDeviceListSteal(list, usb);
     }