[libvirt] [PATCH RESEND] qemu: shared disks with cache=directsync should be safe for migration

From: Hao Peng <peng.hao2@zte.com.cn> 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> --- src/qemu/qemu_migration.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index c23fffe..9d509dd 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1160,11 +1160,12 @@ qemuMigrationIsSafe(virDomainDefPtr def, const char *src = virDomainDiskGetSource(disk); /* 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) || disk->src->readonly || 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; /* disks which are migrated by qemu are safe too */ @@ -1188,7 +1189,7 @@ qemuMigrationIsSafe(virDomainDefPtr def, virReportError(VIR_ERR_MIGRATE_UNSAFE, "%s", _("Migration may lead to data corruption if disks" - " use cache != none")); + " use cache != none or cache != directsync")); return false; } -- 1.8.3.1

On Sat, Jul 15, 2017 at 11:01:25PM +0800, Peng Hao wrote:
From: Hao Peng <peng.hao2@zte.com.cn>
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> --- src/qemu/qemu_migration.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Reviewed-by: Daniel P. Berrange <berrange@redhat.com> and pushed to git master Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (2)
-
Daniel P. Berrange
-
Peng Hao