mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-19 11:05:16 +00:00
qemu: Report error from both sides of migration
When migration fails in Perform phase, we call Finish on the destination host with cancelled=1 and get the error from there and report it to the user. This works well if the error on the destination caused the migration to fail. But in other cases the main error may reported by the source and the destination would just be complaining about broken migration stream. In other words, we don't really know which error caused the migration to fail and we have no way of detecting that. So instead of choosing one error, this patch will combine the error messages from both sides of migration into a single message and report it to the user. The result would be, for example: operation failed: migration failed. Message from the source host: operation failed: job 'migration out' failed: Certificate does not match the hostname ble.bla. Message from the destination host: operation failed: job 'migration in' failed: load of migration failed: Invalid argument And yes, this is ugly, but I wasn't able to come up with a better way of fixing this issue. https://issues.redhat.com/browse/RHEL-58933 Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
14fc6812df
commit
899bf2746a
@ -3430,29 +3430,29 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
|
||||
if (ddomain) {
|
||||
VIR_ERROR(_("finish step ignored that migration was cancelled"));
|
||||
} else {
|
||||
/* If Finish reported a useful error, use it instead of the
|
||||
* original "migration unexpectedly failed" error.
|
||||
virErrorPtr err = virGetLastError();
|
||||
/* When both Confirm and Finish reported an error in QEMU driver,
|
||||
* we don't really know which error is the root cause. Let's report
|
||||
* both errors to the user.
|
||||
*
|
||||
* This is ugly but we can't do better with the APIs we have. We
|
||||
* only replace the error if Finish was called with cancelled == 1
|
||||
* and reported a real error (old libvirt would report an error
|
||||
* from RPC instead of MIGRATE_FINISH_OK), which only happens when
|
||||
* the domain died on destination. To further reduce a possibility
|
||||
* of false positives we also check that Perform returned
|
||||
* VIR_ERR_OPERATION_FAILED.
|
||||
* from RPC instead of MIGRATE_FINISH_OK).
|
||||
*/
|
||||
if (orig_err &&
|
||||
orig_err->domain == VIR_FROM_QEMU &&
|
||||
orig_err->code == VIR_ERR_OPERATION_FAILED) {
|
||||
virErrorPtr err = virGetLastError();
|
||||
if (err &&
|
||||
orig_err->code == VIR_ERR_OPERATION_FAILED &&
|
||||
err &&
|
||||
err->domain == VIR_FROM_QEMU &&
|
||||
err->code != VIR_ERR_MIGRATE_FINISH_OK) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("migration failed. Message from the source host: %1$s. Message from the destination host: %2$s"),
|
||||
orig_err->message, err->message);
|
||||
g_clear_pointer(&orig_err, virFreeError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If ddomain is NULL, then we were unable to start
|
||||
* the guest on the target, and must restart on the
|
||||
|
@ -5904,29 +5904,29 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriver *driver,
|
||||
if (ddomain) {
|
||||
VIR_ERROR(_("finish step ignored that migration was cancelled"));
|
||||
} else {
|
||||
/* If Finish reported a useful error, use it instead of the
|
||||
* original "migration unexpectedly failed" error.
|
||||
virErrorPtr err = virGetLastError();
|
||||
/* When both Confirm and Finish reported an error in QEMU driver,
|
||||
* we don't really know which error is the root cause. Let's report
|
||||
* both errors to the user.
|
||||
*
|
||||
* This is ugly but we can't do better with the APIs we have. We
|
||||
* only replace the error if Finish was called with cancelled == 1
|
||||
* and reported a real error (old libvirt would report an error
|
||||
* from RPC instead of MIGRATE_FINISH_OK), which only happens when
|
||||
* the domain died on destination. To further reduce a possibility
|
||||
* of false positives we also check that Perform returned
|
||||
* VIR_ERR_OPERATION_FAILED.
|
||||
* from RPC instead of MIGRATE_FINISH_OK).
|
||||
*/
|
||||
if (orig_err &&
|
||||
orig_err->domain == VIR_FROM_QEMU &&
|
||||
orig_err->code == VIR_ERR_OPERATION_FAILED) {
|
||||
virErrorPtr err = virGetLastError();
|
||||
if (err &&
|
||||
orig_err->code == VIR_ERR_OPERATION_FAILED &&
|
||||
err &&
|
||||
err->domain == VIR_FROM_QEMU &&
|
||||
err->code != VIR_ERR_MIGRATE_FINISH_OK) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("migration failed. Message from the source host: %1$s. Message from the destination host: %2$s"),
|
||||
orig_err->message, err->message);
|
||||
g_clear_pointer(&orig_err, virFreeError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If ddomain is NULL, then we were unable to start
|
||||
* the guest on the target, and must restart on the
|
||||
|
Loading…
x
Reference in New Issue
Block a user