提交 b3e6a2ea 编写于 作者: P Peter Krempa

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: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 4479bd46
......@@ -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;
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册