Commit 5423b15f authored by Marco Casavecchia (aka MCM)'s avatar Marco Casavecchia (aka MCM) Committed by Helga Velroyen

Added support for disk native AIO mode for KVM

This patch adds support for the native aio on KVM
hypervisor.

Basically, It adds a new HV-KVM optional parameter
"disk_aio" that can be set with the followings values:
threads (the default for KVM) or native. If not set, it
uses the KVM default that is "threads". The patch also
updates the man page for gnt-instance.
Signed-off-by: default avatarMarco Casavecchia (aka MCM) <marcolinuz@gmail.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent bd39f2c1
...@@ -331,6 +331,8 @@ class KVMHypervisor(hv_base.BaseHypervisor): ...@@ -331,6 +331,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
constants.HV_USE_LOCALTIME: hv_base.NO_CHECK, constants.HV_USE_LOCALTIME: hv_base.NO_CHECK,
constants.HV_DISK_CACHE: constants.HV_DISK_CACHE:
hv_base.ParamInSet(True, constants.HT_VALID_CACHE_TYPES), hv_base.ParamInSet(True, constants.HT_VALID_CACHE_TYPES),
constants.HV_KVM_DISK_AIO:
hv_base.ParamInSet(False, constants.HT_KVM_VALID_AIO_TYPES),
constants.HV_SECURITY_MODEL: constants.HV_SECURITY_MODEL:
hv_base.ParamInSet(True, constants.HT_KVM_VALID_SM_TYPES), hv_base.ParamInSet(True, constants.HT_KVM_VALID_SM_TYPES),
constants.HV_SECURITY_DOMAIN: hv_base.NO_CHECK, constants.HV_SECURITY_DOMAIN: hv_base.NO_CHECK,
...@@ -895,6 +897,12 @@ class KVMHypervisor(hv_base.BaseHypervisor): ...@@ -895,6 +897,12 @@ class KVMHypervisor(hv_base.BaseHypervisor):
pass pass
else: else:
if_val = ",if=%s" % disk_type if_val = ",if=%s" % disk_type
# AIO mode
aio_mode = up_hvp[constants.HV_KVM_DISK_AIO]
if aio_mode == constants.HT_KVM_AIO_NATIVE:
aio_val = ",aio=%s" % aio_mode
else:
aio_val = ""
# Cache mode # Cache mode
disk_cache = up_hvp[constants.HV_DISK_CACHE] disk_cache = up_hvp[constants.HV_DISK_CACHE]
if instance.disk_template in constants.DTS_EXT_MIRROR: if instance.disk_template in constants.DTS_EXT_MIRROR:
...@@ -927,8 +935,8 @@ class KVMHypervisor(hv_base.BaseHypervisor): ...@@ -927,8 +935,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
else: else:
drive_uri = link_name drive_uri = link_name
drive_val = "file=%s,format=raw%s%s%s" % \ drive_val = "file=%s,format=raw%s%s%s%s" % \
(drive_uri, if_val, boot_val, cache_val) (drive_uri, if_val, boot_val, cache_val, aio_val)
if device_driver: if device_driver:
# kvm_disks are the 4th entry of runtime file that did not exist in # kvm_disks are the 4th entry of runtime file that did not exist in
......
...@@ -586,6 +586,14 @@ disk\_cache ...@@ -586,6 +586,14 @@ disk\_cache
version of KVM used and disk type (always raw file under Ganeti), version of KVM used and disk type (always raw file under Ganeti),
please refer to the KVM documentation for more details. please refer to the KVM documentation for more details.
disk\_aio
Valid for the KVM hypervisor.
This is an optional parameter that specifies the aio mode
for the disks. KVM default is to use the 'threads' mode,
so if not explicitly specified, the native mode will not
be used. Possible values are: threads or native.
security\_model security\_model
Valid for the KVM hypervisor. Valid for the KVM hypervisor.
......
...@@ -1565,6 +1565,9 @@ hvKvmMigrationCaps = "migration_caps" ...@@ -1565,6 +1565,9 @@ hvKvmMigrationCaps = "migration_caps"
hvKvmPath :: String hvKvmPath :: String
hvKvmPath = "kvm_path" hvKvmPath = "kvm_path"
hvKvmDiskAio :: String
hvKvmDiskAio = "disk_aio"
hvKvmSpiceAudioCompr :: String hvKvmSpiceAudioCompr :: String
hvKvmSpiceAudioCompr = "spice_playback_compression" hvKvmSpiceAudioCompr = "spice_playback_compression"
...@@ -1749,6 +1752,7 @@ hvsParameterTypes = Map.fromList ...@@ -1749,6 +1752,7 @@ hvsParameterTypes = Map.fromList
, (hvKvmMachineVersion, VTypeString) , (hvKvmMachineVersion, VTypeString)
, (hvKvmMigrationCaps, VTypeString) , (hvKvmMigrationCaps, VTypeString)
, (hvKvmPath, VTypeString) , (hvKvmPath, VTypeString)
, (hvKvmDiskAio, VTypeString)
, (hvKvmSpiceAudioCompr, VTypeBool) , (hvKvmSpiceAudioCompr, VTypeBool)
, (hvKvmSpiceBind, VTypeString) , (hvKvmSpiceBind, VTypeString)
, (hvKvmSpiceIpVersion, VTypeInt) , (hvKvmSpiceIpVersion, VTypeInt)
...@@ -2588,6 +2592,17 @@ htValidCacheTypes = ...@@ -2588,6 +2592,17 @@ htValidCacheTypes =
htCacheWback, htCacheWback,
htCacheWthrough] htCacheWthrough]
htKvmAioThreads :: String
htKvmAioThreads = "threads"
htKvmAioNative :: String
htKvmAioNative = "native"
htKvmValidAioTypes :: FrozenSet String
htKvmValidAioTypes =
ConstantUtils.mkSet [htKvmAioThreads,
htKvmAioNative]
-- * Mouse types -- * Mouse types
htMouseMouse :: String htMouseMouse :: String
...@@ -3765,6 +3780,7 @@ hvcDefaults = ...@@ -3765,6 +3780,7 @@ hvcDefaults =
, (hvNicType, PyValueEx htNicParavirtual) , (hvNicType, PyValueEx htNicParavirtual)
, (hvDiskType, PyValueEx htDiskParavirtual) , (hvDiskType, PyValueEx htDiskParavirtual)
, (hvKvmCdromDiskType, PyValueEx "") , (hvKvmCdromDiskType, PyValueEx "")
, (hvKvmDiskAio, PyValueEx htKvmAioThreads)
, (hvUsbMouse, PyValueEx "") , (hvUsbMouse, PyValueEx "")
, (hvKeymap, PyValueEx "") , (hvKeymap, PyValueEx "")
, (hvMigrationPort, PyValueEx (8102 :: Int)) , (hvMigrationPort, PyValueEx (8102 :: Int))
......
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