root / doc / iallocator.rst @ 63fb7526
History | View | Annotate | Download (15.6 kB)
1 | 876860a3 | Iustin Pop | Ganeti automatic instance allocation |
---|---|---|---|
2 | 876860a3 | Iustin Pop | ==================================== |
3 | 876860a3 | Iustin Pop | |
4 | 632fb7ec | Iustin Pop | Documents Ganeti version 2.1 |
5 | 876860a3 | Iustin Pop | |
6 | 876860a3 | Iustin Pop | .. contents:: |
7 | 876860a3 | Iustin Pop | |
8 | 876860a3 | Iustin Pop | Introduction |
9 | 876860a3 | Iustin Pop | ------------ |
10 | 876860a3 | Iustin Pop | |
11 | 876860a3 | Iustin Pop | Currently in Ganeti the admin has to specify the exact locations for |
12 | 876860a3 | Iustin Pop | an instance's node(s). This prevents a completely automatic node |
13 | 876860a3 | Iustin Pop | evacuation, and is in general a nuisance. |
14 | 876860a3 | Iustin Pop | |
15 | 876860a3 | Iustin Pop | The *iallocator* framework will enable automatic placement via |
16 | 876860a3 | Iustin Pop | external scripts, which allows customization of the cluster layout per |
17 | 876860a3 | Iustin Pop | the site's requirements. |
18 | 876860a3 | Iustin Pop | |
19 | 876860a3 | Iustin Pop | User-visible changes |
20 | 876860a3 | Iustin Pop | ~~~~~~~~~~~~~~~~~~~~ |
21 | 876860a3 | Iustin Pop | |
22 | 876860a3 | Iustin Pop | There are two parts of the ganeti operation that are impacted by the |
23 | 876860a3 | Iustin Pop | auto-allocation: how the cluster knows what the allocator algorithms |
24 | 876860a3 | Iustin Pop | are and how the admin uses these in creating instances. |
25 | 876860a3 | Iustin Pop | |
26 | 876860a3 | Iustin Pop | An allocation algorithm is just the filename of a program installed in |
27 | 876860a3 | Iustin Pop | a defined list of directories. |
28 | 876860a3 | Iustin Pop | |
29 | 876860a3 | Iustin Pop | Cluster configuration |
30 | 876860a3 | Iustin Pop | ~~~~~~~~~~~~~~~~~~~~~ |
31 | 876860a3 | Iustin Pop | |
32 | 876860a3 | Iustin Pop | At configure time, the list of the directories can be selected via the |
33 | 876860a3 | Iustin Pop | ``--with-iallocator-search-path=LIST`` option, where *LIST* is a |
34 | 876860a3 | Iustin Pop | comma-separated list of directories. If not given, this defaults to |
35 | 876860a3 | Iustin Pop | ``$libdir/ganeti/iallocators``, i.e. for an installation under |
36 | 876860a3 | Iustin Pop | ``/usr``, this will be ``/usr/lib/ganeti/iallocators``. |
37 | 876860a3 | Iustin Pop | |
38 | 876860a3 | Iustin Pop | Ganeti will then search for allocator script in the configured list, |
39 | 876860a3 | Iustin Pop | using the first one whose filename matches the one given by the user. |
40 | 876860a3 | Iustin Pop | |
41 | 876860a3 | Iustin Pop | Command line interface changes |
42 | 876860a3 | Iustin Pop | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
43 | 876860a3 | Iustin Pop | |
44 | 876860a3 | Iustin Pop | The node selection options in instanece add and instance replace disks |
45 | 876860a3 | Iustin Pop | can be replace by the new ``--iallocator=NAME`` option (shortened to |
46 | 876860a3 | Iustin Pop | ``-I``), which will cause the auto-assignement of nodes with the |
47 | 876860a3 | Iustin Pop | passed iallocator. The selected node(s) will be show as part of the |
48 | 876860a3 | Iustin Pop | command output. |
49 | 876860a3 | Iustin Pop | |
50 | 876860a3 | Iustin Pop | IAllocator API |
51 | 876860a3 | Iustin Pop | -------------- |
52 | 876860a3 | Iustin Pop | |
53 | 876860a3 | Iustin Pop | The protocol for communication between Ganeti and an allocator script |
54 | 876860a3 | Iustin Pop | will be the following: |
55 | 876860a3 | Iustin Pop | |
56 | 876860a3 | Iustin Pop | #. ganeti launches the program with a single argument, a filename that |
57 | 876860a3 | Iustin Pop | contains a JSON-encoded structure (the input message) |
58 | 876860a3 | Iustin Pop | |
59 | 876860a3 | Iustin Pop | #. if the script finishes with exit code different from zero, it is |
60 | 876860a3 | Iustin Pop | considered a general failure and the full output will be reported to |
61 | 876860a3 | Iustin Pop | the users; this can be the case when the allocator can't parse the |
62 | 876860a3 | Iustin Pop | input message |
63 | 876860a3 | Iustin Pop | |
64 | 876860a3 | Iustin Pop | #. if the allocator finishes with exit code zero, it is expected to |
65 | 876860a3 | Iustin Pop | output (on its stdout) a JSON-encoded structure (the response) |
66 | 876860a3 | Iustin Pop | |
67 | 876860a3 | Iustin Pop | Input message |
68 | 876860a3 | Iustin Pop | ~~~~~~~~~~~~~ |
69 | 876860a3 | Iustin Pop | |
70 | 876860a3 | Iustin Pop | The input message will be the JSON encoding of a dictionary containing |
71 | 61791108 | Adeodato Simo | all the required information to perform the operation. We explain the |
72 | 61791108 | Adeodato Simo | contents of this dictionary in two parts: common information that every |
73 | 61791108 | Adeodato Simo | type of operation requires, and operation-specific information. |
74 | 61791108 | Adeodato Simo | |
75 | 61791108 | Adeodato Simo | Common information |
76 | 61791108 | Adeodato Simo | ++++++++++++++++++ |
77 | 61791108 | Adeodato Simo | |
78 | 61791108 | Adeodato Simo | All input dictionaries to the IAllocator must carry the following keys: |
79 | 876860a3 | Iustin Pop | |
80 | 876860a3 | Iustin Pop | version |
81 | 876860a3 | Iustin Pop | the version of the protocol; this document |
82 | 77031881 | Iustin Pop | specifies version 2 |
83 | 876860a3 | Iustin Pop | |
84 | 876860a3 | Iustin Pop | cluster_name |
85 | 876860a3 | Iustin Pop | the cluster name |
86 | 876860a3 | Iustin Pop | |
87 | 876860a3 | Iustin Pop | cluster_tags |
88 | 876860a3 | Iustin Pop | the list of cluster tags |
89 | 876860a3 | Iustin Pop | |
90 | 77031881 | Iustin Pop | enabled_hypervisors |
91 | 77031881 | Iustin Pop | the list of enabled hypervisors |
92 | 77031881 | Iustin Pop | |
93 | 876860a3 | Iustin Pop | request |
94 | 61791108 | Adeodato Simo | a dictionary containing the details of the request; the keys vary |
95 | 61791108 | Adeodato Simo | depending on the type of operation that's being requested, as |
96 | 61791108 | Adeodato Simo | explained in `Operation-specific input`_ below. |
97 | 632fb7ec | Iustin Pop | |
98 | 622444e5 | Iustin Pop | nodegroups |
99 | 622444e5 | Iustin Pop | a dictionary with the data for the cluster's node groups; it is keyed |
100 | 622444e5 | Iustin Pop | on the group UUID, and the values are a dictionary with the following |
101 | 622444e5 | Iustin Pop | keys: |
102 | 622444e5 | Iustin Pop | |
103 | 622444e5 | Iustin Pop | name |
104 | 622444e5 | Iustin Pop | the node group name |
105 | 913639fe | Balazs Lecz | alloc_policy |
106 | 5e9bcdf4 | Adeodato Simo | the allocation policy of the node group (consult the semantics of |
107 | 5e9bcdf4 | Adeodato Simo | this attribute in the :manpage:`gnt-group(8)` manpage) |
108 | 622444e5 | Iustin Pop | |
109 | 876860a3 | Iustin Pop | instances |
110 | 876860a3 | Iustin Pop | a dictionary with the data for the current existing instance on the |
111 | 876860a3 | Iustin Pop | cluster, indexed by instance name; the contents are similar to the |
112 | 876860a3 | Iustin Pop | instance definitions for the allocate mode, with the addition of: |
113 | 876860a3 | Iustin Pop | |
114 | 77031881 | Iustin Pop | admin_up |
115 | 876860a3 | Iustin Pop | if this instance is set to run (but not the actual status of the |
116 | 876860a3 | Iustin Pop | instance) |
117 | 876860a3 | Iustin Pop | |
118 | 876860a3 | Iustin Pop | nodes |
119 | 876860a3 | Iustin Pop | list of nodes on which this instance is placed; the primary node |
120 | 876860a3 | Iustin Pop | of the instance is always the first one |
121 | 876860a3 | Iustin Pop | |
122 | 876860a3 | Iustin Pop | nodes |
123 | 876860a3 | Iustin Pop | dictionary with the data for the nodes in the cluster, indexed by |
124 | 0d853843 | Iustin Pop | the node name; the dict contains [*]_ : |
125 | 876860a3 | Iustin Pop | |
126 | 876860a3 | Iustin Pop | total_disk |
127 | 876860a3 | Iustin Pop | the total disk size of this node (mebibytes) |
128 | 876860a3 | Iustin Pop | |
129 | 876860a3 | Iustin Pop | free_disk |
130 | 876860a3 | Iustin Pop | the free disk space on the node |
131 | 876860a3 | Iustin Pop | |
132 | 876860a3 | Iustin Pop | total_memory |
133 | 876860a3 | Iustin Pop | the total memory size |
134 | 876860a3 | Iustin Pop | |
135 | 876860a3 | Iustin Pop | free_memory |
136 | 876860a3 | Iustin Pop | free memory on the node; note that currently this does not take |
137 | 876860a3 | Iustin Pop | into account the instances which are down on the node |
138 | 876860a3 | Iustin Pop | |
139 | 876860a3 | Iustin Pop | total_cpus |
140 | 876860a3 | Iustin Pop | the physical number of CPUs present on the machine; depending on |
141 | 876860a3 | Iustin Pop | the hypervisor, this might or might not be equal to how many CPUs |
142 | 876860a3 | Iustin Pop | the node operating system sees; |
143 | 876860a3 | Iustin Pop | |
144 | 876860a3 | Iustin Pop | primary_ip |
145 | 876860a3 | Iustin Pop | the primary IP address of the node |
146 | 876860a3 | Iustin Pop | |
147 | 876860a3 | Iustin Pop | secondary_ip |
148 | 876860a3 | Iustin Pop | the secondary IP address of the node (the one used for the DRBD |
149 | 876860a3 | Iustin Pop | replication); note that this can be the same as the primary one |
150 | 876860a3 | Iustin Pop | |
151 | 876860a3 | Iustin Pop | tags |
152 | 876860a3 | Iustin Pop | list with the tags of the node |
153 | 876860a3 | Iustin Pop | |
154 | 77031881 | Iustin Pop | master_candidate: |
155 | 77031881 | Iustin Pop | a boolean flag denoting whether this node is a master candidate |
156 | 77031881 | Iustin Pop | |
157 | 77031881 | Iustin Pop | drained: |
158 | 77031881 | Iustin Pop | a boolean flag denoting whether this node is being drained |
159 | 77031881 | Iustin Pop | |
160 | 77031881 | Iustin Pop | offline: |
161 | 77031881 | Iustin Pop | a boolean flag denoting whether this node is offline |
162 | 77031881 | Iustin Pop | |
163 | 77031881 | Iustin Pop | i_pri_memory: |
164 | 77031881 | Iustin Pop | total memory required by primary instances |
165 | 77031881 | Iustin Pop | |
166 | 77031881 | Iustin Pop | i_pri_up_memory: |
167 | 77031881 | Iustin Pop | total memory required by running primary instances |
168 | 77031881 | Iustin Pop | |
169 | 1116c3b2 | Iustin Pop | group: |
170 | 1116c3b2 | Iustin Pop | the node group that this node belongs to |
171 | 1116c3b2 | Iustin Pop | |
172 | 77031881 | Iustin Pop | No allocations should be made on nodes having either the ``drained`` |
173 | 77031881 | Iustin Pop | or ``offline`` flags set. More details about these of node status |
174 | fd07c6b3 | Iustin Pop | flags is available in the manpage :manpage:`ganeti(7)`. |
175 | 77031881 | Iustin Pop | |
176 | a1cef11c | Iustin Pop | .. [*] Note that no run-time data is present for offline, drained or |
177 | a1cef11c | Iustin Pop | non-vm_capable nodes; this means the tags total_memory, |
178 | a1cef11c | Iustin Pop | reserved_memory, free_memory, total_disk, free_disk, total_cpus, |
179 | a1cef11c | Iustin Pop | i_pri_memory and i_pri_up memory will be absent |
180 | 77031881 | Iustin Pop | |
181 | 61791108 | Adeodato Simo | Operation-specific input |
182 | 61791108 | Adeodato Simo | ++++++++++++++++++++++++ |
183 | 61791108 | Adeodato Simo | |
184 | 61791108 | Adeodato Simo | All input dictionaries to the IAllocator carry, in the ``request`` |
185 | 61791108 | Adeodato Simo | dictionary, detailed information about the operation that's being |
186 | 61791108 | Adeodato Simo | requested. The required keys vary depending on the type of operation, as |
187 | 61791108 | Adeodato Simo | follows. |
188 | 61791108 | Adeodato Simo | |
189 | 61791108 | Adeodato Simo | In all cases, it includes: |
190 | 61791108 | Adeodato Simo | |
191 | 61791108 | Adeodato Simo | type |
192 | 6d267b81 | Adeodato Simo | the request type; this can be either ``allocate``, ``relocate``, |
193 | 6d267b81 | Adeodato Simo | ``multi-relocate`` or ``multi-evacuate``. The ``allocate`` request |
194 | 6d267b81 | Adeodato Simo | is used when a new instance needs to be placed on the cluster. The |
195 | 6d267b81 | Adeodato Simo | ``relocate`` request is used when an existing instance needs to be |
196 | 6d267b81 | Adeodato Simo | moved within its node group, while the ``multi-relocate`` one is |
197 | 6d267b81 | Adeodato Simo | able to relocate multiple instances across multiple node groups. The |
198 | 6d267b81 | Adeodato Simo | ``multi-evacuate`` protocol requests that the script computes the |
199 | 6d267b81 | Adeodato Simo | optimal relocate solution for all secondary instances of the given |
200 | 6d267b81 | Adeodato Simo | nodes. |
201 | 61791108 | Adeodato Simo | |
202 | 61791108 | Adeodato Simo | For both allocate and relocate mode, the following extra keys are needed |
203 | 61791108 | Adeodato Simo | in the ``request`` dictionary: |
204 | 61791108 | Adeodato Simo | |
205 | 61791108 | Adeodato Simo | name |
206 | 61791108 | Adeodato Simo | the name of the instance; if the request is a realocation, then this |
207 | 61791108 | Adeodato Simo | name will be found in the list of instances (see below), otherwise |
208 | 61791108 | Adeodato Simo | is the FQDN of the new instance |
209 | 61791108 | Adeodato Simo | |
210 | 61791108 | Adeodato Simo | required_nodes |
211 | 61791108 | Adeodato Simo | how many nodes should the algorithm return; while this information |
212 | 61791108 | Adeodato Simo | can be deduced from the instace's disk template, it's better if |
213 | 61791108 | Adeodato Simo | this computation is left to Ganeti as then allocator scripts are |
214 | 61791108 | Adeodato Simo | less sensitive to changes to the disk templates |
215 | 61791108 | Adeodato Simo | |
216 | 61791108 | Adeodato Simo | disk_space_total |
217 | 61791108 | Adeodato Simo | the total disk space that will be used by this instance on the |
218 | 61791108 | Adeodato Simo | (new) nodes; again, this information can be computed from the list |
219 | 61791108 | Adeodato Simo | of instance disks and its template type, but Ganeti is better |
220 | 61791108 | Adeodato Simo | suited to compute it |
221 | 61791108 | Adeodato Simo | |
222 | 63fb7526 | Michael Hanselmann | .. pyassert:: |
223 | 63fb7526 | Michael Hanselmann | |
224 | 63fb7526 | Michael Hanselmann | constants.DISK_ACCESS_SET == set([constants.DISK_RDONLY, |
225 | 63fb7526 | Michael Hanselmann | constants.DISK_RDWR]) |
226 | 63fb7526 | Michael Hanselmann | |
227 | 61791108 | Adeodato Simo | Allocation needs, in addition: |
228 | 61791108 | Adeodato Simo | |
229 | 61791108 | Adeodato Simo | disks |
230 | 61791108 | Adeodato Simo | list of dictionaries holding the disk definitions for this |
231 | 61791108 | Adeodato Simo | instance (in the order they are exported to the hypervisor): |
232 | 61791108 | Adeodato Simo | |
233 | 61791108 | Adeodato Simo | mode |
234 | 63fb7526 | Michael Hanselmann | either :pyeval:`constants.DISK_RDONLY` or |
235 | 63fb7526 | Michael Hanselmann | :pyeval:`constants.DISK_RDWR` denoting if the disk is read-only or |
236 | 61791108 | Adeodato Simo | writable |
237 | 61791108 | Adeodato Simo | |
238 | 61791108 | Adeodato Simo | size |
239 | 61791108 | Adeodato Simo | the size of this disk in mebibytes |
240 | 61791108 | Adeodato Simo | |
241 | 61791108 | Adeodato Simo | nics |
242 | 61791108 | Adeodato Simo | a list of dictionaries holding the network interfaces for this |
243 | 61791108 | Adeodato Simo | instance, containing: |
244 | 61791108 | Adeodato Simo | |
245 | 61791108 | Adeodato Simo | ip |
246 | 61791108 | Adeodato Simo | the IP address that Ganeti know for this instance, or null |
247 | 61791108 | Adeodato Simo | |
248 | 61791108 | Adeodato Simo | mac |
249 | 61791108 | Adeodato Simo | the MAC address for this interface |
250 | 61791108 | Adeodato Simo | |
251 | 61791108 | Adeodato Simo | bridge |
252 | 61791108 | Adeodato Simo | the bridge to which this interface will be connected |
253 | 61791108 | Adeodato Simo | |
254 | 61791108 | Adeodato Simo | vcpus |
255 | 61791108 | Adeodato Simo | the number of VCPUs for the instance |
256 | 61791108 | Adeodato Simo | |
257 | 61791108 | Adeodato Simo | disk_template |
258 | 61791108 | Adeodato Simo | the disk template for the instance |
259 | 61791108 | Adeodato Simo | |
260 | 61791108 | Adeodato Simo | memory |
261 | 61791108 | Adeodato Simo | the memory size for the instance |
262 | 61791108 | Adeodato Simo | |
263 | 61791108 | Adeodato Simo | os |
264 | 61791108 | Adeodato Simo | the OS type for the instance |
265 | 61791108 | Adeodato Simo | |
266 | 61791108 | Adeodato Simo | tags |
267 | 61791108 | Adeodato Simo | the list of the instance's tags |
268 | 61791108 | Adeodato Simo | |
269 | 61791108 | Adeodato Simo | hypervisor |
270 | 61791108 | Adeodato Simo | the hypervisor of this instance |
271 | 61791108 | Adeodato Simo | |
272 | 61791108 | Adeodato Simo | Relocation: |
273 | 61791108 | Adeodato Simo | |
274 | 61791108 | Adeodato Simo | relocate_from |
275 | 61791108 | Adeodato Simo | a list of nodes to move the instance away from (note that with |
276 | 61791108 | Adeodato Simo | Ganeti 2.0, this list will always contain a single node, the |
277 | 61791108 | Adeodato Simo | current secondary of the instance) |
278 | 61791108 | Adeodato Simo | |
279 | 6d267b81 | Adeodato Simo | As for ``multi-relocate``, it needs the three following request |
280 | 6d267b81 | Adeodato Simo | arguments: |
281 | 6d267b81 | Adeodato Simo | |
282 | 6d267b81 | Adeodato Simo | instances |
283 | 6d267b81 | Adeodato Simo | a list of instance names to relocate |
284 | 6d267b81 | Adeodato Simo | |
285 | 6d267b81 | Adeodato Simo | reloc_mode |
286 | 6d267b81 | Adeodato Simo | a string indicating the relocation mode; there are three possible |
287 | 6d267b81 | Adeodato Simo | values for this string: *keep_group*, *change_group*, and |
288 | 6d267b81 | Adeodato Simo | *any_group*, the semantics or which are explained in :ref:`the |
289 | 9626f028 | Michael Hanselmann | design document <multi-reloc-detailed-design>` |
290 | 6d267b81 | Adeodato Simo | |
291 | 6d267b81 | Adeodato Simo | target_groups |
292 | 6d267b81 | Adeodato Simo | this argument is only accepted when ``reloc_mode``, as explained |
293 | 6d267b81 | Adeodato Simo | above, is *change_group*; if present, it must either be the empty |
294 | 6d267b81 | Adeodato Simo | list, or contain a list of group UUIDs that should be considered for |
295 | 6d267b81 | Adeodato Simo | relocating instances to |
296 | 6d267b81 | Adeodato Simo | |
297 | 6d267b81 | Adeodato Simo | Finally, in the case of multi-evacuate, there's one single request |
298 | 6d267b81 | Adeodato Simo | argument (in addition to ``type``): |
299 | 61791108 | Adeodato Simo | |
300 | 61791108 | Adeodato Simo | evac_nodes |
301 | 61791108 | Adeodato Simo | the names of the nodes to be evacuated |
302 | 0d853843 | Iustin Pop | |
303 | 0d853843 | Iustin Pop | Response message |
304 | 0d853843 | Iustin Pop | ~~~~~~~~~~~~~~~~ |
305 | 876860a3 | Iustin Pop | |
306 | 876860a3 | Iustin Pop | The response message is much more simple than the input one. It is |
307 | 876860a3 | Iustin Pop | also a dict having three keys: |
308 | 876860a3 | Iustin Pop | |
309 | 876860a3 | Iustin Pop | success |
310 | 5bbd3f7f | Michael Hanselmann | a boolean value denoting if the allocation was successful or not |
311 | 876860a3 | Iustin Pop | |
312 | 876860a3 | Iustin Pop | info |
313 | 876860a3 | Iustin Pop | a string with information from the scripts; if the allocation fails, |
314 | 876860a3 | Iustin Pop | this will be shown to the user |
315 | 876860a3 | Iustin Pop | |
316 | 632fb7ec | Iustin Pop | result |
317 | 632fb7ec | Iustin Pop | the output of the algorithm; even if the algorithm failed |
318 | 632fb7ec | Iustin Pop | (i.e. success is false), this must be returned as an empty list |
319 | 632fb7ec | Iustin Pop | |
320 | 632fb7ec | Iustin Pop | for allocate/relocate, this is the list of node(s) for the instance; |
321 | 632fb7ec | Iustin Pop | note that the length of this list must equal the ``requested_nodes`` |
322 | 632fb7ec | Iustin Pop | entry in the input message, otherwise Ganeti will consider the result |
323 | 632fb7ec | Iustin Pop | as failed |
324 | 632fb7ec | Iustin Pop | |
325 | 9626f028 | Michael Hanselmann | for multi-relocate mode, this is a list of lists of serialized |
326 | 9626f028 | Michael Hanselmann | opcodes. See the :ref:`design document <multi-reloc-result>` for a |
327 | 9626f028 | Michael Hanselmann | detailed dscription. |
328 | 6d267b81 | Adeodato Simo | |
329 | 632fb7ec | Iustin Pop | for multi-evacuation mode, this is a list of lists; each element of |
330 | 632fb7ec | Iustin Pop | the list is a list of instance name and the new secondary node |
331 | 632fb7ec | Iustin Pop | |
332 | 632fb7ec | Iustin Pop | .. note:: Current Ganeti version accepts either ``result`` or ``nodes`` |
333 | 632fb7ec | Iustin Pop | as a backwards-compatibility measure (older versions only supported |
334 | 632fb7ec | Iustin Pop | ``nodes``) |
335 | 876860a3 | Iustin Pop | |
336 | 876860a3 | Iustin Pop | Examples |
337 | 876860a3 | Iustin Pop | -------- |
338 | 876860a3 | Iustin Pop | |
339 | 876860a3 | Iustin Pop | Input messages to scripts |
340 | 876860a3 | Iustin Pop | ~~~~~~~~~~~~~~~~~~~~~~~~~ |
341 | 876860a3 | Iustin Pop | |
342 | 61791108 | Adeodato Simo | Input message, new instance allocation (common elements are listed this |
343 | 61791108 | Adeodato Simo | time, but not included in further examples below):: |
344 | 876860a3 | Iustin Pop | |
345 | 876860a3 | Iustin Pop | { |
346 | 61791108 | Adeodato Simo | "version": 2, |
347 | 61791108 | Adeodato Simo | "cluster_name": "cluster1.example.com", |
348 | 876860a3 | Iustin Pop | "cluster_tags": [], |
349 | 61791108 | Adeodato Simo | "enabled_hypervisors": [ |
350 | 61791108 | Adeodato Simo | "xen-pvm" |
351 | 61791108 | Adeodato Simo | ], |
352 | 61791108 | Adeodato Simo | "nodegroups": { |
353 | 61791108 | Adeodato Simo | "f4e06e0d-528a-4963-a5ad-10f3e114232d": { |
354 | 61791108 | Adeodato Simo | "name": "default", |
355 | 61791108 | Adeodato Simo | "alloc_policy": "preferred" |
356 | 61791108 | Adeodato Simo | } |
357 | 876860a3 | Iustin Pop | }, |
358 | 876860a3 | Iustin Pop | "instances": { |
359 | 876860a3 | Iustin Pop | "instance1.example.com": { |
360 | 876860a3 | Iustin Pop | "tags": [], |
361 | 876860a3 | Iustin Pop | "should_run": false, |
362 | 876860a3 | Iustin Pop | "disks": [ |
363 | 876860a3 | Iustin Pop | { |
364 | 876860a3 | Iustin Pop | "mode": "w", |
365 | 876860a3 | Iustin Pop | "size": 64 |
366 | 876860a3 | Iustin Pop | }, |
367 | 876860a3 | Iustin Pop | { |
368 | 876860a3 | Iustin Pop | "mode": "w", |
369 | 876860a3 | Iustin Pop | "size": 512 |
370 | 876860a3 | Iustin Pop | } |
371 | 876860a3 | Iustin Pop | ], |
372 | 876860a3 | Iustin Pop | "nics": [ |
373 | 876860a3 | Iustin Pop | { |
374 | 876860a3 | Iustin Pop | "ip": null, |
375 | 876860a3 | Iustin Pop | "mac": "aa:00:00:00:60:bf", |
376 | 876860a3 | Iustin Pop | "bridge": "xen-br0" |
377 | 876860a3 | Iustin Pop | } |
378 | 876860a3 | Iustin Pop | ], |
379 | 876860a3 | Iustin Pop | "vcpus": 1, |
380 | 876860a3 | Iustin Pop | "disk_template": "plain", |
381 | 876860a3 | Iustin Pop | "memory": 128, |
382 | 876860a3 | Iustin Pop | "nodes": [ |
383 | 876860a3 | Iustin Pop | "nodee1.com" |
384 | 876860a3 | Iustin Pop | ], |
385 | 6f547f96 | Guido Trotter | "os": "debootstrap+default" |
386 | 876860a3 | Iustin Pop | }, |
387 | 876860a3 | Iustin Pop | "instance2.example.com": { |
388 | 876860a3 | Iustin Pop | "tags": [], |
389 | 876860a3 | Iustin Pop | "should_run": false, |
390 | 876860a3 | Iustin Pop | "disks": [ |
391 | 876860a3 | Iustin Pop | { |
392 | 876860a3 | Iustin Pop | "mode": "w", |
393 | 876860a3 | Iustin Pop | "size": 512 |
394 | 876860a3 | Iustin Pop | }, |
395 | 876860a3 | Iustin Pop | { |
396 | 876860a3 | Iustin Pop | "mode": "w", |
397 | 876860a3 | Iustin Pop | "size": 256 |
398 | 876860a3 | Iustin Pop | } |
399 | 876860a3 | Iustin Pop | ], |
400 | 876860a3 | Iustin Pop | "nics": [ |
401 | 876860a3 | Iustin Pop | { |
402 | 876860a3 | Iustin Pop | "ip": null, |
403 | 876860a3 | Iustin Pop | "mac": "aa:00:00:55:f8:38", |
404 | 876860a3 | Iustin Pop | "bridge": "xen-br0" |
405 | 876860a3 | Iustin Pop | } |
406 | 876860a3 | Iustin Pop | ], |
407 | 876860a3 | Iustin Pop | "vcpus": 1, |
408 | 876860a3 | Iustin Pop | "disk_template": "drbd", |
409 | 876860a3 | Iustin Pop | "memory": 512, |
410 | 876860a3 | Iustin Pop | "nodes": [ |
411 | 876860a3 | Iustin Pop | "node2.example.com", |
412 | 876860a3 | Iustin Pop | "node3.example.com" |
413 | 876860a3 | Iustin Pop | ], |
414 | 6f547f96 | Guido Trotter | "os": "debootstrap+default" |
415 | 876860a3 | Iustin Pop | } |
416 | 876860a3 | Iustin Pop | }, |
417 | 876860a3 | Iustin Pop | "nodes": { |
418 | 876860a3 | Iustin Pop | "node1.example.com": { |
419 | 876860a3 | Iustin Pop | "total_disk": 858276, |
420 | 926feaf1 | Manuel Franceschini | "primary_ip": "198.51.100.1", |
421 | 926feaf1 | Manuel Franceschini | "secondary_ip": "192.0.2.1", |
422 | 876860a3 | Iustin Pop | "tags": [], |
423 | 61791108 | Adeodato Simo | "group": "f4e06e0d-528a-4963-a5ad-10f3e114232d", |
424 | 876860a3 | Iustin Pop | "free_memory": 3505, |
425 | 876860a3 | Iustin Pop | "free_disk": 856740, |
426 | 876860a3 | Iustin Pop | "total_memory": 4095 |
427 | 876860a3 | Iustin Pop | }, |
428 | 876860a3 | Iustin Pop | "node2.example.com": { |
429 | 876860a3 | Iustin Pop | "total_disk": 858240, |
430 | 926feaf1 | Manuel Franceschini | "primary_ip": "198.51.100.2", |
431 | 926feaf1 | Manuel Franceschini | "secondary_ip": "192.0.2.2", |
432 | 876860a3 | Iustin Pop | "tags": ["test"], |
433 | 61791108 | Adeodato Simo | "group": "f4e06e0d-528a-4963-a5ad-10f3e114232d", |
434 | 876860a3 | Iustin Pop | "free_memory": 3505, |
435 | 876860a3 | Iustin Pop | "free_disk": 848320, |
436 | 876860a3 | Iustin Pop | "total_memory": 4095 |
437 | 876860a3 | Iustin Pop | }, |
438 | 876860a3 | Iustin Pop | "node3.example.com.com": { |
439 | 876860a3 | Iustin Pop | "total_disk": 572184, |
440 | 926feaf1 | Manuel Franceschini | "primary_ip": "198.51.100.3", |
441 | 926feaf1 | Manuel Franceschini | "secondary_ip": "192.0.2.3", |
442 | 876860a3 | Iustin Pop | "tags": [], |
443 | 61791108 | Adeodato Simo | "group": "f4e06e0d-528a-4963-a5ad-10f3e114232d", |
444 | 876860a3 | Iustin Pop | "free_memory": 3505, |
445 | 876860a3 | Iustin Pop | "free_disk": 570648, |
446 | 876860a3 | Iustin Pop | "total_memory": 4095 |
447 | 876860a3 | Iustin Pop | } |
448 | 61791108 | Adeodato Simo | }, |
449 | 61791108 | Adeodato Simo | "request": { |
450 | 61791108 | Adeodato Simo | "type": "allocate", |
451 | 61791108 | Adeodato Simo | "name": "instance3.example.com", |
452 | 61791108 | Adeodato Simo | "required_nodes": 2, |
453 | 61791108 | Adeodato Simo | "disk_space_total": 3328, |
454 | 61791108 | Adeodato Simo | "disks": [ |
455 | 61791108 | Adeodato Simo | { |
456 | 61791108 | Adeodato Simo | "mode": "w", |
457 | 61791108 | Adeodato Simo | "size": 1024 |
458 | 61791108 | Adeodato Simo | }, |
459 | 61791108 | Adeodato Simo | { |
460 | 61791108 | Adeodato Simo | "mode": "w", |
461 | 61791108 | Adeodato Simo | "size": 2048 |
462 | 61791108 | Adeodato Simo | } |
463 | 61791108 | Adeodato Simo | ], |
464 | 61791108 | Adeodato Simo | "nics": [ |
465 | 61791108 | Adeodato Simo | { |
466 | 61791108 | Adeodato Simo | "ip": null, |
467 | 61791108 | Adeodato Simo | "mac": "00:11:22:33:44:55", |
468 | 61791108 | Adeodato Simo | "bridge": null |
469 | 61791108 | Adeodato Simo | } |
470 | 61791108 | Adeodato Simo | ], |
471 | 61791108 | Adeodato Simo | "vcpus": 1, |
472 | 61791108 | Adeodato Simo | "disk_template": "drbd", |
473 | 61791108 | Adeodato Simo | "memory": 2048, |
474 | 61791108 | Adeodato Simo | "os": "debootstrap+default", |
475 | 61791108 | Adeodato Simo | "tags": [ |
476 | 61791108 | Adeodato Simo | "type:test", |
477 | 61791108 | Adeodato Simo | "owner:foo" |
478 | 61791108 | Adeodato Simo | ], |
479 | 61791108 | Adeodato Simo | hypervisor: "xen-pvm" |
480 | 876860a3 | Iustin Pop | } |
481 | 876860a3 | Iustin Pop | } |
482 | 876860a3 | Iustin Pop | |
483 | 61791108 | Adeodato Simo | Input message, reallocation:: |
484 | 876860a3 | Iustin Pop | |
485 | 61791108 | Adeodato Simo | { |
486 | 61791108 | Adeodato Simo | "version": 2, |
487 | 61791108 | Adeodato Simo | ... |
488 | 61791108 | Adeodato Simo | "request": { |
489 | 61791108 | Adeodato Simo | "type": "relocate", |
490 | 61791108 | Adeodato Simo | "name": "instance2.example.com", |
491 | 61791108 | Adeodato Simo | "required_nodes": 1, |
492 | 61791108 | Adeodato Simo | "disk_space_total": 832, |
493 | 61791108 | Adeodato Simo | "relocate_from": [ |
494 | 61791108 | Adeodato Simo | "node3.example.com" |
495 | 61791108 | Adeodato Simo | ] |
496 | 61791108 | Adeodato Simo | } |
497 | 61791108 | Adeodato Simo | } |
498 | 876860a3 | Iustin Pop | |
499 | 632fb7ec | Iustin Pop | Input message, node evacuation:: |
500 | 632fb7ec | Iustin Pop | |
501 | 61791108 | Adeodato Simo | { |
502 | 61791108 | Adeodato Simo | "version": 2, |
503 | 61791108 | Adeodato Simo | ... |
504 | 61791108 | Adeodato Simo | "request": { |
505 | 61791108 | Adeodato Simo | "type": "multi-evacuate", |
506 | 61791108 | Adeodato Simo | "evac_nodes": [ |
507 | 61791108 | Adeodato Simo | "node2" |
508 | 61791108 | Adeodato Simo | ], |
509 | 61791108 | Adeodato Simo | } |
510 | 61791108 | Adeodato Simo | } |
511 | 632fb7ec | Iustin Pop | |
512 | 632fb7ec | Iustin Pop | |
513 | 876860a3 | Iustin Pop | Response messages |
514 | 876860a3 | Iustin Pop | ~~~~~~~~~~~~~~~~~ |
515 | 876860a3 | Iustin Pop | Successful response message:: |
516 | 876860a3 | Iustin Pop | |
517 | 876860a3 | Iustin Pop | { |
518 | 61791108 | Adeodato Simo | "success": true, |
519 | 876860a3 | Iustin Pop | "info": "Allocation successful", |
520 | 632fb7ec | Iustin Pop | "result": [ |
521 | 876860a3 | Iustin Pop | "node2.example.com", |
522 | 876860a3 | Iustin Pop | "node1.example.com" |
523 | 61791108 | Adeodato Simo | ] |
524 | 876860a3 | Iustin Pop | } |
525 | 876860a3 | Iustin Pop | |
526 | 876860a3 | Iustin Pop | Failed response message:: |
527 | 876860a3 | Iustin Pop | |
528 | 876860a3 | Iustin Pop | { |
529 | 61791108 | Adeodato Simo | "success": false, |
530 | 876860a3 | Iustin Pop | "info": "Can't find a suitable node for position 2 (already selected: node2.example.com)", |
531 | 61791108 | Adeodato Simo | "result": [] |
532 | 876860a3 | Iustin Pop | } |
533 | 876860a3 | Iustin Pop | |
534 | 632fb7ec | Iustin Pop | Successful node evacuation message:: |
535 | 632fb7ec | Iustin Pop | |
536 | 632fb7ec | Iustin Pop | { |
537 | 61791108 | Adeodato Simo | "success": true, |
538 | 632fb7ec | Iustin Pop | "info": "Request successful", |
539 | 632fb7ec | Iustin Pop | "result": [ |
540 | 632fb7ec | Iustin Pop | [ |
541 | 632fb7ec | Iustin Pop | "instance1", |
542 | 632fb7ec | Iustin Pop | "node3" |
543 | 632fb7ec | Iustin Pop | ], |
544 | 632fb7ec | Iustin Pop | [ |
545 | 632fb7ec | Iustin Pop | "instance2", |
546 | 632fb7ec | Iustin Pop | "node1" |
547 | 632fb7ec | Iustin Pop | ] |
548 | 61791108 | Adeodato Simo | ] |
549 | 632fb7ec | Iustin Pop | } |
550 | 632fb7ec | Iustin Pop | |
551 | 632fb7ec | Iustin Pop | |
552 | 876860a3 | Iustin Pop | Command line messages |
553 | 876860a3 | Iustin Pop | ~~~~~~~~~~~~~~~~~~~~~ |
554 | 876860a3 | Iustin Pop | :: |
555 | 876860a3 | Iustin Pop | |
556 | 6f547f96 | Guido Trotter | # gnt-instance add -t plain -m 2g --os-size 1g --swap-size 512m --iallocator hail -o debootstrap+default instance3 |
557 | 876860a3 | Iustin Pop | Selected nodes for the instance: node1.example.com |
558 | 876860a3 | Iustin Pop | * creating instance disks... |
559 | 876860a3 | Iustin Pop | [...] |
560 | 876860a3 | Iustin Pop | |
561 | 6f547f96 | Guido Trotter | # gnt-instance add -t plain -m 3400m --os-size 1g --swap-size 512m --iallocator hail -o debootstrap+default instance4 |
562 | 876860a3 | Iustin Pop | Failure: prerequisites not met for this operation: |
563 | 6f547f96 | Guido Trotter | Can't compute nodes using iallocator 'hail': Can't find a suitable node for position 1 (already selected: ) |
564 | 876860a3 | Iustin Pop | |
565 | 6f547f96 | Guido Trotter | # gnt-instance add -t drbd -m 1400m --os-size 1g --swap-size 512m --iallocator hail -o debootstrap+default instance5 |
566 | 876860a3 | Iustin Pop | Failure: prerequisites not met for this operation: |
567 | 6f547f96 | Guido Trotter | Can't compute nodes using iallocator 'hail': Can't find a suitable node for position 2 (already selected: node1.example.com) |
568 | 6f547f96 | Guido Trotter | |
569 | 6f547f96 | Guido Trotter | Reference implementation |
570 | 6f547f96 | Guido Trotter | ~~~~~~~~~~~~~~~~~~~~~~~~ |
571 | 6f547f96 | Guido Trotter | |
572 | 1ebe6dbd | Iustin Pop | Ganeti's default iallocator is "hail" which is available when "htools" |
573 | 1ebe6dbd | Iustin Pop | components have been enabled at build time (see :doc:`install-quick` for |
574 | 1ebe6dbd | Iustin Pop | more details). |
575 | 558fd122 | Michael Hanselmann | |
576 | 558fd122 | Michael Hanselmann | .. vim: set textwidth=72 : |
577 | 632fb7ec | Iustin Pop | .. Local Variables: |
578 | 632fb7ec | Iustin Pop | .. mode: rst |
579 | 632fb7ec | Iustin Pop | .. fill-column: 72 |
580 | 632fb7ec | Iustin Pop | .. End: |