Part of work can be done by perl: perl -0777 -i.bak -pe 's/if \(qemuDomainObjEnterMonitorAsync\(driver, vm,\n? .*\) < 0\)\n \ +return -1;/qemuDomainObjEnterMonitor(vm);/g' src/qemu/* perl -0777 -i.bak -pe 's/if \(qemuDomainObjEnterMonitorAsync\(driver, vm,\n? .*\) < 0\)\n \ +goto .+;/qemuDomainObjEnterMonitor(vm);/g' src/qemu/* Part should be done by hand. Then drop asyncJob and driver parameters from the callers until gcc stops giving 'unused parameter' error. --- src/qemu/qemu_domain.c | 69 +++---------- src/qemu/qemu_domain.h | 25 +---- src/qemu/qemu_driver.c | 152 ++++++++++------------------ src/qemu/qemu_hotplug.c | 34 +++---- src/qemu/qemu_hotplug.h | 9 +- src/qemu/qemu_migration.c | 250 +++++++++++++++------------------------------- src/qemu/qemu_migration.h | 7 +- src/qemu/qemu_process.c | 186 +++++++++++++--------------------- src/qemu/qemu_process.h | 20 +--- 9 files changed, 245 insertions(+), 507 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0a51fe8..f426805 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3478,8 +3478,8 @@ qemuDomainObjAbortAsyncJob(virDomainObjPtr obj) * * To be followed with qemuDomainObjExitMonitor() once complete */ -static void -qemuDomainObjEnterMonitorInternal(virDomainObjPtr obj) +void +qemuDomainObjEnterMonitor(virDomainObjPtr obj) { qemuDomainObjPrivatePtr priv = obj->privateData; @@ -3511,11 +3511,6 @@ qemuDomainObjExitMonitorInternal(virDomainObjPtr obj) priv->mon = NULL; } -void qemuDomainObjEnterMonitor(virDomainObjPtr obj) -{ - qemuDomainObjEnterMonitorInternal(obj); -} - /* obj must NOT be locked before calling * * Should be paired with an earlier qemuDomainObjEnterMonitor() call @@ -3541,30 +3536,6 @@ int qemuDomainObjExitMonitor(virDomainObjPtr obj) /* * obj must be locked before calling * - * To be called immediately before any QEMU monitor API call. - * Must have already either called qemuDomainObjBeginJob() - * and checked that the VM is still active, with asyncJob of - * QEMU_ASYNC_JOB_NONE; or already called qemuDomainObjBeginAsyncJob, - * with the same asyncJob. - * - * Returns 0 if job was started, in which case this must be followed with - * qemuDomainObjExitMonitor(); -2 if waiting for the nested job times out; - * or -1 if the job could not be started (probably because the vm exited - * in the meantime). - */ -int -qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, - virDomainObjPtr obj, - qemuDomainAsyncJob asyncJob ATTRIBUTE_UNUSED) -{ - qemuDomainObjEnterMonitorInternal(obj); - return 0; -} - - -/* - * obj must be locked before calling - * * To be called immediately before any QEMU agent API call. * Must have already called qemuDomainObjBeginJob() and checked * that the VM is still active. @@ -5191,9 +5162,7 @@ qemuDomainHasBlockjob(virDomainObjPtr vm, int -qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int asyncJob) +qemuDomainUpdateDeviceList(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; char **aliases; @@ -5202,8 +5171,7 @@ qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_DEL_EVENT)) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorGetDeviceAliases(priv->mon, &aliases); if (qemuDomainObjExitMonitor(vm) < 0) return -1; @@ -5217,9 +5185,7 @@ qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, int -qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int asyncJob) +qemuDomainUpdateMemoryDeviceInfo(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; virHashTablePtr meminfo = NULL; @@ -5229,8 +5195,7 @@ qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver, if (vm->def->nmems == 0) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorGetMemoryDeviceInfo(priv->mon, &meminfo); @@ -6171,10 +6136,7 @@ qemuDomainSupportsNewVcpuHotplug(virDomainObjPtr vm) * Returns 0 on success and -1 on fatal error. */ int -qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int asyncJob, - bool state) +qemuDomainRefreshVcpuInfo(virDomainObjPtr vm, bool state) { virDomainVcpuDefPtr vcpu; qemuDomainVcpuPrivatePtr vcpupriv; @@ -6187,8 +6149,7 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver, hotplug = qemuDomainSupportsNewVcpuHotplug(vm); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorGetCPUInfo(qemuDomainGetMonitor(vm), &info, maxvcpus, hotplug); @@ -6286,9 +6247,7 @@ qemuDomainGetVcpuHalted(virDomainObjPtr vm, * Returns 0 on success and -1 on error */ int -qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int asyncJob) +qemuDomainRefreshVcpuHalted(virDomainObjPtr vm) { virDomainVcpuDefPtr vcpu; qemuDomainVcpuPrivatePtr vcpupriv; @@ -6301,8 +6260,7 @@ qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver, if (vm->def->virtType == VIR_DOMAIN_VIRT_QEMU) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); haltedmap = qemuMonitorGetCpuHalted(qemuDomainGetMonitor(vm), maxvcpus); @@ -6571,15 +6529,12 @@ qemuDomainVcpuPersistOrder(virDomainDefPtr def) int -qemuDomainCheckMonitor(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob) +qemuDomainCheckMonitor(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; int ret; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorCheck(priv->mon); diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 12fef38..aff6270 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -435,11 +435,6 @@ void qemuDomainObjEnterMonitor(virDomainObjPtr obj) ATTRIBUTE_NONNULL(1); int qemuDomainObjExitMonitor(virDomainObjPtr obj) ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK; -int qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver, - virDomainObjPtr obj, - qemuDomainAsyncJob asyncJob) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; - qemuAgentPtr qemuDomainObjEnterAgent(virDomainObjPtr obj) ATTRIBUTE_NONNULL(1); @@ -607,12 +602,9 @@ extern virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks; extern virDomainXMLNamespace virQEMUDriverDomainXMLNamespace; extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig; -int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, - virDomainObjPtr vm, int asyncJob); +int qemuDomainUpdateDeviceList(virDomainObjPtr vm); -int qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int asyncJob); +int qemuDomainUpdateMemoryDeviceInfo(virDomainObjPtr vm); bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver, virDomainDefPtr src, @@ -672,14 +664,9 @@ bool qemuDomainSupportsNewVcpuHotplug(virDomainObjPtr vm); bool qemuDomainHasVcpuPids(virDomainObjPtr vm); pid_t qemuDomainGetVcpuPid(virDomainObjPtr vm, unsigned int vcpuid); int qemuDomainValidateVcpuInfo(virDomainObjPtr vm); -int qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int asyncJob, - bool state); +int qemuDomainRefreshVcpuInfo(virDomainObjPtr vm, bool state); bool qemuDomainGetVcpuHalted(virDomainObjPtr vm, unsigned int vcpu); -int qemuDomainRefreshVcpuHalted(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int asyncJob); +int qemuDomainRefreshVcpuHalted(virDomainObjPtr vm); bool qemuDomainSupportsNicdev(virDomainDefPtr def, virDomainNetDefPtr net); @@ -770,9 +757,7 @@ bool qemuDomainVcpuHotplugIsInOrder(virDomainDefPtr def) void qemuDomainVcpuPersistOrder(virDomainDefPtr def) ATTRIBUTE_NONNULL(1); -int qemuDomainCheckMonitor(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob); +int qemuDomainCheckMonitor(virDomainObjPtr vm); bool qemuDomainSupportsVideoVga(virDomainVideoDefPtr video, virQEMUCapsPtr qemuCaps); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4b39021..46b89a4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1870,7 +1870,7 @@ static int qemuDomainSuspend(virDomainPtr dom) "%s", _("domain is pmsuspended")); goto endjob; } else if (state != VIR_DOMAIN_PAUSED) { - if (qemuProcessStopCPUs(driver, vm, reason, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuProcessStopCPUs(driver, vm, reason) < 0) goto endjob; if (eventDetail >= 0) { @@ -1935,8 +1935,7 @@ static int qemuDomainResume(virDomainPtr dom) reason == VIR_DOMAIN_CRASHED_PANICKED) || state == VIR_DOMAIN_PAUSED) { if (qemuProcessStartCPUs(driver, vm, dom->conn, - VIR_DOMAIN_RUNNING_UNPAUSED, - QEMU_ASYNC_JOB_NONE) < 0) { + VIR_DOMAIN_RUNNING_UNPAUSED) < 0) { if (virGetLastError() == NULL) virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("resume operation failed")); @@ -2248,8 +2247,7 @@ qemuDomainDestroyFlags(virDomainPtr dom, if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN) stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED; - qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED, - QEMU_ASYNC_JOB_NONE, stopFlags); + qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED, stopFlags); event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_DESTROYED); @@ -3048,8 +3046,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, int compressed, const char *compressedpath, bool was_running, - unsigned int flags, - qemuDomainAsyncJob asyncJob) + unsigned int flags) { virQEMUSaveHeader header; bool bypassSecurityDriver = false; @@ -3094,7 +3091,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver, goto cleanup; /* Perform the migration */ - if (qemuMigrationToFile(driver, vm, fd, compressedpath, asyncJob) < 0) + if (qemuMigrationToFile(driver, vm, fd, compressedpath) < 0) goto cleanup; /* Touch up file header to mark image complete. */ @@ -3176,8 +3173,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, /* Pause */ if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) { was_running = true; - if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SAVE, - QEMU_ASYNC_JOB_SAVE) < 0) + if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SAVE) < 0) goto endjob; if (!virDomainObjIsActive(vm)) { @@ -3220,14 +3216,12 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, } ret = qemuDomainSaveMemory(driver, vm, path, xml, compressed, - compressedpath, was_running, flags, - QEMU_ASYNC_JOB_SAVE); + compressedpath, was_running, flags); if (ret < 0) goto endjob; /* Shut it down */ - qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SAVED, - QEMU_ASYNC_JOB_SAVE, 0); + qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SAVED, 0); virDomainAuditStop(vm, "saved"); event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_SAVED); @@ -3236,8 +3230,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom, if (was_running && virDomainObjIsActive(vm)) { virErrorPtr save_err = virSaveLastError(); if (qemuProcessStartCPUs(driver, vm, dom->conn, - VIR_DOMAIN_RUNNING_SAVE_CANCELED, - QEMU_ASYNC_JOB_SAVE) < 0) { + VIR_DOMAIN_RUNNING_SAVE_CANCELED) < 0) { VIR_WARN("Unable to resume guest CPUs after save failure"); qemuDomainEventQueue(driver, virDomainEventLifecycleNewFromObj(vm, @@ -3533,8 +3526,7 @@ qemuDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags) } static int qemuDumpToFd(virQEMUDriverPtr driver, virDomainObjPtr vm, - int fd, qemuDomainAsyncJob asyncJob, - const char *dumpformat) + int fd, const char *dumpformat) { qemuDomainObjPrivatePtr priv = vm->privateData; int ret = -1; @@ -3552,8 +3544,7 @@ static int qemuDumpToFd(virQEMUDriverPtr driver, virDomainObjPtr vm, VIR_FREE(priv->job.current); priv->job.dump_memory_only = true; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); if (dumpformat) { ret = qemuMonitorGetDumpGuestMemoryCapability(priv->mon, dumpformat); @@ -3632,8 +3623,7 @@ doCoreDump(virQEMUDriverPtr driver, if (STREQ(memory_dump_format, "elf")) memory_dump_format = NULL; - ret = qemuDumpToFd(driver, vm, fd, QEMU_ASYNC_JOB_DUMP, - memory_dump_format); + ret = qemuDumpToFd(driver, vm, fd, memory_dump_format); } else { if (dumpformat != VIR_DOMAIN_CORE_DUMP_FORMAT_RAW) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", @@ -3645,8 +3635,7 @@ doCoreDump(virQEMUDriverPtr driver, if (!qemuMigrationIsAllowed(driver, vm, false, 0)) goto cleanup; - ret = qemuMigrationToFile(driver, vm, fd, compressedpath, - QEMU_ASYNC_JOB_DUMP); + ret = qemuMigrationToFile(driver, vm, fd, compressedpath); } if (ret < 0) @@ -3714,8 +3703,7 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom, /* Pause domain for non-live dump */ if (!(flags & VIR_DUMP_LIVE) && virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) { - if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_DUMP, - QEMU_ASYNC_JOB_DUMP) < 0) + if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_DUMP) < 0) goto endjob; paused = true; @@ -3733,8 +3721,7 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom, endjob: if ((ret == 0) && (flags & VIR_DUMP_CRASH)) { - qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_CRASHED, - QEMU_ASYNC_JOB_DUMP, 0); + qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_CRASHED, 0); virDomainAuditStop(vm, "crashed"); event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, @@ -3751,8 +3738,7 @@ qemuDomainCoreDumpWithFormat(virDomainPtr dom, if (resume && virDomainObjIsActive(vm)) { if (qemuProcessStartCPUs(driver, vm, dom->conn, - VIR_DOMAIN_RUNNING_UNPAUSED, - QEMU_ASYNC_JOB_DUMP) < 0) { + VIR_DOMAIN_RUNNING_UNPAUSED) < 0) { event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR); @@ -3937,8 +3923,7 @@ processWatchdogEvent(virQEMUDriverPtr driver, "%s", _("Dump failed")); ret = qemuProcessStartCPUs(driver, vm, NULL, - VIR_DOMAIN_RUNNING_UNPAUSED, - QEMU_ASYNC_JOB_DUMP); + VIR_DOMAIN_RUNNING_UNPAUSED); if (ret < 0) virReportError(VIR_ERR_OPERATION_FAILED, @@ -4024,8 +4009,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver, /* fall through */ case VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY: - qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_CRASHED, - QEMU_ASYNC_JOB_DUMP, 0); + qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_CRASHED, 0); event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_CRASHED); @@ -4082,7 +4066,7 @@ processDeviceDeletedEvent(virQEMUDriverPtr driver, } if (STRPREFIX(devAlias, "vcpu")) { - qemuDomainRemoveVcpuAlias(driver, vm, devAlias); + qemuDomainRemoveVcpuAlias(vm, devAlias); } else { if (virDomainDefFindDevice(vm->def, devAlias, &dev, true) < 0) goto endjob; @@ -4552,7 +4536,7 @@ processMonitorEOFEvent(virQEMUDriverPtr driver, event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, eventReason); - qemuProcessStop(driver, vm, stopReason, QEMU_ASYNC_JOB_NONE, stopFlags); + qemuProcessStop(driver, vm, stopReason, stopFlags); virDomainAuditStop(vm, auditReason); qemuDomainEventQueue(driver, event); @@ -4608,8 +4592,7 @@ static void qemuProcessEventHandler(void *data, void *opaque) static int -qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainHotplugAddVcpu(virDomainObjPtr vm, unsigned int vcpu) { virJSONValuePtr vcpuprops = NULL; @@ -4651,7 +4634,7 @@ qemuDomainHotplugAddVcpu(virQEMUDriverPtr driver, if (newhotplug) vm->def->individualvcpus = true; - if (qemuDomainRefreshVcpuInfo(driver, vm, QEMU_ASYNC_JOB_NONE, false) < 0) + if (qemuDomainRefreshVcpuInfo(vm, false) < 0) goto cleanup; /* validation requires us to set the expected state prior to calling it */ @@ -4882,7 +4865,7 @@ qemuDomainSetVcpusLive(virQEMUDriverPtr driver, if (nvcpus > virDomainDefGetVcpus(vm->def)) { while ((nextvcpu = virBitmapNextSetBit(vcpumap, nextvcpu)) != -1) { - if ((rc = qemuDomainHotplugAddVcpu(driver, vm, nextvcpu)) < 0) + if ((rc = qemuDomainHotplugAddVcpu(vm, nextvcpu)) < 0) break; } } else { @@ -4890,7 +4873,7 @@ qemuDomainSetVcpusLive(virQEMUDriverPtr driver, if (!virBitmapIsBitSet(vcpumap, nextvcpu)) continue; - if ((rc = qemuDomainHotplugDelVcpu(driver, vm, nextvcpu)) < 0) + if ((rc = qemuDomainHotplugDelVcpu(vm, nextvcpu)) < 0) break; } } @@ -6621,7 +6604,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, } if (virCommandWait(cmd, NULL) < 0) { - qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, asyncJob, 0); + qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, 0); restored = false; } VIR_DEBUG("Decompression binary stderr: %s", NULLSTR(errbuf)); @@ -6651,8 +6634,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, /* If it was running before, resume it now unless caller requested pause. */ if (header->was_running && !start_paused) { if (qemuProcessStartCPUs(driver, vm, conn, - VIR_DOMAIN_RUNNING_RESTORED, - asyncJob) < 0) { + VIR_DOMAIN_RUNNING_RESTORED) < 0) { if (virGetLastError() == NULL) virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("failed to resume domain")); @@ -7648,7 +7630,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, } if (ret == 0) - ret = qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE); + ret = qemuDomainUpdateDeviceList(vm); return ret; } @@ -7732,7 +7714,7 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm, } if (ret == 0) - ret = qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE); + ret = qemuDomainUpdateDeviceList(vm); return ret; } @@ -12994,8 +12976,7 @@ qemuDomainGetJobStatsInternal(virQEMUDriverPtr driver, if (jobInfo->type == VIR_DOMAIN_JOB_BOUNDED || jobInfo->type == VIR_DOMAIN_JOB_UNBOUNDED) { if (fetch) - ret = qemuMigrationFetchJobStatus(driver, vm, QEMU_ASYNC_JOB_NONE, - jobInfo); + ret = qemuMigrationFetchJobStatus(vm, jobInfo); else ret = qemuDomainJobInfoUpdateTime(jobInfo); } else { @@ -13640,8 +13621,7 @@ qemuDomainSnapshotCreateActiveInternal(virConnectPtr conn, * confuses libvirt since it's not notified when qemu resumes the * domain. Thus we stop and start CPUs ourselves. */ - if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SAVE, - QEMU_ASYNC_JOB_SNAPSHOT) < 0) + if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SAVE) < 0) goto cleanup; resume = true; @@ -13652,12 +13632,7 @@ qemuDomainSnapshotCreateActiveInternal(virConnectPtr conn, } } - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_SNAPSHOT) < 0) { - resume = false; - goto cleanup; - } - + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorCreateSnapshot(priv->mon, snap->def->name); if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; @@ -13667,8 +13642,7 @@ qemuDomainSnapshotCreateActiveInternal(virConnectPtr conn, if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT) { event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT); - qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, - QEMU_ASYNC_JOB_SNAPSHOT, 0); + qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, 0); virDomainAuditStop(vm, "from-snapshot"); resume = false; } @@ -13676,8 +13650,7 @@ qemuDomainSnapshotCreateActiveInternal(virConnectPtr conn, cleanup: if (resume && virDomainObjIsActive(vm) && qemuProcessStartCPUs(driver, vm, conn, - VIR_DOMAIN_RUNNING_UNPAUSED, - QEMU_ASYNC_JOB_SNAPSHOT) < 0) { + VIR_DOMAIN_RUNNING_UNPAUSED) < 0) { event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR); @@ -14109,8 +14082,7 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver, virDomainDiskDefPtr disk, virDomainDiskDefPtr persistDisk, virJSONValuePtr actions, - bool reuse, - qemuDomainAsyncJob asyncJob) + bool reuse) { qemuDomainObjPrivatePtr priv = vm->privateData; virStorageSourcePtr newDiskSrc = NULL; @@ -14174,9 +14146,8 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver, /* The monitor is only accessed if qemu doesn't support transactions. * Otherwise the following monitor command only constructs the command. */ - if (!actions && - qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; + if (!actions) + qemuDomainObjEnterMonitor(vm); ret = rc = qemuMonitorDiskSnapshot(priv->mon, actions, device, source, formatStr, reuse); @@ -14258,8 +14229,7 @@ static int qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainSnapshotObjPtr snap, - unsigned int flags, - qemuDomainAsyncJob asyncJob) + unsigned int flags) { qemuDomainObjPrivatePtr priv = vm->privateData; virJSONValuePtr actions = NULL; @@ -14309,7 +14279,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, &snap->def->disks[i], vm->def->disks[i], persistDisk, actions, - reuse, asyncJob); + reuse); if (ret < 0) break; @@ -14317,14 +14287,10 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, } if (actions) { if (ret == 0 && do_transaction) { - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { - ret = qemuMonitorTransaction(priv->mon, actions); - if (qemuDomainObjExitMonitor(vm) < 0) - ret = -1; - } else { - /* failed to enter monitor, clean stuff up and quit */ + qemuDomainObjEnterMonitor(vm); + ret = qemuMonitorTransaction(priv->mon, actions); + if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; - } } else { VIR_DEBUG("no disks to snapshot, skipping 'transaction' command"); } @@ -14436,8 +14402,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, */ if ((memory && !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_LIVE)) || (!memory && atomic && !transaction)) { - if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SNAPSHOT, - QEMU_ASYNC_JOB_SNAPSHOT) < 0) + if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SNAPSHOT) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -14470,7 +14435,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file, xml, compressed, compressedpath, resume, - 0, QEMU_ASYNC_JOB_SNAPSHOT)) < 0) + 0)) < 0) goto cleanup; /* the memory image was created, remove it on errors */ @@ -14487,16 +14452,14 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, * * Next we snapshot the disks. */ - if ((ret = qemuDomainSnapshotCreateDiskActive(driver, vm, snap, flags, - QEMU_ASYNC_JOB_SNAPSHOT)) < 0) + if ((ret = qemuDomainSnapshotCreateDiskActive(driver, vm, snap, flags)) < 0) goto cleanup; /* the snapshot is complete now */ if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT) { event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT); - qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, - QEMU_ASYNC_JOB_SNAPSHOT, 0); + qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, 0); virDomainAuditStop(vm, "from-snapshot"); resume = false; thaw = 0; @@ -14517,8 +14480,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, cleanup: if (resume && virDomainObjIsActive(vm) && qemuProcessStartCPUs(driver, vm, conn, - VIR_DOMAIN_RUNNING_UNPAUSED, - QEMU_ASYNC_JOB_SNAPSHOT) < 0) { + VIR_DOMAIN_RUNNING_UNPAUSED) < 0) { event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED, VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR); @@ -15359,9 +15321,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, goto endjob; } virResetError(err); - qemuProcessStop(driver, vm, - VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, - QEMU_ASYNC_JOB_START, 0); + qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, 0); virDomainAuditStop(vm, "from-snapshot"); detail = VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT; event = virDomainEventLifecycleNewFromObj(vm, @@ -15376,8 +15336,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, /* Transitions 5, 6 */ was_running = true; if (qemuProcessStopCPUs(driver, vm, - VIR_DOMAIN_PAUSED_FROM_SNAPSHOT, - QEMU_ASYNC_JOB_START) < 0) + VIR_DOMAIN_PAUSED_FROM_SNAPSHOT) < 0) goto endjob; /* Create an event now in case the restore fails, so * that user will be alerted that they are now paused. @@ -15393,9 +15352,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, } } - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_START) < 0) - goto endjob; + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorLoadSnapshot(priv->mon, snap->def->name); if (qemuDomainObjExitMonitor(vm) < 0) goto endjob; @@ -15448,8 +15405,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, goto endjob; } rc = qemuProcessStartCPUs(driver, vm, snapshot->domain->conn, - VIR_DOMAIN_RUNNING_FROM_SNAPSHOT, - QEMU_ASYNC_JOB_START); + VIR_DOMAIN_RUNNING_FROM_SNAPSHOT); if (rc < 0) goto endjob; virObjectUnref(event); @@ -15481,8 +15437,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, if (virDomainObjIsActive(vm)) { /* Transitions 4, 7 */ - qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, - QEMU_ASYNC_JOB_START, 0); + qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT, 0); virDomainAuditStop(vm, "from-snapshot"); detail = VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT; event = virDomainEventLifecycleNewFromObj(vm, @@ -18963,7 +18918,7 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, static int -qemuDomainGetStatsVcpu(virQEMUDriverPtr driver, +qemuDomainGetStatsVcpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, virDomainObjPtr dom, virDomainStatsRecordPtr record, int *maxparams, @@ -18995,8 +18950,7 @@ qemuDomainGetStatsVcpu(virQEMUDriverPtr driver, goto cleanup; if (HAVE_JOB(privflags) && virDomainObjIsActive(dom)) { - if (qemuDomainRefreshVcpuHalted(driver, dom, - QEMU_ASYNC_JOB_NONE) < 0) { + if (qemuDomainRefreshVcpuHalted(dom) < 0) { /* it's ok to be silent and go ahead, because halted vcpu info * wasn't here from the beginning */ virResetLastError(); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index ed08313..9f9ae4d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2205,14 +2205,13 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, qemuDomainEventQueue(driver, event); /* fix the balloon size */ - ignore_value(qemuProcessRefreshBalloonState(driver, vm, QEMU_ASYNC_JOB_NONE)); + ignore_value(qemuProcessRefreshBalloonState(vm)); /* mem is consumed by vm->def */ mem = NULL; /* this step is best effort, removing the device would be so much trouble */ - ignore_value(qemuDomainUpdateMemoryDeviceInfo(driver, vm, - QEMU_ASYNC_JOB_NONE)); + ignore_value(qemuDomainUpdateMemoryDeviceInfo(vm)); ret = 0; @@ -3265,8 +3264,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver, ret = qemuDomainChangeGraphicsPasswords(driver, vm, VIR_DOMAIN_GRAPHICS_TYPE_VNC, &dev->data.vnc.auth, - cfg->vncPassword, - QEMU_ASYNC_JOB_NONE); + cfg->vncPassword); if (ret < 0) goto cleanup; @@ -3316,8 +3314,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver, ret = qemuDomainChangeGraphicsPasswords(driver, vm, VIR_DOMAIN_GRAPHICS_TYPE_SPICE, &dev->data.spice.auth, - cfg->spicePassword, - QEMU_ASYNC_JOB_NONE); + cfg->spicePassword); if (ret < 0) goto cleanup; @@ -3545,7 +3542,7 @@ qemuDomainRemoveMemoryDevice(virQEMUDriverPtr driver, virDomainMemoryDefFree(mem); /* fix the balloon size */ - ignore_value(qemuProcessRefreshBalloonState(driver, vm, QEMU_ASYNC_JOB_NONE)); + ignore_value(qemuProcessRefreshBalloonState(vm)); /* decrease the mlock limit after memory unplug if necessary */ ignore_value(qemuDomainAdjustMaxMemLock(vm)); @@ -4763,8 +4760,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver, virDomainObjPtr vm, int type, virDomainGraphicsAuthDefPtr auth, - const char *defaultPasswd, - int asyncJob) + const char *defaultPasswd) { qemuDomainObjPrivatePtr priv = vm->privateData; time_t now = time(NULL); @@ -4784,8 +4780,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver, if (auth->connected) connected = virDomainGraphicsAuthConnectedTypeToString(auth->connected); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSetPassword(priv->mon, type, password, connected); if (ret == -2) { @@ -5010,8 +5005,7 @@ qemuDomainDetachMemoryDevice(virQEMUDriverPtr driver, static int -qemuDomainRemoveVcpu(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainRemoveVcpu(virDomainObjPtr vm, unsigned int vcpu) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -5021,7 +5015,7 @@ qemuDomainRemoveVcpu(virQEMUDriverPtr driver, unsigned int nvcpus = vcpupriv->vcpus; size_t i; - if (qemuDomainRefreshVcpuInfo(driver, vm, QEMU_ASYNC_JOB_NONE, false) < 0) + if (qemuDomainRefreshVcpuInfo(vm, false) < 0) return -1; /* validation requires us to set the expected state prior to calling it */ @@ -5054,8 +5048,7 @@ qemuDomainRemoveVcpu(virQEMUDriverPtr driver, void -qemuDomainRemoveVcpuAlias(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainRemoveVcpuAlias(virDomainObjPtr vm, const char *alias) { virDomainVcpuDefPtr vcpu; @@ -5067,7 +5060,7 @@ qemuDomainRemoveVcpuAlias(virQEMUDriverPtr driver, vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu); if (STREQ_NULLABLE(alias, vcpupriv->alias)) { - qemuDomainRemoveVcpu(driver, vm, i); + qemuDomainRemoveVcpu(vm, i); return; } } @@ -5075,8 +5068,7 @@ qemuDomainRemoveVcpuAlias(virQEMUDriverPtr driver, int -qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainHotplugDelVcpu(virDomainObjPtr vm, unsigned int vcpu) { virDomainVcpuDefPtr vcpuinfo = virDomainDefGetVcpu(vm->def, vcpu); @@ -5113,5 +5105,5 @@ qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver, return -1; } - return qemuDomainRemoveVcpu(driver, vm, vcpu); + return qemuDomainRemoveVcpu(vm, vcpu); } diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h index 7f0bca7..9fbc55a 100644 --- a/src/qemu/qemu_hotplug.h +++ b/src/qemu/qemu_hotplug.h @@ -67,8 +67,7 @@ int qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver, virDomainObjPtr vm, int type, virDomainGraphicsAuthDefPtr auth, - const char *defaultPasswd, - int asyncJob); + const char *defaultPasswd); int qemuDomainChangeNet(virDomainObjPtr vm, virDomainDeviceDefPtr dev); int qemuDomainChangeNetLinkState(virDomainObjPtr vm, @@ -110,11 +109,9 @@ int qemuDomainDetachRNGDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainRNGDefPtr rng); -int qemuDomainHotplugDelVcpu(virQEMUDriverPtr driver, - virDomainObjPtr vm, +int qemuDomainHotplugDelVcpu(virDomainObjPtr vm, unsigned int vcpu); -void qemuDomainRemoveVcpuAlias(virQEMUDriverPtr driver, - virDomainObjPtr vm, +void qemuDomainRemoveVcpuAlias(virDomainObjPtr vm, const char *alias); int diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 36ddfa0..83f9eb8 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -584,7 +584,6 @@ qemuMigrationCookieAddNetwork(qemuMigrationCookiePtr mig, static int qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig, - virQEMUDriverPtr driver, virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -611,9 +610,7 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig, if (!(stats = virHashCreate(10, virHashValueFree))) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, - priv->job.asyncJob) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorBlockStatsUpdateCapacity(priv->mon, stats, false); if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; @@ -1401,7 +1398,7 @@ qemuMigrationBakeCookie(qemuMigrationCookiePtr mig, } if ((flags & QEMU_MIGRATION_COOKIE_NBD) && - qemuMigrationCookieAddNBD(mig, driver, dom) < 0) + qemuMigrationCookieAddNBD(mig, dom) < 0) return -1; if (flags & QEMU_MIGRATION_COOKIE_STATS && @@ -1525,8 +1522,7 @@ qemuMigrationRestoreDomainState(virConnectPtr conn, virDomainObjPtr vm) /* we got here through some sort of failure; start the domain again */ if (qemuProcessStartCPUs(driver, vm, conn, - VIR_DOMAIN_RUNNING_MIGRATION_CANCELED, - QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) { + VIR_DOMAIN_RUNNING_MIGRATION_CANCELED) < 0) { /* Hm, we already know we are in error here. We don't want to * overwrite the previous error, though, so we just throw something * to the logs and hope for the best */ @@ -1775,9 +1771,7 @@ qemuMigrationStartNBDServer(virQEMUDriverPtr driver, if (!(diskAlias = qemuAliasFromDisk(disk))) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_IN) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); if (port == 0) { if (nbdPort) @@ -1820,9 +1814,7 @@ qemuMigrationStopNBDServer(virQEMUDriverPtr driver, if (!mig->nbd) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_IN) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); if (qemuMonitorNBDServerStop(priv->mon) < 0) VIR_WARN("Unable to stop NBD server"); @@ -1963,8 +1955,7 @@ static int qemuMigrationCancelOneDriveMirror(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainDiskDefPtr disk, - bool failNoJob, - qemuDomainAsyncJob asyncJob) + bool failNoJob) { qemuDomainObjPrivatePtr priv = vm->privateData; char *diskAlias = NULL; @@ -1991,8 +1982,7 @@ qemuMigrationCancelOneDriveMirror(virQEMUDriverPtr driver, if (!(diskAlias = qemuAliasFromDisk(disk))) return -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); rv = qemuMonitorBlockJobCancel(priv->mon, diskAlias, true); @@ -2023,7 +2013,6 @@ static int qemuMigrationCancelDriveMirror(virQEMUDriverPtr driver, virDomainObjPtr vm, bool check, - qemuDomainAsyncJob asyncJob, virConnectPtr dconn) { virErrorPtr err = NULL; @@ -2041,8 +2030,7 @@ qemuMigrationCancelDriveMirror(virQEMUDriverPtr driver, if (!diskPriv->migrating) continue; - rv = qemuMigrationCancelOneDriveMirror(driver, vm, disk, - check, asyncJob); + rv = qemuMigrationCancelOneDriveMirror(driver, vm, disk, check); if (rv != 0) { if (rv < 0) { if (!err) @@ -2168,9 +2156,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver, hoststr, port, diskAlias) < 0)) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); qemuBlockJobSyncBegin(disk); /* Force "raw" format for NBD export */ @@ -2413,8 +2399,7 @@ qemuMigrationSetOffline(virQEMUDriverPtr driver, { int ret; VIR_DEBUG("driver=%p vm=%p", driver, vm); - ret = qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_MIGRATION, - QEMU_ASYNC_JOB_MIGRATION_OUT); + ret = qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_MIGRATION); if (ret == 0) { virObjectEventPtr event; @@ -2452,8 +2437,7 @@ qemuMigrationPostcopyFailed(virQEMUDriverPtr driver, virObjectEventPtr event; if (qemuProcessStopCPUs(driver, vm, - VIR_DOMAIN_PAUSED_POSTCOPY_FAILED, - QEMU_ASYNC_JOB_MIGRATION_IN) < 0) { + VIR_DOMAIN_PAUSED_POSTCOPY_FAILED) < 0) { VIR_WARN("Unable to pause guest CPUs for %s", vm->def->name); return; } @@ -2470,8 +2454,7 @@ qemuMigrationPostcopyFailed(virQEMUDriverPtr driver, static int -qemuMigrationSetOption(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationSetOption(virDomainObjPtr vm, qemuMonitorMigrationCaps capability, bool state, qemuDomainAsyncJob job) @@ -2479,8 +2462,7 @@ qemuMigrationSetOption(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv = vm->privateData; int ret; - if (qemuDomainObjEnterMonitorAsync(driver, vm, job) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorGetMigrationCapability(priv->mon, capability); @@ -2515,15 +2497,13 @@ qemuMigrationSetOption(virQEMUDriverPtr driver, static int -qemuMigrationSetPostCopy(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationSetPostCopy(virDomainObjPtr vm, bool state, qemuDomainAsyncJob job) { qemuDomainObjPrivatePtr priv = vm->privateData; - if (qemuMigrationSetOption(driver, vm, - QEMU_MONITOR_MIGRATION_CAPS_POSTCOPY, + if (qemuMigrationSetOption(vm, QEMU_MONITOR_MIGRATION_CAPS_POSTCOPY, state, job) < 0) return -1; @@ -2581,16 +2561,12 @@ qemuMigrationUpdateJobType(qemuDomainJobInfoPtr jobInfo) int -qemuMigrationFetchJobStatus(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob, - qemuDomainJobInfoPtr jobInfo) +qemuMigrationFetchJobStatus(virDomainObjPtr vm, qemuDomainJobInfoPtr jobInfo) { qemuDomainObjPrivatePtr priv = vm->privateData; int rv; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); memset(&jobInfo->stats, 0, sizeof(jobInfo->stats)); rv = qemuMonitorGetMigrationStats(priv->mon, &jobInfo->stats); @@ -2622,15 +2598,13 @@ qemuMigrationJobName(virDomainObjPtr vm) static int -qemuMigrationUpdateJobStatus(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob) +qemuMigrationUpdateJobStatus(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainJobInfoPtr jobInfo = priv->job.current; qemuDomainJobInfo newInfo = *jobInfo; - if (qemuMigrationFetchJobStatus(driver, vm, asyncJob, &newInfo) < 0) + if (qemuMigrationFetchJobStatus(vm, &newInfo) < 0) return -1; *jobInfo = newInfo; @@ -2639,10 +2613,7 @@ qemuMigrationUpdateJobStatus(virQEMUDriverPtr driver, static int -qemuMigrationCheckJobStatus(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob, - bool updateJobStats) +qemuMigrationCheckJobStatus(virDomainObjPtr vm, bool updateJobStats) { qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainJobInfoPtr jobInfo = priv->job.current; @@ -2651,7 +2622,7 @@ qemuMigrationCheckJobStatus(virQEMUDriverPtr driver, if (events) qemuMigrationUpdateJobType(jobInfo); - else if (qemuMigrationUpdateJobStatus(driver, vm, asyncJob) < 0) + else if (qemuMigrationUpdateJobStatus(vm) < 0) return -1; switch (jobInfo->type) { @@ -2673,7 +2644,7 @@ qemuMigrationCheckJobStatus(virQEMUDriverPtr driver, case VIR_DOMAIN_JOB_COMPLETED: /* Fetch statistics of a completed migration */ if (events && updateJobStats && - qemuMigrationUpdateJobStatus(driver, vm, asyncJob) < 0) + qemuMigrationUpdateJobStatus(vm) < 0) return -1; break; @@ -2702,7 +2673,6 @@ enum qemuMigrationCompletedFlags { static int qemuMigrationCompleted(virQEMUDriverPtr driver, virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob, virConnectPtr dconn, unsigned int flags) { @@ -2711,7 +2681,7 @@ qemuMigrationCompleted(virQEMUDriverPtr driver, int pauseReason; bool updateStats = !!(flags & QEMU_MIGRATION_COMPLETED_UPDATE_STATS); - if (qemuMigrationCheckJobStatus(driver, vm, asyncJob, updateStats) < 0) + if (qemuMigrationCheckJobStatus(vm, updateStats) < 0) goto error; if (flags & QEMU_MIGRATION_COMPLETED_CHECK_STORAGE && @@ -2741,7 +2711,7 @@ qemuMigrationCompleted(virQEMUDriverPtr driver, jobInfo->stats.status == QEMU_MONITOR_MIGRATION_STATUS_POSTCOPY) { VIR_DEBUG("Migration switched to post-copy"); if (updateStats && - qemuMigrationUpdateJobStatus(driver, vm, asyncJob) < 0) + qemuMigrationUpdateJobStatus(vm) < 0) goto error; return 1; } @@ -2771,7 +2741,6 @@ qemuMigrationCompleted(virQEMUDriverPtr driver, static int qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob, virConnectPtr dconn, unsigned int flags) { @@ -2783,8 +2752,7 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, flags |= QEMU_MIGRATION_COMPLETED_UPDATE_STATS; jobInfo->type = VIR_DOMAIN_JOB_UNBOUNDED; - while ((rv = qemuMigrationCompleted(driver, vm, asyncJob, - dconn, flags)) != 1) { + while ((rv = qemuMigrationCompleted(driver, vm, dconn, flags)) != 1) { if (rv < 0) return rv; @@ -2815,7 +2783,6 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, static int qemuMigrationWaitForDestCompletion(virQEMUDriverPtr driver, virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob, bool postcopy) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -2830,8 +2797,7 @@ qemuMigrationWaitForDestCompletion(virQEMUDriverPtr driver, if (postcopy) flags = QEMU_MIGRATION_COMPLETED_POSTCOPY; - while ((rv = qemuMigrationCompleted(driver, vm, asyncJob, - NULL, flags)) != 1) { + while ((rv = qemuMigrationCompleted(driver, vm, NULL, flags)) != 1) { if (rv < 0 || virDomainObjWait(vm) < 0) return -1; } @@ -2841,8 +2807,7 @@ qemuMigrationWaitForDestCompletion(virQEMUDriverPtr driver, static int -qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuDomainMigrateGraphicsRelocate(virDomainObjPtr vm, qemuMigrationCookiePtr cookie, const char *graphicsuri) { @@ -2924,14 +2889,12 @@ qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver, goto cleanup; } - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT) == 0) { - ret = qemuMonitorGraphicsRelocate(priv->mon, type, listenAddress, - port, tlsPort, tlsSubject); - priv->job.spiceMigration = !ret; - if (qemuDomainObjExitMonitor(vm) < 0) - ret = -1; - } + qemuDomainObjEnterMonitor(vm); + ret = qemuMonitorGraphicsRelocate(priv->mon, type, listenAddress, + port, tlsPort, tlsSubject); + priv->job.spiceMigration = !ret; + if (qemuDomainObjExitMonitor(vm) < 0) + ret = -1; cleanup: virURIFree(uri); @@ -3028,8 +2991,7 @@ qemuMigrationRunIncoming(virQEMUDriverPtr driver, VIR_DEBUG("Setting up incoming migration with URI %s", uri); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); rv = qemuMonitorMigrateIncoming(priv->mon, uri); @@ -3042,7 +3004,7 @@ qemuMigrationRunIncoming(virQEMUDriverPtr driver, goto cleanup; } - if (qemuMigrationWaitForDestCompletion(driver, vm, asyncJob, false) < 0) + if (qemuMigrationWaitForDestCompletion(driver, vm, false) < 0) goto cleanup; ret = 0; @@ -3287,16 +3249,13 @@ qemuMigrationBegin(virConnectPtr conn, { virQEMUDriverPtr driver = conn->privateData; char *xml = NULL; - qemuDomainAsyncJob asyncJob; if ((flags & VIR_MIGRATE_CHANGE_PROTECTION)) { if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) goto cleanup; - asyncJob = QEMU_ASYNC_JOB_MIGRATION_OUT; } else { if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) goto cleanup; - asyncJob = QEMU_ASYNC_JOB_NONE; } qemuMigrationStoreDomainState(vm); @@ -3311,7 +3270,7 @@ qemuMigrationBegin(virConnectPtr conn, * We don't want to require them on the destination. */ if (!(flags & VIR_MIGRATE_OFFLINE) && - qemuProcessRefreshDisks(driver, vm, asyncJob) < 0) + qemuProcessRefreshDisks(vm) < 0) goto endjob; if (!(xml = qemuMigrationBeginPhase(driver, vm, xmlin, dname, @@ -3451,8 +3410,7 @@ qemuMigrationPrepareIncoming(virDomainObjPtr vm, } static int -qemuMigrationSetCompression(virQEMUDriverPtr driver, - virDomainObjPtr vm, +qemuMigrationSetCompression(virDomainObjPtr vm, qemuDomainAsyncJob job, qemuMigrationCompressionPtr compression, qemuMonitorMigrationParamsPtr migParams) @@ -3460,22 +3418,19 @@ qemuMigrationSetCompression(virQEMUDriverPtr driver, int ret = -1; qemuDomainObjPrivatePtr priv = vm->privateData; - if (qemuMigrationSetOption(driver, vm, - QEMU_MONITOR_MIGRATION_CAPS_XBZRLE, + if (qemuMigrationSetOption(vm, QEMU_MONITOR_MIGRATION_CAPS_XBZRLE, compression->methods & (1ULL << QEMU_MIGRATION_COMPRESS_XBZRLE), job) < 0) return -1; - if (qemuMigrationSetOption(driver, vm, - QEMU_MONITOR_MIGRATION_CAPS_COMPRESS, + if (qemuMigrationSetOption(vm, QEMU_MONITOR_MIGRATION_CAPS_COMPRESS, compression->methods & (1ULL << QEMU_MIGRATION_COMPRESS_MT), job) < 0) return -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, job) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); migParams->compressLevel_set = compression->level_set; migParams->compressLevel = compression->level; @@ -3548,16 +3503,13 @@ qemuMigrationParams(virTypedParameterPtr params, static int -qemuMigrationSetParams(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob job, +qemuMigrationSetParams(virDomainObjPtr vm, qemuMonitorMigrationParamsPtr migParams) { qemuDomainObjPrivatePtr priv = vm->privateData; int ret = -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, job) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); if (qemuMonitorSetMigrationParams(priv->mon, migParams) < 0) goto cleanup; @@ -3752,7 +3704,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver, goto stopjob; } - if (qemuProcessInit(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, + if (qemuProcessInit(driver, vm, true, VIR_QEMU_PROCESS_START_AUTODESTROY) < 0) goto stopjob; stopProcess = true; @@ -3790,7 +3742,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver, dataFD[1] = -1; /* 'st' owns the FD now & will close it */ } - if (qemuMigrationSetCompression(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, + if (qemuMigrationSetCompression(vm, QEMU_ASYNC_JOB_MIGRATION_IN, compression, &migParams) < 0) goto stopjob; @@ -3799,19 +3751,16 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver, goto stopjob; } - if (qemuMigrationSetOption(driver, vm, - QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL, + if (qemuMigrationSetOption(vm, QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL, flags & VIR_MIGRATE_RDMA_PIN_ALL, QEMU_ASYNC_JOB_MIGRATION_IN) < 0) goto stopjob; - if (qemuMigrationSetPostCopy(driver, vm, - flags & VIR_MIGRATE_POSTCOPY, + if (qemuMigrationSetPostCopy(vm, flags & VIR_MIGRATE_POSTCOPY, QEMU_ASYNC_JOB_MIGRATION_IN) < 0) goto stopjob; - if (qemuMigrationSetParams(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, - &migParams) < 0) + if (qemuMigrationSetParams(vm, &migParams) < 0) goto stopjob; if (mig->nbd && @@ -3839,7 +3788,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver, QEMU_ASYNC_JOB_MIGRATION_IN) < 0) goto stopjob; - if (qemuProcessFinishStartup(dconn, driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, + if (qemuProcessFinishStartup(dconn, driver, vm, false, VIR_DOMAIN_PAUSED_MIGRATION) < 0) goto stopjob; @@ -3909,8 +3858,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver, if (!relabel) stopFlags |= VIR_QEMU_PROCESS_STOP_NO_RELABEL; virDomainAuditStart(vm, "migrated", false); - qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, - QEMU_ASYNC_JOB_MIGRATION_IN, stopFlags); + qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, stopFlags); } qemuMigrationJobFinish(driver, vm); @@ -4226,9 +4174,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver, */ if (virDomainObjGetState(vm, &reason) == VIR_DOMAIN_PAUSED && reason == VIR_DOMAIN_PAUSED_POSTCOPY && - qemuMigrationFetchJobStatus(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT, - jobInfo) < 0) + qemuMigrationFetchJobStatus(vm, jobInfo) < 0) VIR_WARN("Could not refresh migration statistics"); qemuDomainJobInfoUpdateTime(jobInfo); @@ -4250,7 +4196,6 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver, qemuMigrationWaitForSpice(vm); qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_MIGRATED, - QEMU_ASYNC_JOB_MIGRATION_OUT, VIR_QEMU_PROCESS_STOP_MIGRATED); virDomainAuditStop(vm, "migrated"); @@ -4264,8 +4209,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver, int reason; /* cancel any outstanding NBD jobs */ - qemuMigrationCancelDriveMirror(driver, vm, false, - QEMU_ASYNC_JOB_MIGRATION_OUT, NULL); + qemuMigrationCancelDriveMirror(driver, vm, false, NULL); virSetError(orig_err); virFreeError(orig_err); @@ -4701,7 +4645,7 @@ qemuMigrationRun(virQEMUDriverPtr driver, if (!mig) goto cleanup; - if (qemuDomainMigrateGraphicsRelocate(driver, vm, mig, graphicsuri) < 0) + if (qemuDomainMigrateGraphicsRelocate(vm, mig, graphicsuri) < 0) VIR_WARN("unable to provide data for graphics client relocation"); if (migrate_flags & (QEMU_MONITOR_MIGRATE_NON_SHARED_DISK | @@ -4732,34 +4676,28 @@ qemuMigrationRun(virQEMUDriverPtr driver, goto cleanup; } - if (qemuMigrationSetCompression(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, + if (qemuMigrationSetCompression(vm, QEMU_ASYNC_JOB_MIGRATION_OUT, compression, migParams) < 0) goto cleanup; - if (qemuMigrationSetOption(driver, vm, - QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE, + if (qemuMigrationSetOption(vm, QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE, flags & VIR_MIGRATE_AUTO_CONVERGE, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) goto cleanup; - if (qemuMigrationSetOption(driver, vm, - QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL, + if (qemuMigrationSetOption(vm, QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL, flags & VIR_MIGRATE_RDMA_PIN_ALL, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) goto cleanup; - if (qemuMigrationSetPostCopy(driver, vm, - flags & VIR_MIGRATE_POSTCOPY, + if (qemuMigrationSetPostCopy(vm, flags & VIR_MIGRATE_POSTCOPY, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) goto cleanup; - if (qemuMigrationSetParams(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, - migParams) < 0) + if (qemuMigrationSetParams(vm, migParams) < 0) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); if (priv->job.abortJob) { /* explicitly do this *after* we entered the monitor, @@ -4833,9 +4771,7 @@ qemuMigrationRun(virQEMUDriverPtr driver, * rather failed later on. Check its status before waiting for a * connection from qemu which may never be initiated. */ - if (qemuMigrationCheckJobStatus(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT, - false) < 0) + if (qemuMigrationCheckJobStatus(vm, false) < 0) goto cancel; while ((fd = accept(spec->dest.unix_socket.sock, NULL, NULL)) < 0) { @@ -4864,9 +4800,7 @@ qemuMigrationRun(virQEMUDriverPtr driver, if (flags & VIR_MIGRATE_POSTCOPY) waitFlags |= QEMU_MIGRATION_COMPLETED_POSTCOPY; - rc = qemuMigrationWaitForCompletion(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT, - dconn, waitFlags); + rc = qemuMigrationWaitForCompletion(driver, vm, dconn, waitFlags); if (rc == -2) goto cancel; else if (rc == -1) @@ -4902,9 +4836,7 @@ qemuMigrationRun(virQEMUDriverPtr driver, /* cancel any outstanding NBD jobs */ if (mig && mig->nbd) { - if (qemuMigrationCancelDriveMirror(driver, vm, ret == 0, - QEMU_ASYNC_JOB_MIGRATION_OUT, - dconn) < 0) + if (qemuMigrationCancelDriveMirror(driver, vm, ret == 0, dconn) < 0) ret = -1; } @@ -4955,11 +4887,9 @@ qemuMigrationRun(virQEMUDriverPtr driver, orig_err = virSaveLastError(); if (virDomainObjIsActive(vm)) { - if (qemuDomainObjEnterMonitorAsync(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_OUT) == 0) { - qemuMonitorMigrateCancel(priv->mon); - ignore_value(qemuDomainObjExitMonitor(vm)); - } + qemuDomainObjEnterMonitor(vm); + qemuMonitorMigrateCancel(priv->mon); + ignore_value(qemuDomainObjExitMonitor(vm)); } goto cleanup; @@ -5873,7 +5803,6 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver, */ if (!v3proto) { qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_MIGRATED, - QEMU_ASYNC_JOB_MIGRATION_OUT, VIR_QEMU_PROCESS_STOP_MIGRATED); virDomainAuditStop(vm, "migrated"); event = virDomainEventLifecycleNewFromObj(vm, @@ -6231,7 +6160,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, /* Check for a possible error on the monitor in case Finish was called * earlier than monitor EOF handler got a chance to process the error */ - qemuDomainCheckMonitor(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN); + qemuDomainCheckMonitor(vm); goto endjob; } @@ -6251,8 +6180,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, if (qemuMigrationStopNBDServer(driver, vm, mig) < 0) goto endjob; - if (qemuRefreshVirtioChannelState(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_IN) < 0) + if (qemuRefreshVirtioChannelState(driver, vm) < 0) goto endjob; if (qemuConnectAgent(driver, vm) < 0) @@ -6281,7 +6209,6 @@ qemuMigrationFinish(virQEMUDriverPtr driver, * before starting guest CPUs. */ if (qemuMigrationWaitForDestCompletion(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_IN, !!(flags & VIR_MIGRATE_POSTCOPY)) < 0) { /* There's not much we can do for v2 protocol since the * original domain on the source host is already gone. @@ -6300,8 +6227,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, */ if (qemuProcessStartCPUs(driver, vm, dconn, inPostCopy ? VIR_DOMAIN_RUNNING_POSTCOPY - : VIR_DOMAIN_RUNNING_MIGRATED, - QEMU_ASYNC_JOB_MIGRATION_IN) < 0) { + : VIR_DOMAIN_RUNNING_MIGRATED) < 0) { if (virGetLastError() == NULL) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("resume operation failed")); @@ -6345,11 +6271,9 @@ qemuMigrationFinish(virQEMUDriverPtr driver, } if (inPostCopy) { - if (qemuMigrationWaitForDestCompletion(driver, vm, - QEMU_ASYNC_JOB_MIGRATION_IN, - false) < 0) { + if (qemuMigrationWaitForDestCompletion(driver, vm, false) < 0) goto endjob; - } + if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) { virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, @@ -6385,7 +6309,6 @@ qemuMigrationFinish(virQEMUDriverPtr driver, virDomainObjIsActive(vm)) { if (doKill) { qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, - QEMU_ASYNC_JOB_MIGRATION_IN, VIR_QEMU_PROCESS_STOP_MIGRATED); virDomainAuditStop(vm, "failed"); event = virDomainEventLifecycleNewFromObj(vm, @@ -6410,8 +6333,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, if (inPostCopy) VIR_FREE(priv->job.completed); - qemuMigrationSetPostCopy(driver, vm, false, - QEMU_ASYNC_JOB_MIGRATION_IN); + qemuMigrationSetPostCopy(vm, false, QEMU_ASYNC_JOB_MIGRATION_IN); } qemuMigrationJobFinish(driver, vm); @@ -6447,9 +6369,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver, /* Helper function called while vm is active. */ int qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, - int fd, - const char *compressor, - qemuDomainAsyncJob asyncJob) + int fd, const char *compressor) { qemuDomainObjPrivatePtr priv = vm->privateData; int rc; @@ -6462,13 +6382,11 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, /* Increase migration bandwidth to unlimited since target is a file. * Failure to change migration speed is not fatal. */ - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { - qemuMonitorSetMigrationSpeed(priv->mon, - QEMU_DOMAIN_MIG_BANDWIDTH_MAX); - priv->migMaxBandwidth = QEMU_DOMAIN_MIG_BANDWIDTH_MAX; - if (qemuDomainObjExitMonitor(vm) < 0) - return -1; - } + qemuDomainObjEnterMonitor(vm); + qemuMonitorSetMigrationSpeed(priv->mon, QEMU_DOMAIN_MIG_BANDWIDTH_MAX); + priv->migMaxBandwidth = QEMU_DOMAIN_MIG_BANDWIDTH_MAX; + if (qemuDomainObjExitMonitor(vm) < 0) + return -1; if (!virDomainObjIsActive(vm)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -6491,8 +6409,7 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, compressor ? pipeFD[1] : fd) < 0) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); if (!compressor) { rc = qemuMonitorMigrateToFd(priv->mon, @@ -6533,14 +6450,14 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, if (rc < 0) goto cleanup; - rc = qemuMigrationWaitForCompletion(driver, vm, asyncJob, NULL, 0); + rc = qemuMigrationWaitForCompletion(driver, vm, NULL, 0); if (rc < 0) { if (rc == -2) { orig_err = virSaveLastError(); virCommandAbort(cmd); - if (virDomainObjIsActive(vm) && - qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { + if (virDomainObjIsActive(vm)) { + qemuDomainObjEnterMonitor(vm); qemuMonitorMigrateCancel(priv->mon); ignore_value(qemuDomainObjExitMonitor(vm)); } @@ -6559,8 +6476,8 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, orig_err = virSaveLastError(); /* Restore max migration bandwidth */ - if (virDomainObjIsActive(vm) && - qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { + if (virDomainObjIsActive(vm)) { + qemuDomainObjEnterMonitor(vm); qemuMonitorSetMigrationSpeed(priv->mon, saveMigBandwidth); priv->migMaxBandwidth = saveMigBandwidth; ignore_value(qemuDomainObjExitMonitor(vm)); @@ -6634,8 +6551,7 @@ qemuMigrationCancel(virQEMUDriverPtr driver, } } - if (qemuMigrationCancelDriveMirror(driver, vm, false, - QEMU_ASYNC_JOB_NONE, NULL) < 0) + if (qemuMigrationCancelDriveMirror(driver, vm, false, NULL) < 0) goto endsyncjob; ret = 0; diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index 14c6178..36b79f5 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -238,16 +238,13 @@ bool qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm, int qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, int fd, - const char *compressor, - qemuDomainAsyncJob asyncJob) + const char *compressor) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; int qemuMigrationCancel(virQEMUDriverPtr driver, virDomainObjPtr vm); -int qemuMigrationFetchJobStatus(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob, +int qemuMigrationFetchJobStatus(virDomainObjPtr vm, qemuDomainJobInfoPtr jobInfo); int qemuMigrationErrorInit(virQEMUDriverPtr driver); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2bf69d5..68a964e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -545,9 +545,7 @@ qemuProcessFakeReboot(void *opaque) if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_CRASHED) reason = VIR_DOMAIN_RUNNING_CRASHED; - if (qemuProcessStartCPUs(driver, vm, NULL, - reason, - QEMU_ASYNC_JOB_NONE) < 0) { + if (qemuProcessStartCPUs(driver, vm, NULL, reason) < 0) { if (virGetLastError() == NULL) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("resume operation failed")); @@ -1660,7 +1658,7 @@ qemuProcessMonitorLogFree(void *opaque) } static int -qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob, +qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, qemuDomainLogContextPtr logCtxt) { qemuDomainObjPrivatePtr priv = vm->privateData; @@ -1717,8 +1715,7 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob, } - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); if (qemuMonitorSetCapabilities(priv->mon) < 0) goto cleanup; @@ -1965,15 +1962,13 @@ qemuProcessRefreshChannelVirtioState(virQEMUDriverPtr driver, int qemuRefreshVirtioChannelState(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob) + virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; virHashTablePtr info = NULL; int ret = -1; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorGetChardevInfo(priv->mon, &info); if (qemuDomainObjExitMonitor(vm) < 0) @@ -2026,9 +2021,7 @@ qemuRefreshRTC(virDomainObjPtr vm) } int -qemuProcessRefreshBalloonState(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int asyncJob) +qemuProcessRefreshBalloonState(virDomainObjPtr vm) { unsigned long long balloon; int rc; @@ -2040,8 +2033,7 @@ qemuProcessRefreshBalloonState(virQEMUDriverPtr driver, return 0; } - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorGetBalloonInfo(qemuDomainGetMonitor(vm), &balloon); if (qemuDomainObjExitMonitor(vm) < 0 || rc < 0) @@ -2056,7 +2048,6 @@ qemuProcessRefreshBalloonState(virQEMUDriverPtr driver, static int qemuProcessWaitForMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, - int asyncJob, virQEMUCapsPtr qemuCaps, qemuDomainLogContextPtr logCtxt) { @@ -2065,7 +2056,7 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver, qemuDomainObjPrivatePtr priv; VIR_DEBUG("Connect monitor to %p '%s'", vm, vm->def->name); - if (qemuConnectMonitor(driver, vm, asyncJob, logCtxt) < 0) + if (qemuConnectMonitor(driver, vm, logCtxt) < 0) goto cleanup; /* Try to get the pty path mappings again via the monitor. This is much more @@ -2073,8 +2064,7 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver, * Note that the monitor itself can be on a pty, so we still need to try the * log output method. */ priv = vm->privateData; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorGetChardevInfo(priv->mon, &info); VIR_DEBUG("qemuMonitorGetChardevInfo returned %i", ret); if (qemuDomainObjExitMonitor(vm) < 0) @@ -2104,9 +2094,7 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver, static int -qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int asyncJob) +qemuProcessDetectIOThreadPIDs(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; qemuMonitorIOThreadInfoPtr *iothreads = NULL; @@ -2142,8 +2130,7 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver, } /* Get the list of IOThreads from qemu */ - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); niothreads = qemuMonitorGetIOThreads(priv->mon, &iothreads); if (qemuDomainObjExitMonitor(vm) < 0) goto cleanup; @@ -2249,9 +2236,7 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm) /* set link states to down on interfaces at qemu start */ static int -qemuProcessSetLinkStates(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob) +qemuProcessSetLinkStates(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; virDomainDefPtr def = vm->def; @@ -2259,8 +2244,7 @@ qemuProcessSetLinkStates(virQEMUDriverPtr driver, int ret = -1; int rv; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); for (i = 0; i < def->nnets; i++) { if (def->nets[i]->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) { @@ -2421,8 +2405,7 @@ qemuProcessSetupEmulator(virDomainObjPtr vm) static int qemuProcessInitPasswords(virConnectPtr conn, virQEMUDriverPtr driver, - virDomainObjPtr vm, - int asyncJob) + virDomainObjPtr vm) { int ret = 0; qemuDomainObjPrivatePtr priv = vm->privateData; @@ -2437,14 +2420,12 @@ qemuProcessInitPasswords(virConnectPtr conn, ret = qemuDomainChangeGraphicsPasswords(driver, vm, VIR_DOMAIN_GRAPHICS_TYPE_VNC, &graphics->data.vnc.auth, - cfg->vncPassword, - asyncJob); + cfg->vncPassword); } else if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { ret = qemuDomainChangeGraphicsPasswords(driver, vm, VIR_DOMAIN_GRAPHICS_TYPE_SPICE, &graphics->data.spice.auth, - cfg->spicePassword, - asyncJob); + cfg->spicePassword); } if (ret < 0) @@ -2473,8 +2454,7 @@ qemuProcessInitPasswords(virConnectPtr conn, VIR_FREE(alias); if (!(alias = qemuAliasFromDisk(vm->def->disks[i]))) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorSetDrivePassphrase(priv->mon, alias, secret); if (qemuDomainObjExitMonitor(vm) < 0) ret = -1; @@ -2539,8 +2519,7 @@ qemuProcessCleanupChardevDevice(virDomainDefPtr def ATTRIBUTE_UNUSED, */ static int qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int asyncJob) + virDomainObjPtr vm) { int ret = -1; ssize_t i; @@ -2548,8 +2527,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver, virDomainVideoDefPtr video = NULL; virQEMUDriverConfigPtr cfg = NULL; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - return -1; + qemuDomainObjEnterMonitor(vm); for (i = 0; i < vm->def->nvideos; i++) { video = vm->def->videos[i]; @@ -2705,8 +2683,7 @@ qemuProcessPrepareMonitorChr(virDomainChrSourceDefPtr monConfig, */ int qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm, - virConnectPtr conn, virDomainRunningReason reason, - qemuDomainAsyncJob asyncJob) + virConnectPtr conn, virDomainRunningReason reason) { int ret = -1; qemuDomainObjPrivatePtr priv = vm->privateData; @@ -2727,8 +2704,7 @@ qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm, } VIR_FREE(priv->lockState); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto release; + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorStartCPUs(priv->mon, conn); if (qemuDomainObjExitMonitor(vm) < 0) @@ -2753,16 +2729,14 @@ qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm, int qemuProcessStopCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm, - virDomainPausedReason reason, - qemuDomainAsyncJob asyncJob) + virDomainPausedReason reason) { int ret = -1; qemuDomainObjPrivatePtr priv = vm->privateData; VIR_FREE(priv->lockState); - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); ret = qemuMonitorStopCPUs(priv->mon); if (qemuDomainObjExitMonitor(vm) < 0) @@ -2926,8 +2900,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver, VIR_DEBUG("Incoming migration finished, resuming domain %s", vm->def->name); if (qemuProcessStartCPUs(driver, vm, conn, - VIR_DOMAIN_RUNNING_UNPAUSED, - QEMU_ASYNC_JOB_NONE) < 0) { + VIR_DOMAIN_RUNNING_UNPAUSED) < 0) { VIR_WARN("Could not resume domain %s", vm->def->name); } break; @@ -3031,8 +3004,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver, (reason == VIR_DOMAIN_PAUSED_MIGRATION || reason == VIR_DOMAIN_PAUSED_UNKNOWN)) { if (qemuProcessStartCPUs(driver, vm, conn, - VIR_DOMAIN_RUNNING_UNPAUSED, - QEMU_ASYNC_JOB_NONE) < 0) { + VIR_DOMAIN_RUNNING_UNPAUSED) < 0) { VIR_WARN("Could not resume domain %s", vm->def->name); } } @@ -3084,8 +3056,7 @@ qemuProcessRecoverJob(virQEMUDriverPtr driver, reason == VIR_DOMAIN_PAUSED_SNAPSHOT) || reason == VIR_DOMAIN_PAUSED_UNKNOWN)) { if (qemuProcessStartCPUs(driver, vm, conn, - VIR_DOMAIN_RUNNING_UNPAUSED, - QEMU_ASYNC_JOB_NONE) < 0) { + VIR_DOMAIN_RUNNING_UNPAUSED) < 0) { VIR_WARN("Could not resume domain '%s' after migration to file", vm->def->name); } @@ -3155,7 +3126,7 @@ qemuProcessUpdateDevices(virQEMUDriverPtr driver, old = priv->qemuDevices; priv->qemuDevices = NULL; - if (qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuDomainUpdateDeviceList(vm) < 0) goto cleanup; qemuDevices = (const char **) priv->qemuDevices; @@ -3296,7 +3267,7 @@ qemuProcessReconnect(void *opaque) VIR_DEBUG("Reconnect monitor to %p '%s'", obj, obj->def->name); /* XXX check PID liveliness & EXE path */ - if (qemuConnectMonitor(driver, obj, QEMU_ASYNC_JOB_NONE, NULL) < 0) + if (qemuConnectMonitor(driver, obj, NULL) < 0) goto error; if (qemuHostdevUpdateActiveDomainDevices(driver, obj->def) < 0) @@ -3375,7 +3346,7 @@ qemuProcessReconnect(void *opaque) ignore_value(virSecurityManagerCheckAllLabel(driver->securityManager, obj->def)); - if (qemuDomainRefreshVcpuInfo(driver, obj, QEMU_ASYNC_JOB_NONE, true) < 0) + if (qemuDomainRefreshVcpuInfo(obj, true) < 0) goto error; if (virSecurityManagerReserveLabel(driver->securityManager, obj->def, obj->pid) < 0) @@ -3387,16 +3358,16 @@ qemuProcessReconnect(void *opaque) if (qemuProcessFiltersInstantiate(obj->def)) goto error; - if (qemuProcessRefreshDisks(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuProcessRefreshDisks(obj) < 0) goto error; - if (qemuRefreshVirtioChannelState(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuRefreshVirtioChannelState(driver, obj) < 0) goto error; /* If querying of guest's RTC failed, report error, but do not kill the domain. */ qemuRefreshRTC(obj); - if (qemuProcessRefreshBalloonState(driver, obj, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuProcessRefreshBalloonState(obj) < 0) goto error; if (qemuProcessRecoverJob(driver, obj, conn, &oldjob) < 0) @@ -3466,7 +3437,7 @@ qemuProcessReconnect(void *opaque) * thread didn't have a chance to start playing with the domain yet * (it's all we can do anyway). */ - qemuProcessStop(driver, obj, state, QEMU_ASYNC_JOB_NONE, stopFlags); + qemuProcessStop(driver, obj, state, stopFlags); } goto cleanup; } @@ -3509,8 +3480,7 @@ qemuProcessReconnectHelper(virDomainObjPtr obj, * is no thread that could be doing anything else with the same domain * object. */ - qemuProcessStop(src->driver, obj, VIR_DOMAIN_SHUTOFF_FAILED, - QEMU_ASYNC_JOB_NONE, 0); + qemuProcessStop(src->driver, obj, VIR_DOMAIN_SHUTOFF_FAILED, 0); qemuDomainRemoveInactive(src->driver, obj); virDomainObjEndAPI(&obj); @@ -3683,9 +3653,7 @@ qemuValidateCpuCount(virDomainDefPtr def, static bool -qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int asyncJob) +qemuProcessVerifyGuestCPU(virDomainObjPtr vm) { virDomainDefPtr def = vm->def; virArch arch = def->os.arch; @@ -3698,8 +3666,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, switch (arch) { case VIR_ARCH_I686: case VIR_ARCH_X86_64: - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - return false; + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorGetGuestCPU(priv->mon, arch, &guestcpu); if (qemuDomainObjExitMonitor(vm) < 0) return false; @@ -4327,9 +4294,7 @@ qemuProcessSetupRawIO(virQEMUDriverPtr driver, static int -qemuProcessSetupBalloon(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob) +qemuProcessSetupBalloon(virDomainObjPtr vm) { unsigned long long balloon = vm->def->mem.cur_balloon; qemuDomainObjPrivatePtr priv = vm->privateData; @@ -4338,8 +4303,7 @@ qemuProcessSetupBalloon(virQEMUDriverPtr driver, if (!virDomainDefHasMemballoon(vm->def)) return 0; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); if (vm->def->memballoon->period) qemuMonitorSetMemoryStatsPeriod(priv->mon, vm->def->memballoon, @@ -4601,7 +4565,6 @@ qemuProcessStartValidate(virQEMUDriverPtr driver, int qemuProcessInit(virQEMUDriverPtr driver, virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob, bool migration, unsigned int flags) { @@ -4673,7 +4636,7 @@ qemuProcessInit(virQEMUDriverPtr driver, stopFlags = VIR_QEMU_PROCESS_STOP_NO_RELABEL; if (migration) stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED; - qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, asyncJob, stopFlags); + qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, stopFlags); goto cleanup; } @@ -4940,9 +4903,7 @@ qemuProcessVcpusSortOrder(const void *a, static int -qemuProcessSetupHotpluggableVcpus(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob) +qemuProcessSetupHotpluggableVcpus(virDomainObjPtr vm) { unsigned int maxvcpus = virDomainDefGetVcpusMax(vm->def); qemuDomainObjPrivatePtr priv = vm->privateData; @@ -4988,8 +4949,7 @@ qemuProcessSetupHotpluggableVcpus(virQEMUDriverPtr driver, if (!(vcpuprops = qemuBuildHotpluggableCPUProps(vcpu))) goto cleanup; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; + qemuDomainObjEnterMonitor(vm); rc = qemuMonitorAddDeviceArgs(qemuDomainGetMonitor(vm), vcpuprops); vcpuprops = NULL; @@ -5547,14 +5507,14 @@ qemuProcessLaunch(virConnectPtr conn, goto cleanup; VIR_DEBUG("Waiting for monitor to show up"); - if (qemuProcessWaitForMonitor(driver, vm, asyncJob, priv->qemuCaps, logCtxt) < 0) + if (qemuProcessWaitForMonitor(driver, vm, priv->qemuCaps, logCtxt) < 0) goto cleanup; if (qemuConnectAgent(driver, vm) < 0) goto cleanup; VIR_DEBUG("Detecting if required emulator features are present"); - if (!qemuProcessVerifyGuestCPU(driver, vm, asyncJob)) + if (!qemuProcessVerifyGuestCPU(vm)) goto cleanup; VIR_DEBUG("Setting up post-init cgroup restrictions"); @@ -5563,18 +5523,18 @@ qemuProcessLaunch(virConnectPtr conn, VIR_DEBUG("setting up hotpluggable cpus"); if (qemuDomainHasHotpluggableStartupVcpus(vm->def)) { - if (qemuDomainRefreshVcpuInfo(driver, vm, asyncJob, false) < 0) + if (qemuDomainRefreshVcpuInfo(vm, false) < 0) goto cleanup; if (qemuProcessValidateHotpluggableVcpus(vm->def) < 0) goto cleanup; - if (qemuProcessSetupHotpluggableVcpus(driver, vm, asyncJob) < 0) + if (qemuProcessSetupHotpluggableVcpus(vm) < 0) goto cleanup; } VIR_DEBUG("Refreshing VCPU info"); - if (qemuDomainRefreshVcpuInfo(driver, vm, asyncJob, false) < 0) + if (qemuDomainRefreshVcpuInfo(vm, false) < 0) goto cleanup; if (qemuDomainValidateVcpuInfo(vm) < 0) @@ -5583,7 +5543,7 @@ qemuProcessLaunch(virConnectPtr conn, qemuDomainVcpuPersistOrder(vm->def); VIR_DEBUG("Detecting IOThread PIDs"); - if (qemuProcessDetectIOThreadPIDs(driver, vm, asyncJob) < 0) + if (qemuProcessDetectIOThreadPIDs(vm) < 0) goto cleanup; VIR_DEBUG("Setting global CPU cgroup (if required)"); @@ -5599,41 +5559,40 @@ qemuProcessLaunch(virConnectPtr conn, goto cleanup; VIR_DEBUG("Setting any required VM passwords"); - if (qemuProcessInitPasswords(conn, driver, vm, asyncJob) < 0) + if (qemuProcessInitPasswords(conn, driver, vm) < 0) goto cleanup; /* set default link states */ /* qemu doesn't support setting this on the command line, so * enter the monitor */ VIR_DEBUG("Setting network link states"); - if (qemuProcessSetLinkStates(driver, vm, asyncJob) < 0) + if (qemuProcessSetLinkStates(vm) < 0) goto cleanup; VIR_DEBUG("Fetching list of active devices"); - if (qemuDomainUpdateDeviceList(driver, vm, asyncJob) < 0) + if (qemuDomainUpdateDeviceList(vm) < 0) goto cleanup; VIR_DEBUG("Updating info of memory devices"); - if (qemuDomainUpdateMemoryDeviceInfo(driver, vm, asyncJob) < 0) + if (qemuDomainUpdateMemoryDeviceInfo(vm) < 0) goto cleanup; VIR_DEBUG("Setting initial memory amount"); - if (qemuProcessSetupBalloon(driver, vm, asyncJob) < 0) + if (qemuProcessSetupBalloon(vm) < 0) goto cleanup; /* Since CPUs were not started yet, the balloon could not return the memory * to the host and thus cur_balloon needs to be updated so that GetXMLdesc * and friends return the correct size in case they can't grab the job */ - if (!incoming && !snapshot && - qemuProcessRefreshBalloonState(driver, vm, asyncJob) < 0) + if (!incoming && !snapshot && qemuProcessRefreshBalloonState(vm) < 0) goto cleanup; VIR_DEBUG("Detecting actual memory size for video device"); - if (qemuProcessUpdateVideoRamSize(driver, vm, asyncJob) < 0) + if (qemuProcessUpdateVideoRamSize(driver, vm) < 0) goto cleanup; VIR_DEBUG("Updating disk data"); - if (qemuProcessRefreshDisks(driver, vm, asyncJob) < 0) + if (qemuProcessRefreshDisks(vm) < 0) goto cleanup; if (flags & VIR_QEMU_PROCESS_START_AUTODESTROY && @@ -5662,7 +5621,6 @@ int qemuProcessFinishStartup(virConnectPtr conn, virQEMUDriverPtr driver, virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob, bool startCPUs, virDomainPausedReason pausedReason) { @@ -5672,8 +5630,7 @@ qemuProcessFinishStartup(virConnectPtr conn, if (startCPUs) { VIR_DEBUG("Starting domain CPUs"); if (qemuProcessStartCPUs(driver, vm, conn, - VIR_DOMAIN_RUNNING_BOOTED, - asyncJob) < 0) { + VIR_DOMAIN_RUNNING_BOOTED) < 0) { if (!virGetLastError()) virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("resume operation failed")); @@ -5734,7 +5691,7 @@ qemuProcessStart(virConnectPtr conn, if (!migrateFrom && !snapshot) flags |= VIR_QEMU_PROCESS_START_NEW; - if (qemuProcessInit(driver, vm, asyncJob, !!migrateFrom, flags) < 0) + if (qemuProcessInit(driver, vm, !!migrateFrom, flags) < 0) goto cleanup; if (migrateFrom) { @@ -5763,7 +5720,7 @@ qemuProcessStart(virConnectPtr conn, qemuMigrationRunIncoming(driver, vm, incoming->deferredURI, asyncJob) < 0) goto stop; - if (qemuProcessFinishStartup(conn, driver, vm, asyncJob, + if (qemuProcessFinishStartup(conn, driver, vm, !(flags & VIR_QEMU_PROCESS_START_PAUSED), incoming ? VIR_DOMAIN_PAUSED_MIGRATION : @@ -5789,7 +5746,7 @@ qemuProcessStart(virConnectPtr conn, stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED; if (priv->mon) qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL); - qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, asyncJob, stopFlags); + qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED, stopFlags); goto cleanup; } @@ -5813,7 +5770,7 @@ qemuProcessCreatePretendCmd(virConnectPtr conn, flags |= VIR_QEMU_PROCESS_START_PRETEND; flags |= VIR_QEMU_PROCESS_START_NEW; - if (qemuProcessInit(driver, vm, QEMU_ASYNC_JOB_NONE, !!migrateURI, flags) < 0) + if (qemuProcessInit(driver, vm, !!migrateURI, flags) < 0) goto cleanup; if (qemuProcessPrepareDomain(conn, driver, vm, flags) < 0) @@ -5913,7 +5870,6 @@ qemuProcessBeginStopJob(virQEMUDriverPtr driver, void qemuProcessStop(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainShutoffReason reason, - qemuDomainAsyncJob asyncJob ATTRIBUTE_UNUSED, unsigned int flags) { int ret; @@ -6348,21 +6304,21 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, qemuDomainObjTaint(driver, vm, VIR_DOMAIN_TAINT_EXTERNAL_LAUNCH, logCtxt); VIR_DEBUG("Waiting for monitor to show up"); - if (qemuProcessWaitForMonitor(driver, vm, QEMU_ASYNC_JOB_NONE, priv->qemuCaps, NULL) < 0) + if (qemuProcessWaitForMonitor(driver, vm, priv->qemuCaps, NULL) < 0) goto error; if (qemuConnectAgent(driver, vm) < 0) goto error; VIR_DEBUG("Detecting VCPU PIDs"); - if (qemuDomainRefreshVcpuInfo(driver, vm, QEMU_ASYNC_JOB_NONE, false) < 0) + if (qemuDomainRefreshVcpuInfo(vm, false) < 0) goto error; if (qemuDomainValidateVcpuInfo(vm) < 0) goto error; VIR_DEBUG("Detecting IOThread PIDs"); - if (qemuProcessDetectIOThreadPIDs(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) + if (qemuProcessDetectIOThreadPIDs(vm) < 0) goto error; VIR_DEBUG("Getting initial memory amount"); @@ -6473,8 +6429,7 @@ qemuProcessAutoDestroy(virDomainObjPtr dom, if (qemuProcessBeginStopJob(driver, dom, QEMU_JOB_DESTROY, true) < 0) goto cleanup; - qemuProcessStop(driver, dom, VIR_DOMAIN_SHUTOFF_DESTROYED, - QEMU_ASYNC_JOB_NONE, stopFlags); + qemuProcessStop(driver, dom, VIR_DOMAIN_SHUTOFF_DESTROYED, stopFlags); virDomainAuditStop(dom, "destroyed"); event = virDomainEventLifecycleNewFromObj(dom, @@ -6522,20 +6477,17 @@ bool qemuProcessAutoDestroyActive(virQEMUDriverPtr driver, int -qemuProcessRefreshDisks(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob) +qemuProcessRefreshDisks(virDomainObjPtr vm) { qemuDomainObjPrivatePtr priv = vm->privateData; virHashTablePtr table = NULL; int ret = -1; size_t i; - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) { - table = qemuMonitorGetBlockInfo(priv->mon); - if (qemuDomainObjExitMonitor(vm) < 0) - goto cleanup; - } + qemuDomainObjEnterMonitor(vm); + table = qemuMonitorGetBlockInfo(priv->mon); + if (qemuDomainObjExitMonitor(vm) < 0) + goto cleanup; if (!table) goto cleanup; diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index 21f3b0c..5f10d6e 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -31,12 +31,10 @@ int qemuProcessPrepareMonitorChr(virDomainChrSourceDefPtr monConfig, int qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm, virConnectPtr conn, - virDomainRunningReason reason, - qemuDomainAsyncJob asyncJob); + virDomainRunningReason reason); int qemuProcessStopCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm, - virDomainPausedReason reason, - qemuDomainAsyncJob asyncJob); + virDomainPausedReason reason); void qemuProcessAutostartAll(virQEMUDriverPtr driver); void qemuProcessReconnectAll(virConnectPtr conn, virQEMUDriverPtr driver); @@ -92,7 +90,6 @@ virCommandPtr qemuProcessCreatePretendCmd(virConnectPtr conn, int qemuProcessInit(virQEMUDriverPtr driver, virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob, bool migration, unsigned int flags); @@ -117,7 +114,6 @@ int qemuProcessLaunch(virConnectPtr conn, int qemuProcessFinishStartup(virConnectPtr conn, virQEMUDriverPtr driver, virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob, bool startCPUs, virDomainPausedReason pausedReason); @@ -133,7 +129,6 @@ int qemuProcessBeginStopJob(virQEMUDriverPtr driver, void qemuProcessStop(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainShutoffReason reason, - qemuDomainAsyncJob asyncJob, unsigned int flags); int qemuProcessAttach(virConnectPtr conn, @@ -180,15 +175,10 @@ int qemuProcessSetupIOThread(virDomainObjPtr vm, virDomainIOThreadIDDefPtr iothread); int qemuRefreshVirtioChannelState(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob); + virDomainObjPtr vm); -int qemuProcessRefreshBalloonState(virQEMUDriverPtr driver, - virDomainObjPtr vm, - int asyncJob); +int qemuProcessRefreshBalloonState(virDomainObjPtr vm); -int qemuProcessRefreshDisks(virQEMUDriverPtr driver, - virDomainObjPtr vm, - qemuDomainAsyncJob asyncJob); +int qemuProcessRefreshDisks(virDomainObjPtr vm); #endif /* __QEMU_PROCESS_H__ */ -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list