Revision da5f09ef lib/config.py
b/lib/config.py | ||
---|---|---|
600 | 600 |
except errors.ConfigurationError, err: |
601 | 601 |
result.append("%s has invalid nicparams: %s" % (owner, err)) |
602 | 602 |
|
603 |
def _helper_ipolicy(owner, params, check_std):
|
|
603 |
def _helper_ipolicy(owner, ipolicy, iscluster):
|
|
604 | 604 |
try: |
605 |
objects.InstancePolicy.CheckParameterSyntax(params, check_std)
|
|
605 |
objects.InstancePolicy.CheckParameterSyntax(ipolicy, iscluster)
|
|
606 | 606 |
except errors.ConfigurationError, err: |
607 | 607 |
result.append("%s has invalid instance policy: %s" % (owner, err)) |
608 |
|
|
609 |
def _helper_ispecs(owner, params):
|
|
610 |
for key, value in params.items():
|
|
611 |
if key in constants.IPOLICY_ISPECS:
|
|
612 |
fullkey = "ipolicy/" + key
|
|
613 |
_helper(owner, fullkey, value, constants.ISPECS_PARAMETER_TYPES)
|
|
608 |
for key, value in ipolicy.items(): |
|
609 |
if key == constants.ISPECS_MINMAX:
|
|
610 |
_helper_ispecs(owner, "ipolicy/" + key, value)
|
|
611 |
elif key == constants.ISPECS_STD:
|
|
612 |
_helper(owner, "ipolicy/" + key, value,
|
|
613 |
constants.ISPECS_PARAMETER_TYPES)
|
|
614 | 614 |
else: |
615 | 615 |
# FIXME: assuming list type |
616 | 616 |
if key in constants.IPOLICY_PARAMETERS: |
... | ... | |
622 | 622 |
" expecting %s, got %s" % |
623 | 623 |
(owner, key, exp_type.__name__, type(value))) |
624 | 624 |
|
625 |
def _helper_ispecs(owner, parentkey, params): |
|
626 |
for (key, value) in params.items(): |
|
627 |
fullkey = "/".join([parentkey, key]) |
|
628 |
_helper(owner, fullkey, value, constants.ISPECS_PARAMETER_TYPES) |
|
629 |
|
|
625 | 630 |
# check cluster parameters |
626 | 631 |
_helper("cluster", "beparams", cluster.SimpleFillBE({}), |
627 | 632 |
constants.BES_PARAMETER_TYPES) |
... | ... | |
630 | 635 |
_helper_nic("cluster", cluster.SimpleFillNIC({})) |
631 | 636 |
_helper("cluster", "ndparams", cluster.SimpleFillND({}), |
632 | 637 |
constants.NDS_PARAMETER_TYPES) |
633 |
_helper_ipolicy("cluster", cluster.SimpleFillIPolicy({}), True) |
|
634 |
_helper_ispecs("cluster", cluster.SimpleFillIPolicy({})) |
|
638 |
_helper_ipolicy("cluster", cluster.ipolicy, True) |
|
635 | 639 |
|
636 | 640 |
# per-instance checks |
637 | 641 |
for instance_name in data.instances: |
... | ... | |
762 | 766 |
group_name = "group %s" % nodegroup.name |
763 | 767 |
_helper_ipolicy(group_name, cluster.SimpleFillIPolicy(nodegroup.ipolicy), |
764 | 768 |
False) |
765 |
_helper_ispecs(group_name, cluster.SimpleFillIPolicy(nodegroup.ipolicy)) |
|
766 | 769 |
if nodegroup.ndparams: |
767 | 770 |
_helper(group_name, "ndparams", |
768 | 771 |
cluster.SimpleFillND(nodegroup.ndparams), |
Also available in: Unified diff