From 5379bb0f33f1529f530a40958a10e8f02eb868bb Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 12 Jun 2013 16:11:22 +0200 Subject: [PATCH] migration: Don't propagate VIR_MIGRATE_ABORT_ON_ERROR This flag is meant for errors happening on the source of the migration and isn't used on the destination. To allow better migration compatibility, don't propagate it to the destination. --- src/libvirt.c | 17 +++++++++++------ src/qemu/qemu_migration.c | 16 ++++++++++------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/libvirt.c b/src/libvirt.c index 8eb714128f..db120b7f94 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -4554,6 +4554,8 @@ virDomainMigrateVersion1(virDomainPtr domain, char *cookie = NULL; int cookielen = 0, ret; virDomainInfo info; + unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR; + VIR_DOMAIN_DEBUG(domain, "dconn=%p, flags=%lx, dname=%s, uri=%s, bandwidth=%lu", dconn, flags, NULLSTR(dname), NULLSTR(uri), bandwidth); @@ -4575,7 +4577,7 @@ virDomainMigrateVersion1(virDomainPtr domain, * the URI, it should leave uri_out as NULL. */ if (dconn->driver->domainMigratePrepare - (dconn, &cookie, &cookielen, uri, &uri_out, flags, dname, + (dconn, &cookie, &cookielen, uri, &uri_out, destflags, dname, bandwidth) == -1) goto done; @@ -4602,7 +4604,7 @@ virDomainMigrateVersion1(virDomainPtr domain, dname = dname ? dname : domain->name; if (dconn->driver->domainMigrateFinish) ddomain = dconn->driver->domainMigrateFinish - (dconn, dname, cookie, cookielen, uri, flags); + (dconn, dname, cookie, cookielen, uri, destflags); else ddomain = virDomainLookupByName(dconn, dname); @@ -4648,6 +4650,8 @@ virDomainMigrateVersion2(virDomainPtr domain, virErrorPtr orig_err = NULL; unsigned int getxml_flags = 0; int cancelled; + unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR; + VIR_DOMAIN_DEBUG(domain, "dconn=%p, flags=%lx, dname=%s, uri=%s, bandwidth=%lu", dconn, flags, NULLSTR(dname), NULLSTR(uri), bandwidth); @@ -4692,7 +4696,7 @@ virDomainMigrateVersion2(virDomainPtr domain, VIR_DEBUG("Prepare2 %p flags=%lx", dconn, flags); ret = dconn->driver->domainMigratePrepare2 - (dconn, &cookie, &cookielen, uri, &uri_out, flags, dname, + (dconn, &cookie, &cookielen, uri, &uri_out, destflags, dname, bandwidth, dom_xml); VIR_FREE(dom_xml); if (ret == -1) @@ -4732,7 +4736,7 @@ finish: dname = dname ? dname : domain->name; VIR_DEBUG("Finish2 %p ret=%d", dconn, ret); ddomain = dconn->driver->domainMigrateFinish2 - (dconn, dname, cookie, cookielen, uri, flags, cancelled); + (dconn, dname, cookie, cookielen, uri, destflags, cancelled); done: if (orig_err) { @@ -4791,6 +4795,7 @@ virDomainMigrateVersion3(virDomainPtr domain, int cancelled = 1; unsigned long protection = 0; bool notify_source = true; + unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR; VIR_DOMAIN_DEBUG(domain, "dconn=%p xmlin=%s, flags=%lx, " "dname=%s, uri=%s, bandwidth=%lu", @@ -4830,7 +4835,7 @@ virDomainMigrateVersion3(virDomainPtr domain, cookieoutlen = 0; ret = dconn->driver->domainMigratePrepare3 (dconn, cookiein, cookieinlen, &cookieout, &cookieoutlen, - uri, &uri_out, flags, dname, bandwidth, dom_xml); + uri, &uri_out, destflags, dname, bandwidth, dom_xml); VIR_FREE(dom_xml); if (ret == -1) { if (protection) { @@ -4908,7 +4913,7 @@ finish: dname = dname ? dname : domain->name; ddomain = dconn->driver->domainMigrateFinish3 (dconn, dname, cookiein, cookieinlen, &cookieout, &cookieoutlen, - NULL, uri, flags, cancelled); + NULL, uri, destflags, cancelled); /* If ddomain is NULL, then we were unable to start * the guest on the target, and must restart on the diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 9a486427a7..8de38fe65c 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3183,6 +3183,8 @@ static int doPeer2PeerMigrate2(virQEMUDriverPtr driver, virErrorPtr orig_err = NULL; bool cancelled; virStreamPtr st = NULL; + unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR; + VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, dconnuri=%s, " "flags=%lx, dname=%s, resource=%lu", driver, sconn, dconn, vm, NULLSTR(dconnuri), @@ -3212,13 +3214,13 @@ static int doPeer2PeerMigrate2(virQEMUDriverPtr driver, qemuDomainObjEnterRemote(vm); ret = dconn->driver->domainMigratePrepareTunnel - (dconn, st, flags, dname, resource, dom_xml); + (dconn, st, destflags, dname, resource, dom_xml); qemuDomainObjExitRemote(vm); } else { qemuDomainObjEnterRemote(vm); ret = dconn->driver->domainMigratePrepare2 (dconn, &cookie, &cookielen, NULL, &uri_out, - flags, dname, resource, dom_xml); + destflags, dname, resource, dom_xml); qemuDomainObjExitRemote(vm); } VIR_FREE(dom_xml); @@ -3276,7 +3278,7 @@ finish: qemuDomainObjEnterRemote(vm); ddomain = dconn->driver->domainMigrateFinish2 (dconn, dname, cookie, cookielen, - uri_out ? uri_out : dconnuri, flags, cancelled); + uri_out ? uri_out : dconnuri, destflags, cancelled); qemuDomainObjExitRemote(vm); cleanup: @@ -3326,6 +3328,8 @@ static int doPeer2PeerMigrate3(virQEMUDriverPtr driver, virErrorPtr orig_err = NULL; bool cancelled; virStreamPtr st = NULL; + unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR; + VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, xmlin=%s, " "dconnuri=%s, uri=%s, flags=%lx, dname=%s, resource=%lu", driver, sconn, dconn, vm, NULLSTR(xmlin), @@ -3358,13 +3362,13 @@ static int doPeer2PeerMigrate3(virQEMUDriverPtr driver, ret = dconn->driver->domainMigratePrepareTunnel3 (dconn, st, cookiein, cookieinlen, &cookieout, &cookieoutlen, - flags, dname, resource, dom_xml); + destflags, dname, resource, dom_xml); qemuDomainObjExitRemote(vm); } else { qemuDomainObjEnterRemote(vm); ret = dconn->driver->domainMigratePrepare3 (dconn, cookiein, cookieinlen, &cookieout, &cookieoutlen, - uri, &uri_out, flags, dname, resource, dom_xml); + uri, &uri_out, destflags, dname, resource, dom_xml); qemuDomainObjExitRemote(vm); } VIR_FREE(dom_xml); @@ -3440,7 +3444,7 @@ finish: qemuDomainObjEnterRemote(vm); ddomain = dconn->driver->domainMigrateFinish3 (dconn, dname, cookiein, cookieinlen, &cookieout, &cookieoutlen, - dconnuri, uri_out ? uri_out : uri, flags, cancelled); + dconnuri, uri_out ? uri_out : uri, destflags, cancelled); qemuDomainObjExitRemote(vm); /* If ddomain is NULL, then we were unable to start -- GitLab