Although these and functions in the following two patches are for now just being used by the qemu driver, it makes sense to have all begin job functions in the same file. Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx> --- docs/kbase/internals/qemu-threads.rst | 10 ++-- src/conf/virdomainjob.c | 34 +++++++++++ src/conf/virdomainjob.h | 4 ++ src/libvirt_private.syms | 2 + src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_domainjob.c | 34 ----------- src/qemu/qemu_domainjob.h | 4 -- src/qemu/qemu_driver.c | 82 +++++++++++++-------------- src/qemu/qemu_snapshot.c | 10 ++-- 9 files changed, 92 insertions(+), 90 deletions(-) diff --git a/docs/kbase/internals/qemu-threads.rst b/docs/kbase/internals/qemu-threads.rst index 22d12f61a5..afdf9e61cc 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 (``virDomainObjBeginJob``) + (``virDomainObjBeginAgentJob``), 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 @@ -130,11 +130,11 @@ To acquire the normal job condition To acquire the agent job condition - ``qemuDomainObjBeginAgentJob()`` + ``virDomainObjBeginAgentJob()`` - Waits until there is no other agent job set - Sets ``job.agentActive`` to the job type - ``qemuDomainObjEndAgentJob()`` + ``virDomainObjEndAgentJob()`` - Sets ``job.agentActive`` to 0 - Signals on ``job.cond`` condition @@ -253,7 +253,7 @@ Design patterns obj = qemuDomObjFromDomain(dom); - qemuDomainObjBeginAgentJob(obj, VIR_AGENT_JOB_TYPE); + virDomainObjBeginAgentJob(obj, VIR_AGENT_JOB_TYPE); ...do prep work... @@ -266,7 +266,7 @@ Design patterns ...do final work... - qemuDomainObjEndAgentJob(obj); + virDomainObjEndAgentJob(obj); virDomainObjEndAPI(&obj); diff --git a/src/conf/virdomainjob.c b/src/conf/virdomainjob.c index 85486f612a..dfb28df6f9 100644 --- a/src/conf/virdomainjob.c +++ b/src/conf/virdomainjob.c @@ -528,6 +528,22 @@ int virDomainObjBeginJob(virDomainObj *obj, return 0; } +/** + * virDomainObjBeginAgentJob: + * + * Grabs agent type of job. Use if caller talks to guest agent only. + * + * To end job call virDomainObjEndAgentJob. + */ +int +virDomainObjBeginAgentJob(virDomainObj *obj, + virDomainAgentJob agentJob) +{ + return virDomainObjBeginJobInternal(obj, obj->job, VIR_JOB_NONE, + agentJob, + VIR_ASYNC_JOB_NONE, false); +} + /* * obj must be locked and have a reference before calling * @@ -555,3 +571,21 @@ virDomainObjEndJob(virDomainObj *obj) * grabbing a job requires checking more variables. */ virCondBroadcast(&obj->job->cond); } + +void +virDomainObjEndAgentJob(virDomainObj *obj) +{ + virDomainAgentJob agentJob = obj->job->agentActive; + + obj->job->jobsQueued--; + + VIR_DEBUG("Stopping agent job: %s (async=%s vm=%p name=%s)", + virDomainAgentJobTypeToString(agentJob), + virDomainAsyncJobTypeToString(obj->job->asyncJob), + obj, obj->def->name); + + virDomainObjResetAgentJob(obj->job); + /* We indeed need to wake up ALL threads waiting because + * grabbing a job requires checking more variables. */ + virCondBroadcast(&obj->job->cond); +} diff --git a/src/conf/virdomainjob.h b/src/conf/virdomainjob.h index 7a06c384f3..6cec322af1 100644 --- a/src/conf/virdomainjob.h +++ b/src/conf/virdomainjob.h @@ -249,5 +249,9 @@ int virDomainObjBeginJobInternal(virDomainObj *obj, int virDomainObjBeginJob(virDomainObj *obj, virDomainJob job) G_GNUC_WARN_UNUSED_RESULT; +int virDomainObjBeginAgentJob(virDomainObj *obj, + virDomainAgentJob agentJob) + G_GNUC_WARN_UNUSED_RESULT; void virDomainObjEndJob(virDomainObj *obj); +void virDomainObjEndAgentJob(virDomainObj *obj); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 9d2b26bfa2..74988dec34 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1187,10 +1187,12 @@ virDomainJobStatusToType; virDomainJobTypeFromString; virDomainJobTypeToString; virDomainNestedJobAllowed; +virDomainObjBeginAgentJob; virDomainObjBeginJob; virDomainObjBeginJobInternal; virDomainObjCanSetJob; virDomainObjClearJob; +virDomainObjEndAgentJob; virDomainObjEndJob; virDomainObjInitJob; virDomainObjPreserveJob; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 4dfb978599..ab05bed456 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6057,7 +6057,7 @@ qemuDomainObjEnterMonitorAsync(virDomainObj *obj, * obj must be locked before calling * * To be called immediately before any QEMU agent API call. - * Must have already called qemuDomainObjBeginAgentJob() and + * Must have already called virDomainObjBeginAgentJob() and * checked that the VM is still active. * * To be followed with qemuDomainObjExitAgent() once complete diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c index a8baf096e5..0775e04add 100644 --- a/src/qemu/qemu_domainjob.c +++ b/src/qemu/qemu_domainjob.c @@ -655,22 +655,6 @@ qemuDomainObjReleaseAsyncJob(virDomainObj *obj) obj->job->asyncOwner = 0; } -/** - * qemuDomainObjBeginAgentJob: - * - * Grabs agent type of job. Use if caller talks to guest agent only. - * - * To end job call qemuDomainObjEndAgentJob. - */ -int -qemuDomainObjBeginAgentJob(virDomainObj *obj, - virDomainAgentJob agentJob) -{ - return virDomainObjBeginJobInternal(obj, obj->job, VIR_JOB_NONE, - agentJob, - VIR_ASYNC_JOB_NONE, false); -} - int qemuDomainObjBeginAsyncJob(virDomainObj *obj, virDomainAsyncJob asyncJob, virDomainJobOperation operation, @@ -730,24 +714,6 @@ qemuDomainObjBeginJobNowait(virDomainObj *obj, VIR_ASYNC_JOB_NONE, true); } -void -qemuDomainObjEndAgentJob(virDomainObj *obj) -{ - virDomainAgentJob agentJob = obj->job->agentActive; - - obj->job->jobsQueued--; - - VIR_DEBUG("Stopping agent job: %s (async=%s vm=%p name=%s)", - virDomainAgentJobTypeToString(agentJob), - virDomainAsyncJobTypeToString(obj->job->asyncJob), - obj, obj->def->name); - - virDomainObjResetAgentJob(obj->job); - /* We indeed need to wake up ALL threads waiting because - * grabbing a job requires checking more variables. */ - virCondBroadcast(&obj->job->cond); -} - void qemuDomainObjEndAsyncJob(virDomainObj *obj) { diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h index 918b74748b..0cc4dc44f3 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 qemuDomainObjBeginAgentJob(virDomainObj *obj, - virDomainAgentJob agentJob) - G_GNUC_WARN_UNUSED_RESULT; int qemuDomainObjBeginAsyncJob(virDomainObj *obj, virDomainAsyncJob asyncJob, virDomainJobOperation operation, @@ -84,7 +81,6 @@ int qemuDomainObjBeginJobNowait(virDomainObj *obj, virDomainJob job) G_GNUC_WARN_UNUSED_RESULT; -void qemuDomainObjEndAgentJob(virDomainObj *obj); void qemuDomainObjEndAsyncJob(virDomainObj *obj); void qemuDomainObjAbortAsyncJob(virDomainObj *obj); void qemuDomainObjSetJobPhase(virDomainObj *obj, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 65f9ce6bca..7cabd32b64 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1781,7 +1781,7 @@ qemuDomainShutdownFlagsAgent(virDomainObj *vm, int agentFlag = isReboot ? QEMU_AGENT_SHUTDOWN_REBOOT : QEMU_AGENT_SHUTDOWN_POWERDOWN; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) return -1; if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) { @@ -1799,7 +1799,7 @@ qemuDomainShutdownFlagsAgent(virDomainObj *vm, qemuDomainObjExitAgent(vm, agent); endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); return ret; } @@ -1909,7 +1909,7 @@ qemuDomainRebootAgent(virDomainObj *vm, if (!isReboot) agentFlag = QEMU_AGENT_SHUTDOWN_POWERDOWN; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) return -1; if (!qemuDomainAgentAvailable(vm, agentForced)) @@ -1924,7 +1924,7 @@ qemuDomainRebootAgent(virDomainObj *vm, qemuDomainObjExitAgent(vm, agent); endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); return ret; } @@ -4368,7 +4368,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, if (useAgent) { - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; } else { if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) @@ -4388,7 +4388,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, endjob: if (useAgent) - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); else virDomainObjEndJob(vm); @@ -4809,7 +4809,7 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) goto cleanup; if (flags & VIR_DOMAIN_VCPU_GUEST) { - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; if (!virDomainObjIsActive(vm)) { @@ -4827,7 +4827,7 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) qemuDomainObjExitAgent(vm, agent); endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); if (ncpuinfo < 0) goto cleanup; @@ -16603,7 +16603,7 @@ qemuDomainPMSuspendAgent(virDomainObj *vm, qemuAgent *agent; int ret = -1; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -16617,7 +16617,7 @@ qemuDomainPMSuspendAgent(virDomainObj *vm, qemuDomainObjExitAgent(vm, agent); endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); return ret; } @@ -16769,7 +16769,7 @@ qemuDomainQemuAgentCommand(virDomainPtr domain, if (virDomainQemuAgentCommandEnsureACL(domain->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -16787,7 +16787,7 @@ qemuDomainQemuAgentCommand(virDomainPtr domain, VIR_FREE(result); endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -16863,7 +16863,7 @@ qemuDomainFSTrim(virDomainPtr dom, if (virDomainFSTrimEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -16877,7 +16877,7 @@ qemuDomainFSTrim(virDomainPtr dom, qemuDomainObjExitAgent(vm, agent); endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -17033,7 +17033,7 @@ qemuDomainGetHostnameAgent(virDomainObj *vm, qemuAgent *agent; int ret = -1; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -17048,7 +17048,7 @@ qemuDomainGetHostnameAgent(virDomainObj *vm, ret = 0; endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); return ret; } @@ -17174,7 +17174,7 @@ qemuDomainGetTime(virDomainPtr dom, if (virDomainGetTimeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -17193,7 +17193,7 @@ qemuDomainGetTime(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -17210,7 +17210,7 @@ qemuDomainSetTimeAgent(virDomainObj *vm, qemuAgent *agent; int ret = -1; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) return -1; if (virDomainObjCheckActive(vm) < 0) @@ -17224,7 +17224,7 @@ qemuDomainSetTimeAgent(virDomainObj *vm, qemuDomainObjExitAgent(vm, agent); endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); return ret; } @@ -17310,7 +17310,7 @@ qemuDomainFSFreeze(virDomainPtr dom, if (virDomainFSFreezeEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -17319,7 +17319,7 @@ qemuDomainFSFreeze(virDomainPtr dom, ret = qemuSnapshotFSFreeze(vm, mountpoints, nmountpoints); endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -17350,7 +17350,7 @@ qemuDomainFSThaw(virDomainPtr dom, if (virDomainFSThawEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -17359,7 +17359,7 @@ qemuDomainFSThaw(virDomainPtr dom, ret = qemuSnapshotFSThaw(vm, true); endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -18913,7 +18913,7 @@ qemuDomainGetFSInfoAgent(virDomainObj *vm, int ret = -1; qemuAgent *agent; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) return ret; if (virDomainObjCheckActive(vm) < 0) @@ -18927,7 +18927,7 @@ qemuDomainGetFSInfoAgent(virDomainObj *vm, qemuDomainObjExitAgent(vm, agent); endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); return ret; } @@ -19072,7 +19072,7 @@ qemuDomainInterfaceAddresses(virDomainPtr dom, break; case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT: - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -19083,7 +19083,7 @@ qemuDomainInterfaceAddresses(virDomainPtr dom, qemuDomainObjExitAgent(vm, agent); endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); break; @@ -19123,7 +19123,7 @@ qemuDomainSetUserPassword(virDomainPtr dom, if (virDomainSetUserPasswordEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) @@ -19143,7 +19143,7 @@ qemuDomainSetUserPassword(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); cleanup: virDomainObjEndAPI(&vm); @@ -19426,7 +19426,7 @@ qemuDomainGetGuestVcpus(virDomainPtr dom, if (virDomainGetGuestVcpusEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -19445,7 +19445,7 @@ qemuDomainGetGuestVcpus(virDomainPtr dom, ret = 0; endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); cleanup: VIR_FREE(info); @@ -19484,7 +19484,7 @@ qemuDomainSetGuestVcpus(virDomainPtr dom, if (virDomainSetGuestVcpusEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -19530,7 +19530,7 @@ qemuDomainSetGuestVcpus(virDomainPtr dom, qemuDomainObjExitAgent(vm, agent); endjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); cleanup: VIR_FREE(info); @@ -20445,7 +20445,7 @@ qemuDomainGetGuestInfo(virDomainPtr dom, if (virDomainGetGuestInfoEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -20503,7 +20503,7 @@ qemuDomainGetGuestInfo(virDomainPtr dom, } qemuDomainObjExitAgent(vm, agent); - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); if (nfs > 0 || ndisks > 0) { if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0) @@ -20550,7 +20550,7 @@ qemuDomainGetGuestInfo(virDomainPtr dom, qemuDomainObjExitAgent(vm, agent); endagentjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); goto cleanup; } @@ -20621,7 +20621,7 @@ qemuDomainAuthorizedSSHKeysGet(virDomainPtr dom, if (virDomainAuthorizedSshKeysGetEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -20632,7 +20632,7 @@ qemuDomainAuthorizedSSHKeysGet(virDomainPtr dom, qemuDomainObjExitAgent(vm, agent); endagentjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); cleanup: virDomainObjEndAPI(&vm); return rv; @@ -20661,7 +20661,7 @@ qemuDomainAuthorizedSSHKeysSet(virDomainPtr dom, if (virDomainAuthorizedSshKeysSetEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_QUERY) < 0) goto cleanup; if (!qemuDomainAgentAvailable(vm, true)) @@ -20675,7 +20675,7 @@ qemuDomainAuthorizedSSHKeysSet(virDomainPtr dom, qemuDomainObjExitAgent(vm, agent); endagentjob: - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); cleanup: virDomainObjEndAPI(&vm); return rv; diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index afed0f0e28..c5e5e3ed5b 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1277,16 +1277,16 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver, if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE) { int frozen; - if (qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) + if (virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) < 0) goto cleanup; if (virDomainObjCheckActive(vm) < 0) { - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); goto cleanup; } frozen = qemuSnapshotFSFreeze(vm, NULL, 0); - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); if (frozen < 0) goto cleanup; @@ -1422,13 +1422,13 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver, } if (thaw && - qemuDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) >= 0 && + virDomainObjBeginAgentJob(vm, VIR_AGENT_JOB_MODIFY) >= 0 && virDomainObjIsActive(vm)) { /* report error only on an otherwise successful snapshot */ if (qemuSnapshotFSThaw(vm, ret == 0) < 0) ret = -1; - qemuDomainObjEndAgentJob(vm); + virDomainObjEndAgentJob(vm); } virQEMUSaveDataFree(data); -- 2.37.2