Merge "Add configuration options for CPU and RAM overcommitment"
This commit is contained in:
@@ -18,7 +18,7 @@ from .setup_controller import Controller
|
||||
from .exceptions import ParamValidationError
|
||||
|
||||
|
||||
__all__ = ('ParamValidationError', 'validate_integer',
|
||||
__all__ = ('ParamValidationError', 'validate_integer', 'validate_float',
|
||||
'validate_regexp', 'validate_port', 'validate_not_empty',
|
||||
'validate_options', 'validate_ip', 'validate_multi_ip',
|
||||
'validate_file', 'validate_ping', 'validate_ssh',
|
||||
@@ -39,6 +39,20 @@ def validate_integer(param, options=None):
|
||||
raise ParamValidationError(msg % param)
|
||||
|
||||
|
||||
def validate_float(param, options=None):
|
||||
"""
|
||||
Raises ParamValidationError if given param is not a float.
|
||||
"""
|
||||
options = options or []
|
||||
try:
|
||||
float(param)
|
||||
except ValueError:
|
||||
logging.debug('validate_float(%s, options=%s) failed.' %
|
||||
(param, options))
|
||||
msg = 'Given value is not a float: %s'
|
||||
raise ParamValidationError(msg % param)
|
||||
|
||||
|
||||
def validate_regexp(param, options=None):
|
||||
"""
|
||||
Raises ParamValidationError if given param doesn't match at least
|
||||
|
||||
@@ -98,7 +98,7 @@ def _getInputFromUser(param):
|
||||
else:
|
||||
userInput = commandLineValues[param.getKey("CONF_NAME")]
|
||||
# If DEFAULT_VALUE is set and user did not input anything
|
||||
if userInput == "" and len(param.getKey("DEFAULT_VALUE")) > 0:
|
||||
if userInput == "" and len(str(param.getKey("DEFAULT_VALUE"))) > 0:
|
||||
userInput = param.getKey("DEFAULT_VALUE")
|
||||
|
||||
# Param processing
|
||||
|
||||
@@ -181,6 +181,34 @@ def initConfig(controllerObject):
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
{"CMD_OPTION" : "novasched-cpu-allocation-ratio",
|
||||
"USAGE" : "The overcommitment ratio for virtual to physical CPUs. "
|
||||
"Set to 1.0 to disable CPU overcommitment",
|
||||
"PROMPT" : "Enter the CPU overcommitment ratio. "
|
||||
"Set to 1.0 to disable CPU overcommitment",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validate.validate_float],
|
||||
"DEFAULT_VALUE" : 16.0,
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_NOVA_SCHED_CPU_ALLOC_RATIO",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
{"CMD_OPTION" : "novasched-ram-allocation-ratio",
|
||||
"USAGE" : "The overcommitment ratio for virtual to physical RAM. "
|
||||
"Set to 1.0 to disable RAM overcommitment",
|
||||
"PROMPT" : "Enter the RAM overcommitment ratio. "
|
||||
"Set to 1.0 to disable RAM overcommitment",
|
||||
"OPTION_LIST" : [],
|
||||
"VALIDATORS" : [validate.validate_float],
|
||||
"DEFAULT_VALUE" : 1.5,
|
||||
"MASK_INPUT" : False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
"CONF_NAME" : "CONFIG_NOVA_SCHED_RAM_ALLOC_RATIO",
|
||||
"USE_DEFAULT" : False,
|
||||
"NEED_CONFIRM" : False,
|
||||
"CONDITION" : False },
|
||||
]
|
||||
groupDict = { "GROUP_NAME" : "NOVA",
|
||||
"DESCRIPTION" : "Nova Options",
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
nova_config{
|
||||
# OpenStack doesn't include the CoreFilter (= CPU Filter) by default
|
||||
"DEFAULT/scheduler_default_filters":
|
||||
value => "RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,CoreFilter";
|
||||
"DEFAULT/cpu_allocation_ratio":
|
||||
value => "%(CONFIG_NOVA_SCHED_CPU_ALLOC_RATIO)s";
|
||||
"DEFAULT/ram_allocation_ratio":
|
||||
value => "%(CONFIG_NOVA_SCHED_RAM_ALLOC_RATIO)s";
|
||||
}
|
||||
|
||||
class {"nova::scheduler":
|
||||
enabled => true,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user