[PATCH 1/2] qemuBackupJobTerminate: Move cleanup of temp files earlier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux