2011/5/24 Daniel P. Berrange <berrange(a)redhat.com>:
When doing migration, if an error occurs in Perform, it must not
be overwritten during Finish/Confirm steps. If an error occurs
in Finish, it must not be overwritten in Confirm.
Previous commit a9d12c2444e43a0d3e5135eb15b4b62a7c011427 added
code to qemudDomainMigrateFinish2 to preserve the error. This
is not the right place, because it is not applicable in non-p2p
migration. The src/libvirt.c virDomainMigrateV2/3 methods need
code to preserve errors for non-p2p migration, while the
doPeer2PeerMigrate2 and doPeer2PeerMigrate3 methods contain
code to preverse errors for p2p migration.
Remove the bogus error preservation from qemudDomainMigrateFinish2
and qemudDomainMigrateFinish3.
Fix virDomainMigrateV3 and doPeer2PeerMigrate3 so that they
preserve any error hit during the Finish3 step, before invoking
Confirm3.
Finally if qemuMigrationFinish fails to resume the CPUs, it must
preserve the error before tearing down the VM, so that VM cleanup
doesn't overwrite it.
* src/libvirt.c: Preserve error before invoking Confirm3
* src/qemu/qemu_driver.c: Remove bogus error preservation
code in qemudDomainMigrateFinish2/qemudDomainMigrateFinish3
* src/qemu/qemu_migration.c: Preserve error before invoking Confirm3
and after resume fails in qemuMigrationFinish.
---
src/libvirt.c | 6 ++++++
src/qemu/qemu_driver.c | 24 ------------------------
src/qemu/qemu_migration.c | 23 ++++++++++++++++++++---
3 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 280b8cb..a0365ac 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2382,6 +2394,11 @@ cleanup:
if (event)
qemuDomainEventQueue(driver, event);
qemuMigrationCookieFree(mig);
+ if (orig_err) {
+ virSetError(orig_err);
+ virFreeError(orig_err);
+ orig_err = virGetLastError();
+ }
return dom;
}
The last virGetLastError isn't necessary and can be removed, can't it?
ACK.
Matthias