1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

qemuDomainRemoveChrDevice: Release device address

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 <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2018-05-23 18:32:26 +02:00
parent 856fb16492
commit aac088d998

View File

@ -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);