Commit 1db993d5 authored by Guido Trotter's avatar Guido Trotter
Browse files

ImportExport: use max and min memory params



Import uses the old "memory" parameter to populate the two new ones, if
they're not overridden already.

FinalizeExport exports minmem and maxmem, but also memory, as maxmem, to
allow importing to older ganeti clusters.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 31d1791a
......@@ -2493,8 +2493,13 @@ def FinalizeExport(instance, snap_disks):
config.add_section(constants.INISECT_INS)
config.set(constants.INISECT_INS, "name", instance.name)
config.set(constants.INISECT_INS, "maxmem", "%d" %
instance.beparams[constants.BE_MAXMEM])
config.set(constants.INISECT_INS, "minmem", "%d" %
instance.beparams[constants.BE_MINMEM])
# "memory" is deprecated, but useful for exporting to old ganeti versions
config.set(constants.INISECT_INS, "memory", "%d" %
instance.beparams[constants.BE_MEMORY])
instance.beparams[constants.BE_MAXMEM])
config.set(constants.INISECT_INS, "vcpus", "%d" %
instance.beparams[constants.BE_VCPUS])
config.set(constants.INISECT_INS, "disk_template", instance.disk_template)
......
......@@ -8858,6 +8858,12 @@ class LUInstanceCreate(LogicalUnit):
for name, value in einfo.items(constants.INISECT_BEP):
if name not in self.op.beparams:
self.op.beparams[name] = value
# Compatibility for the old "memory" be param
if name == constants.BE_MEMORY:
if constants.BE_MAXMEM not in self.op.beparams:
self.op.beparams[constants.BE_MAXMEM] = value
if constants.BE_MINMEM not in self.op.beparams:
self.op.beparams[constants.BE_MINMEM] = value
else:
# try to read the parameters old style, from the main section
for name in constants.BES_PARAMETERS:
......
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