1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

qemu: use virDomainObjBeginJob()

This patch moves qemuDomainObjBeginJob() into
src/conf/virdomainjob as universal virDomainObjBeginJob().

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Kristina Hanicova 2022-09-05 15:57:05 +02:00 committed by Ján Tomko
parent 0150f7a8c1
commit 0d22febfc6
12 changed files with 113 additions and 111 deletions

View File

@ -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...

View File

@ -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;
}

View File

@ -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;

View File

@ -1187,6 +1187,7 @@ virDomainJobStatusToType;
virDomainJobTypeFromString;
virDomainJobTypeToString;
virDomainNestedJobAllowed;
virDomainObjBeginJob;
virDomainObjBeginJobInternal;
virDomainObjCanSetJob;
virDomainObjClearJob;

View File

@ -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) {

View File

@ -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.

View File

@ -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:
*

View File

@ -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;

View File

@ -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)
@ -12851,7 +12851,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)
@ -12954,7 +12954,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)
@ -13003,7 +13003,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)
@ -13053,7 +13053,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)
@ -13102,7 +13102,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)
@ -13178,7 +13178,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)
@ -13226,7 +13226,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)
@ -13318,7 +13318,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)
@ -14063,7 +14063,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)
@ -14394,7 +14394,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)
@ -14502,7 +14502,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)
@ -14663,7 +14663,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)
@ -14732,7 +14732,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)
@ -14924,7 +14924,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)
@ -15388,7 +15388,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)
@ -15588,7 +15588,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)
@ -15706,7 +15706,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",
@ -15961,7 +15961,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;
@ -16239,7 +16239,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 */
@ -16379,7 +16379,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)
@ -16454,7 +16454,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,
@ -16575,7 +16575,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)
@ -16706,7 +16706,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)
@ -17057,7 +17057,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)
@ -17259,7 +17259,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)
@ -18836,7 +18836,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;
@ -19015,7 +19015,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)
@ -19303,7 +19303,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)) {
@ -19569,7 +19569,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)
@ -19627,7 +19627,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)
@ -19799,7 +19799,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)
@ -19951,7 +19951,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) {
@ -20094,7 +20094,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)
@ -20499,7 +20499,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)
@ -20762,7 +20762,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) {

View File

@ -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;
}

View File

@ -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)) {
@ -8039,7 +8039,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;
@ -8680,7 +8680,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;

View File

@ -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)))