[PATCH] migration: fix xml file residual during vm crash with migration

Chuan Zheng posted 1 patch 2 weeks ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1595832661-113281-1-git-send-email-zhengchuan@huawei.com
src/qemu/qemu_migration.c | 3 +++
1 file changed, 3 insertions(+)

[PATCH] migration: fix xml file residual during vm crash with migration

Posted by Chuan Zheng 2 weeks ago
From: Zheng Chuan <zhengchuan@huawei.com>

when migration is cancelled (such as kill -9 vmpid in Src, etc), it could
do virDomainSaveStatus() to save xml file after qemuProcessStop(), which results
in xml residulal.

Fix it by that do not do virDomainSaveStatus() if vm is not active.

Signed-off-by: Zheng Chuan <zhengchuan@huawei.com>
---
 src/qemu/qemu_migration.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 2c7bf34..d2804ab 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3073,6 +3073,9 @@ qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver,
         qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
                                  jobPriv->migParams, priv->job.apiFlags);
 
+        if (!virDomainObjIsActive(vm))
+            goto done;
+
         if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
             VIR_WARN("Failed to save status on vm %s", vm->def->name);
     }
-- 
1.8.3.1