Paused domain should remain paused after migration

https://bugzilla.redhat.com/show_bug.cgi?id=981139

If a domain is paused before migration starts, we need to tell that to
the destination libvirtd to prevent it from resuming the domain at the
end of migration. This regression was introduced by commit 5379bb0.
This commit is contained in:
Jiri Denemark 2013-07-04 19:58:51 +02:00
parent 2e4dd4107e
commit d4ce75ba76
2 changed files with 19 additions and 12 deletions

View File

@ -4563,16 +4563,17 @@ virDomainMigrateVersion1(virDomainPtr domain,
char *cookie = NULL; char *cookie = NULL;
int cookielen = 0, ret; int cookielen = 0, ret;
virDomainInfo info; virDomainInfo info;
unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR; unsigned int destflags;
VIR_DOMAIN_DEBUG(domain, VIR_DOMAIN_DEBUG(domain,
"dconn=%p, flags=%lx, dname=%s, uri=%s, bandwidth=%lu", "dconn=%p, flags=%lx, dname=%s, uri=%s, bandwidth=%lu",
dconn, flags, NULLSTR(dname), NULLSTR(uri), bandwidth); dconn, flags, NULLSTR(dname), NULLSTR(uri), bandwidth);
ret = virDomainGetInfo(domain, &info); ret = virDomainGetInfo(domain, &info);
if (ret == 0 && info.state == VIR_DOMAIN_PAUSED) { if (ret == 0 && info.state == VIR_DOMAIN_PAUSED)
flags |= VIR_MIGRATE_PAUSED; flags |= VIR_MIGRATE_PAUSED;
}
destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
/* Prepare the migration. /* Prepare the migration.
* *
@ -4659,7 +4660,7 @@ virDomainMigrateVersion2(virDomainPtr domain,
virErrorPtr orig_err = NULL; virErrorPtr orig_err = NULL;
unsigned int getxml_flags = 0; unsigned int getxml_flags = 0;
int cancelled; int cancelled;
unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR; unsigned long destflags;
VIR_DOMAIN_DEBUG(domain, VIR_DOMAIN_DEBUG(domain,
"dconn=%p, flags=%lx, dname=%s, uri=%s, bandwidth=%lu", "dconn=%p, flags=%lx, dname=%s, uri=%s, bandwidth=%lu",
@ -4699,11 +4700,12 @@ virDomainMigrateVersion2(virDomainPtr domain,
return NULL; return NULL;
ret = virDomainGetInfo(domain, &info); ret = virDomainGetInfo(domain, &info);
if (ret == 0 && info.state == VIR_DOMAIN_PAUSED) { if (ret == 0 && info.state == VIR_DOMAIN_PAUSED)
flags |= VIR_MIGRATE_PAUSED; flags |= VIR_MIGRATE_PAUSED;
}
VIR_DEBUG("Prepare2 %p flags=%lx", dconn, flags); destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
VIR_DEBUG("Prepare2 %p flags=%lx", dconn, destflags);
ret = dconn->driver->domainMigratePrepare2 ret = dconn->driver->domainMigratePrepare2
(dconn, &cookie, &cookielen, uri, &uri_out, destflags, dname, (dconn, &cookie, &cookielen, uri, &uri_out, destflags, dname,
bandwidth, dom_xml); bandwidth, dom_xml);
@ -4811,7 +4813,7 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
int cancelled = 1; int cancelled = 1;
unsigned long protection = 0; unsigned long protection = 0;
bool notify_source = true; bool notify_source = true;
unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR; unsigned int destflags;
int state; int state;
virTypedParameterPtr tmp; virTypedParameterPtr tmp;
@ -4870,7 +4872,9 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
if (ret == 0 && state == VIR_DOMAIN_PAUSED) if (ret == 0 && state == VIR_DOMAIN_PAUSED)
flags |= VIR_MIGRATE_PAUSED; flags |= VIR_MIGRATE_PAUSED;
VIR_DEBUG("Prepare3 %p flags=%x", dconn, flags); destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
VIR_DEBUG("Prepare3 %p flags=%x", dconn, destflags);
cookiein = cookieout; cookiein = cookieout;
cookieinlen = cookieoutlen; cookieinlen = cookieoutlen;
cookieout = NULL; cookieout = NULL;

View File

@ -3503,7 +3503,7 @@ static int doPeer2PeerMigrate2(virQEMUDriverPtr driver,
virErrorPtr orig_err = NULL; virErrorPtr orig_err = NULL;
bool cancelled; bool cancelled;
virStreamPtr st = NULL; virStreamPtr st = NULL;
unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR; unsigned long destflags;
VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, dconnuri=%s, " VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, dconnuri=%s, "
"flags=%lx, dname=%s, resource=%lu", "flags=%lx, dname=%s, resource=%lu",
@ -3522,6 +3522,8 @@ static int doPeer2PeerMigrate2(virQEMUDriverPtr driver,
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED)
flags |= VIR_MIGRATE_PAUSED; flags |= VIR_MIGRATE_PAUSED;
destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
VIR_DEBUG("Prepare2 %p", dconn); VIR_DEBUG("Prepare2 %p", dconn);
if (flags & VIR_MIGRATE_TUNNELLED) { if (flags & VIR_MIGRATE_TUNNELLED) {
/* /*
@ -3651,8 +3653,7 @@ doPeer2PeerMigrate3(virQEMUDriverPtr driver,
virErrorPtr orig_err = NULL; virErrorPtr orig_err = NULL;
bool cancelled = true; bool cancelled = true;
virStreamPtr st = NULL; virStreamPtr st = NULL;
unsigned int destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR; unsigned long destflags;
virTypedParameterPtr params = NULL; virTypedParameterPtr params = NULL;
int nparams = 0; int nparams = 0;
int maxparams = 0; int maxparams = 0;
@ -3705,6 +3706,8 @@ doPeer2PeerMigrate3(virQEMUDriverPtr driver,
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED)
flags |= VIR_MIGRATE_PAUSED; flags |= VIR_MIGRATE_PAUSED;
destflags = flags & ~VIR_MIGRATE_ABORT_ON_ERROR;
VIR_DEBUG("Prepare3 %p", dconn); VIR_DEBUG("Prepare3 %p", dconn);
cookiein = cookieout; cookiein = cookieout;
cookieinlen = cookieoutlen; cookieinlen = cookieoutlen;