Revision 41044e04 lib/objects.py
b/lib/objects.py | ||
---|---|---|
959 | 959 |
if check_std: |
960 | 960 |
InstancePolicy._CheckIncompleteSpec(stdspec, constants.ISPECS_STD) |
961 | 961 |
|
962 |
minmaxspecs = ipolicy[constants.ISPECS_MINMAX] |
|
963 |
missing = constants.ISPECS_MINMAX_KEYS - frozenset(minmaxspecs.keys()) |
|
964 |
if missing: |
|
965 |
msg = "Missing instance specification: %s" % utils.CommaJoin(missing) |
|
966 |
raise errors.ConfigurationError(msg) |
|
967 |
for (key, spec) in minmaxspecs.items(): |
|
968 |
InstancePolicy._CheckIncompleteSpec(spec, key) |
|
969 |
|
|
970 |
spec_std_ok = True |
|
971 |
for param in constants.ISPECS_PARAMETERS: |
|
972 |
par_std_ok = InstancePolicy._CheckISpecParamSyntax(minmaxspecs, stdspec, |
|
973 |
param, check_std) |
|
974 |
spec_std_ok = spec_std_ok and par_std_ok |
|
975 |
if not spec_std_ok: |
|
962 |
if not ipolicy[constants.ISPECS_MINMAX]: |
|
963 |
raise errors.ConfigurationError("Empty minmax specifications") |
|
964 |
std_is_good = False |
|
965 |
for minmaxspecs in ipolicy[constants.ISPECS_MINMAX]: |
|
966 |
missing = constants.ISPECS_MINMAX_KEYS - frozenset(minmaxspecs.keys()) |
|
967 |
if missing: |
|
968 |
msg = "Missing instance specification: %s" % utils.CommaJoin(missing) |
|
969 |
raise errors.ConfigurationError(msg) |
|
970 |
for (key, spec) in minmaxspecs.items(): |
|
971 |
InstancePolicy._CheckIncompleteSpec(spec, key) |
|
972 |
|
|
973 |
spec_std_ok = True |
|
974 |
for param in constants.ISPECS_PARAMETERS: |
|
975 |
par_std_ok = InstancePolicy._CheckISpecParamSyntax(minmaxspecs, stdspec, |
|
976 |
param, check_std) |
|
977 |
spec_std_ok = spec_std_ok and par_std_ok |
|
978 |
std_is_good = std_is_good or spec_std_ok |
|
979 |
if not std_is_good: |
|
976 | 980 |
raise errors.ConfigurationError("Invalid std specifications") |
977 | 981 |
|
978 | 982 |
@classmethod |
Also available in: Unified diff