提交 dc311c64 编写于 作者: D Dmitry Andreev 提交者: Jiri Denemark

qemuMigrationCookieAddPersistent: move it out and change argument type

This changes allow to use qemuMigrationCookieAddPersistent with
an XML definition that isn't assigned to any domain.
上级 c81bba4f
......@@ -501,7 +501,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",
......@@ -509,10 +509,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;
......@@ -1360,10 +1360,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;
......@@ -4770,11 +4766,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");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册