Commit 90b704a1 authored by Guido Trotter's avatar Guido Trotter
Browse files

Fix change of cluster nic parameters

To stay on the safe side, we check for errors in all instances, and
refuse to act, reporting on the errors we found, if there are any
Signed-off-by: default avatarGuido Trotter <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 0c9d32c1
......@@ -1970,6 +1970,29 @@ class LUSetClusterParams(LogicalUnit):
self.new_nicparams = objects.FillDict(
cluster.nicparams[constants.PP_DEFAULT], self.op.nicparams)
nic_errors = []
# check all instances for consistency
for instance in self.cfg.GetAllInstancesInfo().values():
for nic_idx, nic in enumerate(instance.nics):
params_copy = copy.deepcopy(nic.nicparams)
params_filled = objects.FillDict(self.new_nicparams, params_copy)
# check parameter syntax
except errors.ConfigurationError, err:
nic_errors.append("Instance %s, nic/%d: %s" %
(, nic_idx, err))
# if we're moving instances to routed, check that they have an ip
target_mode = params_filled[constants.NIC_MODE]
if target_mode == constants.NIC_MODE_ROUTED and not nic.ip:
nic_errors.append("Instance %s, nic/%d: routed nick with no ip" %
(, nic_idx))
if nic_errors:
raise errors.OpPrereqError("Cannot apply the change, errors:\n%s" %
# hypervisor list/parameters
self.new_hvparams = objects.FillDict(cluster.hvparams, {})
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