The legacy job handler does not look at the old job state so we can
update it earlier.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_blockjob.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 097d87f663..08d131ca2b 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -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);
}
--
2.21.0