mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu & conf: move BeginNestedJob & BeginJobNowait into src/conf
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:
parent
4435c026b7
commit
ecc742126a
@ -559,6 +559,50 @@ int virDomainObjBeginAsyncJob(virDomainObj *obj,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
virDomainObjBeginNestedJob(virDomainObj *obj,
|
||||
virDomainAsyncJob asyncJob)
|
||||
{
|
||||
if (asyncJob != obj->job->asyncJob) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected async job %d type expected %d"),
|
||||
asyncJob, obj->job->asyncJob);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (obj->job->asyncOwner != virThreadSelfID()) {
|
||||
VIR_WARN("This thread doesn't seem to be the async job owner: %llu",
|
||||
obj->job->asyncOwner);
|
||||
}
|
||||
|
||||
return virDomainObjBeginJobInternal(obj, obj->job,
|
||||
VIR_JOB_ASYNC_NESTED,
|
||||
VIR_AGENT_JOB_NONE,
|
||||
VIR_ASYNC_JOB_NONE,
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
* virDomainObjBeginJobNowait:
|
||||
*
|
||||
* @obj: domain object
|
||||
* @job: virDomainJob to start
|
||||
*
|
||||
* Acquires job for a domain object which must be locked before
|
||||
* calling. If there's already a job running it returns
|
||||
* immediately without any error reported.
|
||||
*
|
||||
* Returns: see virDomainObjBeginJobInternal
|
||||
*/
|
||||
int
|
||||
virDomainObjBeginJobNowait(virDomainObj *obj,
|
||||
virDomainJob job)
|
||||
{
|
||||
return virDomainObjBeginJobInternal(obj, obj->job, job,
|
||||
VIR_AGENT_JOB_NONE,
|
||||
VIR_ASYNC_JOB_NONE, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* obj must be locked and have a reference before calling
|
||||
*
|
||||
|
@ -257,6 +257,12 @@ int virDomainObjBeginAsyncJob(virDomainObj *obj,
|
||||
virDomainJobOperation operation,
|
||||
unsigned long apiFlags)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
int virDomainObjBeginNestedJob(virDomainObj *obj,
|
||||
virDomainAsyncJob asyncJob)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
int virDomainObjBeginJobNowait(virDomainObj *obj,
|
||||
virDomainJob job)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
void virDomainObjEndJob(virDomainObj *obj);
|
||||
void virDomainObjEndAgentJob(virDomainObj *obj);
|
||||
|
@ -1191,6 +1191,8 @@ virDomainObjBeginAgentJob;
|
||||
virDomainObjBeginAsyncJob;
|
||||
virDomainObjBeginJob;
|
||||
virDomainObjBeginJobInternal;
|
||||
virDomainObjBeginJobNowait;
|
||||
virDomainObjBeginNestedJob;
|
||||
virDomainObjCanSetJob;
|
||||
virDomainObjClearJob;
|
||||
virDomainObjEndAgentJob;
|
||||
|
@ -5968,7 +5968,7 @@ qemuDomainObjEnterMonitorInternal(virDomainObj *obj,
|
||||
|
||||
if (asyncJob != VIR_ASYNC_JOB_NONE) {
|
||||
int ret;
|
||||
if ((ret = qemuDomainObjBeginNestedJob(obj, asyncJob)) < 0)
|
||||
if ((ret = virDomainObjBeginNestedJob(obj, asyncJob)) < 0)
|
||||
return ret;
|
||||
if (!virDomainObjIsActive(obj)) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
|
@ -655,50 +655,6 @@ qemuDomainObjReleaseAsyncJob(virDomainObj *obj)
|
||||
obj->job->asyncOwner = 0;
|
||||
}
|
||||
|
||||
int
|
||||
qemuDomainObjBeginNestedJob(virDomainObj *obj,
|
||||
virDomainAsyncJob asyncJob)
|
||||
{
|
||||
if (asyncJob != obj->job->asyncJob) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected async job %d type expected %d"),
|
||||
asyncJob, obj->job->asyncJob);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (obj->job->asyncOwner != virThreadSelfID()) {
|
||||
VIR_WARN("This thread doesn't seem to be the async job owner: %llu",
|
||||
obj->job->asyncOwner);
|
||||
}
|
||||
|
||||
return virDomainObjBeginJobInternal(obj, obj->job,
|
||||
VIR_JOB_ASYNC_NESTED,
|
||||
VIR_AGENT_JOB_NONE,
|
||||
VIR_ASYNC_JOB_NONE,
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
* qemuDomainObjBeginJobNowait:
|
||||
*
|
||||
* @obj: domain object
|
||||
* @job: virDomainJob to start
|
||||
*
|
||||
* Acquires job for a domain object which must be locked before
|
||||
* calling. If there's already a job running it returns
|
||||
* immediately without any error reported.
|
||||
*
|
||||
* Returns: see qemuDomainObjBeginJobInternal
|
||||
*/
|
||||
int
|
||||
qemuDomainObjBeginJobNowait(virDomainObj *obj,
|
||||
virDomainJob job)
|
||||
{
|
||||
return virDomainObjBeginJobInternal(obj, obj->job, job,
|
||||
VIR_AGENT_JOB_NONE,
|
||||
VIR_ASYNC_JOB_NONE, true);
|
||||
}
|
||||
|
||||
void
|
||||
qemuDomainObjAbortAsyncJob(virDomainObj *obj)
|
||||
{
|
||||
|
@ -69,13 +69,6 @@ int qemuDomainAsyncJobPhaseFromString(virDomainAsyncJob job,
|
||||
void qemuDomainEventEmitJobCompleted(virQEMUDriver *driver,
|
||||
virDomainObj *vm);
|
||||
|
||||
int qemuDomainObjBeginNestedJob(virDomainObj *obj,
|
||||
virDomainAsyncJob asyncJob)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
int qemuDomainObjBeginJobNowait(virDomainObj *obj,
|
||||
virDomainJob job)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
void qemuDomainObjAbortAsyncJob(virDomainObj *obj);
|
||||
void qemuDomainObjSetJobPhase(virDomainObj *obj,
|
||||
int phase);
|
||||
|
@ -18834,7 +18834,7 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
|
||||
int rv;
|
||||
|
||||
if (flags & VIR_CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT)
|
||||
rv = qemuDomainObjBeginJobNowait(vm, VIR_JOB_QUERY);
|
||||
rv = virDomainObjBeginJobNowait(vm, VIR_JOB_QUERY);
|
||||
else
|
||||
rv = virDomainObjBeginJob(vm, VIR_JOB_QUERY);
|
||||
|
||||
|
@ -8080,7 +8080,7 @@ void qemuProcessStop(virQEMUDriver *driver,
|
||||
virErrorPreserveLast(&orig_err);
|
||||
|
||||
if (asyncJob != VIR_ASYNC_JOB_NONE) {
|
||||
if (qemuDomainObjBeginNestedJob(vm, asyncJob) < 0)
|
||||
if (virDomainObjBeginNestedJob(vm, asyncJob) < 0)
|
||||
goto cleanup;
|
||||
} else if (vm->job->asyncJob != VIR_ASYNC_JOB_NONE &&
|
||||
vm->job->asyncOwner == virThreadSelfID() &&
|
||||
|
Loading…
Reference in New Issue
Block a user