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:
Kristina Hanicova 2021-12-01 10:41:41 +01:00 committed by Ján Tomko
parent 9b43ec60af
commit 01f9873724
4 changed files with 10 additions and 10 deletions

View File

@ -141,8 +141,6 @@ struct _qemuDomainObjPrivate {
*/
virTristateBool allowReboot;
int jobs_queued;
unsigned long migMaxBandwidth;
char *origname;
int nbdPort; /* Port used for migration with NBD */

View File

@ -841,13 +841,13 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
if (virTimeMillisNow(&now) < 0)
return -1;
priv->jobs_queued++;
priv->job.jobsQueued++;
then = now + QEMU_JOB_WAIT_TIME;
retry:
if ((!async && job != QEMU_JOB_DESTROY) &&
cfg->maxQueuedJobs &&
priv->jobs_queued > cfg->maxQueuedJobs) {
priv->job.jobsQueued > cfg->maxQueuedJobs) {
goto error;
}
@ -980,7 +980,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
}
ret = -2;
} else if (cfg->maxQueuedJobs &&
priv->jobs_queued > cfg->maxQueuedJobs) {
priv->job.jobsQueued > cfg->maxQueuedJobs) {
if (blocker && agentBlocker) {
virReportError(VIR_ERR_OPERATION_FAILED,
_("cannot acquire state change "
@ -1010,7 +1010,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
}
cleanup:
priv->jobs_queued--;
priv->job.jobsQueued--;
return ret;
}
@ -1130,7 +1130,7 @@ qemuDomainObjEndJob(virQEMUDriver *driver, virDomainObj *obj)
qemuDomainObjPrivate *priv = obj->privateData;
qemuDomainJob job = priv->job.active;
priv->jobs_queued--;
priv->job.jobsQueued--;
VIR_DEBUG("Stopping job: %s (async=%s vm=%p name=%s)",
qemuDomainJobTypeToString(job),
@ -1151,7 +1151,7 @@ qemuDomainObjEndAgentJob(virDomainObj *obj)
qemuDomainObjPrivate *priv = obj->privateData;
qemuDomainAgentJob agentJob = priv->job.agentActive;
priv->jobs_queued--;
priv->job.jobsQueued--;
VIR_DEBUG("Stopping agent job: %s (async=%s vm=%p name=%s)",
qemuDomainAgentJobTypeToString(agentJob),
@ -1169,7 +1169,7 @@ qemuDomainObjEndAsyncJob(virQEMUDriver *driver, virDomainObj *obj)
{
qemuDomainObjPrivate *priv = obj->privateData;
priv->jobs_queued--;
priv->job.jobsQueued--;
VIR_DEBUG("Stopping async job: %s (vm=%p name=%s)",
qemuDomainAsyncJobTypeToString(priv->job.asyncJob),

View File

@ -176,6 +176,8 @@ struct _qemuDomainObjPrivateJobCallbacks {
struct _qemuDomainJobObj {
virCond cond; /* Use to coordinate jobs */
int jobsQueued;
/* The following members are for QEMU_JOB_* */
qemuDomainJob active; /* Currently running job */
unsigned long long owner; /* Thread id which set current job */

View File

@ -3733,7 +3733,7 @@ qemuProcessRecoverJob(virQEMUDriver *driver,
ignore_value(virTimeMillisNow(&now));
/* 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.asyncOwnerAPI = g_strdup(virThreadJobGet());
priv->job.asyncStarted = now;