config: Add function to determine instance's groups
[ganeti-local] / doc / design-multi-reloc.rst
1 ====================================
2 Moving instances accross node groups
3 ====================================
4
5 This design document explains the changes needed in Ganeti to perform
6 instance moves across node groups. Reader familiarity with the following
7 existing documents is advised:
8
9 - :doc:`Current IAllocator specification <iallocator>`
10 - :doc:`Shared storage model in 2.3+ <design-shared-storage>`
11
12 Motivation and and design proposal
13 ==================================
14
15 At the moment, moving instances away from their primary or secondary
16 nodes with the ``relocate`` and ``multi-evacuate`` IAllocator calls
17 restricts target nodes to those on the same node group. This ensures a
18 mobility domain is never crossed, and allows normal operation of each
19 node group to be confined within itself.
20
21 It is desirable, however, to have a way of moving instances across node
22 groups so that, for example, it is possible to move a set of instances
23 to another group for policy reasons, or completely empty a given group
24 to perform maintenance operations.
25
26 To implement this, we propose a new ``multi-relocate`` IAllocator call
27 that will be able to compute inter-group instance moves, taking into
28 account mobility domains as appropriate. The interface proposed below
29 should be enough to cover the use cases mentioned above.
30
31 .. _multi-reloc-detailed-design:
32
33 Detailed design
34 ===============
35
36 We introduce a new ``multi-relocate`` IAllocator call whose input will
37 be a list of instances to move, and a "mode of operation" that will
38 determine what groups will be candidates to receive the new instances.
39
40 The mode of operation will be one of:
41
42 - *Stay in group*: the instances will be moved off their current nodes,
43   but will stay in the same group; this is what the ``relocate`` call
44   does, but here it can act on multiple instances. (Typically, the
45   source nodes will be marked as drained, to avoid just exchanging
46   instances among them.)
47
48 - *Change group*: this mode accepts one extra parameter, a list of node
49   group UUIDs; the instances will be moved away from their current
50   group, to any of the groups in this list. If the list is empty, the
51   request is, simply, "change group": the instances are placed in any
52   group but their original one.
53
54 - *Any*: for each instance, any group is valid, including its current
55   one.
56
57 In all modes, the groups' ``alloc_policy`` attribute will be honored.
58
59 Result
60 ------
61
62 In all storage models, an inter-group move can be modeled as a sequence
63 of **replace secondary** and **failover** operations (when shared
64 storage is used, they will all be failover operations within the
65 corresponding mobility domain). This will be represented as a list of
66 ``(instance, [operations])`` pairs.
67
68 For replace secondary operations, a new secondary node must be
69 specified. For failover operations, a node *may* be specified when
70 necessary, e.g. when shared storage is in use and there's no designated
71 secondary for the instance.
72
73 .. vim: set textwidth=72 :
74 .. Local Variables:
75 .. mode: rst
76 .. fill-column: 72
77 .. End: