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(a)redhat.com>
---
Not gonna lie, it will make my planned generalization of jobs
much easier as well.
src/qemu/qemu_domain.h | 2 --
src/qemu/qemu_domainjob.c | 14 +++++++-------
src/qemu/qemu_domainjob.h | 2 ++
src/qemu/qemu_process.c | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 6728ab047e..913c20b941 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -141,8 +141,6 @@ struct _qemuDomainObjPrivate {
*/
virTristateBool allowReboot;
- int jobs_queued;
-
unsigned long migMaxBandwidth;
char *origname;
int nbdPort; /* Port used for migration with NBD */
diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c
index cff8d7bb83..62fa09921b 100644
--- a/src/qemu/qemu_domainjob.c
+++ b/src/qemu/qemu_domainjob.c
@@ -847,13 +847,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;
}
@@ -986,7 +986,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 "
@@ -1016,7 +1016,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
}
cleanup:
- priv->jobs_queued--;
+ priv->job.jobsQueued--;
return ret;
}
@@ -1136,7 +1136,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),
@@ -1157,7 +1157,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),
@@ -1175,7 +1175,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),
diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h
index 46cbb8a067..cfef1ff462 100644
--- a/src/qemu/qemu_domainjob.h
+++ b/src/qemu/qemu_domainjob.h
@@ -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 */
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index c355a39e15..3b07f52954 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3745,7 +3745,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;
--
2.31.1
Show replies by date
On a Wednesday in 2021, Kristina Hanicova wrote:
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(a)redhat.com>
---
Not gonna lie, it will make my planned generalization of jobs
much easier as well.
Lying might be against our project governance rules anyway:
https://libvirt.org/governance.html
src/qemu/qemu_domain.h | 2 --
src/qemu/qemu_domainjob.c | 14 +++++++-------
src/qemu/qemu_domainjob.h | 2 ++
src/qemu/qemu_process.c | 2 +-
4 files changed, 10 insertions(+), 10 deletions(-)
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano