Remove the check from conditions where it's coupled with some other checks. Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/qemu/qemu_backup.c | 9 ++++--- src/qemu/qemu_block.c | 23 +++++++++++----- src/qemu/qemu_blockjob.c | 3 ++- src/qemu/qemu_checkpoint.c | 9 ++++--- src/qemu/qemu_domain.c | 4 ++- src/qemu/qemu_driver.c | 45 ++++++++++++++++++++------------ src/qemu/qemu_hotplug.c | 15 +++++++---- src/qemu/qemu_migration.c | 24 +++++++++++------ src/qemu/qemu_migration_cookie.c | 3 ++- src/qemu/qemu_migration_params.c | 6 +++-- src/qemu/qemu_process.c | 19 +++++++++----- src/qemu/qemu_snapshot.c | 3 ++- 12 files changed, 109 insertions(+), 54 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 193d4ccd29..8e191d344e 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -474,7 +474,8 @@ qemuBackupDiskPrepareOneStorage(virDomainObj *vm, rc = qemuBlockStorageSourceAttachApply(priv->mon, dd->crdata->srcdata[0]); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(priv->driver, vm); + if (rc < 0) return -1; } @@ -888,7 +889,8 @@ qemuBackupBegin(virDomainObj *vm, if (rc == 0) rc = qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(priv->driver, vm); + if (rc < 0) goto endjob; job_started = true; @@ -1158,7 +1160,8 @@ qemuBackupGetJobInfoStats(virQEMUDriver *driver, rc = qemuMonitorGetJobInfo(priv->mon, &blockjobs, &nblockjobs); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) goto cleanup; /* count in completed jobs */ diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 44579a83ea..04f5e383bc 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -326,7 +326,9 @@ qemuBlockNodeNamesDetect(virQEMUDriver *driver, data = qemuMonitorQueryNamedBlockNodes(qemuDomainGetMonitor(vm)); blockstats = qemuMonitorQueryBlockstats(qemuDomainGetMonitor(vm)); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || !data || !blockstats) + qemuDomainObjExitMonitor(driver, vm); + + if (!data || !blockstats) return -1; if (!(disktable = qemuBlockNodeNameGetBackingChain(data, blockstats))) @@ -2711,7 +2713,8 @@ qemuBlockStorageSourceCreateGeneric(virDomainObj *vm, rc = qemuMonitorBlockdevCreate(priv->mon, job->name, props); props = NULL; - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(priv->driver, vm); + if (rc < 0) goto cleanup; qemuBlockJobStarted(job, vm); @@ -2857,7 +2860,8 @@ qemuBlockStorageSourceCreate(virDomainObj *vm, rc = qemuBlockStorageSourceAttachApplyStorageDeps(priv->mon, data); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(priv->driver, vm); + if (rc < 0) goto cleanup; if (qemuBlockStorageSourceCreateStorage(vm, src, chain, asyncJob) < 0) @@ -2871,7 +2875,8 @@ qemuBlockStorageSourceCreate(virDomainObj *vm, if (rc == 0) rc = qemuBlockStorageSourceAttachApplyFormatDeps(priv->mon, data); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(priv->driver, vm); + if (rc < 0) goto cleanup; if (qemuBlockStorageSourceCreateFormat(vm, src, backingStore, chain, @@ -2889,7 +2894,8 @@ qemuBlockStorageSourceCreate(virDomainObj *vm, rc = qemuBlockStorageSourceAttachApplyFormat(priv->mon, data); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(priv->driver, vm); + if (rc < 0) goto cleanup; ret = 0; @@ -3021,7 +3027,9 @@ qemuBlockGetNamedNodeData(virDomainObj *vm, blockNamedNodeData = qemuMonitorBlockGetNamedNodeData(priv->mon, supports_flat); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockNamedNodeData) + qemuDomainObjExitMonitor(driver, vm); + + if (!blockNamedNodeData) return NULL; return g_steal_pointer(&blockNamedNodeData); @@ -3377,7 +3385,8 @@ qemuBlockReopenFormat(virDomainObj *vm, rc = qemuBlockReopenFormatMon(priv->mon, src); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; return 0; diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index e7c3fea946..e57902df8c 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -507,7 +507,8 @@ qemuBlockJobRefreshJobs(virQEMUDriver *driver, rc = qemuMonitorGetJobInfo(priv->mon, &jobinfo, &njobinfo); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) goto cleanup; for (i = 0; i < njobinfo; i++) { diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 38ea57dea7..3ac5912def 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -524,7 +524,8 @@ qemuCheckpointCreate(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorTransaction(qemuDomainGetMonitor(vm), &actions); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) { + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) { qemuCheckpointRollbackMetadata(vm, chk); return NULL; } @@ -734,7 +735,8 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, if (rc == 0) rc = qemuMonitorTransaction(priv->mon, &mergeactions); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) goto endjob; /* now do a final refresh */ @@ -746,7 +748,8 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, rc = qemuMonitorTransaction(priv->mon, &cleanupactions); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) goto endjob; /* update disks */ diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d0d9a31f37..b0b2dd0258 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9628,7 +9628,9 @@ qemuDomainRefreshVcpuHalted(virQEMUDriver *driver, QEMU_CAPS_QUERY_CPUS_FAST); haltedmap = qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm), maxvcpus, fast); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || !haltedmap) + qemuDomainObjExitMonitor(driver, vm); + + if (!haltedmap) return -1; for (i = 0; i < maxvcpus; i++) { diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 33686f4f23..4a48354df1 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2388,7 +2388,8 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, priv = vm->privateData; qemuDomainObjEnterMonitor(driver, vm); r = qemuMonitorSetBalloon(priv->mon, newmem); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || r < 0) + qemuDomainObjExitMonitor(driver, vm); + if (r < 0) goto endjob; /* Lack of balloon support is a fatal error */ @@ -3126,7 +3127,8 @@ qemuDumpToFd(virQEMUDriver *driver, ret = qemuMonitorDumpToFd(priv->mon, fd, dumpformat, detach); - if ((qemuDomainObjExitMonitor(driver, vm) < 0) || ret < 0) + qemuDomainObjExitMonitor(driver, vm); + if (ret < 0) return -1; if (detach) @@ -10001,7 +10003,9 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, blockstats); } - if (qemuDomainObjExitMonitor(driver, vm) < 0 || nstats < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + + if (nstats < 0 || rc < 0) goto cleanup; *retstats = g_new0(qemuBlockStats, 1); @@ -12573,7 +12577,8 @@ qemuDomainGetJobInfoDumpStats(virQEMUDriver *driver, rc = qemuMonitorQueryDump(priv->mon, &stats); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; jobInfo->stats.dump = stats; @@ -12909,7 +12914,8 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom, } else { qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorSetMigrationDowntime(priv->mon, downtime); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) goto endjob; } @@ -13024,7 +13030,8 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, } else { qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorGetMigrationCacheSize(priv->mon, cacheSize); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) goto endjob; } @@ -13089,7 +13096,8 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, } else { qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorSetMigrationCacheSize(priv->mon, cacheSize); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) goto endjob; } @@ -13177,7 +13185,8 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorSetMigrationSpeed(priv->mon, bandwidth); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) goto endjob; } @@ -14663,7 +14672,9 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, qemuDomainObjEnterMonitor(driver, vm); blockjobstats = qemuMonitorGetAllBlockJobInfo(qemuDomainGetMonitor(vm), true); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockjobstats) + qemuDomainObjExitMonitor(driver, vm); + + if (!blockjobstats) goto endjob; rawInfo = g_hash_table_lookup(blockjobstats, job->name); @@ -15587,10 +15598,10 @@ qemuDomainBlockCommit(virDomainPtr dom, topPath, nodetop, basePath, nodebase, backingPath, speed); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || ret < 0) { - ret = -1; + qemuDomainObjExitMonitor(driver, vm); + + if (ret < 0) goto endjob; - } if (mirror) { disk->mirror = g_steal_pointer(&mirror); @@ -16607,8 +16618,8 @@ qemuDomainProbeQMPCurrentMachine(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); rv = qemuMonitorGetCurrentMachineInfo(priv->mon, &info); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || - rv < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rv < 0) return -1; *wakeupSupported = info.wakeupSuspendSupport; @@ -19681,7 +19692,8 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorSetBlockThreshold(priv->mon, nodename, threshold); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) goto endjob; /* we need to remember whether the threshold was registered with an explicit @@ -19796,7 +19808,8 @@ qemuDomainModifyLifecycleActionLive(virDomainObj *vm, QEMU_MONITOR_ACTION_WATCHDOG_KEEP, QEMU_MONITOR_ACTION_PANIC_KEEP); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; return 0; diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 59b3e57fd3..e886fbc35d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -280,7 +280,8 @@ qemuDomainChangeMediaLegacy(virQEMUDriver *driver, /* re-issue ejection command to pop out the media */ qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorEjectMedia(priv->mon, driveAlias, false); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; } else { @@ -432,7 +433,8 @@ qemuHotplugAttachManagedPR(virQEMUDriver *driver, rc = qemuMonitorAddObject(priv->mon, &props, NULL); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) goto cleanup; ret = 0; @@ -529,7 +531,8 @@ qemuDomainChangeMediaBlockdev(virQEMUDriver *driver, if (diskPriv->tray && disk->tray_status != VIR_DOMAIN_DISK_TRAY_OPEN) { qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorBlockdevTrayOpen(priv->mon, diskPriv->qomName, force); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; if (!force && qemuHotplugWaitForTrayEject(vm, disk) < 0) @@ -567,7 +570,8 @@ qemuDomainChangeMediaBlockdev(virQEMUDriver *driver, if (rc < 0 && newbackend) qemuBlockStorageSourceChainDetach(priv->mon, newbackend); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; return 0; @@ -2786,7 +2790,8 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriver *driver, ignore_value(qemuMonitorCloseFileHandle(priv->mon, vhostfdName)); if (removeextension) ignore_value(qemuDomainDetachExtensionDevice(priv->mon, hostdev->info)); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || ret < 0) + qemuDomainObjExitMonitor(driver, vm); + if (ret < 0) goto audit; vm->def->hostdevs[vm->def->nhostdevs++] = hostdev; diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 3fd0db15bb..a544e9e2fd 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -750,7 +750,8 @@ qemuMigrationSrcNBDCopyCancelOne(virQEMUDriver *driver, * consistency on the destination so that we can force cancel the mirror */ rv = qemuMonitorBlockJobCancel(priv->mon, job->name, abortMigration); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rv < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rv < 0) return -1; return 0; @@ -963,7 +964,8 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriver *driver, if (mon_ret != 0) qemuBlockStorageSourceAttachRollback(qemuDomainGetMonitor(vm), data); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || mon_ret < 0) + qemuDomainObjExitMonitor(driver, vm); + if (mon_ret < 0) return -1; diskPriv->migrSource = g_steal_pointer(©src); @@ -1004,7 +1006,8 @@ qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDriver *driver, diskAlias, nbd_dest, "raw", mirror_speed, 0, 0, mirror_shallow, true); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || mon_ret < 0) + qemuDomainObjExitMonitor(driver, vm); + if (mon_ret < 0) return -1; return 0; @@ -1673,7 +1676,8 @@ qemuMigrationAnyFetchStats(virQEMUDriver *driver, rv = qemuMonitorGetMigrationStats(priv->mon, &stats, error); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rv < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rv < 0) return -1; jobInfo->stats.mig = stats; @@ -2140,7 +2144,8 @@ qemuMigrationDstRun(virQEMUDriver *driver, rv = qemuMonitorMigrateIncoming(priv->mon, uri); exit_monitor: - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rv < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rv < 0) return -1; if (asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN) { @@ -3930,7 +3935,8 @@ qemuMigrationSrcRunPrepareBlockDirtyBitmapsMerge(virDomainObj *vm, rc = qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; jobPriv->migTempBitmaps = g_steal_pointer(&tmpbitmaps); @@ -4240,7 +4246,8 @@ qemuMigrationSrcRun(virQEMUDriver *driver, break; } - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) goto error; /* From this point onwards we *must* call cancel to abort the @@ -6247,7 +6254,8 @@ qemuMigrationSrcFetchMirrorStats(virQEMUDriver *driver, blockinfo = qemuMonitorGetAllBlockJobInfo(priv->mon, false); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockinfo) + qemuDomainObjExitMonitor(driver, vm); + if (!blockinfo) return -1; memset(stats, 0, sizeof(*stats)); diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c index eaf360932d..bffab7c13d 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -496,7 +496,8 @@ qemuMigrationCookieAddNBD(qemuMigrationCookie *mig, rc = qemuMonitorBlockStatsUpdateCapacityBlockdev(priv->mon, stats); else rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; for (i = 0; i < vm->def->ndisks; i++) { diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c index 7bfae29de4..837ee6d635 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -1079,7 +1079,8 @@ qemuMigrationParamsFetch(virQEMUDriver *driver, rc = qemuMonitorGetMigrationParams(priv->mon, &jsonParams); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; if (!(*migParams = qemuMigrationParamsFromJSON(jsonParams))) @@ -1379,7 +1380,8 @@ qemuMigrationCapsCheck(virQEMUDriver *driver, rc = qemuMonitorGetMigrationCapabilities(priv->mon, &caps); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; if (!caps) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1148e6072f..dcd547b279 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2372,7 +2372,8 @@ qemuProcessRefreshBalloonState(virQEMUDriver *driver, return -1; rc = qemuMonitorGetBalloonInfo(qemuDomainGetMonitor(vm), &balloon); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; /* We want the balloon size stored in domain definition to @@ -4457,7 +4458,8 @@ qemuProcessFetchCPUDefinitions(virQEMUDriver *driver, rc = virQEMUCapsFetchCPUModels(priv->mon, vm->def->os.arch, &models); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; *cpuModels = g_steal_pointer(&models); @@ -7127,7 +7129,8 @@ qemuProcessSetupDisksTransientHotplug(virDomainObj *vm, rc = qemuMonitorSystemReset(priv->mon); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(priv->driver, vm); + if (rc < 0) return -1; } @@ -7178,7 +7181,8 @@ qemuProcessSetupLifecycleActions(virDomainObj *vm, QEMU_MONITOR_ACTION_WATCHDOG_KEEP, QEMU_MONITOR_ACTION_PANIC_KEEP); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(priv->driver, vm); + if (rc < 0) return -1; return 0; @@ -8390,7 +8394,8 @@ qemuProcessRefreshCPUMigratability(virQEMUDriver *driver, rc = qemuMonitorGetCPUMigratable(priv->mon, &migratable); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; if (rc == 1) @@ -8547,7 +8552,9 @@ qemuProcessRefreshLegacyBlockjobs(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); blockJobs = qemuMonitorGetAllBlockJobInfo(qemuDomainGetMonitor(vm), true); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockJobs) + qemuDomainObjExitMonitor(driver, vm); + + if (!blockJobs) goto cleanup; if (virHashForEach(blockJobs, qemuProcessRefreshLegacyBlockjob, vm) < 0) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index ff827d5313..d0b2d40e94 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1032,7 +1032,8 @@ qemuSnapshotDiskPrepareOneBlockdev(virQEMUDriver *driver, rc = qemuBlockStorageSourceAttachApply(qemuDomainGetMonitor(vm), dd->crdata->srcdata[0]); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + qemuDomainObjExitMonitor(driver, vm); + if (rc < 0) return -1; } else { if (qemuBlockStorageSourceCreateDetectSize(blockNamedNodeData, -- 2.31.1