Commit e3a19474 authored by Iustin Pop's avatar Iustin Pop
Browse files

Allow fixing of split instances via relocate

Currently, the IAllocator code requests strictly that the (set of) groups of
the nodes we're relocating from is equal to the set of groups we're
relocating to.

This, however, makes is impossible to fix split instances, since (by
definition) the secondary of a split instance is not in the same group
as the primary node, and after the fixing is it the same.

The patch changes the test from group equality to check that the final
group set (across both primary and secondary nodes) is a subset of the
initial group set (again across both nodes). This means we can't
"extend" the group of nodes but keeping the same or decreasing it is

After this patch, one can finally fix (automatically) split instances
via a gnt-instance replace-disks.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 88df1fa9
......@@ -13188,10 +13188,11 @@ class IAllocator(object):
fn = compat.partial(self._NodesToGroups, node2group,
request_groups = fn(self.relocate_from)
result_groups = fn(rdict["result"])
instance = self.cfg.GetInstanceInfo(
request_groups = fn(self.relocate_from + [instance.primary_node])
result_groups = fn(rdict["result"] + [instance.primary_node])
if self.success and result_groups != request_groups:
if self.success and not set(result_groups).issubset(request_groups):
raise errors.OpExecError("Groups of nodes returned by iallocator (%s)"
" differ from original groups (%s)" %
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