提交 4514abbd 编写于 作者: J Jiri Denemark

qemu: Allow migration with disk cache on

When QEMU supports flushing caches at the end of migration, we can
safely allow migration even if disk/driver/@cache is not none nor
directsync.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Acked-By: NPeter Krempa <pkrempa@redhat.com>
上级 598ec0db
......@@ -1214,6 +1214,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriverPtr driver,
static bool
qemuMigrationSrcIsSafe(virDomainDefPtr def,
virQEMUCapsPtr qemuCaps,
size_t nmigrate_disks,
const char **migrate_disks,
unsigned int flags)
......@@ -1264,6 +1265,11 @@ qemuMigrationSrcIsSafe(virDomainDefPtr def,
disk->cachemode == VIR_DOMAIN_DISK_CACHE_DIRECTSYNC)
continue;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MIGRATION_FILE_DROP_CACHE)) {
VIR_DEBUG("QEMU supports flushing caches; migration is safe");
continue;
}
virReportError(VIR_ERR_MIGRATE_UNSAFE, "%s",
_("Migration may lead to data corruption if disks"
" use cache other than none or directsync"));
......@@ -1971,7 +1977,8 @@ qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver,
goto cleanup;
if (!(flags & (VIR_MIGRATE_UNSAFE | VIR_MIGRATE_OFFLINE)) &&
!qemuMigrationSrcIsSafe(vm->def, nmigrate_disks, migrate_disks, flags))
!qemuMigrationSrcIsSafe(vm->def, priv->qemuCaps,
nmigrate_disks, migrate_disks, flags))
goto cleanup;
if (flags & VIR_MIGRATE_POSTCOPY &&
......@@ -4583,7 +4590,8 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver,
goto endjob;
if (!(flags & (VIR_MIGRATE_UNSAFE | VIR_MIGRATE_OFFLINE)) &&
!qemuMigrationSrcIsSafe(vm->def, nmigrate_disks, migrate_disks, flags))
!qemuMigrationSrcIsSafe(vm->def, priv->qemuCaps,
nmigrate_disks, migrate_disks, flags))
goto endjob;
qemuMigrationSrcStoreDomainState(vm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册