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

Handle default/none values in hv/be params

When a value is set to constants.VALUE_DEFAULT we have to remove it from
the specific instance dict, as this way it will be populated from the
cluster before. If instead it's specified as constants.VALUE_NONE we'll
explicitely set it to None, to override its presence with a different
values in such defaults. However, currently, we handle None values only
for hvparams, that have a real use case for them.

Reviewed-by: imsnah
parent 467ae11e
......@@ -5000,11 +5000,13 @@ class LUSetInstanceParams(LogicalUnit):
if self.op.hvparams:
i_hvdict = copy.deepcopy(instance.hvparams)
for key, val in self.op.hvparams.iteritems():
if val is None:
if val == constants.VALUE_DEFAULT:
try:
del i_hvdict[key]
except KeyError:
pass
elif val == constants.VALUE_NONE:
i_hvdict[key] = None
else:
i_hvdict[key] = val
cluster = self.cfg.GetClusterInfo()
......@@ -5023,7 +5025,7 @@ class LUSetInstanceParams(LogicalUnit):
if self.op.beparams:
i_bedict = copy.deepcopy(instance.beparams)
for key, val in self.op.beparams.iteritems():
if val is None:
if val == constants.VALUE_DEFAULT:
try:
del i_bedict[key]
except KeyError:
......
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