1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

Do not try to cancel non-existent migration on source

If migration failed on source daemon, the migration is automatically
canceled by the daemon itself. Thus we don't need to call
virDomainMigrateConfirm3(cancelled=1). Calling it doesn't cause any harm
but the resulting error message printed in logs may confuse people.
This commit is contained in:
Jiri Denemark 2011-08-12 20:46:07 +02:00
parent 6766ff10dd
commit 3398eeda75

View File

@ -4149,6 +4149,7 @@ virDomainMigrateVersion3(virDomainPtr domain,
virErrorPtr orig_err = NULL; virErrorPtr orig_err = NULL;
int cancelled = 1; int cancelled = 1;
unsigned long protection = 0; unsigned long protection = 0;
bool notify_source = true;
VIR_DOMAIN_DEBUG(domain, "dconn=%p xmlin=%s, flags=%lx, " VIR_DOMAIN_DEBUG(domain, "dconn=%p xmlin=%s, flags=%lx, "
"dname=%s, uri=%s, bandwidth=%lu", "dname=%s, uri=%s, bandwidth=%lu",
@ -4229,8 +4230,13 @@ virDomainMigrateVersion3(virDomainPtr domain,
uri, flags | protection, dname, bandwidth); uri, flags | protection, dname, bandwidth);
/* Perform failed. Make sure Finish doesn't overwrite the error */ /* Perform failed. Make sure Finish doesn't overwrite the error */
if (ret < 0) if (ret < 0) {
orig_err = virSaveLastError(); orig_err = virSaveLastError();
/* Perform failed so we don't need to call confirm to let source know
* about the failure.
*/
notify_source = false;
}
/* If Perform returns < 0, then we need to cancel the VM /* If Perform returns < 0, then we need to cancel the VM
* startup on the destination * startup on the destination
@ -4273,25 +4279,29 @@ finish:
confirm: confirm:
/* /*
* If cancelled, then src VM will be restarted, else * If cancelled, then src VM will be restarted, else it will be killed.
* it will be killed * Don't do this if migration failed on source and thus it was already
* cancelled there.
*/ */
VIR_DEBUG("Confirm3 %p ret=%d domain=%p", domain->conn, ret, domain); if (notify_source) {
VIR_FREE(cookiein); VIR_DEBUG("Confirm3 %p ret=%d domain=%p", domain->conn, ret, domain);
cookiein = cookieout; VIR_FREE(cookiein);
cookieinlen = cookieoutlen; cookiein = cookieout;
cookieout = NULL; cookieinlen = cookieoutlen;
cookieoutlen = 0; cookieout = NULL;
ret = domain->conn->driver->domainMigrateConfirm3 cookieoutlen = 0;
(domain, cookiein, cookieinlen, ret = domain->conn->driver->domainMigrateConfirm3
flags | protection, cancelled); (domain, cookiein, cookieinlen,
/* If Confirm3 returns -1, there's nothing more we can flags | protection, cancelled);
* do, but fortunately worst case is that there is a /* If Confirm3 returns -1, there's nothing more we can
* domain left in 'paused' state on source. * do, but fortunately worst case is that there is a
*/ * domain left in 'paused' state on source.
if (ret < 0) */
VIR_WARN("Guest %s probably left in 'paused' state on source", if (ret < 0) {
domain->name); VIR_WARN("Guest %s probably left in 'paused' state on source",
domain->name);
}
}
done: done:
if (orig_err) { if (orig_err) {