This patch moves qemuDomainObjBeginJob() into src/conf/virdomainjob as universal virDomainObjBeginJob(). Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx> --- docs/kbase/internals/qemu-threads.rst | 8 +- src/conf/virdomainjob.c | 18 +++ src/conf/virdomainjob.h | 4 + src/libvirt_private.syms | 1 + src/qemu/qemu_checkpoint.c | 6 +- src/qemu/qemu_domain.c | 4 +- src/qemu/qemu_domainjob.c | 18 --- src/qemu/qemu_domainjob.h | 3 - src/qemu/qemu_driver.c | 152 +++++++++++++------------- src/qemu/qemu_migration.c | 2 +- src/qemu/qemu_process.c | 6 +- src/qemu/qemu_snapshot.c | 2 +- 12 files changed, 113 insertions(+), 111 deletions(-) diff --git a/docs/kbase/internals/qemu-threads.rst b/docs/kbase/internals/qemu-threads.rst index c68512d1b3..00340bb732 100644 --- a/docs/kbase/internals/qemu-threads.rst +++ b/docs/kbase/internals/qemu-threads.rst @@ -62,7 +62,7 @@ There are a number of locks on various objects Agent job condition is then used when thread wishes to talk to qemu agent monitor. It is possible to acquire just agent job - (``qemuDomainObjBeginAgentJob``), or only normal job (``qemuDomainObjBeginJob``) + (``qemuDomainObjBeginAgentJob``), or only normal job (``virDomainObjBeginJob``) but not both at the same time. Holding an agent job and a normal job would allow an unresponsive or malicious agent to block normal libvirt API and potentially result in a denial of service. Which type of job to grab @@ -114,7 +114,7 @@ To lock the ``virDomainObj`` To acquire the normal job condition - ``qemuDomainObjBeginJob()`` + ``virDomainObjBeginJob()`` - Waits until the job is compatible with current async job or no async job is running - Waits for ``job.cond`` condition ``job.active != 0`` using ``virDomainObj`` @@ -214,7 +214,7 @@ Design patterns obj = qemuDomObjFromDomain(dom); - qemuDomainObjBeginJob(obj, VIR_JOB_TYPE); + virDomainObjBeginJob(obj, VIR_JOB_TYPE); ...do work... @@ -230,7 +230,7 @@ Design patterns obj = qemuDomObjFromDomain(dom); - qemuDomainObjBeginJob(obj, VIR_JOB_TYPE); + virDomainObjBeginJob(obj, VIR_JOB_TYPE); ...do prep work... diff --git a/src/conf/virdomainjob.c b/src/conf/virdomainjob.c index a073ff08cd..033ea5c517 100644 --- a/src/conf/virdomainjob.c +++ b/src/conf/virdomainjob.c @@ -509,3 +509,21 @@ virDomainObjBeginJobInternal(virDomainObj *obj, jobObj->jobsQueued--; return ret; } + +/* + * obj must be locked before calling + * + * This must be called by anything that will change the VM state + * in any way, or anything that will use the Hypervisor monitor. + * + * Successful calls must be followed by EndJob eventually + */ +int virDomainObjBeginJob(virDomainObj *obj, + virDomainJob job) +{ + if (virDomainObjBeginJobInternal(obj, obj->job, job, + VIR_AGENT_JOB_NONE, + VIR_ASYNC_JOB_NONE, false) < 0) + return -1; + return 0; +} diff --git a/src/conf/virdomainjob.h b/src/conf/virdomainjob.h index 091d951aa6..adee679e72 100644 --- a/src/conf/virdomainjob.h +++ b/src/conf/virdomainjob.h @@ -245,3 +245,7 @@ int virDomainObjBeginJobInternal(virDomainObj *obj, virDomainAsyncJob asyncJob, bool nowait) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); + +int virDomainObjBeginJob(virDomainObj *obj, + virDomainJob job) + G_GNUC_WARN_UNUSED_RESULT; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index cd0b94297c..4fc2ec2cca 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1187,6 +1187,7 @@ virDomainJobStatusToType; virDomainJobTypeFromString; virDomainJobTypeToString; virDomainNestedJobAllowed; +virDomainObjBeginJob; virDomainObjBeginJobInternal; virDomainObjCanSetJob; virDomainObjClearJob; diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index ed236eaace..c6fb3d1f97 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -604,7 +604,7 @@ qemuCheckpointCreateXML(virDomainPtr domain, /* Unlike snapshots, the RNG schema already ensured a sane filename. */ /* We are going to modify the domain below. */ - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return NULL; if (redefine) { @@ -654,7 +654,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, size_t i; int ret = -1; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -848,7 +848,7 @@ qemuCheckpointDelete(virDomainObj *vm, VIR_DOMAIN_CHECKPOINT_DELETE_METADATA_ONLY | VIR_DOMAIN_CHECKPOINT_DELETE_CHILDREN_ONLY, -1); - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if (!metadata_only) { diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ebd3c7478f..a4640c5c13 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5954,7 +5954,7 @@ qemuDomainSaveConfig(virDomainObj *obj) * obj must be locked before calling * * To be called immediately before any QEMU monitor API call - * Must have already called qemuDomainObjBeginJob() and checked + * Must have already called virDomainObjBeginJob() and checked * that the VM is still active; may not be used for nested async * jobs. * @@ -6035,7 +6035,7 @@ void qemuDomainObjEnterMonitor(virDomainObj *obj) * obj must be locked before calling * * To be called immediately before any QEMU monitor API call. - * Must have already either called qemuDomainObjBeginJob() + * Must have already either called virDomainObjBeginJob() * and checked that the VM is still active, with asyncJob of * VIR_ASYNC_JOB_NONE; or already called qemuDomainObjBeginAsyncJob, * with the same asyncJob. diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c index 0ecadddbc7..13e1f332dc 100644 --- a/src/qemu/qemu_domainjob.c +++ b/src/qemu/qemu_domainjob.c @@ -655,24 +655,6 @@ qemuDomainObjReleaseAsyncJob(virDomainObj *obj) obj->job->asyncOwner = 0; } -/* - * obj must be locked before calling - * - * This must be called by anything that will change the VM state - * in any way, or anything that will use the QEMU monitor. - * - * Successful calls must be followed by EndJob eventually - */ -int qemuDomainObjBeginJob(virDomainObj *obj, - virDomainJob job) -{ - if (virDomainObjBeginJobInternal(obj, obj->job, job, - VIR_AGENT_JOB_NONE, - VIR_ASYNC_JOB_NONE, false) < 0) - return -1; - return 0; -} - /** * qemuDomainObjBeginAgentJob: * diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h index 201d7857a8..66f18483fe 100644 --- a/src/qemu/qemu_domainjob.h +++ b/src/qemu/qemu_domainjob.h @@ -69,9 +69,6 @@ int qemuDomainAsyncJobPhaseFromString(virDomainAsyncJob job, void qemuDomainEventEmitJobCompleted(virQEMUDriver *driver, virDomainObj *vm); -int qemuDomainObjBeginJob(virDomainObj *obj, - virDomainJob job) - G_GNUC_WARN_UNUSED_RESULT; int qemuDomainObjBeginAgentJob(virDomainObj *obj, virDomainAgentJob agentJob) G_GNUC_WARN_UNUSED_RESULT; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 383c88f784..5f36113a9c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1680,7 +1680,7 @@ static int qemuDomainSuspend(virDomainPtr dom) if (virDomainSuspendEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_SUSPEND) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_SUSPEND) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -1730,7 +1730,7 @@ static int qemuDomainResume(virDomainPtr dom) if (virDomainResumeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -1813,7 +1813,7 @@ qemuDomainShutdownFlagsMonitor(virDomainObj *vm, priv = vm->privateData; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) { @@ -1936,7 +1936,7 @@ qemuDomainRebootMonitor(virDomainObj *vm, qemuDomainObjPrivate *priv = vm->privateData; int ret = -1; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -2023,7 +2023,7 @@ qemuDomainReset(virDomainPtr dom, unsigned int flags) if (virDomainResetEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -2192,7 +2192,7 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, if (virDomainSetMemoryFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -2335,7 +2335,7 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period, if (virDomainSetMemoryStatsPeriodEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -2402,7 +2402,7 @@ static int qemuDomainInjectNMI(virDomainPtr domain, unsigned int flags) priv = vm->privateData; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -2460,7 +2460,7 @@ static int qemuDomainSendKey(virDomainPtr domain, if (virDomainSendKeyEnsureACL(domain->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -3323,7 +3323,7 @@ qemuDomainScreenshot(virDomainPtr dom, if (virDomainScreenshotEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -3603,7 +3603,7 @@ processDeviceDeletedEvent(virQEMUDriver *driver, VIR_DEBUG("Removing device %s from domain %p %s", devAlias, vm, vm->def->name); - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -3839,7 +3839,7 @@ processNicRxFilterChangedEvent(virDomainObj *vm, "from domain %p %s", devAlias, vm, vm->def->name); - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -3965,7 +3965,7 @@ processSerialChangedEvent(virQEMUDriver *driver, memset(&dev, 0, sizeof(dev)); } - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY_MIGRATION_SAFE) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY_MIGRATION_SAFE) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -4011,7 +4011,7 @@ static void processJobStatusChangeEvent(virDomainObj *vm, qemuBlockJobData *job) { - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -4153,7 +4153,7 @@ processMemoryDeviceSizeChange(virQEMUDriver *driver, virObjectEvent *event = NULL; unsigned long long balloon; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return; if (!virDomainObjIsActive(vm)) { @@ -4371,7 +4371,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; } else { - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; } @@ -4508,7 +4508,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom, if (virDomainPinVcpuFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -4634,7 +4634,7 @@ qemuDomainPinEmulator(virDomainPtr dom, if (virDomainPinEmulatorEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -4892,7 +4892,7 @@ qemuDomainGetIOThreadsLive(virDomainObj *vm, size_t i; int ret = -1; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -5020,7 +5020,7 @@ qemuDomainPinIOThread(virDomainPtr dom, if (virDomainPinIOThreadEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -5528,7 +5528,7 @@ qemuDomainChgIOThread(virQEMUDriver *driver, priv = vm->privateData; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -6737,7 +6737,7 @@ qemuDomainUndefineFlags(virDomainPtr dom, if (virDomainUndefineFlagsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (!vm->persistent) { @@ -7994,7 +7994,7 @@ qemuDomainAttachDeviceFlags(virDomainPtr dom, if (virDomainAttachDeviceFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) @@ -8049,7 +8049,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom, if (virDomainUpdateDeviceFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) @@ -8279,7 +8279,7 @@ qemuDomainDetachDeviceFlags(virDomainPtr dom, if (virDomainDetachDeviceFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) @@ -8314,7 +8314,7 @@ qemuDomainDetachDeviceAlias(virDomainPtr dom, if (virDomainDetachDeviceAliasEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjUpdateModificationImpact(vm, &flags) < 0) @@ -8387,7 +8387,7 @@ static int qemuDomainSetAutostart(virDomainPtr dom, autostart = (autostart != 0); if (vm->autostart != autostart) { - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (!(configFile = virDomainConfigFile(cfg->configDir, vm->def->name))) @@ -8533,7 +8533,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -8707,7 +8707,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; /* QEMU and LXC implementation are identical */ @@ -8950,7 +8950,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom, } } - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -9167,7 +9167,7 @@ qemuDomainSetPerfEvents(virDomainPtr dom, if (virDomainSetPerfEventsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -9241,7 +9241,7 @@ qemuDomainGetPerfEvents(virDomainPtr dom, if (virDomainGetPerfEventsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (!(def = virDomainObjGetOneDefState(vm, flags, &live))) @@ -9418,7 +9418,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -9920,7 +9920,7 @@ qemuDomainBlockResize(virDomainPtr dom, if (virDomainBlockResizeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -10120,7 +10120,7 @@ qemuDomainBlockStats(virDomainPtr dom, if (virDomainBlockStatsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -10177,7 +10177,7 @@ qemuDomainBlockStatsFlags(virDomainPtr dom, if (virDomainBlockStatsFlagsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -10339,7 +10339,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, if (virDomainSetInterfaceParametersEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -10702,7 +10702,7 @@ qemuDomainMemoryStats(virDomainPtr dom, if (virDomainMemoryStatsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; ret = qemuDomainMemoryStatsInternal(vm, stats, nr_stats); @@ -10812,7 +10812,7 @@ qemuDomainMemoryPeek(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -11089,7 +11089,7 @@ qemuDomainGetBlockInfo(virDomainPtr dom, if (virDomainGetBlockInfoEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (!(disk = virDomainDiskByName(vm->def, path, false))) { @@ -12679,7 +12679,7 @@ qemuDomainGetJobStatsInternal(virDomainObj *vm, return -1; } - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -12858,7 +12858,7 @@ qemuDomainAbortJobFlags(virDomainPtr dom, if (virDomainAbortJobFlagsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_ABORT) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_ABORT) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -12961,7 +12961,7 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom, if (virDomainMigrateSetMaxDowntimeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MIGRATION_OP) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MIGRATION_OP) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13010,7 +13010,7 @@ qemuDomainMigrateGetMaxDowntime(virDomainPtr dom, if (virDomainMigrateGetMaxDowntimeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13060,7 +13060,7 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom, if (virDomainMigrateGetCompressionCacheEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13109,7 +13109,7 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom, if (virDomainMigrateSetCompressionCacheEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MIGRATION_OP) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MIGRATION_OP) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13185,7 +13185,7 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(vm, VIR_JOB_MIGRATION_OP) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MIGRATION_OP) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -13233,7 +13233,7 @@ qemuDomainMigrationGetPostcopyBandwidth(virDomainObj *vm, int rc; int ret = -1; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -13325,7 +13325,7 @@ qemuDomainMigrateStartPostCopy(virDomainPtr dom, if (virDomainMigrateStartPostCopyEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MIGRATION_OP) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MIGRATION_OP) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14070,7 +14070,7 @@ qemuDomainQemuMonitorCommandWithFiles(virDomainPtr domain, if (virDomainQemuMonitorCommandWithFilesEnsureACL(domain->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14401,7 +14401,7 @@ qemuDomainBlockPullCommon(virDomainObj *vm, goto cleanup; } - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14509,7 +14509,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom, if (virDomainBlockJobAbortEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14670,7 +14670,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14739,7 +14739,7 @@ qemuDomainBlockJobSetSpeed(virDomainPtr dom, if (virDomainBlockJobSetSpeedEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -14931,7 +14931,7 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, return -1; } - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -15395,7 +15395,7 @@ qemuDomainBlockCommit(virDomainPtr dom, if (virDomainBlockCommitEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -15595,7 +15595,7 @@ qemuDomainOpenGraphics(virDomainPtr dom, if (virDomainOpenGraphicsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -15713,7 +15713,7 @@ qemuDomainOpenGraphicsFD(virDomainPtr dom, if (qemuSecurityClearSocketLabel(driver->securityManager, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; qemuDomainObjEnterMonitor(vm); ret = qemuMonitorOpenGraphics(priv->mon, protocol, pair[1], "graphicsfd", @@ -15968,7 +15968,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, cfg = virQEMUDriverGetConfig(driver); - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; priv = vm->privateData; @@ -16246,7 +16246,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, if (virDomainGetBlockIoTuneEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; /* the API check guarantees that only one of the definitions will be set */ @@ -16386,7 +16386,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom, if (virDomainGetDiskErrorsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -16461,7 +16461,7 @@ qemuDomainSetMetadata(virDomainPtr dom, if (virDomainSetMetadataEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; ret = virDomainObjSetMetadata(vm, type, metadata, key, uri, @@ -16582,7 +16582,7 @@ qemuDomainQueryWakeupSuspendSupport(virDomainObj *vm, if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_CURRENT_MACHINE)) return -1; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if ((ret = virDomainObjCheckActive(vm)) < 0) @@ -16713,7 +16713,7 @@ qemuDomainPMWakeup(virDomainPtr dom, if (virDomainPMWakeupEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -17064,7 +17064,7 @@ qemuDomainGetHostnameLease(virDomainObj *vm, size_t i, j; int ret = -1; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -17266,7 +17266,7 @@ qemuDomainSetTime(virDomainPtr dom, if (qemuDomainSetTimeAgent(vm, seconds, nseconds, rtcSync) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -18843,7 +18843,7 @@ qemuConnectGetAllDomainStats(virConnectPtr conn, if (flags & VIR_CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT) rv = qemuDomainObjBeginJobNowait(vm, VIR_JOB_QUERY); else - rv = qemuDomainObjBeginJob(vm, VIR_JOB_QUERY); + rv = virDomainObjBeginJob(vm, VIR_JOB_QUERY); if (rv == 0) domflags |= QEMU_DOMAIN_STATS_HAVE_JOB; @@ -19022,7 +19022,7 @@ qemuDomainGetFSInfo(virDomainPtr dom, if ((nfs = qemuDomainGetFSInfoAgent(vm, &agentinfo)) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -19310,7 +19310,7 @@ static int qemuDomainRename(virDomainPtr dom, if (virDomainRenameEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjIsActive(vm)) { @@ -19576,7 +19576,7 @@ qemuDomainSetVcpu(virDomainPtr dom, if (virDomainSetVcpuEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -19634,7 +19634,7 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, if (virDomainSetBlockThresholdEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -19806,7 +19806,7 @@ qemuDomainSetLifecycleAction(virDomainPtr dom, if (virDomainSetLifecycleActionEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) @@ -19958,7 +19958,7 @@ qemuDomainGetSEVInfo(virDomainObj *vm, virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) { @@ -20101,7 +20101,7 @@ qemuDomainSetLaunchSecurityState(virDomainPtr domain, else if (rc == 1) hasSetaddr = true; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -20506,7 +20506,7 @@ qemuDomainGetGuestInfo(virDomainPtr dom, qemuDomainObjEndAgentJob(vm); if (nfs > 0 || ndisks > 0) { - if (qemuDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -20769,7 +20769,7 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom, goto cleanup; } - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) { diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 2572f47385..ca1f9071bc 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2803,7 +2803,7 @@ qemuMigrationSrcBegin(virConnectPtr conn, if (!qemuMigrationJobIsAllowed(vm)) goto cleanup; - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; asyncJob = VIR_ASYNC_JOB_NONE; } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 71b476a32f..6c0181b3ae 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -459,7 +459,7 @@ qemuProcessFakeReboot(void *opaque) VIR_DEBUG("vm=%p", vm); virObjectLock(vm); - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -8061,7 +8061,7 @@ qemuProcessBeginStopJob(virDomainObj *vm, VIR_DEBUG("waking up all jobs waiting on the domain condition"); virDomainObjBroadcast(vm); - if (qemuDomainObjBeginJob(vm, job) < 0) + if (virDomainObjBeginJob(vm, job) < 0) goto cleanup; ret = 0; @@ -8702,7 +8702,7 @@ qemuProcessReconnect(void *opaque) if (oldjob.asyncJob == VIR_ASYNC_JOB_BACKUP && priv->backup) priv->backup->apiFlags = oldjob.apiFlags; - if (qemuDomainObjBeginJob(obj, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(obj, VIR_JOB_MODIFY) < 0) goto error; jobStarted = true; diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 243c18193b..c50e9f3846 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -2299,7 +2299,7 @@ qemuSnapshotDelete(virDomainObj *vm, VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY | VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY, -1); - if (qemuDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) return -1; if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot))) -- 2.37.2