]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: blockjob: Clarify that job 'status' field contains new state
authorPeter Krempa <pkrempa@redhat.com>
Thu, 22 Nov 2018 14:05:50 +0000 (15:05 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 17 Jan 2019 16:12:50 +0000 (17:12 +0100)
The field is used to note the state the job has transitioned to while
handling the blockjob state change event. Rename the field so that it's
obvious that this is the new state and not the general state of the
blockjob.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_blockjob.c
src/qemu/qemu_blockjob.h
src/qemu/qemu_driver.c
src/qemu/qemu_process.c

index ef71d8f0f9119067cc1aa179649e6bb9c553d172..5c9f263450e200c22babe355005d59d55e6229eb 100644 (file)
@@ -262,22 +262,22 @@ qemuBlockJobUpdateDisk(virDomainObjPtr vm,
 {
     qemuBlockJobDataPtr job = QEMU_DOMAIN_DISK_PRIVATE(disk)->blockjob;
     qemuDomainObjPrivatePtr priv = vm->privateData;
-    int status = job->status;
+    int state = job->newstate;
 
     if (error)
         *error = NULL;
 
-    if (status != -1) {
+    if (state != -1) {
         qemuBlockJobEventProcessLegacy(priv->driver, vm, disk, asyncJob,
-                                       job->type, status);
-        job->status = -1;
+                                       job->type, state);
+        job->newstate = -1;
         if (error)
             VIR_STEAL_PTR(*error, job->errmsg);
         else
             VIR_FREE(job->errmsg);
     }
 
-    return status;
+    return state;
 }
 
 
@@ -301,7 +301,7 @@ qemuBlockJobSyncBeginDisk(virDomainDiskDefPtr disk)
 
     VIR_DEBUG("disk=%s", disk->dst);
     job->synchronous = true;
-    job->status = -1;
+    job->newstate = -1;
 }
 
 
index fc794d3d0b6c08bdc5113ed61e78fea2749722dd..9fda68a20593af048d2a46941c47eb1cd4c14e03 100644 (file)
@@ -34,9 +34,10 @@ struct _qemuBlockJobData {
 
     bool started;
     int type;
-    int status;
     char *errmsg;
     bool synchronous; /* API call is waiting for this job */
+
+    int newstate; /* virConnectDomainEventBlockJobStatus - new state to be processed */
 };
 
 qemuBlockJobDataPtr qemuBlockJobDataNew(void);
index 79481310108160c3baf36a7d62de46baea53f4b9..926b8c7b89656b55d9c868e720cc46fb81d3af23 100644 (file)
@@ -4735,7 +4735,7 @@ processBlockJobEvent(virQEMUDriverPtr driver,
     job = QEMU_DOMAIN_DISK_PRIVATE(disk)->blockjob;
 
     job->type = type;
-    job->status = status;
+    job->newstate = status;
 
     qemuBlockJobUpdateDisk(vm, QEMU_ASYNC_JOB_NONE, disk, NULL);
 
index a75996f2ccea98f3211eb9a9dab69b79da2f554d..d5bdd0d74d8cbfcbd9b2aadbee576387ce1d5772 100644 (file)
@@ -943,7 +943,7 @@ qemuProcessHandleBlockJob(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     if (job->synchronous) {
         /* We have a SYNC API waiting for this event, dispatch it back */
         job->type = type;
-        job->status = status;
+        job->newstate = status;
         VIR_FREE(job->errmsg);
         ignore_value(VIR_STRDUP_QUIET(job->errmsg, error));
         virDomainObjBroadcast(vm);
@@ -7845,7 +7845,7 @@ qemuProcessRefreshLegacyBlockjob(void *payload,
     }
 
     job->started = true;
-    job->status = -1;
+    job->newstate = -1;
 
     return 0;
 }