From 9dd12d4ecf6446669ca19402a371379850cb5152 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 17 Jul 2019 16:00:32 +0200 Subject: [PATCH] qemu: blockjob: Update new job state earlier in qemuBlockJobEventProcessLegacy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The legacy job handler does not look at the old job state so we can update it earlier. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- 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); }