Commit 12378fe3 authored by Iustin Pop's avatar Iustin Pop
Browse files

Rename IPOLICY_PARAMETERS to IPOLICY_ISPECS



As opposed to the initial situation, the PARAMETERS will be more than
just the min/std/max ispecs. Let's rename it, before re-adding the
PARAMETERS constant with a different meaning.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent ad0e078e
...@@ -463,7 +463,7 @@ def ShowClusterConfig(opts, args): ...@@ -463,7 +463,7 @@ def ShowClusterConfig(opts, args):
_PrintGroupedParams(result["nicparams"], roman=opts.roman_integers) _PrintGroupedParams(result["nicparams"], roman=opts.roman_integers)
ToStdout("Instance policy - limits for instances:") ToStdout("Instance policy - limits for instances:")
for key in constants.IPOLICY_PARAMETERS: for key in constants.IPOLICY_ISPECS:
ToStdout(" - %s", key) ToStdout(" - %s", key)
_PrintGroupedParams(result["ipolicy"][key], roman=opts.roman_integers) _PrintGroupedParams(result["ipolicy"][key], roman=opts.roman_integers)
ToStdout(" - enabled disk templates: %s", ToStdout(" - enabled disk templates: %s",
......
...@@ -734,7 +734,7 @@ def _GetUpdatedIPolicy(old_ipolicy, new_ipolicy, group_policy=False): ...@@ -734,7 +734,7 @@ def _GetUpdatedIPolicy(old_ipolicy, new_ipolicy, group_policy=False):
if key not in constants.IPOLICY_ALL_KEYS: if key not in constants.IPOLICY_ALL_KEYS:
raise errors.OpPrereqError("Invalid key in new ipolicy: %s" % key, raise errors.OpPrereqError("Invalid key in new ipolicy: %s" % key,
errors.ECODE_INVAL) errors.ECODE_INVAL)
if key in constants.IPOLICY_PARAMETERS: if key in constants.IPOLICY_ISPECS:
utils.ForceDictType(value, constants.ISPECS_PARAMETER_TYPES) utils.ForceDictType(value, constants.ISPECS_PARAMETER_TYPES)
ipolicy[key] = _GetUpdatedParams(old_ipolicy.get(key, {}), value, ipolicy[key] = _GetUpdatedParams(old_ipolicy.get(key, {}), value,
use_none=use_none, use_none=use_none,
......
# #
# #
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Google Inc. # Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -434,7 +434,7 @@ class ConfigWriter: ...@@ -434,7 +434,7 @@ class ConfigWriter:
def _helper_ispecs(owner, params): def _helper_ispecs(owner, params):
for key, value in params.items(): for key, value in params.items():
if key in constants.IPOLICY_PARAMETERS: if key in constants.IPOLICY_ISPECS:
fullkey = "ipolicy/" + key fullkey = "ipolicy/" + key
_helper(owner, fullkey, value, constants.ISPECS_PARAMETER_TYPES) _helper(owner, fullkey, value, constants.ISPECS_PARAMETER_TYPES)
else: else:
......
...@@ -951,12 +951,12 @@ ISPECS_MAX = "max" ...@@ -951,12 +951,12 @@ ISPECS_MAX = "max"
ISPECS_STD = "std" ISPECS_STD = "std"
IPOLICY_DTS = "disk_templates" IPOLICY_DTS = "disk_templates"
IPOLICY_PARAMETERS = frozenset([ IPOLICY_ISPECS = frozenset([
ISPECS_MIN, ISPECS_MIN,
ISPECS_MAX, ISPECS_MAX,
ISPECS_STD, ISPECS_STD,
]) ])
IPOLICY_ALL_KEYS = IPOLICY_PARAMETERS.union([IPOLICY_DTS]) IPOLICY_ALL_KEYS = IPOLICY_ISPECS.union([IPOLICY_DTS])
# Node parameter names # Node parameter names
ND_OOB_PROGRAM = "oob_program" ND_OOB_PROGRAM = "oob_program"
......
...@@ -98,7 +98,7 @@ def FillIPolicy(default_ipolicy, custom_ipolicy, skip_keys=None): ...@@ -98,7 +98,7 @@ def FillIPolicy(default_ipolicy, custom_ipolicy, skip_keys=None):
""" """
assert frozenset(default_ipolicy.keys()) == constants.IPOLICY_ALL_KEYS assert frozenset(default_ipolicy.keys()) == constants.IPOLICY_ALL_KEYS
ret_dict = {} ret_dict = {}
for key in constants.IPOLICY_PARAMETERS: for key in constants.IPOLICY_ISPECS:
ret_dict[key] = FillDict(default_ipolicy[key], ret_dict[key] = FillDict(default_ipolicy[key],
custom_ipolicy.get(key, {}), custom_ipolicy.get(key, {}),
skip_keys=skip_keys) skip_keys=skip_keys)
......
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