mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00: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:
parent
8ca9fcec24
commit
c257352797
@ -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) {
|
||||
if (job->newstate == -1)
|
||||
return -1;
|
||||
|
||||
qemuBlockJobEventProcessLegacy(priv->driver, vm, job, asyncJob);
|
||||
job->newstate = -1;
|
||||
}
|
||||
|
||||
return state;
|
||||
return job->state;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user