Statistics
| Branch: | Tag: | Revision:

root / doc / iallocator.rst @ f8afb7e6

History | View | Annotate | Download (13.5 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 876860a3 Iustin Pop
the following:
72 876860a3 Iustin Pop
73 876860a3 Iustin Pop
version
74 876860a3 Iustin Pop
  the version of the protocol; this document
75 77031881 Iustin Pop
  specifies version 2
76 876860a3 Iustin Pop
77 876860a3 Iustin Pop
cluster_name
78 876860a3 Iustin Pop
  the cluster name
79 876860a3 Iustin Pop
80 876860a3 Iustin Pop
cluster_tags
81 876860a3 Iustin Pop
  the list of cluster tags
82 876860a3 Iustin Pop
83 77031881 Iustin Pop
enabled_hypervisors
84 77031881 Iustin Pop
  the list of enabled hypervisors
85 77031881 Iustin Pop
86 876860a3 Iustin Pop
request
87 876860a3 Iustin Pop
  a dictionary containing the request data:
88 876860a3 Iustin Pop
89 876860a3 Iustin Pop
  type
90 632fb7ec Iustin Pop
    the request type; this can be either ``allocate``, ``relocate`` or
91 632fb7ec Iustin Pop
    ``multi-evacuate``; the ``allocate`` request is used when a new
92 632fb7ec Iustin Pop
    instance needs to be placed on the cluster, while the ``relocate``
93 632fb7ec Iustin Pop
    request is used when an existing instance needs to be moved within
94 632fb7ec Iustin Pop
    the cluster; the ``multi-evacuate`` protocol requests that the
95 632fb7ec Iustin Pop
    script computes the optimal relocate solution for all secondary
96 632fb7ec Iustin Pop
    instances of the given nodes
97 632fb7ec Iustin Pop
98 632fb7ec Iustin Pop
  The following keys are needed in allocate/relocate mode:
99 876860a3 Iustin Pop
100 876860a3 Iustin Pop
  name
101 632fb7ec Iustin Pop
    the name of the instance; if the request is a realocation, then this
102 632fb7ec Iustin Pop
    name will be found in the list of instances (see below), otherwise
103 632fb7ec Iustin Pop
    is the FQDN of the new instance
104 876860a3 Iustin Pop
105 876860a3 Iustin Pop
  required_nodes
106 876860a3 Iustin Pop
    how many nodes should the algorithm return; while this information
107 876860a3 Iustin Pop
    can be deduced from the instace's disk template, it's better if
108 876860a3 Iustin Pop
    this computation is left to Ganeti as then allocator scripts are
109 876860a3 Iustin Pop
    less sensitive to changes to the disk templates
110 876860a3 Iustin Pop
111 876860a3 Iustin Pop
  disk_space_total
112 876860a3 Iustin Pop
    the total disk space that will be used by this instance on the
113 876860a3 Iustin Pop
    (new) nodes; again, this information can be computed from the list
114 876860a3 Iustin Pop
    of instance disks and its template type, but Ganeti is better
115 876860a3 Iustin Pop
    suited to compute it
116 876860a3 Iustin Pop
117 876860a3 Iustin Pop
  If the request is an allocation, then there are extra fields in the
118 876860a3 Iustin Pop
  request dictionary:
119 876860a3 Iustin Pop
120 876860a3 Iustin Pop
  disks
121 876860a3 Iustin Pop
    list of dictionaries holding the disk definitions for this
122 876860a3 Iustin Pop
    instance (in the order they are exported to the hypervisor):
123 876860a3 Iustin Pop
124 876860a3 Iustin Pop
    mode
125 f8afb7e6 Michael Hanselmann
      either ``ro`` or ``rw`` denoting if the disk is read-only or
126 876860a3 Iustin Pop
      writable
127 876860a3 Iustin Pop
128 876860a3 Iustin Pop
    size
129 876860a3 Iustin Pop
      the size of this disk in mebibytes
130 876860a3 Iustin Pop
131 876860a3 Iustin Pop
  nics
132 876860a3 Iustin Pop
    a list of dictionaries holding the network interfaces for this
133 876860a3 Iustin Pop
    instance, containing:
134 876860a3 Iustin Pop
135 876860a3 Iustin Pop
    ip
136 876860a3 Iustin Pop
      the IP address that Ganeti know for this instance, or null
137 876860a3 Iustin Pop
138 876860a3 Iustin Pop
    mac
139 876860a3 Iustin Pop
      the MAC address for this interface
140 876860a3 Iustin Pop
141 876860a3 Iustin Pop
    bridge
142 876860a3 Iustin Pop
      the bridge to which this interface will be connected
143 876860a3 Iustin Pop
144 876860a3 Iustin Pop
  vcpus
145 876860a3 Iustin Pop
    the number of VCPUs for the instance
146 876860a3 Iustin Pop
147 876860a3 Iustin Pop
  disk_template
148 876860a3 Iustin Pop
    the disk template for the instance
149 876860a3 Iustin Pop
150 876860a3 Iustin Pop
  memory
151 876860a3 Iustin Pop
   the memory size for the instance
152 876860a3 Iustin Pop
153 876860a3 Iustin Pop
  os
154 876860a3 Iustin Pop
   the OS type for the instance
155 876860a3 Iustin Pop
156 876860a3 Iustin Pop
  tags
157 876860a3 Iustin Pop
    the list of the instance's tags
158 876860a3 Iustin Pop
159 77031881 Iustin Pop
  hypervisor
160 77031881 Iustin Pop
    the hypervisor of this instance
161 77031881 Iustin Pop
162 876860a3 Iustin Pop
163 876860a3 Iustin Pop
  If the request is of type relocate, then there is one more entry in
164 876860a3 Iustin Pop
  the request dictionary, named ``relocate_from``, and it contains a
165 876860a3 Iustin Pop
  list of nodes to move the instance away from; note that with Ganeti
166 876860a3 Iustin Pop
  2.0, this list will always contain a single node, the current
167 876860a3 Iustin Pop
  secondary of the instance.
168 876860a3 Iustin Pop
169 632fb7ec Iustin Pop
  The multi-evacuate mode has instead a single request argument:
170 632fb7ec Iustin Pop
171 632fb7ec Iustin Pop
  nodes
172 632fb7ec Iustin Pop
    the names of the nodes to be evacuated
173 632fb7ec Iustin Pop
174 622444e5 Iustin Pop
nodegroups
175 622444e5 Iustin Pop
  a dictionary with the data for the cluster's node groups; it is keyed
176 622444e5 Iustin Pop
  on the group UUID, and the values are a dictionary with the following
177 622444e5 Iustin Pop
  keys:
178 622444e5 Iustin Pop
179 622444e5 Iustin Pop
  name
180 622444e5 Iustin Pop
    the node group name
181 913639fe Balazs Lecz
  alloc_policy
182 913639fe Balazs Lecz
    the allocation policy of the node group
183 622444e5 Iustin Pop
184 876860a3 Iustin Pop
instances
185 876860a3 Iustin Pop
  a dictionary with the data for the current existing instance on the
186 876860a3 Iustin Pop
  cluster, indexed by instance name; the contents are similar to the
187 876860a3 Iustin Pop
  instance definitions for the allocate mode, with the addition of:
188 876860a3 Iustin Pop
189 77031881 Iustin Pop
  admin_up
190 876860a3 Iustin Pop
    if this instance is set to run (but not the actual status of the
191 876860a3 Iustin Pop
    instance)
192 876860a3 Iustin Pop
193 876860a3 Iustin Pop
  nodes
194 876860a3 Iustin Pop
    list of nodes on which this instance is placed; the primary node
195 876860a3 Iustin Pop
    of the instance is always the first one
196 876860a3 Iustin Pop
197 876860a3 Iustin Pop
nodes
198 876860a3 Iustin Pop
  dictionary with the data for the nodes in the cluster, indexed by
199 0d853843 Iustin Pop
  the node name; the dict contains [*]_ :
200 876860a3 Iustin Pop
201 876860a3 Iustin Pop
  total_disk
202 876860a3 Iustin Pop
    the total disk size of this node (mebibytes)
203 876860a3 Iustin Pop
204 876860a3 Iustin Pop
  free_disk
205 876860a3 Iustin Pop
    the free disk space on the node
206 876860a3 Iustin Pop
207 876860a3 Iustin Pop
  total_memory
208 876860a3 Iustin Pop
    the total memory size
209 876860a3 Iustin Pop
210 876860a3 Iustin Pop
  free_memory
211 876860a3 Iustin Pop
    free memory on the node; note that currently this does not take
212 876860a3 Iustin Pop
    into account the instances which are down on the node
213 876860a3 Iustin Pop
214 876860a3 Iustin Pop
  total_cpus
215 876860a3 Iustin Pop
    the physical number of CPUs present on the machine; depending on
216 876860a3 Iustin Pop
    the hypervisor, this might or might not be equal to how many CPUs
217 876860a3 Iustin Pop
    the node operating system sees;
218 876860a3 Iustin Pop
219 876860a3 Iustin Pop
  primary_ip
220 876860a3 Iustin Pop
    the primary IP address of the node
221 876860a3 Iustin Pop
222 876860a3 Iustin Pop
  secondary_ip
223 876860a3 Iustin Pop
    the secondary IP address of the node (the one used for the DRBD
224 876860a3 Iustin Pop
    replication); note that this can be the same as the primary one
225 876860a3 Iustin Pop
226 876860a3 Iustin Pop
  tags
227 876860a3 Iustin Pop
    list with the tags of the node
228 876860a3 Iustin Pop
229 77031881 Iustin Pop
  master_candidate:
230 77031881 Iustin Pop
    a boolean flag denoting whether this node is a master candidate
231 77031881 Iustin Pop
232 77031881 Iustin Pop
  drained:
233 77031881 Iustin Pop
    a boolean flag denoting whether this node is being drained
234 77031881 Iustin Pop
235 77031881 Iustin Pop
  offline:
236 77031881 Iustin Pop
    a boolean flag denoting whether this node is offline
237 77031881 Iustin Pop
238 77031881 Iustin Pop
  i_pri_memory:
239 77031881 Iustin Pop
    total memory required by primary instances
240 77031881 Iustin Pop
241 77031881 Iustin Pop
  i_pri_up_memory:
242 77031881 Iustin Pop
    total memory required by running primary instances
243 77031881 Iustin Pop
244 1116c3b2 Iustin Pop
  group:
245 1116c3b2 Iustin Pop
    the node group that this node belongs to
246 1116c3b2 Iustin Pop
247 77031881 Iustin Pop
  No allocations should be made on nodes having either the ``drained``
248 77031881 Iustin Pop
  or ``offline`` flags set. More details about these of node status
249 fd07c6b3 Iustin Pop
  flags is available in the manpage :manpage:`ganeti(7)`.
250 77031881 Iustin Pop
251 a1cef11c Iustin Pop
.. [*] Note that no run-time data is present for offline, drained or
252 a1cef11c Iustin Pop
   non-vm_capable nodes; this means the tags total_memory,
253 a1cef11c Iustin Pop
   reserved_memory, free_memory, total_disk, free_disk, total_cpus,
254 a1cef11c Iustin Pop
   i_pri_memory and i_pri_up memory will be absent
255 77031881 Iustin Pop
256 0d853843 Iustin Pop
257 0d853843 Iustin Pop
Response message
258 0d853843 Iustin Pop
~~~~~~~~~~~~~~~~
259 876860a3 Iustin Pop
260 876860a3 Iustin Pop
The response message is much more simple than the input one. It is
261 876860a3 Iustin Pop
also a dict having three keys:
262 876860a3 Iustin Pop
263 876860a3 Iustin Pop
success
264 5bbd3f7f Michael Hanselmann
  a boolean value denoting if the allocation was successful or not
265 876860a3 Iustin Pop
266 876860a3 Iustin Pop
info
267 876860a3 Iustin Pop
  a string with information from the scripts; if the allocation fails,
268 876860a3 Iustin Pop
  this will be shown to the user
269 876860a3 Iustin Pop
270 632fb7ec Iustin Pop
result
271 632fb7ec Iustin Pop
  the output of the algorithm; even if the algorithm failed
272 632fb7ec Iustin Pop
  (i.e. success is false), this must be returned as an empty list
273 632fb7ec Iustin Pop
274 632fb7ec Iustin Pop
  for allocate/relocate, this is the list of node(s) for the instance;
275 632fb7ec Iustin Pop
  note that the length of this list must equal the ``requested_nodes``
276 632fb7ec Iustin Pop
  entry in the input message, otherwise Ganeti will consider the result
277 632fb7ec Iustin Pop
  as failed
278 632fb7ec Iustin Pop
279 632fb7ec Iustin Pop
  for multi-evacuation mode, this is a list of lists; each element of
280 632fb7ec Iustin Pop
  the list is a list of instance name and the new secondary node
281 632fb7ec Iustin Pop
282 632fb7ec Iustin Pop
.. note:: Current Ganeti version accepts either ``result`` or ``nodes``
283 632fb7ec Iustin Pop
   as a backwards-compatibility measure (older versions only supported
284 632fb7ec Iustin Pop
   ``nodes``)
285 876860a3 Iustin Pop
286 876860a3 Iustin Pop
Examples
287 876860a3 Iustin Pop
--------
288 876860a3 Iustin Pop
289 876860a3 Iustin Pop
Input messages to scripts
290 876860a3 Iustin Pop
~~~~~~~~~~~~~~~~~~~~~~~~~
291 876860a3 Iustin Pop
292 876860a3 Iustin Pop
Input message, new instance allocation::
293 876860a3 Iustin Pop
294 876860a3 Iustin Pop
  {
295 876860a3 Iustin Pop
    "cluster_tags": [],
296 876860a3 Iustin Pop
    "request": {
297 876860a3 Iustin Pop
      "required_nodes": 2,
298 876860a3 Iustin Pop
      "name": "instance3.example.com",
299 876860a3 Iustin Pop
      "tags": [
300 876860a3 Iustin Pop
        "type:test",
301 876860a3 Iustin Pop
        "owner:foo"
302 876860a3 Iustin Pop
      ],
303 876860a3 Iustin Pop
      "type": "allocate",
304 876860a3 Iustin Pop
      "disks": [
305 876860a3 Iustin Pop
        {
306 876860a3 Iustin Pop
          "mode": "w",
307 876860a3 Iustin Pop
          "size": 1024
308 876860a3 Iustin Pop
        },
309 876860a3 Iustin Pop
        {
310 876860a3 Iustin Pop
          "mode": "w",
311 876860a3 Iustin Pop
          "size": 2048
312 876860a3 Iustin Pop
        }
313 876860a3 Iustin Pop
      ],
314 876860a3 Iustin Pop
      "nics": [
315 876860a3 Iustin Pop
        {
316 876860a3 Iustin Pop
          "ip": null,
317 876860a3 Iustin Pop
          "mac": "00:11:22:33:44:55",
318 876860a3 Iustin Pop
          "bridge": null
319 876860a3 Iustin Pop
        }
320 876860a3 Iustin Pop
      ],
321 876860a3 Iustin Pop
      "vcpus": 1,
322 876860a3 Iustin Pop
      "disk_template": "drbd",
323 876860a3 Iustin Pop
      "memory": 2048,
324 876860a3 Iustin Pop
      "disk_space_total": 3328,
325 6f547f96 Guido Trotter
      "os": "debootstrap+default"
326 876860a3 Iustin Pop
    },
327 876860a3 Iustin Pop
    "cluster_name": "cluster1.example.com",
328 876860a3 Iustin Pop
    "instances": {
329 876860a3 Iustin Pop
      "instance1.example.com": {
330 876860a3 Iustin Pop
        "tags": [],
331 876860a3 Iustin Pop
        "should_run": false,
332 876860a3 Iustin Pop
        "disks": [
333 876860a3 Iustin Pop
          {
334 876860a3 Iustin Pop
            "mode": "w",
335 876860a3 Iustin Pop
            "size": 64
336 876860a3 Iustin Pop
          },
337 876860a3 Iustin Pop
          {
338 876860a3 Iustin Pop
            "mode": "w",
339 876860a3 Iustin Pop
            "size": 512
340 876860a3 Iustin Pop
          }
341 876860a3 Iustin Pop
        ],
342 876860a3 Iustin Pop
        "nics": [
343 876860a3 Iustin Pop
          {
344 876860a3 Iustin Pop
            "ip": null,
345 876860a3 Iustin Pop
            "mac": "aa:00:00:00:60:bf",
346 876860a3 Iustin Pop
            "bridge": "xen-br0"
347 876860a3 Iustin Pop
          }
348 876860a3 Iustin Pop
        ],
349 876860a3 Iustin Pop
        "vcpus": 1,
350 876860a3 Iustin Pop
        "disk_template": "plain",
351 876860a3 Iustin Pop
        "memory": 128,
352 876860a3 Iustin Pop
        "nodes": [
353 876860a3 Iustin Pop
          "nodee1.com"
354 876860a3 Iustin Pop
        ],
355 6f547f96 Guido Trotter
        "os": "debootstrap+default"
356 876860a3 Iustin Pop
      },
357 876860a3 Iustin Pop
      "instance2.example.com": {
358 876860a3 Iustin Pop
        "tags": [],
359 876860a3 Iustin Pop
        "should_run": false,
360 876860a3 Iustin Pop
        "disks": [
361 876860a3 Iustin Pop
          {
362 876860a3 Iustin Pop
            "mode": "w",
363 876860a3 Iustin Pop
            "size": 512
364 876860a3 Iustin Pop
          },
365 876860a3 Iustin Pop
          {
366 876860a3 Iustin Pop
            "mode": "w",
367 876860a3 Iustin Pop
            "size": 256
368 876860a3 Iustin Pop
          }
369 876860a3 Iustin Pop
        ],
370 876860a3 Iustin Pop
        "nics": [
371 876860a3 Iustin Pop
          {
372 876860a3 Iustin Pop
            "ip": null,
373 876860a3 Iustin Pop
            "mac": "aa:00:00:55:f8:38",
374 876860a3 Iustin Pop
            "bridge": "xen-br0"
375 876860a3 Iustin Pop
          }
376 876860a3 Iustin Pop
        ],
377 876860a3 Iustin Pop
        "vcpus": 1,
378 876860a3 Iustin Pop
        "disk_template": "drbd",
379 876860a3 Iustin Pop
        "memory": 512,
380 876860a3 Iustin Pop
        "nodes": [
381 876860a3 Iustin Pop
          "node2.example.com",
382 876860a3 Iustin Pop
          "node3.example.com"
383 876860a3 Iustin Pop
        ],
384 6f547f96 Guido Trotter
        "os": "debootstrap+default"
385 876860a3 Iustin Pop
      }
386 876860a3 Iustin Pop
    },
387 876860a3 Iustin Pop
    "version": 1,
388 876860a3 Iustin Pop
    "nodes": {
389 876860a3 Iustin Pop
      "node1.example.com": {
390 876860a3 Iustin Pop
        "total_disk": 858276,
391 926feaf1 Manuel Franceschini
        "primary_ip": "198.51.100.1",
392 926feaf1 Manuel Franceschini
        "secondary_ip": "192.0.2.1",
393 876860a3 Iustin Pop
        "tags": [],
394 876860a3 Iustin Pop
        "free_memory": 3505,
395 876860a3 Iustin Pop
        "free_disk": 856740,
396 876860a3 Iustin Pop
        "total_memory": 4095
397 876860a3 Iustin Pop
      },
398 876860a3 Iustin Pop
      "node2.example.com": {
399 876860a3 Iustin Pop
        "total_disk": 858240,
400 926feaf1 Manuel Franceschini
        "primary_ip": "198.51.100.2",
401 926feaf1 Manuel Franceschini
        "secondary_ip": "192.0.2.2",
402 876860a3 Iustin Pop
        "tags": ["test"],
403 876860a3 Iustin Pop
        "free_memory": 3505,
404 876860a3 Iustin Pop
        "free_disk": 848320,
405 876860a3 Iustin Pop
        "total_memory": 4095
406 876860a3 Iustin Pop
      },
407 876860a3 Iustin Pop
      "node3.example.com.com": {
408 876860a3 Iustin Pop
        "total_disk": 572184,
409 926feaf1 Manuel Franceschini
        "primary_ip": "198.51.100.3",
410 926feaf1 Manuel Franceschini
        "secondary_ip": "192.0.2.3",
411 876860a3 Iustin Pop
        "tags": [],
412 876860a3 Iustin Pop
        "free_memory": 3505,
413 876860a3 Iustin Pop
        "free_disk": 570648,
414 876860a3 Iustin Pop
        "total_memory": 4095
415 876860a3 Iustin Pop
      }
416 876860a3 Iustin Pop
    }
417 876860a3 Iustin Pop
  }
418 876860a3 Iustin Pop
419 876860a3 Iustin Pop
Input message, reallocation. Since only the request entry in the input
420 876860a3 Iustin Pop
message is changed, we show only this changed entry::
421 876860a3 Iustin Pop
422 876860a3 Iustin Pop
  "request": {
423 876860a3 Iustin Pop
    "relocate_from": [
424 876860a3 Iustin Pop
      "node3.example.com"
425 876860a3 Iustin Pop
    ],
426 876860a3 Iustin Pop
    "required_nodes": 1,
427 876860a3 Iustin Pop
    "type": "relocate",
428 876860a3 Iustin Pop
    "name": "instance2.example.com",
429 876860a3 Iustin Pop
    "disk_space_total": 832
430 876860a3 Iustin Pop
  },
431 876860a3 Iustin Pop
432 876860a3 Iustin Pop
433 632fb7ec Iustin Pop
Input message, node evacuation::
434 632fb7ec Iustin Pop
435 632fb7ec Iustin Pop
  "request": {
436 632fb7ec Iustin Pop
    "evac_nodes": [
437 632fb7ec Iustin Pop
      "node2"
438 632fb7ec Iustin Pop
    ],
439 632fb7ec Iustin Pop
    "type": "multi-evacuate"
440 632fb7ec Iustin Pop
  },
441 632fb7ec Iustin Pop
442 632fb7ec Iustin Pop
443 876860a3 Iustin Pop
Response messages
444 876860a3 Iustin Pop
~~~~~~~~~~~~~~~~~
445 876860a3 Iustin Pop
Successful response message::
446 876860a3 Iustin Pop
447 876860a3 Iustin Pop
  {
448 876860a3 Iustin Pop
    "info": "Allocation successful",
449 632fb7ec Iustin Pop
    "result": [
450 876860a3 Iustin Pop
      "node2.example.com",
451 876860a3 Iustin Pop
      "node1.example.com"
452 876860a3 Iustin Pop
    ],
453 876860a3 Iustin Pop
    "success": true
454 876860a3 Iustin Pop
  }
455 876860a3 Iustin Pop
456 876860a3 Iustin Pop
Failed response message::
457 876860a3 Iustin Pop
458 876860a3 Iustin Pop
  {
459 876860a3 Iustin Pop
    "info": "Can't find a suitable node for position 2 (already selected: node2.example.com)",
460 632fb7ec Iustin Pop
    "result": [],
461 876860a3 Iustin Pop
    "success": false
462 876860a3 Iustin Pop
  }
463 876860a3 Iustin Pop
464 632fb7ec Iustin Pop
Successful node evacuation message::
465 632fb7ec Iustin Pop
466 632fb7ec Iustin Pop
  {
467 632fb7ec Iustin Pop
    "info": "Request successful",
468 632fb7ec Iustin Pop
    "result": [
469 632fb7ec Iustin Pop
      [
470 632fb7ec Iustin Pop
        "instance1",
471 632fb7ec Iustin Pop
        "node3"
472 632fb7ec Iustin Pop
      ],
473 632fb7ec Iustin Pop
      [
474 632fb7ec Iustin Pop
        "instance2",
475 632fb7ec Iustin Pop
        "node1"
476 632fb7ec Iustin Pop
      ]
477 632fb7ec Iustin Pop
    ],
478 632fb7ec Iustin Pop
    "success": true
479 632fb7ec Iustin Pop
  }
480 632fb7ec Iustin Pop
481 632fb7ec Iustin Pop
482 876860a3 Iustin Pop
Command line messages
483 876860a3 Iustin Pop
~~~~~~~~~~~~~~~~~~~~~
484 876860a3 Iustin Pop
::
485 876860a3 Iustin Pop
486 6f547f96 Guido Trotter
  # gnt-instance add -t plain -m 2g --os-size 1g --swap-size 512m --iallocator hail -o debootstrap+default instance3
487 876860a3 Iustin Pop
  Selected nodes for the instance: node1.example.com
488 876860a3 Iustin Pop
  * creating instance disks...
489 876860a3 Iustin Pop
  [...]
490 876860a3 Iustin Pop
491 6f547f96 Guido Trotter
  # gnt-instance add -t plain -m 3400m --os-size 1g --swap-size 512m --iallocator hail -o debootstrap+default instance4
492 876860a3 Iustin Pop
  Failure: prerequisites not met for this operation:
493 6f547f96 Guido Trotter
  Can't compute nodes using iallocator 'hail': Can't find a suitable node for position 1 (already selected: )
494 876860a3 Iustin Pop
495 6f547f96 Guido Trotter
  # gnt-instance add -t drbd -m 1400m --os-size 1g --swap-size 512m --iallocator hail -o debootstrap+default instance5
496 876860a3 Iustin Pop
  Failure: prerequisites not met for this operation:
497 6f547f96 Guido Trotter
  Can't compute nodes using iallocator 'hail': Can't find a suitable node for position 2 (already selected: node1.example.com)
498 6f547f96 Guido Trotter
499 6f547f96 Guido Trotter
Reference implementation
500 6f547f96 Guido Trotter
~~~~~~~~~~~~~~~~~~~~~~~~
501 6f547f96 Guido Trotter
502 6f547f96 Guido Trotter
Ganeti's default iallocator is "hail" which is part of the separate
503 6f547f96 Guido Trotter
ganeti-htools project. In order to see its source code please clone
504 6f547f96 Guido Trotter
``git://git.ganeti.org/htools.git``. Note that htools is implemented
505 6f547f96 Guido Trotter
using the Haskell programming language.
506 558fd122 Michael Hanselmann
507 558fd122 Michael Hanselmann
.. vim: set textwidth=72 :
508 632fb7ec Iustin Pop
.. Local Variables:
509 632fb7ec Iustin Pop
.. mode: rst
510 632fb7ec Iustin Pop
.. fill-column: 72
511 632fb7ec Iustin Pop
.. End: