Upcoming patch will remove unnecessary actions if the VM crashed. The
cleanup needs to be performed always, thus needs to be moved earlier.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_backup.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
index 423de9c719..d3d98c1d6a 100644
--- a/src/qemu/qemu_backup.c
+++ b/src/qemu/qemu_backup.c
@@ -560,21 +560,6 @@ qemuBackupJobTerminate(virDomainObjPtr vm,
qemuDomainObjPrivatePtr priv = vm->privateData;
size_t i;
- qemuDomainJobInfoUpdateTime(priv->job.current);
-
- g_clear_pointer(&priv->job.completed, qemuDomainJobInfoFree);
- priv->job.completed = qemuDomainJobInfoCopy(priv->job.current);
-
- priv->job.completed->stats.backup.total = priv->backup->push_total;
- priv->job.completed->stats.backup.transferred =
priv->backup->push_transferred;
- priv->job.completed->stats.backup.tmp_used =
priv->backup->pull_tmp_used;
- priv->job.completed->stats.backup.tmp_total =
priv->backup->pull_tmp_total;
-
- priv->job.completed->status = jobstatus;
- priv->job.completed->errmsg = g_strdup(priv->backup->errmsg);
-
- qemuDomainEventEmitJobCompleted(priv->driver, vm);
-
if (!(priv->job.apiFlags & VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL) &&
(priv->backup->type == VIR_DOMAIN_BACKUP_TYPE_PULL ||
(priv->backup->type == VIR_DOMAIN_BACKUP_TYPE_PUSH &&
@@ -598,6 +583,21 @@ qemuBackupJobTerminate(virDomainObjPtr vm,
}
}
+ qemuDomainJobInfoUpdateTime(priv->job.current);
+
+ g_clear_pointer(&priv->job.completed, qemuDomainJobInfoFree);
+ priv->job.completed = qemuDomainJobInfoCopy(priv->job.current);
+
+ priv->job.completed->stats.backup.total = priv->backup->push_total;
+ priv->job.completed->stats.backup.transferred =
priv->backup->push_transferred;
+ priv->job.completed->stats.backup.tmp_used =
priv->backup->pull_tmp_used;
+ priv->job.completed->stats.backup.tmp_total =
priv->backup->pull_tmp_total;
+
+ priv->job.completed->status = jobstatus;
+ priv->job.completed->errmsg = g_strdup(priv->backup->errmsg);
+
+ qemuDomainEventEmitJobCompleted(priv->driver, vm);
+
virDomainBackupDefFree(priv->backup);
priv->backup = NULL;
qemuDomainObjEndAsyncJob(priv->driver, vm);
--
2.29.2