If migration failed in Prepare phase after virDomainAssignDef and before
a job is started, the domain object was not properly removed.
---
Notes:
Version 2:
- only remove the inactive domain if ret < 0
src/qemu/qemu_migration.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 0a5a13d..ada5396 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1178,8 +1178,12 @@ cleanup:
virDomainDefFree(def);
VIR_FORCE_CLOSE(dataFD[0]);
VIR_FORCE_CLOSE(dataFD[1]);
- if (vm)
- virDomainObjUnlock(vm);
+ if (vm) {
+ if (ret >= 0 || vm->persistent)
+ virDomainObjUnlock(vm);
+ else
+ qemuDomainRemoveInactive(driver, vm);
+ }
if (event)
qemuDomainEventQueue(driver, event);
qemuMigrationCookieFree(mig);
@@ -1188,9 +1192,6 @@ cleanup:
endjob:
if (qemuMigrationJobFinish(driver, vm) == 0) {
vm = NULL;
- } else if (!vm->persistent) {
- qemuDomainRemoveInactive(driver, vm);
- vm = NULL;
}
goto cleanup;
}
--
1.7.6.1