mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
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: Jiri Denemark <jdenemar@redhat.com> Acked-By: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
598ec0db68
commit
4514abbd41
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user