Commit bb0d8ddc authored by Adam Ingrassia's avatar Adam Ingrassia Committed by Iustin Pop
Browse files

Support for checking the group of only the primary node



_CheckInstanceNodeGroups behaves in the old way with the default value
of the new parameter.
Signed-off-by: default avatarAdam Ingrassia <api@google.com>
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent fc1282b8
......@@ -640,7 +640,8 @@ def _CheckInstancesNodeGroups(cfg, instances, owned_groups, owned_nodes,
"Instance %s has no node in group %s" % (name, cur_group_uuid)
 
 
def _CheckInstanceNodeGroups(cfg, instance_name, owned_groups):
def _CheckInstanceNodeGroups(cfg, instance_name, owned_groups,
primary_only=False):
"""Checks if the owned node groups are still correct for an instance.
 
@type cfg: L{config.ConfigWriter}
......@@ -649,9 +650,11 @@ def _CheckInstanceNodeGroups(cfg, instance_name, owned_groups):
@param instance_name: Instance name
@type owned_groups: set or frozenset
@param owned_groups: List of currently owned node groups
@type primary_only: boolean
@param primary_only: Whether to check node groups for only the primary node
 
"""
inst_groups = cfg.GetInstanceNodeGroups(instance_name)
inst_groups = cfg.GetInstanceNodeGroups(instance_name, primary_only)
 
if not owned_groups.issuperset(inst_groups):
raise errors.OpPrereqError("Instance %s's node groups changed since"
......
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