Commit 8c72ab2b authored by Guido Trotter's avatar Guido Trotter
Browse files

beparams: add min/max memory values



For now the new "memory" parameter stays there, but it will be removed
later. The new values are just taken from the old one, in this patch.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 5d40c988
......@@ -860,12 +860,16 @@ DSS_PARAMETER_TYPES = {
DSS_PARAMETERS = frozenset(DSS_PARAMETER_TYPES.keys())
# Backend parameter names
BE_MEMORY = "memory"
BE_MEMORY = "memory" # deprecated and replaced by max and min mem
BE_MAXMEM = "maxmem"
BE_MINMEM = "minmem"
BE_VCPUS = "vcpus"
BE_AUTO_BALANCE = "auto_balance"
BES_PARAMETER_TYPES = {
BE_MEMORY: VTYPE_SIZE,
BE_MAXMEM: VTYPE_SIZE,
BE_MINMEM: VTYPE_SIZE,
BE_VCPUS: VTYPE_INT,
BE_AUTO_BALANCE: VTYPE_BOOL,
}
......@@ -1624,6 +1628,8 @@ HVC_GLOBALS = frozenset([
BEC_DEFAULTS = {
BE_MEMORY: 128,
BE_MINMEM: 128,
BE_MAXMEM: 128,
BE_VCPUS: 1,
BE_AUTO_BALANCE: True,
}
......
......@@ -96,6 +96,21 @@ def UpgradeGroupedParams(target, defaults):
return target
def UpgradeBeParams(target):
"""Update the be parameters dict to the new format.
@type target: dict
@param target: "be" parameters dict
"""
if constants.BE_MEMORY in target:
memory = target[constants.BE_MEMORY]
target[constants.BE_MAXMEM] = memory
target[constants.BE_MINMEM] = memory
#FIXME(dynmem): delete old value
#del target[constants.BE_MEMORY]
class ConfigObject(object):
"""A generic config object.
......@@ -912,6 +927,7 @@ class Instance(TaggableObject):
pass
if self.osparams is None:
self.osparams = {}
UpgradeBeParams(self.beparams)
class OS(ConfigObject):
......@@ -1150,6 +1166,9 @@ class Cluster(TaggableObject):
self.beparams = UpgradeGroupedParams(self.beparams,
constants.BEC_DEFAULTS)
for beparams_group in self.beparams:
UpgradeBeParams(self.beparams[beparams_group])
migrate_default_bridge = not self.nicparams
self.nicparams = UpgradeGroupedParams(self.nicparams,
constants.NICC_DEFAULTS)
......
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