Revision 90b704a1
b/lib/cmdlib.py | ||
---|---|---|
1970 | 1970 |
self.new_nicparams = objects.FillDict( |
1971 | 1971 |
cluster.nicparams[constants.PP_DEFAULT], self.op.nicparams) |
1972 | 1972 |
objects.NIC.CheckParameterSyntax(self.new_nicparams) |
1973 |
nic_errors = [] |
|
1974 |
|
|
1975 |
# check all instances for consistency |
|
1976 |
for instance in self.cfg.GetAllInstancesInfo().values(): |
|
1977 |
for nic_idx, nic in enumerate(instance.nics): |
|
1978 |
params_copy = copy.deepcopy(nic.nicparams) |
|
1979 |
params_filled = objects.FillDict(self.new_nicparams, params_copy) |
|
1980 |
|
|
1981 |
# check parameter syntax |
|
1982 |
try: |
|
1983 |
objects.NIC.CheckParameterSyntax(params_filled) |
|
1984 |
except errors.ConfigurationError, err: |
|
1985 |
nic_errors.append("Instance %s, nic/%d: %s" % |
|
1986 |
(instance.name, nic_idx, err)) |
|
1987 |
|
|
1988 |
# if we're moving instances to routed, check that they have an ip |
|
1989 |
target_mode = params_filled[constants.NIC_MODE] |
|
1990 |
if target_mode == constants.NIC_MODE_ROUTED and not nic.ip: |
|
1991 |
nic_errors.append("Instance %s, nic/%d: routed nick with no ip" % |
|
1992 |
(instance.name, nic_idx)) |
|
1993 |
if nic_errors: |
|
1994 |
raise errors.OpPrereqError("Cannot apply the change, errors:\n%s" % |
|
1995 |
"\n".join(nic_errors)) |
|
1973 | 1996 |
|
1974 | 1997 |
# hypervisor list/parameters |
1975 | 1998 |
self.new_hvparams = objects.FillDict(cluster.hvparams, {}) |
Also available in: Unified diff