[PATCH RFC 16/51] qemu: blockjob: Clarify that job 'status' field contains new state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_blockjob.c | 12 ++++++------
 src/qemu/qemu_blockjob.h |  3 ++-
 src/qemu/qemu_driver.c   |  2 +-
 src/qemu/qemu_process.c  |  4 ++--
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index cf1710a0e8..252f1640b2 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -261,22 +261,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;
 }


@@ -300,7 +300,7 @@ qemuBlockJobSyncBeginDisk(virDomainDiskDefPtr disk)

     VIR_DEBUG("disk=%s", disk->dst);
     job->synchronous = true;
-    job->status = -1;
+    job->newstate = -1;
 }


diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h
index de1ad7039d..7761eee6ae 100644
--- a/src/qemu/qemu_blockjob.h
+++ b/src/qemu/qemu_blockjob.h
@@ -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);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0598f6e5c7..637307806b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4734,7 +4734,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);

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 471e11115f..2cead713f6 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -942,7 +942,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);
@@ -7782,7 +7782,7 @@ qemuProcessRefreshLegacyBlockjob(void *payload,
     }

     job->started = true;
-    job->status = -1;
+    job->newstate = -1;

     return 0;
 }
-- 
2.19.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux