qemu: blockjob: Update new job state earlier in qemuBlockJobEventProcessLegacy

The legacy job handler does not look at the old job state so we can
update it earlier.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-07-17 16:00:32 +02:00
parent b6316435e4
commit 9dd12d4ecf

View File

@ -350,9 +350,12 @@ qemuBlockJobEventProcessLegacy(virQEMUDriverPtr driver,
qemuBlockJobEmitEvents(driver, vm, disk, job->type, job->newstate);
job->state = job->newstate;
job->newstate = -1;
/* If we completed a block pull or commit, then update the XML
* to match. */
switch ((virConnectDomainEventBlockJobStatus) job->newstate) {
switch ((virConnectDomainEventBlockJobStatus) job->state) {
case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
qemuBlockJobEventProcessLegacyCompleted(driver, vm, job, asyncJob);
break;
@ -377,9 +380,6 @@ qemuBlockJobEventProcessLegacy(virQEMUDriverPtr driver,
break;
}
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);
}