Remove the unreachable code. Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/qemu/qemu_backup.c | 9 +- src/qemu/qemu_block.c | 3 +- src/qemu/qemu_blockjob.c | 28 ++--- src/qemu/qemu_checkpoint.c | 3 +- src/qemu/qemu_domain.c | 14 +-- src/qemu/qemu_driver.c | 110 +++++++------------- src/qemu/qemu_hotplug.c | 170 +++++++++---------------------- src/qemu/qemu_migration.c | 27 ++--- src/qemu/qemu_migration_params.c | 6 +- src/qemu/qemu_process.c | 54 ++++------ src/qemu/qemu_snapshot.c | 6 +- 11 files changed, 134 insertions(+), 296 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 9fa8d2f02e..193d4ccd29 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -677,8 +677,7 @@ qemuBackupJobCancelBlockjobs(virDomainObj *vm, rc = qemuMonitorBlockJobCancel(priv->mon, job->name, true); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) - return; + qemuDomainObjExitMonitor(priv->driver, vm); if (rc == 0) { backupdisk->state = VIR_DOMAIN_BACKUP_DISK_STATE_CANCELLING; @@ -910,8 +909,7 @@ qemuBackupBegin(virDomainObj *vm, /* note that if the export fails we've already created the checkpoint * and we will not delete it */ rc = qemuBackupBeginPullExportDisks(vm, dd, ndd); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) - goto endjob; + qemuDomainObjExitMonitor(priv->driver, vm); if (rc < 0) { qemuBackupJobCancelBlockjobs(vm, priv->backup, false, QEMU_ASYNC_JOB_BACKUP); @@ -1003,8 +1001,7 @@ qemuBackupNotifyBlockjobEnd(virDomainObj *vm, ignore_value(qemuMonitorDelObject(priv->mon, backup->tlsAlias, false)); if (backup->tlsSecretAlias) ignore_value(qemuMonitorDelObject(priv->mon, backup->tlsSecretAlias, false)); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) - return; + qemuDomainObjExitMonitor(priv->driver, vm); /* update the final statistics with the current job's data */ backup->pull_tmp_used += cur; diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 53a0b919f9..44579a83ea 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2136,8 +2136,7 @@ qemuBlockStorageSourceDetachOneBlockdev(virQEMUDriver *driver, if (ret == 0) ret = qemuMonitorBlockdevDel(qemuDomainGetMonitor(vm), src->nodestorage); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); return ret; } diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index faf9a9fb7d..e7c3fea946 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -530,8 +530,7 @@ qemuBlockJobRefreshJobs(virQEMUDriver *driver, if (rc == -1 && jobinfo[i]->status == QEMU_MONITOR_JOB_STATUS_CONCLUDED) VIR_WARN("can't cancel job '%s' with invalid data", job->name); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) qemuBlockJobUnregister(job, vm); @@ -847,8 +846,8 @@ qemuBlockJobEventProcessConcludedRemoveChain(virQEMUDriver *driver, return; qemuBlockStorageSourceChainDetach(qemuDomainGetMonitor(vm), data); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return; + + qemuDomainObjExitMonitor(driver, vm); qemuDomainStorageSourceChainAccessRevoke(driver, vm, chain); } @@ -964,8 +963,7 @@ qemuBlockJobProcessEventCompletedPullBitmaps(virDomainObj *vm, qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(priv->driver, vm); return 0; } @@ -1138,8 +1136,7 @@ qemuBlockJobProcessEventCompletedCommitBitmaps(virDomainObj *vm, qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(priv->driver, vm); if (!active) { if (qemuBlockReopenReadOnly(vm, job->data.commit.base, asyncJob) < 0) @@ -1359,8 +1356,7 @@ qemuBlockJobProcessEventCompletedCopyBitmaps(virDomainObj *vm, qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(priv->driver, vm); return 0; } @@ -1442,8 +1438,7 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDriver *driver, disk->mirror->nodeformat, "libvirt-tmp-activewrite"); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) - return; + qemuDomainObjExitMonitor(priv->driver, vm); /* Ideally, we would make the backing chain read only again (yes, SELinux * can do that using different labels). But that is not implemented yet and @@ -1491,8 +1486,7 @@ qemuBlockJobProcessEventConcludedCreate(virQEMUDriver *driver, qemuBlockStorageSourceAttachRollback(qemuDomainGetMonitor(vm), backend); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return; + qemuDomainObjExitMonitor(driver, vm); qemuDomainStorageSourceAccessRevoke(driver, vm, job->data.create.src); } @@ -1527,8 +1521,7 @@ qemuBlockJobProcessEventConcludedBackup(virQEMUDriver *driver, job->disk->src->nodeformat, job->data.backup.bitmap); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return; + qemuDomainObjExitMonitor(driver, vm); if (job->data.backup.store) qemuDomainStorageSourceAccessRevoke(driver, vm, job->data.backup.store); @@ -1641,8 +1634,7 @@ qemuBlockJobEventProcessConcluded(qemuBlockJobData *job, /* dismiss job in qemu */ ignore_value(qemuMonitorJobDismiss(qemuDomainGetMonitor(vm), job->name)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); if ((job->newstate == QEMU_BLOCKJOB_STATE_COMPLETED || job->newstate == QEMU_BLOCKJOB_STATE_FAILED) && diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 4902585e5d..38ea57dea7 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -237,8 +237,7 @@ qemuCheckpointDiscardBitmaps(virDomainObj *vm, qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); relabel: for (next = relabelimages; next; next = next->next) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1f45b30975..d0d9a31f37 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8181,8 +8181,7 @@ qemuDomainUpdateDeviceList(virQEMUDriver *driver, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) return -1; rc = qemuMonitorGetDeviceAliases(priv->mon, &aliases); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) return -1; @@ -8210,10 +8209,7 @@ qemuDomainUpdateMemoryDeviceInfo(virQEMUDriver *driver, rc = qemuMonitorGetMemoryDeviceInfo(priv->mon, &meminfo); - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - virHashFree(meminfo); - return -1; - } + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) return -1; @@ -9480,8 +9476,7 @@ qemuDomainRefreshVcpuInfo(virQEMUDriver *driver, rc = qemuMonitorGetCPUInfo(qemuDomainGetMonitor(vm), &info, maxvcpus, hotplug, fast); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) goto cleanup; @@ -10054,8 +10049,7 @@ qemuDomainCheckMonitor(virQEMUDriver *driver, ret = qemuMonitorCheck(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); return ret; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index aa48480043..33686f4f23 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1939,8 +1939,7 @@ qemuDomainShutdownFlagsMonitor(virQEMUDriver *driver, qemuDomainSetFakeReboot(driver, vm, isReboot); qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorSystemPowerdown(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); endjob: qemuDomainObjEndJob(driver, vm); @@ -2065,8 +2064,7 @@ qemuDomainRebootMonitor(virQEMUDriver *driver, qemuDomainSetFakeReboot(driver, vm, isReboot); qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorSystemPowerdown(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); endjob: qemuDomainObjEndJob(driver, vm); @@ -2155,8 +2153,7 @@ qemuDomainReset(virDomainPtr dom, unsigned int flags) priv = vm->privateData; qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorSystemReset(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); priv->fakeReboot = false; @@ -2471,8 +2468,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, qemuDomainObjEnterMonitor(driver, vm); r = qemuMonitorSetMemoryStatsPeriod(priv->mon, def->memballoon, period); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; + qemuDomainObjExitMonitor(driver, vm); if (r < 0) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("unable to set balloon driver collection period")); @@ -2529,8 +2525,7 @@ static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int flags) qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorInjectNMI(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); endjob: qemuDomainObjEndJob(driver, vm); @@ -2589,8 +2584,7 @@ static int qemuDomainSendKey(virDomainPtr domain, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorSendKey(priv->mon, holdtime, keycodes, nkeycodes); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); endjob: qemuDomainObjEndJob(driver, vm); @@ -3309,8 +3303,7 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom, if ((ret == 0) && (flags & VIR_DUMP_RESET)) { qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorSystemReset(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); } if (resume && virDomainObjIsActive(vm)) { @@ -3427,8 +3420,7 @@ qemuDomainScreenshot(virDomainPtr dom, ignore_value(qemuDomainObjExitMonitor(driver, vm)); goto endjob; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; + qemuDomainObjExitMonitor(driver, vm); if (VIR_CLOSE(tmp_fd) < 0) { virReportSystemError(errno, _("unable to close %s"), tmp); @@ -3928,8 +3920,7 @@ processNicRxFilterChangedEvent(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorQueryRxFilter(priv->mon, devAlias, &guestFilter); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); if (ret < 0) goto endjob; @@ -4975,8 +4966,7 @@ qemuDomainGetIOThreadsMon(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorGetIOThreads(priv->mon, iothreads, niothreads); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); return ret; } @@ -5263,8 +5253,7 @@ qemuDomainHotplugAddIOThread(virQEMUDriver *driver, if (qemuMonitorGetIOThreads(priv->mon, &new_iothreads, &new_niothreads) < 0) goto exit_monitor; - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); if (new_niothreads != exp_niothreads) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -5349,8 +5338,7 @@ qemuDomainHotplugModIOThread(virQEMUDriver *driver, rc = qemuMonitorSetIOThread(priv->mon, &iothread); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) return -1; @@ -5386,8 +5374,7 @@ qemuDomainHotplugDelIOThread(virQEMUDriver *driver, if (qemuMonitorGetIOThreads(priv->mon, &new_iothreads, &new_niothreads) < 0) goto exit_monitor; - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); if (new_niothreads != exp_niothreads) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -9921,8 +9908,7 @@ qemuDomainBlockResize(virDomainPtr dom, ignore_value(qemuDomainObjExitMonitor(driver, vm)); goto endjob; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; + qemuDomainObjExitMonitor(driver, vm); ret = 0; @@ -10638,8 +10624,7 @@ qemuDomainMemoryStatsInternal(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorGetMemoryStats(qemuDomainGetMonitor(vm), vm->def->memballoon, stats, nr_stats); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); if (ret < 0 || ret >= nr_stats) return ret; @@ -10816,8 +10801,7 @@ qemuDomainMemoryPeek(virDomainPtr dom, goto endjob; } } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; + qemuDomainObjExitMonitor(driver, vm); /* Read the memory file into buffer. */ if (saferead(fd, buffer, size) == (ssize_t)-1) { @@ -12784,8 +12768,7 @@ qemuDomainAbortJobMigration(virDomainObj *vm) qemuDomainObjAbortAsyncJob(vm); qemuDomainObjEnterMonitor(priv->driver, vm); ret = qemuMonitorMigrateCancel(priv->mon); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(priv->driver, vm); return ret; } @@ -13342,8 +13325,7 @@ qemuDomainMigrateStartPostCopy(virDomainPtr dom, VIR_DEBUG("Starting post-copy"); qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorMigrateStartPostCopy(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); endjob: qemuDomainObjEndJob(driver, vm); @@ -14057,8 +14039,7 @@ static int qemuDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorArbitraryCommand(priv->mon, cmd, result, hmp); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); endjob: qemuDomainObjEndJob(driver, vm); @@ -14333,8 +14314,7 @@ qemuDomainBlockPivot(virQEMUDriver *driver, } else { ret = qemuMonitorDrivePivot(priv->mon, job->name); } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); /* The pivot failed. The block job in QEMU remains in the synchronised state */ if (ret < 0) @@ -14465,8 +14445,7 @@ qemuDomainBlockPullCommon(virDomainObj *vm, (!baseSource || basePath)) ret = qemuMonitorBlockStream(priv->mon, device, jobname, persistjob, basePath, nodebase, backingPath, speed); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); if (ret < 0) goto endjob; @@ -14540,10 +14519,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom, } else { qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorBlockJobCancel(priv->mon, job->name, false); - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - ret = -1; - goto endjob; - } + qemuDomainObjExitMonitor(driver, vm); if (ret < 0) goto endjob; @@ -14758,8 +14734,7 @@ qemuDomainBlockJobSetSpeed(virDomainPtr dom, ret = qemuMonitorBlockJobSetSpeed(qemuDomainGetMonitor(vm), job->name, speed); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); endjob: qemuDomainObjEndJob(driver, vm); @@ -15142,8 +15117,7 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, if (data) { qemuDomainObjEnterMonitor(driver, vm); rc = qemuBlockStorageSourceChainAttach(priv->mon, data); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) goto endjob; @@ -15177,8 +15151,7 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, } virDomainAuditDisk(vm, NULL, mirror, "mirror", ret >= 0); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); if (ret < 0) { qemuDomainStorageSourceChainAccessRevoke(driver, vm, mirror); goto endjob; @@ -15707,8 +15680,7 @@ qemuDomainOpenGraphics(virDomainPtr dom, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorOpenGraphics(priv->mon, protocol, fd, "graphicsfd", (flags & VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH) != 0); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); endjob: qemuDomainObjEndJob(driver, vm); @@ -15784,8 +15756,7 @@ qemuDomainOpenGraphicsFD(virDomainPtr dom, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorOpenGraphics(priv->mon, protocol, pair[1], "graphicsfd", (flags & VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); qemuDomainObjEndJob(driver, vm); if (ret < 0) goto cleanup; @@ -16221,8 +16192,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qdevid, &info); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); if (ret < 0) goto endjob; ret = -1; @@ -16352,8 +16322,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, } qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorGetBlockIoThrottle(priv->mon, drivealias, qdevid, &reply); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; + qemuDomainObjExitMonitor(driver, vm); if (ret < 0) goto endjob; } @@ -16472,8 +16441,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom, qemuDomainObjEnterMonitor(driver, vm); table = qemuMonitorGetBlockInfo(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; + qemuDomainObjExitMonitor(driver, vm); if (!table) goto endjob; @@ -16804,8 +16772,7 @@ qemuDomainPMWakeup(virDomainPtr dom, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorSystemWakeup(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); endjob: qemuDomainObjEndJob(driver, vm); @@ -17365,8 +17332,7 @@ qemuDomainSetTime(virDomainPtr dom, if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION)) { qemuDomainObjEnterMonitor(driver, vm); rv = qemuMonitorRTCResetReinjection(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; + qemuDomainObjExitMonitor(driver, vm); if (rv < 0) goto endjob; @@ -18498,8 +18464,7 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver, if (fetchnodedata) nodedata = qemuMonitorQueryNamedBlockNodes(priv->mon); - if (qemuDomainObjExitMonitor(driver, dom) < 0) - return -1; + qemuDomainObjExitMonitor(driver, dom); /* failure to retrieve stats is fine at this point */ if (rc < 0 || (fetchnodedata && !nodedata)) @@ -18637,8 +18602,7 @@ qemuDomainGetStatsDirtyRateMon(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorQueryDirtyRate(priv->mon, info); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); return ret; } @@ -20008,8 +19972,7 @@ qemuDomainGetSEVMeasurement(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); tmp = qemuMonitorGetSEVMeasurement(QEMU_DOMAIN_PRIVATE(vm)->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; + qemuDomainObjExitMonitor(driver, vm); if (!tmp) goto endjob; @@ -20678,8 +20641,7 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorStartDirtyRateCalc(priv->mon, seconds); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); endjob: qemuDomainObjEndJob(driver, vm); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 7ae0088c6a..59b3e57fd3 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -109,10 +109,7 @@ qemuDomainDeleteDevice(virDomainObj *vm, rc = qemuMonitorDelDevice(priv->mon, alias); - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - /* Domain is no longer running. No cleanup needed. */ - return -1; - } + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) { /* Deleting device failed. Let's check if DEVICE_DELETED @@ -272,8 +269,7 @@ qemuDomainChangeMediaLegacy(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorEjectMedia(priv->mon, driveAlias, force); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); /* If the tray is present wait for it to open. */ if (!force && diskPriv->tray) { @@ -305,8 +301,7 @@ qemuDomainChangeMediaLegacy(virQEMUDriver *driver, driveAlias, sourcestr, format); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); } if (rc < 0) @@ -354,8 +349,7 @@ qemuHotplugAttachDBusVMState(virQEMUDriver *driver, if (ret == 0) priv->dbusVMState = true; - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); return ret; } @@ -391,8 +385,7 @@ qemuHotplugRemoveDBusVMState(virQEMUDriver *driver, if (ret == 0) priv->dbusVMState = false; - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); return ret; } @@ -479,8 +472,7 @@ qemuHotplugRemoveManagedPR(virQEMUDriver *driver, goto cleanup; ignore_value(qemuMonitorDelObject(priv->mon, qemuDomainGetManagedPRAlias(), false)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); qemuProcessKillManagedPRDaemon(vm); @@ -757,8 +749,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, rc = qemuBlockStorageSourceChainAttach(priv->mon, data); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -2; + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) goto rollback; @@ -808,8 +799,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, VIR_WARN("failed to set blkdeviotune for '%s' of '%s'", disk->dst, vm->def->name); } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -2; + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) goto rollback; @@ -825,8 +815,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver, qemuBlockStorageSourceChainDetach(priv->mon, data); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -2; + qemuDomainObjExitMonitor(driver, vm); return -1; } @@ -891,11 +880,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriver *driver, ignore_value(qemuDomainDetachExtensionDevice(priv->mon, &controller->info)); exit_monitor: - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - releaseaddr = false; - ret = -1; - goto cleanup; - } + qemuDomainObjExitMonitor(driver, vm); if (ret == 0) virDomainControllerInsertPreAlloced(vm->def, controller); @@ -1486,8 +1471,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver, } netdevPlugged = true; - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); for (i = 0; i < tapfdSize; i++) VIR_FORCE_CLOSE(tapfd[i]); @@ -1511,8 +1495,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver, virDomainAuditNet(vm, NULL, net, "attach", false); goto try_remove; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); /* set link state */ if (net->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) { @@ -1528,8 +1511,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver, goto try_remove; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); } /* link set to down */ } @@ -1728,8 +1710,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, ignore_value(qemuDomainDetachExtensionDevice(priv->mon, hostdev->info)); exit_monitor: - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto error; + qemuDomainObjExitMonitor(driver, vm); virDomainAuditHostdev(vm, hostdev, "attach", ret == 0); if (ret < 0) @@ -1940,8 +1921,7 @@ qemuDomainDelChardevTLSObjects(virQEMUDriver *driver, if (secAlias) ignore_value(qemuMonitorDelObject(priv->mon, secAlias, false)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); return 0; } @@ -1989,8 +1969,7 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriver *driver, if (qemuMonitorAddDeviceProps(priv->mon, &devprops) < 0) goto exit_monitor; - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto audit; + qemuDomainObjExitMonitor(driver, vm); def->redirdevs[def->nredirdevs++] = redirdev; ret = 0; @@ -2255,8 +2234,7 @@ int qemuDomainAttachChrDevice(virQEMUDriver *driver, goto exit_monitor; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto audit; + qemuDomainObjExitMonitor(driver, vm); qemuDomainChrInsertPreAlloced(vmdef, chr); ret = 0; @@ -2363,10 +2341,7 @@ qemuDomainAttachRNGDevice(virQEMUDriver *driver, goto exit_monitor; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - releaseaddr = false; - goto cleanup; - } + qemuDomainObjExitMonitor(driver, vm); VIR_APPEND_ELEMENT_INPLACE(vm->def->rngs, vm->def->nrngs, rng); @@ -2393,8 +2368,7 @@ qemuDomainAttachRNGDevice(virQEMUDriver *driver, ignore_value(qemuMonitorDelObject(priv->mon, objAlias, false)); if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD && chardevAdded) ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - releaseaddr = false; + qemuDomainObjExitMonitor(driver, vm); virErrorRestore(&orig_err); qemuDomainDelTLSObjects(driver, vm, QEMU_ASYNC_JOB_NONE, @@ -2487,11 +2461,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver, if (qemuMonitorAddDeviceProps(priv->mon, &devprops) < 0) goto exit_monitor; - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - /* we shouldn't touch mem now, as the def might be freed */ - mem = NULL; - goto audit; - } + qemuDomainObjExitMonitor(driver, vm); event = virDomainEventDeviceAddedNewFromObj(vm, objalias); virObjectEventStateQueue(driver->domainEventState, event); @@ -2531,8 +2501,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver, virErrorPreserveLast(&orig_err); if (objAdded) ignore_value(qemuMonitorDelObject(priv->mon, objalias, false)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - mem = NULL; + qemuDomainObjExitMonitor(driver, vm); if (objAdded && mem) ignore_value(qemuProcessDestroyMemoryBackingPath(driver, vm, mem)); @@ -2597,10 +2566,7 @@ qemuDomainAttachHostUSBDevice(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorAddDeviceProps(priv->mon, &devprops); - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - ret = -1; - goto cleanup; - } + qemuDomainObjExitMonitor(driver, vm); virDomainAuditHostdev(vm, hostdev, "attach", ret == 0); if (ret < 0) goto cleanup; @@ -2694,8 +2660,7 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriver *driver, if (qemuMonitorAddDeviceProps(priv->mon, &devprops) < 0) goto exit_monitor; - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); virDomainAuditHostdev(vm, hostdev, "attach", true); @@ -2914,10 +2879,7 @@ qemuDomainAttachMediatedDevice(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorAddDeviceProps(priv->mon, &devprops); - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - ret = -1; - goto cleanup; - } + qemuDomainObjExitMonitor(driver, vm); virDomainAuditHostdev(vm, hostdev, "attach", ret == 0); if (ret < 0) @@ -3072,10 +3034,7 @@ qemuDomainAttachShmemDevice(virQEMUDriver *driver, goto exit_monitor; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - release_address = false; - goto cleanup; - } + qemuDomainObjExitMonitor(driver, vm); /* Doing a copy here just so the pointer doesn't get nullified * because we need it in the audit function */ @@ -3104,8 +3063,7 @@ qemuDomainAttachShmemDevice(virQEMUDriver *driver, ignore_value(qemuMonitorDelObject(priv->mon, memAlias, false)); } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - release_address = false; + qemuDomainObjExitMonitor(driver, vm); virErrorRestore(&orig_err); @@ -3205,10 +3163,7 @@ qemuDomainAttachWatchdog(virQEMUDriver *driver, if (rv >= 0) rv = qemuMonitorAddDeviceProps(priv->mon, &props); - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - releaseAddress = false; - goto cleanup; - } + qemuDomainObjExitMonitor(driver, vm); if (rv < 0) goto cleanup; @@ -3296,10 +3251,7 @@ qemuDomainAttachInputDevice(virQEMUDriver *driver, goto exit_monitor; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - releaseaddr = false; - goto cleanup; - } + qemuDomainObjExitMonitor(driver, vm); VIR_APPEND_ELEMENT_COPY_INPLACE(vm->def->inputs, vm->def->ninputs, input); @@ -3325,10 +3277,7 @@ qemuDomainAttachInputDevice(virQEMUDriver *driver, return ret; exit_monitor: - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - releaseaddr = false; - goto cleanup; - } + qemuDomainObjExitMonitor(driver, vm); goto audit; } @@ -3386,10 +3335,7 @@ qemuDomainAttachVsockDevice(virQEMUDriver *driver, if ((ret = qemuMonitorAddDeviceProps(priv->mon, &devprops)) < 0) goto exit_monitor; - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - releaseaddr = false; - goto cleanup; - } + qemuDomainObjExitMonitor(driver, vm); vm->def->vsock = g_steal_pointer(&vsock); @@ -3410,8 +3356,7 @@ qemuDomainAttachVsockDevice(virQEMUDriver *driver, ignore_value(qemuMonitorCloseFileHandle(priv->mon, fdname)); if (removeextension) ignore_value(qemuDomainDetachExtensionDevice(priv->mon, &vsock->info)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - releaseaddr = false; + qemuDomainObjExitMonitor(driver, vm); goto cleanup; } @@ -3480,10 +3425,7 @@ qemuDomainAttachFSDevice(virQEMUDriver *driver, goto exit_monitor; } - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - releaseaddr = false; - goto cleanup; - } + qemuDomainObjExitMonitor(driver, vm); VIR_APPEND_ELEMENT_COPY(vm->def->fss, vm->def->nfss, fs); @@ -3507,8 +3449,7 @@ qemuDomainAttachFSDevice(virQEMUDriver *driver, virErrorPreserveLast(&origErr); if (chardevAdded) ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - releaseaddr = false; + qemuDomainObjExitMonitor(driver, vm); virErrorRestore(&origErr); goto audit; } @@ -3677,8 +3618,7 @@ int qemuDomainChangeNetLinkState(virQEMUDriver *driver, dev->linkstate = linkstate; cleanup: - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); return ret; } @@ -4272,8 +4212,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriver *driver, ret = qemuMonitorExpirePassword(priv->mon, type, expire); end_job: - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); return ret; } @@ -4552,8 +4491,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriver *driver, if (diskBackend) qemuBlockStorageSourceChainDetach(priv->mon, diskBackend); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); virDomainAuditDisk(vm, disk->src, NULL, "detach", true); @@ -4629,8 +4567,7 @@ qemuDomainRemoveMemoryDevice(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorDelObject(priv->mon, backendAlias, true); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - rc = -1; + qemuDomainObjExitMonitor(driver, vm); virDomainAuditMemory(vm, oldmem, newmem, "update", rc == 0); if (rc < 0) @@ -4729,8 +4666,7 @@ qemuDomainRemoveHostDevice(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); qemuBlockStorageSourceAttachRollback(priv->mon, detachscsi); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); } if (hostdev->parentnet) { @@ -4847,8 +4783,7 @@ qemuDomainRemoveNetDevice(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); if (qemuMonitorRemoveNetdev(priv->mon, hostnet_name) < 0) { - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); virDomainAuditNet(vm, net, NULL, "detach", false); return -1; } @@ -4894,8 +4829,7 @@ qemuDomainRemoveNetDevice(virQEMUDriver *driver, } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); if (QEMU_DOMAIN_NETWORK_PRIVATE(net)->slirp) qemuSlirpStop(QEMU_DOMAIN_NETWORK_PRIVATE(net)->slirp, vm, driver, net); @@ -4969,8 +4903,7 @@ qemuDomainRemoveChrDevice(virQEMUDriver *driver, if (monitor) { qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorDetachCharDev(priv->mon, charAlias); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); } if (rc == 0 && @@ -5036,8 +4969,7 @@ qemuDomainRemoveRNGDevice(virQEMUDriver *driver, qemuMonitorDetachCharDev(priv->mon, charAlias) < 0) rc = -1; - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD && rc == 0 && @@ -5091,8 +5023,7 @@ qemuDomainRemoveShmemDevice(virQEMUDriver *driver, else rc = qemuMonitorDelObject(priv->mon, memAlias, true); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); virDomainAuditShmem(vm, shmem, "detach", rc == 0); @@ -5186,8 +5117,7 @@ qemuDomainRemoveRedirdevDevice(virQEMUDriver *driver, */ ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); if (qemuDomainDelChardevTLSObjects(driver, vm, dev->source, charAlias) < 0) return -1; @@ -5224,8 +5154,7 @@ qemuDomainRemoveFSDevice(virQEMUDriver *driver, if (qemuMonitorDetachCharDev(priv->mon, charAlias) < 0) rc = -1; - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); } virDomainAuditFS(vm, fs, NULL, "detach", rc == 0); @@ -5966,8 +5895,7 @@ qemuDomainDetachDeviceChr(virQEMUDriver *driver, int rc; qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorRemoveNetdev(priv->mon, tmpChr->info.alias); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - rc = -1; + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) goto cleanup; @@ -6503,8 +6431,7 @@ qemuDomainHotplugAddVcpu(virQEMUDriver *driver, rc = qemuMonitorAddDeviceProps(qemuDomainGetMonitor(vm), &vcpuprops); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); virDomainAuditVcpu(vm, oldvcpus, oldvcpus + nvcpus, "update", rc == 0); @@ -7000,8 +6927,7 @@ qemuDomainChangeMemoryRequestedSize(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorChangeMemoryRequestedSize(priv->mon, alias, requestedsize); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); return rc; } diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 8001792f5a..3fd0db15bb 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -515,8 +515,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriver *driver, if (qemuBlockExportAddNBD(vm, diskAlias, disk->src, diskAlias, true, NULL) < 0) goto exit_monitor; - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); } if (server.transport == VIR_STORAGE_NET_HOST_TRANS_TCP) @@ -551,8 +550,7 @@ qemuMigrationDstStopNBDServer(virQEMUDriver *driver, if (qemuMonitorNBDServerStop(priv->mon) < 0) VIR_WARN("Unable to stop NBD server"); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); virPortAllocatorRelease(priv->nbdPort); priv->nbdPort = 0; @@ -873,8 +871,7 @@ qemuMigrationSrcCancelRemoveTempBitmaps(virDomainObj *vm, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) return -1; qemuMonitorBitmapRemove(priv->mon, t->nodename, t->bitmapname); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); } return 0; @@ -2039,8 +2036,7 @@ qemuMigrationSrcGraphicsRelocate(virQEMUDriver *driver, ret = qemuMonitorGraphicsRelocate(priv->mon, type, listenAddress, port, tlsPort, tlsSubject); jobPriv->spiceMigration = !ret; - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); } cleanup: @@ -3811,8 +3807,7 @@ qemuMigrationSrcContinue(virQEMUDriver *driver, ret = qemuMonitorMigrateContinue(priv->mon, status); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); return ret; } @@ -3835,8 +3830,7 @@ qemuMigrationSetDBusVMState(virQEMUDriver *driver, rv = qemuMonitorSetDBusVMStateIdList(priv->mon, priv->dbusVMStateIds); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - rv = -1; + qemuDomainObjExitMonitor(driver, vm); return rv; } else { @@ -5932,8 +5926,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm, qemuMonitorSetMigrationSpeed(priv->mon, QEMU_DOMAIN_MIG_BANDWIDTH_MAX); priv->migMaxBandwidth = QEMU_DOMAIN_MIG_BANDWIDTH_MAX; - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); } } @@ -5984,8 +5977,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm, VIR_CLOSE(pipeFD[1]) < 0) VIR_WARN("failed to close intermediate pipe"); } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) goto cleanup; @@ -6057,8 +6049,7 @@ qemuMigrationSrcCancel(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); ignore_value(qemuMonitorMigrateCancel(priv->mon)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); for (i = 0; i < vm->def->ndisks; i++) { virDomainDiskDef *disk = vm->def->disks[i]; diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c index 8df7aac93a..7bfae29de4 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -870,8 +870,7 @@ qemuMigrationParamsApply(virQEMUDriver *driver, ret = 0; cleanup: - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); if (xbzrleCacheSize_old) migParams->params[xbzrle].set = true; @@ -1412,8 +1411,7 @@ qemuMigrationCapsCheck(virQEMUDriver *driver, rc = qemuMonitorSetMigrationCapabilities(priv->mon, &json); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) { virResetLastError(); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c355a39e15..1148e6072f 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -473,8 +473,7 @@ qemuProcessFakeReboot(void *opaque) qemuDomainObjEnterMonitor(driver, vm); rc = qemuMonitorSystemReset(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto endjob; + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) goto endjob; @@ -1956,8 +1955,7 @@ qemuProcessInitMonitor(virQEMUDriver *driver, ret = qemuMonitorSetCapabilities(QEMU_DOMAIN_PRIVATE(vm)->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); return ret; } @@ -2252,8 +2250,7 @@ qemuRefreshVirtioChannelState(virQEMUDriver *driver, goto cleanup; ret = qemuMonitorGetChardevInfo(priv->mon, &info); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); if (ret < 0) goto cleanup; @@ -2306,8 +2303,7 @@ qemuRefreshPRManagerState(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorGetPRManagerInfo(priv->mon, &info); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); if (ret < 0) goto cleanup; @@ -2337,8 +2333,7 @@ qemuRefreshRTC(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); now = time(NULL); rv = qemuMonitorGetRTCTime(priv->mon, &thenbits); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - rv = -1; + qemuDomainObjExitMonitor(driver, vm); if (rv < 0) return; @@ -2427,8 +2422,7 @@ qemuProcessWaitForMonitor(virQEMUDriver *driver, goto cleanup; ret = qemuMonitorGetChardevInfo(priv->mon, &info); VIR_DEBUG("qemuMonitorGetChardevInfo returned %i", ret); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); if (ret == 0) { if ((ret = qemuProcessFindCharDevicePTYsMonitor(vm, info)) < 0) @@ -2470,8 +2464,7 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriver *driver, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) goto cleanup; ret = qemuMonitorGetIOThreads(priv->mon, &iothreads, &niothreads); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); if (ret < 0) goto cleanup; @@ -2646,8 +2639,7 @@ qemuProcessSetLinkStates(virQEMUDriver *driver, ret = 0; cleanup: - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); return ret; } @@ -3194,8 +3186,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriver *driver, } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); cfg = virQEMUDriverGetConfig(driver); ret = virDomainObjSave(vm, driver->xmlopt, cfg->stateDir); @@ -3326,8 +3317,7 @@ qemuProcessStartCPUs(virQEMUDriver *driver, virDomainObj *vm, goto release; ret = qemuMonitorStartCPUs(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); if (ret < 0) goto release; @@ -3364,8 +3354,7 @@ int qemuProcessStopCPUs(virQEMUDriver *driver, goto cleanup; ret = qemuMonitorStopCPUs(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); if (ret < 0) goto cleanup; @@ -3476,8 +3465,7 @@ qemuProcessUpdateState(virQEMUDriver *driver, virDomainObj *vm) qemuDomainObjEnterMonitor(driver, vm); ret = qemuMonitorGetStatus(priv->mon, &running, &reason); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); if (ret < 0) return -1; @@ -3713,8 +3701,7 @@ qemuProcessRecoverJob(virQEMUDriver *driver, case QEMU_ASYNC_JOB_SNAPSHOT: qemuDomainObjEnterMonitor(driver, vm); ignore_value(qemuMonitorMigrateCancel(priv->mon)); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); /* resume the domain but only if it was paused as a result of * running a migration-to-file operation. Although we are * recovering an async job, this function is run at startup @@ -4355,8 +4342,7 @@ qemuProcessFetchGuestCPU(virQEMUDriver *driver, rc = qemuMonitorGetGuestCPUx86(priv->mon, &dataEnabled, &dataDisabled); } - if (qemuDomainObjExitMonitor(driver, vm) < 0) - return -1; + qemuDomainObjExitMonitor(driver, vm); if (rc == -1) return -1; @@ -5206,8 +5192,7 @@ qemuProcessSetupBalloon(virQEMUDriver *driver, ret = 0; cleanup: - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); return ret; } @@ -6115,8 +6100,7 @@ qemuProcessSetupHotpluggableVcpus(virQEMUDriver *driver, rc = qemuMonitorAddDeviceProps(qemuDomainGetMonitor(vm), &vcpuprops); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); if (rc < 0) goto cleanup; @@ -7023,8 +7007,7 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver *driver, ret = 0; cleanup: - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); return ret; } @@ -8337,8 +8320,7 @@ qemuProcessRefreshDisks(virQEMUDriver *driver, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { table = qemuMonitorGetBlockInfo(priv->mon); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + qemuDomainObjExitMonitor(driver, vm); } if (!table) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 661aeeb8aa..ff827d5313 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -330,8 +330,7 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *driver, } ret = qemuMonitorCreateSnapshot(priv->mon, snap->def->name); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret = -1; + qemuDomainObjExitMonitor(driver, vm); if (ret < 0) goto cleanup; @@ -1289,8 +1288,7 @@ qemuSnapshotDiskCreate(qemuSnapshotDiskContext *snapctxt) rc = qemuMonitorTransaction(priv->mon, &snapctxt->actions); - if (qemuDomainObjExitMonitor(driver, snapctxt->vm) < 0) - rc = -1; + qemuDomainObjExitMonitor(driver, snapctxt->vm); for (i = 0; i < snapctxt->ndd; i++) { qemuSnapshotDiskData *dd = snapctxt->dd + i; -- 2.31.1