]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_domainjob: move jobs_queued to struct qemuDomainJobObj
authorKristina Hanicova <khanicov@redhat.com>
Wed, 1 Dec 2021 09:41:41 +0000 (10:41 +0100)
committerJán Tomko <jtomko@redhat.com>
Wed, 1 Dec 2021 11:45:40 +0000 (12:45 +0100)
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>
src/qemu/qemu_domain.h
src/qemu/qemu_domainjob.c
src/qemu/qemu_domainjob.h
src/qemu/qemu_process.c

index 8173c39cdb11c4dda7e784c186316a6a4e02039c..f2a303d8a721f66298ae224606a7a49e6be5516b 100644 (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 */
index 439a9d10c22eb346a249386365041dd50c3c8f33..c8fe8ad55569f423df3b89a2cb300091f6851ba8 100644 (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),
index eaa5cda3ebfca8290e789fd3a81db547ca89d90e..f904bd49c231e06117770eff754faf9701336b71 100644 (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 */
index 34302b404a602784a56e242b44441a94e63b1454..e1b5e68237f58b0d659b4e37264dafe184a5099b 100644 (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;