Commit 81e3ab4f authored by Agata Murawska's avatar Agata Murawska
Browse files

Introduce instance policy on nodegroup level


Signed-off-by: default avatarAgata Murawska <agatamurawska@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent be499e31
......@@ -1229,6 +1229,14 @@ def _DecideSelfPromotion(lu, exceptions=None):
return mc_now < mc_should
def _CalculateGroupIPolicy(cfg, group):
"""Calculate instance policy for group.
"""
cluster = cfg.GetClusterInfo()
return cluster.SimpleFillIPolicy(group.ipolicy)
def _CheckNicsBridgesExist(lu, target_nics, target_node):
"""Check that the brigdes needed by a list of nics exist.
......
......@@ -561,8 +561,11 @@ class ConfigWriter:
result.append("duplicate node group name '%s'" % nodegroup.name)
else:
nodegroups_names.add(nodegroup.name)
group_name = "group %s" % nodegroup.name
_helper_ipolicy(group_name, cluster.SimpleFillIPolicy(nodegroup.ipolicy))
_helper_ispecs(group_name, cluster.SimpleFillIPolicy(nodegroup.ipolicy))
if nodegroup.ndparams:
_helper("group %s" % nodegroup.name, "ndparams",
_helper(group_name, "ndparams",
cluster.SimpleFillND(nodegroup.ndparams),
constants.NDS_PARAMETER_TYPES)
......
......@@ -1257,6 +1257,7 @@ class NodeGroup(TaggableObject):
"members",
"ndparams",
"diskparams",
"ipolicy",
"serial_no",
"hv_state_static",
"disk_state_static",
......@@ -1304,6 +1305,8 @@ class NodeGroup(TaggableObject):
self.mtime = time.time()
self.diskparams = UpgradeDiskParams(self.diskparams)
if self.ipolicy is None:
self.ipolicy = MakeEmptyIPolicy()
def FillND(self, node):
"""Return filled out ndparams for L{objects.Node}
......
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