Commit 28a45bfc authored by René Nussbaumer's avatar René Nussbaumer
Browse files

RAPI regression beparams/memory fix

For compatibility with the old Ganeti version, we want to keep the
beparams/memory field around for another release. This patch fixes this
Signed-off-by: default avatarRené Nussbaumer <>
Reviewed-by: default avatarIustin Pop <>
parent cc706abc
......@@ -156,6 +156,21 @@ ALL_FEATURES = frozenset([
# FIXME: For compatibility we update the beparams/memory field. Needs to be
# removed in Ganeti 2.7
def _UpdateBeparams(inst):
"""Updates the beparams dict of inst to support the memory field.
@param inst: Inst dict
@return: Updated inst dict
beparams = inst["beparams"]
beparams[constants.BE_MEMORY] = beparams[constants.BE_MAXMEM]
return inst
class R_root(baserlib.ResourceBase):
"""/ resource.
......@@ -763,7 +778,7 @@ class R_2_instances(baserlib.OpcodeResource):
use_locking = self.useLocking()
if self.useBulk():
bulkdata = client.QueryInstances([], I_FIELDS, use_locking)
return baserlib.MapBulkFields(bulkdata, I_FIELDS)
return map(_UpdateBeparams, baserlib.MapBulkFields(bulkdata, I_FIELDS))
instancesdata = client.QueryInstances([], ["name"], use_locking)
instanceslist = [row[0] for row in instancesdata]
......@@ -816,7 +831,7 @@ class R_2_instances_name(baserlib.OpcodeResource):
return baserlib.MapFields(I_FIELDS, result[0])
return _UpdateBeparams(baserlib.MapFields(I_FIELDS, result[0]))
def GetDeleteOpInput(self):
"""Delete an instance.
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