mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-27 09:57:43 +03:00
qemu_domainjob: move jobs_queued to struct qemuDomainJobObj
I think it makes more sense for the variable about jobs to be in the job object. I also renamed it to be consistent with the rest of the struct. 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
9b43ec60af
commit
01f9873724
@ -141,8 +141,6 @@ struct _qemuDomainObjPrivate {
|
|||||||
*/
|
*/
|
||||||
virTristateBool allowReboot;
|
virTristateBool allowReboot;
|
||||||
|
|
||||||
int jobs_queued;
|
|
||||||
|
|
||||||
unsigned long migMaxBandwidth;
|
unsigned long migMaxBandwidth;
|
||||||
char *origname;
|
char *origname;
|
||||||
int nbdPort; /* Port used for migration with NBD */
|
int nbdPort; /* Port used for migration with NBD */
|
||||||
|
@ -841,13 +841,13 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
|
|||||||
if (virTimeMillisNow(&now) < 0)
|
if (virTimeMillisNow(&now) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
priv->jobs_queued++;
|
priv->job.jobsQueued++;
|
||||||
then = now + QEMU_JOB_WAIT_TIME;
|
then = now + QEMU_JOB_WAIT_TIME;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
if ((!async && job != QEMU_JOB_DESTROY) &&
|
if ((!async && job != QEMU_JOB_DESTROY) &&
|
||||||
cfg->maxQueuedJobs &&
|
cfg->maxQueuedJobs &&
|
||||||
priv->jobs_queued > cfg->maxQueuedJobs) {
|
priv->job.jobsQueued > cfg->maxQueuedJobs) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -980,7 +980,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
|
|||||||
}
|
}
|
||||||
ret = -2;
|
ret = -2;
|
||||||
} else if (cfg->maxQueuedJobs &&
|
} else if (cfg->maxQueuedJobs &&
|
||||||
priv->jobs_queued > cfg->maxQueuedJobs) {
|
priv->job.jobsQueued > cfg->maxQueuedJobs) {
|
||||||
if (blocker && agentBlocker) {
|
if (blocker && agentBlocker) {
|
||||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("cannot acquire state change "
|
_("cannot acquire state change "
|
||||||
@ -1010,7 +1010,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
priv->jobs_queued--;
|
priv->job.jobsQueued--;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1130,7 +1130,7 @@ qemuDomainObjEndJob(virQEMUDriver *driver, virDomainObj *obj)
|
|||||||
qemuDomainObjPrivate *priv = obj->privateData;
|
qemuDomainObjPrivate *priv = obj->privateData;
|
||||||
qemuDomainJob job = priv->job.active;
|
qemuDomainJob job = priv->job.active;
|
||||||
|
|
||||||
priv->jobs_queued--;
|
priv->job.jobsQueued--;
|
||||||
|
|
||||||
VIR_DEBUG("Stopping job: %s (async=%s vm=%p name=%s)",
|
VIR_DEBUG("Stopping job: %s (async=%s vm=%p name=%s)",
|
||||||
qemuDomainJobTypeToString(job),
|
qemuDomainJobTypeToString(job),
|
||||||
@ -1151,7 +1151,7 @@ qemuDomainObjEndAgentJob(virDomainObj *obj)
|
|||||||
qemuDomainObjPrivate *priv = obj->privateData;
|
qemuDomainObjPrivate *priv = obj->privateData;
|
||||||
qemuDomainAgentJob agentJob = priv->job.agentActive;
|
qemuDomainAgentJob agentJob = priv->job.agentActive;
|
||||||
|
|
||||||
priv->jobs_queued--;
|
priv->job.jobsQueued--;
|
||||||
|
|
||||||
VIR_DEBUG("Stopping agent job: %s (async=%s vm=%p name=%s)",
|
VIR_DEBUG("Stopping agent job: %s (async=%s vm=%p name=%s)",
|
||||||
qemuDomainAgentJobTypeToString(agentJob),
|
qemuDomainAgentJobTypeToString(agentJob),
|
||||||
@ -1169,7 +1169,7 @@ qemuDomainObjEndAsyncJob(virQEMUDriver *driver, virDomainObj *obj)
|
|||||||
{
|
{
|
||||||
qemuDomainObjPrivate *priv = obj->privateData;
|
qemuDomainObjPrivate *priv = obj->privateData;
|
||||||
|
|
||||||
priv->jobs_queued--;
|
priv->job.jobsQueued--;
|
||||||
|
|
||||||
VIR_DEBUG("Stopping async job: %s (vm=%p name=%s)",
|
VIR_DEBUG("Stopping async job: %s (vm=%p name=%s)",
|
||||||
qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
|
qemuDomainAsyncJobTypeToString(priv->job.asyncJob),
|
||||||
|
@ -176,6 +176,8 @@ struct _qemuDomainObjPrivateJobCallbacks {
|
|||||||
struct _qemuDomainJobObj {
|
struct _qemuDomainJobObj {
|
||||||
virCond cond; /* Use to coordinate jobs */
|
virCond cond; /* Use to coordinate jobs */
|
||||||
|
|
||||||
|
int jobsQueued;
|
||||||
|
|
||||||
/* The following members are for QEMU_JOB_* */
|
/* The following members are for QEMU_JOB_* */
|
||||||
qemuDomainJob active; /* Currently running job */
|
qemuDomainJob active; /* Currently running job */
|
||||||
unsigned long long owner; /* Thread id which set current job */
|
unsigned long long owner; /* Thread id which set current job */
|
||||||
|
@ -3733,7 +3733,7 @@ qemuProcessRecoverJob(virQEMUDriver *driver,
|
|||||||
ignore_value(virTimeMillisNow(&now));
|
ignore_value(virTimeMillisNow(&now));
|
||||||
|
|
||||||
/* Restore the config of the async job which is not persisted */
|
/* Restore the config of the async job which is not persisted */
|
||||||
priv->jobs_queued++;
|
priv->job.jobsQueued++;
|
||||||
priv->job.asyncJob = QEMU_ASYNC_JOB_BACKUP;
|
priv->job.asyncJob = QEMU_ASYNC_JOB_BACKUP;
|
||||||
priv->job.asyncOwnerAPI = g_strdup(virThreadJobGet());
|
priv->job.asyncOwnerAPI = g_strdup(virThreadJobGet());
|
||||||
priv->job.asyncStarted = now;
|
priv->job.asyncStarted = now;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user