[libvirt] [PATCH v2 04/12] qemuDomainRemoveChrDevice: Release device address

Michal Privoznik posted 12 patches 6 years, 11 months ago
[libvirt] [PATCH v2 04/12] qemuDomainRemoveChrDevice: Release device address
Posted by Michal Privoznik 6 years, 11 months ago
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>
---
 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);
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 04/12] qemuDomainRemoveChrDevice: Release device address
Posted by Ján Tomko 6 years, 11 months ago
On Thu, May 24, 2018 at 01:13:31PM +0200, Michal Privoznik wrote:
>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>
>---
> src/qemu/qemu_hotplug.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

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