This changes allow to use qemuMigrationCookieAddPersistent with
an XML definition that isn't assigned to any domain.
---
src/qemu/qemu_migration.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index c0b580d..f723a52 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -507,7 +507,7 @@ qemuMigrationCookieAddLockstate(qemuMigrationCookiePtr mig,
static int
qemuMigrationCookieAddPersistent(qemuMigrationCookiePtr mig,
- virDomainObjPtr dom)
+ virDomainDefPtr def)
{
if (mig->flags & QEMU_MIGRATION_COOKIE_PERSISTENT) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -515,10 +515,10 @@ qemuMigrationCookieAddPersistent(qemuMigrationCookiePtr mig,
return -1;
}
- if (!dom->newDef)
+ if (!def)
return 0;
- mig->persistent = dom->newDef;
+ mig->persistent = def;
mig->flags |= QEMU_MIGRATION_COOKIE_PERSISTENT;
mig->flagsMandatory |= QEMU_MIGRATION_COOKIE_PERSISTENT;
return 0;
@@ -1366,10 +1366,6 @@ qemuMigrationBakeCookie(qemuMigrationCookiePtr mig,
qemuMigrationCookieAddLockstate(mig, driver, dom) < 0)
return -1;
- if (flags & QEMU_MIGRATION_COOKIE_PERSISTENT &&
- qemuMigrationCookieAddPersistent(mig, dom) < 0)
- return -1;
-
if (flags & QEMU_MIGRATION_COOKIE_NETWORK &&
qemuMigrationCookieAddNetwork(mig, driver, dom) < 0) {
return -1;
@@ -4569,11 +4565,12 @@ qemuMigrationRun(virQEMUDriverPtr driver,
cookieFlags |= QEMU_MIGRATION_COOKIE_NETWORK |
QEMU_MIGRATION_COOKIE_STATS;
- if (flags & VIR_MIGRATE_PERSIST_DEST)
- cookieFlags |= QEMU_MIGRATION_COOKIE_PERSISTENT;
+
if (ret == 0 &&
- qemuMigrationBakeCookie(mig, driver, vm, cookieout,
- cookieoutlen, cookieFlags) < 0) {
+ (((flags & VIR_MIGRATE_PERSIST_DEST &&
+ qemuMigrationCookieAddPersistent(mig, vm->newDef) < 0)) ||
+ qemuMigrationBakeCookie(mig, driver, vm, cookieout,
+ cookieoutlen, cookieFlags) < 0)) {
VIR_WARN("Unable to encode migration cookie");
}
--
1.8.3.1