From aac088d998b29446b8c9adadb167d70ad6f4bad2 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 23 May 2018 18:32:26 +0200 Subject: [PATCH] qemuDomainRemoveChrDevice: Release device address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of releasing address only sometimes in qemuDomainDetachChrDevice() let's release it whenever the device is actually removed from the domain definition. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- src/qemu/qemu_hotplug.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index b35594be5f..cddd700af8 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4337,6 +4337,7 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver, event = virDomainEventDeviceRemovedNewFromObj(vm, chr->info.alias); qemuDomainEventQueue(driver, event); + qemuDomainReleaseDeviceAddress(vm, &chr->info, NULL); qemuDomainChrRemove(vm->def, chr); virDomainChrDefFree(chr); ret = 0; @@ -5620,10 +5621,8 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver, if (qemuDomainObjExitMonitor(driver, vm) < 0) goto cleanup; - if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1) { - qemuDomainReleaseDeviceAddress(vm, &tmpChr->info, NULL); + if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1) ret = qemuDomainRemoveChrDevice(driver, vm, tmpChr); - } cleanup: qemuDomainResetDeviceRemoval(vm);