From b9fab14b81da7068fff45172fd5b89bb8ad3bcce Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 25 Jul 2022 14:07:47 +0200 Subject: [PATCH] qemuMigrationDstPersist: Avoid multi-line ternary operator in function call Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index b28c479345..083cbc5993 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -6393,6 +6393,7 @@ qemuMigrationDstPersist(virQEMUDriver *driver, g_autoptr(virDomainDef) oldDef = NULL; unsigned int oldPersist = vm->persistent; virObjectEvent *event; + virDomainEventDefinedDetailType eventDetail = VIR_DOMAIN_EVENT_DEFINED_UPDATED; vm->persistent = 1; oldDef = vm->newDef; @@ -6402,18 +6403,19 @@ qemuMigrationDstPersist(virQEMUDriver *driver, priv->qemuCaps))) goto error; - if (!oldPersist && qemuDomainNamePathsCleanup(cfg, vmdef->name, false) < 0) - goto error; + if (!oldPersist) { + eventDetail = VIR_DOMAIN_EVENT_DEFINED_ADDED; + + if (qemuDomainNamePathsCleanup(cfg, vmdef->name, false) < 0) + goto error; + } if (virDomainDefSave(vmdef, driver->xmlopt, cfg->configDir) < 0 && !ignoreSaveError) goto error; - event = virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_DEFINED, - oldPersist ? - VIR_DOMAIN_EVENT_DEFINED_UPDATED : - VIR_DOMAIN_EVENT_DEFINED_ADDED); + event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_DEFINED, + eventDetail); virObjectEventStateQueue(driver->domainEventState, event); return 0;