mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-26 03:21:44 +03:00
qemu: shared disks with cache=directsync should be safe for migration
At present shared disks can be migrated with either readonly or cache=none. But cache=directsync should be safe for migration, because both cache=directsync and cache=none don't use the host page cache, and cache=direct write through qemu block layer cache. Signed-off-by: Peng Hao <peng.hao2@zte.com.cn> Reviewed-by: Wang Yechao <wang.yechao255@zte.com.cn>
This commit is contained in:
parent
703abf1d79
commit
fed9cc85ea
@ -1160,11 +1160,12 @@ qemuMigrationIsSafe(virDomainDefPtr def,
|
|||||||
const char *src = virDomainDiskGetSource(disk);
|
const char *src = virDomainDiskGetSource(disk);
|
||||||
|
|
||||||
/* Our code elsewhere guarantees shared disks are either readonly (in
|
/* Our code elsewhere guarantees shared disks are either readonly (in
|
||||||
* which case cache mode doesn't matter) or used with cache=none */
|
* which case cache mode doesn't matter) or used with cache=none or used with cache=directsync */
|
||||||
if (virStorageSourceIsEmpty(disk->src) ||
|
if (virStorageSourceIsEmpty(disk->src) ||
|
||||||
disk->src->readonly ||
|
disk->src->readonly ||
|
||||||
disk->src->shared ||
|
disk->src->shared ||
|
||||||
disk->cachemode == VIR_DOMAIN_DISK_CACHE_DISABLE)
|
disk->cachemode == VIR_DOMAIN_DISK_CACHE_DISABLE ||
|
||||||
|
disk->cachemode == VIR_DOMAIN_DISK_CACHE_DIRECTSYNC)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* disks which are migrated by qemu are safe too */
|
/* disks which are migrated by qemu are safe too */
|
||||||
@ -1188,7 +1189,7 @@ qemuMigrationIsSafe(virDomainDefPtr def,
|
|||||||
|
|
||||||
virReportError(VIR_ERR_MIGRATE_UNSAFE, "%s",
|
virReportError(VIR_ERR_MIGRATE_UNSAFE, "%s",
|
||||||
_("Migration may lead to data corruption if disks"
|
_("Migration may lead to data corruption if disks"
|
||||||
" use cache != none"));
|
" use cache != none or cache != directsync"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user