From: Peter Krempa <[email protected]>

Avoid the 'virDomainLeaseInsertPreAlloc' +
'virDomainLeaseInsertPreAlloced' dance. It's now not needed since
allocation failure will crash the daemon anyways.

Signed-off-by: Peter Krempa <[email protected]>
---
 src/qemu/qemu_hotplug.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 5be567b510..3d25b4c7d0 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3421,15 +3421,11 @@ qemuDomainAttachLease(virQEMUDriver *driver,
 {
     g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);

-    virDomainLeaseInsertPreAlloc(vm->def);
-
-    if (virDomainLockLeaseAttach(driver->lockManager, cfg->uri,
-                                 vm, lease) < 0) {
-        virDomainLeaseInsertPreAlloced(vm->def, NULL);
+    if (virDomainLockLeaseAttach(driver->lockManager, cfg->uri, vm, lease) < 0)
         return -1;
-    }

-    virDomainLeaseInsertPreAlloced(vm->def, lease);
+    virDomainLeaseInsert(vm->def, lease);
+
     return 0;
 }

-- 
2.54.0

Reply via email to