
On 06/03/14 10:22, Jiri Denemark wrote:
In general, we should only remove a backend after seeing DEVICE_DELETED event for a corresponding frontend. This doesn't make any difference for disks attached using -drive or drive_add since QEMU automatically removes their backends but it's still better to make our code consistent. And it may start making difference in case we switch to attaching disks using -blockdev.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> ---
Notes: Version 2: - s/frontends/backends/ in the commit message - return int and propagate errors
src/qemu/qemu_hotplug.c | 45 ++++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 27 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 4d8d3cd..35099e4 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c
...
@@ -2984,10 +2980,6 @@ qemuDomainDetachDiskDevice(virQEMUDriverPtr driver, NULL, "detach", false); goto cleanup; } - - /* disconnect guest from host device */ - qemuMonitorDriveDel(priv->mon, drivestr); - qemuDomainObjExitMonitor(driver, vm);
rc = qemuDomainWaitForDeviceRemoval(vm);
A few lines below you forgot to propagate the returned value as you've done in qemuDomainDetachVirtioDiskDevice.
@@ -2997,7 +2989,6 @@ qemuDomainDetachDiskDevice(virQEMUDriverPtr driver,
cleanup: qemuDomainResetDeviceRemoval(vm); - VIR_FREE(drivestr); return ret; }
ACK with the nit resolved. Peter