Commit 41e794f6 authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos Committed by Iustin Pop

KVM: use cache=none for shared disk templates

Disable host cache for externally mirrored disks to avoid cache incoherency.
Without this, migrations between the same two nodes may end up in disk
corruption.

This is a runtime override of cluster defaults, mostly a workaround.
Unfortunately, we cannot use cmdlib._CheckHVParams, as we want to check the
hypervisor parameters *in conjunction* with the disk template, which is part of
the instance definition.
Signed-off-by: default avatarApollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent db366d9a
# #
# #
# Copyright (C) 2008, 2009, 2010 Google Inc. # Copyright (C) 2008, 2009, 2010, 2011 Google Inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -534,7 +534,14 @@ class KVMHypervisor(hv_base.BaseHypervisor): ...@@ -534,7 +534,14 @@ class KVMHypervisor(hv_base.BaseHypervisor):
if_val = ',if=%s' % disk_type if_val = ',if=%s' % disk_type
# Cache mode # Cache mode
disk_cache = hvp[constants.HV_DISK_CACHE] disk_cache = hvp[constants.HV_DISK_CACHE]
if disk_cache != constants.HT_CACHE_DEFAULT: if instance.disk_template in constants.DTS_EXT_MIRROR:
if disk_cache != "none":
# TODO: make this a hard error, instead of a silent overwrite
logging.warning("KVM: overriding disk_cache setting '%s' with 'none'"
" to prevent shared storage corruption on migration",
disk_cache)
cache_val = ",cache=none"
elif disk_cache != constants.HT_CACHE_DEFAULT:
cache_val = ",cache=%s" % disk_cache cache_val = ",cache=%s" % disk_cache
else: else:
cache_val = "" cache_val = ""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment