1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-27 07:22:07 +03:00

qemu: blockjob: Consume new block job state in the processing function

The processing function modifies the job state so it should make sure
that the variable holding the new state is cleared properly and not the
caller. The caller should only deal with the job state and not the
transition that happened.

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-26 15:29:55 +01:00
parent 8ca9fcec24
commit c257352797

View File

@ -286,6 +286,9 @@ qemuBlockJobEventProcessLegacy(virQEMUDriverPtr driver,
job->state,
job->newstate);
if (job->newstate == -1)
return;
qemuBlockJobEmitEvents(driver, vm, disk, job->type, job->newstate);
/* If we completed a block pull or commit, then update the XML
@ -315,6 +318,7 @@ qemuBlockJobEventProcessLegacy(virQEMUDriverPtr driver,
}
job->state = job->newstate;
job->newstate = -1;
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("Unable to save status on vm %s after block job", vm->def->name);
@ -347,14 +351,13 @@ qemuBlockJobUpdateDisk(virDomainObjPtr vm,
{
qemuBlockJobDataPtr job = QEMU_DOMAIN_DISK_PRIVATE(disk)->blockjob;
qemuDomainObjPrivatePtr priv = vm->privateData;
int state = job->newstate;
if (state != -1) {
qemuBlockJobEventProcessLegacy(priv->driver, vm, job, asyncJob);
job->newstate = -1;
}
if (job->newstate == -1)
return -1;
return state;
qemuBlockJobEventProcessLegacy(priv->driver, vm, job, asyncJob);
return job->state;
}