qemu: blockjob: Clarify that job 'status' field contains new state

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>
This commit is contained in:
Peter Krempa 2018-11-22 15:05:50 +01:00
parent 4479bd4611
commit b3e6a2ea3a
4 changed files with 11 additions and 10 deletions

View 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;
}

View 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);

View 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);

View 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;
}