root / doc / iallocator.sgml @ 3fc175f0
History | View | Annotate | Download (19.2 kB)
1 | b2d72ffe | Iustin Pop | <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [ |
---|---|---|---|
2 | b2d72ffe | Iustin Pop | ]> |
3 | b2d72ffe | Iustin Pop | <article class="specification"> |
4 | b2d72ffe | Iustin Pop | <articleinfo> |
5 | b2d72ffe | Iustin Pop | <title>Ganeti automatic instance allocation</title> |
6 | b2d72ffe | Iustin Pop | </articleinfo> |
7 | b2d72ffe | Iustin Pop | <para>Documents Ganeti version 1.2</para> |
8 | b2d72ffe | Iustin Pop | <sect1> |
9 | b2d72ffe | Iustin Pop | <title>Introduction</title> |
10 | b2d72ffe | Iustin Pop | |
11 | b2d72ffe | Iustin Pop | <para>Currently in Ganeti the admin has to specify the exact |
12 | b2d72ffe | Iustin Pop | locations for an instance's node(s). This prevents a completely |
13 | b2d72ffe | Iustin Pop | automatic node evacuation, and is in general a nuisance.</para> |
14 | b2d72ffe | Iustin Pop | |
15 | b2d72ffe | Iustin Pop | <para>The <acronym>iallocator</acronym> framework will enable |
16 | b2d72ffe | Iustin Pop | automatic placement via external scripts, which allows |
17 | b2d72ffe | Iustin Pop | customization of the cluster layout per the site's |
18 | b2d72ffe | Iustin Pop | requirements.</para> |
19 | b2d72ffe | Iustin Pop | |
20 | b2d72ffe | Iustin Pop | </sect1> |
21 | b2d72ffe | Iustin Pop | |
22 | b2d72ffe | Iustin Pop | <sect1> |
23 | b2d72ffe | Iustin Pop | <title>User-visible changes</title> |
24 | b2d72ffe | Iustin Pop | |
25 | b2d72ffe | Iustin Pop | <para>There are two parts of the ganeti operation that are |
26 | b2d72ffe | Iustin Pop | impacted by the auto-allocation: how the cluster knows what the |
27 | b2d72ffe | Iustin Pop | allocator algorithms are and how the admin uses these in creating |
28 | b2d72ffe | Iustin Pop | instances.</para> |
29 | b2d72ffe | Iustin Pop | |
30 | b2d72ffe | Iustin Pop | <para>An allocation algorithm is just the filename of a program |
31 | b2d72ffe | Iustin Pop | installed in a defined list of directories.</para> |
32 | b2d72ffe | Iustin Pop | |
33 | b2d72ffe | Iustin Pop | <sect2> |
34 | b2d72ffe | Iustin Pop | <title>Cluster configuration</title> |
35 | b2d72ffe | Iustin Pop | |
36 | b2d72ffe | Iustin Pop | <para>At configure time, the list of the directories can be |
37 | b2d72ffe | Iustin Pop | selected via the |
38 | b2d72ffe | Iustin Pop | <option>--with-iallocator-search-path=LIST</option> option, |
39 | b2d72ffe | Iustin Pop | where <userinput>LIST</userinput> is a comma-separated list of |
40 | b2d72ffe | Iustin Pop | directories. If not given, this defaults to |
41 | b2d72ffe | Iustin Pop | <constant>$libdir/ganeti/iallocators</constant>, i.e. for an |
42 | b2d72ffe | Iustin Pop | installation under <filename class="directory">/usr</filename>, |
43 | b2d72ffe | Iustin Pop | this will be <filename |
44 | b2d72ffe | Iustin Pop | class="directory">/usr/lib/ganeti/iallocators</filename>.</para> |
45 | b2d72ffe | Iustin Pop | |
46 | b2d72ffe | Iustin Pop | <para>Ganeti will then search for allocator script in the |
47 | b2d72ffe | Iustin Pop | configured list, using the first one whose filename matches the |
48 | b2d72ffe | Iustin Pop | one given by the user.</para> |
49 | b2d72ffe | Iustin Pop | |
50 | b2d72ffe | Iustin Pop | </sect2> |
51 | b2d72ffe | Iustin Pop | |
52 | b2d72ffe | Iustin Pop | <sect2> |
53 | b2d72ffe | Iustin Pop | <title>Command line interface changes</title> |
54 | b2d72ffe | Iustin Pop | |
55 | b2d72ffe | Iustin Pop | <para>The node selection options in instanece add and instance |
56 | b2d72ffe | Iustin Pop | replace disks can be replace by the new <option>--iallocator |
57 | b2d72ffe | Iustin Pop | <replaceable>NAME</replaceable></option> option, which will |
58 | b2d72ffe | Iustin Pop | cause the autoassignation. The selected node(s) will be show as |
59 | b2d72ffe | Iustin Pop | part of the command output.</para> |
60 | b2d72ffe | Iustin Pop | |
61 | b2d72ffe | Iustin Pop | </sect2> |
62 | b2d72ffe | Iustin Pop | |
63 | b2d72ffe | Iustin Pop | </sect1> |
64 | b2d72ffe | Iustin Pop | |
65 | b2d72ffe | Iustin Pop | <sect1> |
66 | b2d72ffe | Iustin Pop | <title>IAllocator API</title> |
67 | b2d72ffe | Iustin Pop | |
68 | b2d72ffe | Iustin Pop | <para>The protocol for communication between Ganeti and an |
69 | b2d72ffe | Iustin Pop | allocator script will be the following:</para> |
70 | b2d72ffe | Iustin Pop | |
71 | b2d72ffe | Iustin Pop | <orderedlist> |
72 | b2d72ffe | Iustin Pop | <listitem> |
73 | b2d72ffe | Iustin Pop | <simpara>ganeti launches the program with a single argument, a |
74 | b2d72ffe | Iustin Pop | filename that contains a JSON-encoded structure (the input |
75 | b2d72ffe | Iustin Pop | message)</simpara> |
76 | b2d72ffe | Iustin Pop | </listitem> |
77 | b2d72ffe | Iustin Pop | <listitem> |
78 | b2d72ffe | Iustin Pop | <simpara>if the script finishes with exit code different from |
79 | b2d72ffe | Iustin Pop | zero, it is considered a general failure and the full output |
80 | b2d72ffe | Iustin Pop | will be reported to the users; this can be the case when the |
81 | b2d72ffe | Iustin Pop | allocator can't parse the input message;</simpara> |
82 | b2d72ffe | Iustin Pop | </listitem> |
83 | b2d72ffe | Iustin Pop | <listitem> |
84 | b2d72ffe | Iustin Pop | <simpara>if the allocator finishes with exit code zero, it is |
85 | b2d72ffe | Iustin Pop | expected to output (on its stdout) a JSON-encoded structure |
86 | b2d72ffe | Iustin Pop | (the response)</simpara> |
87 | b2d72ffe | Iustin Pop | </listitem> |
88 | b2d72ffe | Iustin Pop | </orderedlist> |
89 | b2d72ffe | Iustin Pop | |
90 | b2d72ffe | Iustin Pop | <sect2> |
91 | b2d72ffe | Iustin Pop | <title>Input message</title> |
92 | b2d72ffe | Iustin Pop | |
93 | b2d72ffe | Iustin Pop | <para>The input message will be the JSON encoding of a |
94 | b2d72ffe | Iustin Pop | dictionary containing the following:</para> |
95 | b2d72ffe | Iustin Pop | |
96 | b2d72ffe | Iustin Pop | <variablelist> |
97 | b2d72ffe | Iustin Pop | <varlistentry> |
98 | b2d72ffe | Iustin Pop | <term>version</term> |
99 | b2d72ffe | Iustin Pop | <listitem> |
100 | b2d72ffe | Iustin Pop | <simpara>the version of the protocol; this document |
101 | b2d72ffe | Iustin Pop | specifies version 1</simpara> |
102 | b2d72ffe | Iustin Pop | </listitem> |
103 | b2d72ffe | Iustin Pop | </varlistentry> |
104 | b2d72ffe | Iustin Pop | <varlistentry> |
105 | b2d72ffe | Iustin Pop | <term>cluster_name</term> |
106 | b2d72ffe | Iustin Pop | <listitem> |
107 | b2d72ffe | Iustin Pop | <simpara>the cluster name</simpara> |
108 | b2d72ffe | Iustin Pop | </listitem> |
109 | b2d72ffe | Iustin Pop | </varlistentry> |
110 | b2d72ffe | Iustin Pop | <varlistentry> |
111 | b2d72ffe | Iustin Pop | <term>cluster_tags</term> |
112 | b2d72ffe | Iustin Pop | <listitem> |
113 | b2d72ffe | Iustin Pop | <simpara>the list of cluster tags</simpara> |
114 | b2d72ffe | Iustin Pop | </listitem> |
115 | b2d72ffe | Iustin Pop | </varlistentry> |
116 | b2d72ffe | Iustin Pop | <varlistentry> |
117 | b2d72ffe | Iustin Pop | <term>request</term> |
118 | b2d72ffe | Iustin Pop | <listitem> |
119 | b2d72ffe | Iustin Pop | <simpara>a dictionary containing the request data:</simpara> |
120 | b2d72ffe | Iustin Pop | <variablelist> |
121 | b2d72ffe | Iustin Pop | <varlistentry> |
122 | b2d72ffe | Iustin Pop | <term>type</term> |
123 | b2d72ffe | Iustin Pop | <listitem> |
124 | b2d72ffe | Iustin Pop | <simpara>the request type; this can be either |
125 | b2d72ffe | Iustin Pop | <literal>allocate</literal> or |
126 | b2d72ffe | Iustin Pop | <literal>relocate</literal>; the |
127 | b2d72ffe | Iustin Pop | <literal>allocate</literal> request is used when a |
128 | b2d72ffe | Iustin Pop | new instance needs to be placed on the cluster, |
129 | b2d72ffe | Iustin Pop | while the <literal>relocate</literal> request is |
130 | b2d72ffe | Iustin Pop | used when an existing instance needs to be moved |
131 | b2d72ffe | Iustin Pop | within the cluster</simpara> |
132 | b2d72ffe | Iustin Pop | </listitem> |
133 | b2d72ffe | Iustin Pop | </varlistentry> |
134 | b2d72ffe | Iustin Pop | <varlistentry> |
135 | b2d72ffe | Iustin Pop | <term>name</term> |
136 | b2d72ffe | Iustin Pop | <listitem> |
137 | b2d72ffe | Iustin Pop | <simpara>the name of the instance; if the request is |
138 | b2d72ffe | Iustin Pop | a realocation, then this name will be found in the |
139 | b2d72ffe | Iustin Pop | list of instances (see below), otherwise is the |
140 | b2d72ffe | Iustin Pop | <acronym>FQDN</acronym> of the new |
141 | b2d72ffe | Iustin Pop | instance</simpara> |
142 | b2d72ffe | Iustin Pop | </listitem> |
143 | b2d72ffe | Iustin Pop | </varlistentry> |
144 | b2d72ffe | Iustin Pop | <varlistentry> |
145 | b2d72ffe | Iustin Pop | <term>required_nodes</term> |
146 | b2d72ffe | Iustin Pop | <listitem> |
147 | b2d72ffe | Iustin Pop | <simpara>how many nodes should the algorithm return; |
148 | b2d72ffe | Iustin Pop | while this information can be deduced from the |
149 | b2d72ffe | Iustin Pop | instace's disk template, it's better if this |
150 | b2d72ffe | Iustin Pop | computation is left to Ganeti as then allocator |
151 | b2d72ffe | Iustin Pop | scripts are less sensitive to changes to the disk |
152 | b2d72ffe | Iustin Pop | templates</simpara> |
153 | b2d72ffe | Iustin Pop | </listitem> |
154 | b2d72ffe | Iustin Pop | </varlistentry> |
155 | b2d72ffe | Iustin Pop | <varlistentry> |
156 | b2d72ffe | Iustin Pop | <term>disk_space_total</term> |
157 | b2d72ffe | Iustin Pop | <listitem> |
158 | b2d72ffe | Iustin Pop | <simpara>the total disk space that will be used by |
159 | b2d72ffe | Iustin Pop | this instance on the (new) nodes; again, this |
160 | b2d72ffe | Iustin Pop | information can be computed from the list of |
161 | b2d72ffe | Iustin Pop | instance disks and its template type, but Ganeti is |
162 | b2d72ffe | Iustin Pop | better suited to compute it</simpara> |
163 | b2d72ffe | Iustin Pop | </listitem> |
164 | b2d72ffe | Iustin Pop | </varlistentry> |
165 | b2d72ffe | Iustin Pop | </variablelist> |
166 | b2d72ffe | Iustin Pop | <simpara>If the request is an allocation, then there are |
167 | b2d72ffe | Iustin Pop | extra fields in the request dictionary:</simpara> |
168 | b2d72ffe | Iustin Pop | <variablelist> |
169 | b2d72ffe | Iustin Pop | <varlistentry> |
170 | b2d72ffe | Iustin Pop | <term>disks</term> |
171 | b2d72ffe | Iustin Pop | <listitem> |
172 | b2d72ffe | Iustin Pop | <simpara>list of dictionaries holding the disk |
173 | b2d72ffe | Iustin Pop | definitions for this instance (in the order they are |
174 | b2d72ffe | Iustin Pop | exported to the hypervisor):</simpara> |
175 | b2d72ffe | Iustin Pop | <variablelist> |
176 | b2d72ffe | Iustin Pop | <varlistentry> |
177 | b2d72ffe | Iustin Pop | <term>mode</term> |
178 | b2d72ffe | Iustin Pop | <listitem> |
179 | b2d72ffe | Iustin Pop | <simpara>either <literal>w</literal> or |
180 | b2d72ffe | Iustin Pop | <literal>w</literal> denoting if the disk is |
181 | b2d72ffe | Iustin Pop | read-only or writable; for Ganeti 1.2, this |
182 | b2d72ffe | Iustin Pop | will always be <literal>w</literal</simpara> |
183 | b2d72ffe | Iustin Pop | </listitem> |
184 | b2d72ffe | Iustin Pop | </varlistentry> |
185 | b2d72ffe | Iustin Pop | <varlistentry> |
186 | b2d72ffe | Iustin Pop | <term>size</term> |
187 | b2d72ffe | Iustin Pop | <listitem> |
188 | b2d72ffe | Iustin Pop | <simpara>the size of this disk in mebibyte</simpara> |
189 | b2d72ffe | Iustin Pop | </listitem> |
190 | b2d72ffe | Iustin Pop | </varlistentry> |
191 | b2d72ffe | Iustin Pop | </variablelist> |
192 | b2d72ffe | Iustin Pop | </listitem> |
193 | b2d72ffe | Iustin Pop | </varlistentry> |
194 | b2d72ffe | Iustin Pop | <varlistentry> |
195 | b2d72ffe | Iustin Pop | <term>nics</term> |
196 | b2d72ffe | Iustin Pop | <listitem> |
197 | b2d72ffe | Iustin Pop | <simpara>a list of dictionaries holding the network |
198 | b2d72ffe | Iustin Pop | interfaces for this instance, containing:</simpara> |
199 | b2d72ffe | Iustin Pop | <variablelist> |
200 | b2d72ffe | Iustin Pop | <varlistentry> |
201 | b2d72ffe | Iustin Pop | <term>ip</term> |
202 | b2d72ffe | Iustin Pop | <listitem> |
203 | b2d72ffe | Iustin Pop | <simpara>the IP address that Ganeti know for |
204 | b2d72ffe | Iustin Pop | this instance, or null</simpara> |
205 | b2d72ffe | Iustin Pop | </listitem> |
206 | b2d72ffe | Iustin Pop | </varlistentry> |
207 | b2d72ffe | Iustin Pop | <varlistentry> |
208 | b2d72ffe | Iustin Pop | <term>mac</term> |
209 | b2d72ffe | Iustin Pop | <listitem> |
210 | b2d72ffe | Iustin Pop | <simpara>the MAC address for this interface</simpara> |
211 | b2d72ffe | Iustin Pop | </listitem> |
212 | b2d72ffe | Iustin Pop | </varlistentry> |
213 | b2d72ffe | Iustin Pop | <varlistentry> |
214 | b2d72ffe | Iustin Pop | <term>bridge</term> |
215 | b2d72ffe | Iustin Pop | <listitem> |
216 | b2d72ffe | Iustin Pop | <simpara>the bridge to which this interface |
217 | b2d72ffe | Iustin Pop | will be connected</simpara> |
218 | b2d72ffe | Iustin Pop | </listitem> |
219 | b2d72ffe | Iustin Pop | </varlistentry> |
220 | b2d72ffe | Iustin Pop | </variablelist> |
221 | b2d72ffe | Iustin Pop | </listitem> |
222 | b2d72ffe | Iustin Pop | </varlistentry> |
223 | b2d72ffe | Iustin Pop | <varlistentry> |
224 | b2d72ffe | Iustin Pop | <term>vcpus</term> |
225 | b2d72ffe | Iustin Pop | <listitem> |
226 | b2d72ffe | Iustin Pop | <simpara>the number of VCPUs for the instance</simpara> |
227 | b2d72ffe | Iustin Pop | </listitem> |
228 | b2d72ffe | Iustin Pop | </varlistentry> |
229 | b2d72ffe | Iustin Pop | <varlistentry> |
230 | b2d72ffe | Iustin Pop | <term>disk_template</term> |
231 | b2d72ffe | Iustin Pop | <listitem> |
232 | b2d72ffe | Iustin Pop | <simpara>the disk template for the instance</simpara> |
233 | b2d72ffe | Iustin Pop | </listitem> |
234 | b2d72ffe | Iustin Pop | </varlistentry> |
235 | b2d72ffe | Iustin Pop | <varlistentry> |
236 | b2d72ffe | Iustin Pop | <term>memory</term> |
237 | b2d72ffe | Iustin Pop | <listitem> |
238 | b2d72ffe | Iustin Pop | <simpara>the memory size for the instance</simpara> |
239 | b2d72ffe | Iustin Pop | </listitem> |
240 | b2d72ffe | Iustin Pop | </varlistentry> |
241 | b2d72ffe | Iustin Pop | <varlistentry> |
242 | b2d72ffe | Iustin Pop | <term>os</term> |
243 | b2d72ffe | Iustin Pop | <listitem> |
244 | b2d72ffe | Iustin Pop | <simpara>the OS type for the instance</simpara> |
245 | b2d72ffe | Iustin Pop | </listitem> |
246 | b2d72ffe | Iustin Pop | </varlistentry> |
247 | b2d72ffe | Iustin Pop | <varlistentry> |
248 | b2d72ffe | Iustin Pop | <term>tags</term> |
249 | b2d72ffe | Iustin Pop | <listitem> |
250 | b2d72ffe | Iustin Pop | <simpara>the list of the instance's tags</simpara> |
251 | b2d72ffe | Iustin Pop | </listitem> |
252 | b2d72ffe | Iustin Pop | </varlistentry> |
253 | b2d72ffe | Iustin Pop | </variablelist> |
254 | b2d72ffe | Iustin Pop | <simpara>If the request is of type relocate, then there is |
255 | b2d72ffe | Iustin Pop | one more entry in the request dictionary, named |
256 | b2d72ffe | Iustin Pop | <varname>relocate_from</varname>, and it contains a list |
257 | b2d72ffe | Iustin Pop | of nodes to move the instance away from; note that with |
258 | b2d72ffe | Iustin Pop | Ganeti 1.2, this list will always contain a single node, |
259 | b2d72ffe | Iustin Pop | the current secondary of the instance.</simpara> |
260 | b2d72ffe | Iustin Pop | </listitem> |
261 | b2d72ffe | Iustin Pop | </varlistentry> |
262 | b2d72ffe | Iustin Pop | <varlistentry> |
263 | b2d72ffe | Iustin Pop | <term>instances</term> |
264 | b2d72ffe | Iustin Pop | <listitem> |
265 | b2d72ffe | Iustin Pop | <simpara>a dictionary with the data for the current |
266 | b2d72ffe | Iustin Pop | existing instance on the cluster, indexed by instance |
267 | b2d72ffe | Iustin Pop | name; the contents are similar to the instance definitions |
268 | b2d72ffe | Iustin Pop | for the allocate mode, with the addition of:</simpara> |
269 | b2d72ffe | Iustin Pop | <variablelist> |
270 | b2d72ffe | Iustin Pop | <varlistentry> |
271 | b2d72ffe | Iustin Pop | <term>should_run</term> |
272 | b2d72ffe | Iustin Pop | <listitem> |
273 | b2d72ffe | Iustin Pop | <simpara>if this instance is set to run (but not the |
274 | b2d72ffe | Iustin Pop | actual status of the instance)</simpara> |
275 | b2d72ffe | Iustin Pop | </listitem> |
276 | b2d72ffe | Iustin Pop | </varlistentry> |
277 | b2d72ffe | Iustin Pop | <varlistentry> |
278 | b2d72ffe | Iustin Pop | <term>nodes</term> |
279 | b2d72ffe | Iustin Pop | <listitem> |
280 | b2d72ffe | Iustin Pop | <simpara>list of nodes on which this instance is |
281 | b2d72ffe | Iustin Pop | placed; the primary node of the instance is always |
282 | b2d72ffe | Iustin Pop | the first one</simpara> |
283 | b2d72ffe | Iustin Pop | </listitem> |
284 | b2d72ffe | Iustin Pop | </varlistentry> |
285 | b2d72ffe | Iustin Pop | </variablelist> |
286 | b2d72ffe | Iustin Pop | </listitem> |
287 | b2d72ffe | Iustin Pop | </varlistentry> |
288 | b2d72ffe | Iustin Pop | <varlistentry> |
289 | b2d72ffe | Iustin Pop | <term>nodes</term> |
290 | b2d72ffe | Iustin Pop | <listitem> |
291 | b2d72ffe | Iustin Pop | <simpara>dictionary with the data for the nodes in the |
292 | b2d72ffe | Iustin Pop | cluster, indexed by the node name; the dict |
293 | b2d72ffe | Iustin Pop | contains:</simpara> |
294 | b2d72ffe | Iustin Pop | <variablelist> |
295 | b2d72ffe | Iustin Pop | <varlistentry> |
296 | b2d72ffe | Iustin Pop | <term>total_disk</term> |
297 | b2d72ffe | Iustin Pop | <listitem> |
298 | b2d72ffe | Iustin Pop | <simpara>the total disk size of this node |
299 | b2d72ffe | Iustin Pop | (mebibytes)</simpara> |
300 | b2d72ffe | Iustin Pop | </listitem> |
301 | b2d72ffe | Iustin Pop | </varlistentry> |
302 | b2d72ffe | Iustin Pop | <varlistentry> |
303 | b2d72ffe | Iustin Pop | <term>free_disk</term> |
304 | b2d72ffe | Iustin Pop | <listitem> |
305 | b2d72ffe | Iustin Pop | <simpara>the free disk space on the node</simpara> |
306 | b2d72ffe | Iustin Pop | </listitem> |
307 | b2d72ffe | Iustin Pop | </varlistentry> |
308 | b2d72ffe | Iustin Pop | <varlistentry> |
309 | b2d72ffe | Iustin Pop | <term>total_memory</term> |
310 | b2d72ffe | Iustin Pop | <listitem> |
311 | b2d72ffe | Iustin Pop | <simpara>the total memory size</simpara> |
312 | b2d72ffe | Iustin Pop | </listitem> |
313 | b2d72ffe | Iustin Pop | </varlistentry> |
314 | b2d72ffe | Iustin Pop | <varlistentry> |
315 | b2d72ffe | Iustin Pop | <term>free_memory</term> |
316 | b2d72ffe | Iustin Pop | <listitem> |
317 | b2d72ffe | Iustin Pop | <simpara>free memory on the node; note that |
318 | b2d72ffe | Iustin Pop | currently this does not take into account the |
319 | b2d72ffe | Iustin Pop | instances which are down on the node</simpara> |
320 | b2d72ffe | Iustin Pop | </listitem> |
321 | b2d72ffe | Iustin Pop | </varlistentry> |
322 | b2d72ffe | Iustin Pop | <varlistentry> |
323 | 4337cf1b | Iustin Pop | <term>total_cpus</term> |
324 | 4337cf1b | Iustin Pop | <listitem> |
325 | 4337cf1b | Iustin Pop | <simpara>the physical number of CPUs present on the |
326 | 4337cf1b | Iustin Pop | machine; depending on the hypervisor, this might or |
327 | 4337cf1b | Iustin Pop | might not be equal to how many CPUs the node |
328 | 4337cf1b | Iustin Pop | operating system sees;</simpara> |
329 | 4337cf1b | Iustin Pop | </listitem> |
330 | 4337cf1b | Iustin Pop | </varlistentry> |
331 | 4337cf1b | Iustin Pop | <varlistentry> |
332 | b2d72ffe | Iustin Pop | <term>primary_ip</term> |
333 | b2d72ffe | Iustin Pop | <listitem> |
334 | b2d72ffe | Iustin Pop | <simpara>the primary IP address of the |
335 | b2d72ffe | Iustin Pop | node</simpara> |
336 | b2d72ffe | Iustin Pop | </listitem> |
337 | b2d72ffe | Iustin Pop | </varlistentry> |
338 | b2d72ffe | Iustin Pop | <varlistentry> |
339 | b2d72ffe | Iustin Pop | <term>secondary_ip</term> |
340 | b2d72ffe | Iustin Pop | <listitem> |
341 | b2d72ffe | Iustin Pop | <simpara>the secondary IP address of the node (the |
342 | b2d72ffe | Iustin Pop | one used for the DRBD replication); note that this |
343 | b2d72ffe | Iustin Pop | can be the same as the primary one</simpara> |
344 | b2d72ffe | Iustin Pop | </listitem> |
345 | b2d72ffe | Iustin Pop | </varlistentry> |
346 | b2d72ffe | Iustin Pop | <varlistentry> |
347 | b2d72ffe | Iustin Pop | <term>tags</term> |
348 | b2d72ffe | Iustin Pop | <listitem> |
349 | b2d72ffe | Iustin Pop | <simpara>list with the tags of the node</simpara> |
350 | b2d72ffe | Iustin Pop | </listitem> |
351 | b2d72ffe | Iustin Pop | </varlistentry> |
352 | b2d72ffe | Iustin Pop | </variablelist> |
353 | b2d72ffe | Iustin Pop | </listitem> |
354 | b2d72ffe | Iustin Pop | </varlistentry> |
355 | b2d72ffe | Iustin Pop | </variablelist> |
356 | b2d72ffe | Iustin Pop | |
357 | b2d72ffe | Iustin Pop | </sect2> |
358 | b2d72ffe | Iustin Pop | |
359 | b2d72ffe | Iustin Pop | <sect2> |
360 | b2d72ffe | Iustin Pop | <title>Respone message</title> |
361 | b2d72ffe | Iustin Pop | |
362 | b2d72ffe | Iustin Pop | <para>The response message is much more simple than the input |
363 | b2d72ffe | Iustin Pop | one. It is also a dict having three keys:</para> |
364 | b2d72ffe | Iustin Pop | <variablelist> |
365 | b2d72ffe | Iustin Pop | <varlistentry> |
366 | b2d72ffe | Iustin Pop | <term>success</term> |
367 | b2d72ffe | Iustin Pop | <listitem> |
368 | b2d72ffe | Iustin Pop | <simpara>a boolean value denoting if the allocation was |
369 | b2d72ffe | Iustin Pop | successfull or not</simpara> |
370 | b2d72ffe | Iustin Pop | </listitem> |
371 | b2d72ffe | Iustin Pop | </varlistentry> |
372 | b2d72ffe | Iustin Pop | <varlistentry> |
373 | b2d72ffe | Iustin Pop | <term>info</term> |
374 | b2d72ffe | Iustin Pop | <listitem> |
375 | b2d72ffe | Iustin Pop | <simpara>a string with information from the scripts; if |
376 | b2d72ffe | Iustin Pop | the allocation fails, this will be shown to the |
377 | b2d72ffe | Iustin Pop | user</simpara> |
378 | b2d72ffe | Iustin Pop | </listitem> |
379 | b2d72ffe | Iustin Pop | </varlistentry> |
380 | b2d72ffe | Iustin Pop | <varlistentry> |
381 | b2d72ffe | Iustin Pop | <term>nodes</term> |
382 | b2d72ffe | Iustin Pop | <listitem> |
383 | b2d72ffe | Iustin Pop | <simpara>the list of nodes computed by the algorithm; even |
384 | b2d72ffe | Iustin Pop | if the algorithm failed (i.e. success is false), this must |
385 | b2d72ffe | Iustin Pop | be returned as an empty list; also note that the length of |
386 | b2d72ffe | Iustin Pop | this list must equal the |
387 | b2d72ffe | Iustin Pop | <varname>requested_nodes</varname> entry in the input |
388 | b2d72ffe | Iustin Pop | message, otherwise Ganeti will consider the result as |
389 | b2d72ffe | Iustin Pop | failed</simpara> |
390 | b2d72ffe | Iustin Pop | </listitem> |
391 | b2d72ffe | Iustin Pop | </varlistentry> |
392 | b2d72ffe | Iustin Pop | </variablelist> |
393 | b2d72ffe | Iustin Pop | </sect2> |
394 | b2d72ffe | Iustin Pop | </sect1> |
395 | b2d72ffe | Iustin Pop | |
396 | b2d72ffe | Iustin Pop | <sect1> |
397 | b2d72ffe | Iustin Pop | <title>Examples</title> |
398 | b2d72ffe | Iustin Pop | <sect2> |
399 | b2d72ffe | Iustin Pop | <title>Input messages to scripts</title> |
400 | b2d72ffe | Iustin Pop | <simpara>Input message, new instance allocation</simpara> |
401 | b2d72ffe | Iustin Pop | <screen> |
402 | b2d72ffe | Iustin Pop | { |
403 | b2d72ffe | Iustin Pop | "cluster_tags": [], |
404 | b2d72ffe | Iustin Pop | "request": { |
405 | b2d72ffe | Iustin Pop | "required_nodes": 2, |
406 | b2d72ffe | Iustin Pop | "name": "instance3.example.com", |
407 | b2d72ffe | Iustin Pop | "tags": [ |
408 | b2d72ffe | Iustin Pop | "type:test", |
409 | b2d72ffe | Iustin Pop | "owner:foo" |
410 | b2d72ffe | Iustin Pop | ], |
411 | b2d72ffe | Iustin Pop | "type": "allocate", |
412 | b2d72ffe | Iustin Pop | "disks": [ |
413 | b2d72ffe | Iustin Pop | { |
414 | b2d72ffe | Iustin Pop | "mode": "w", |
415 | b2d72ffe | Iustin Pop | "size": 1024 |
416 | b2d72ffe | Iustin Pop | }, |
417 | b2d72ffe | Iustin Pop | { |
418 | b2d72ffe | Iustin Pop | "mode": "w", |
419 | b2d72ffe | Iustin Pop | "size": 2048 |
420 | b2d72ffe | Iustin Pop | } |
421 | b2d72ffe | Iustin Pop | ], |
422 | b2d72ffe | Iustin Pop | "nics": [ |
423 | b2d72ffe | Iustin Pop | { |
424 | b2d72ffe | Iustin Pop | "ip": null, |
425 | b2d72ffe | Iustin Pop | "mac": "00:11:22:33:44:55", |
426 | b2d72ffe | Iustin Pop | "bridge": null |
427 | b2d72ffe | Iustin Pop | } |
428 | b2d72ffe | Iustin Pop | ], |
429 | b2d72ffe | Iustin Pop | "vcpus": 1, |
430 | b2d72ffe | Iustin Pop | "disk_template": "drbd", |
431 | b2d72ffe | Iustin Pop | "memory": 2048, |
432 | b2d72ffe | Iustin Pop | "disk_space_total": 3328, |
433 | b2d72ffe | Iustin Pop | "os": "etch-image" |
434 | b2d72ffe | Iustin Pop | }, |
435 | b2d72ffe | Iustin Pop | "cluster_name": "cluster1.example.com", |
436 | b2d72ffe | Iustin Pop | "instances": { |
437 | b2d72ffe | Iustin Pop | "instance1.example.com": { |
438 | b2d72ffe | Iustin Pop | "tags": [], |
439 | b2d72ffe | Iustin Pop | "should_run": false, |
440 | b2d72ffe | Iustin Pop | "disks": [ |
441 | b2d72ffe | Iustin Pop | { |
442 | b2d72ffe | Iustin Pop | "mode": "w", |
443 | b2d72ffe | Iustin Pop | "size": 64 |
444 | b2d72ffe | Iustin Pop | }, |
445 | b2d72ffe | Iustin Pop | { |
446 | b2d72ffe | Iustin Pop | "mode": "w", |
447 | b2d72ffe | Iustin Pop | "size": 512 |
448 | b2d72ffe | Iustin Pop | } |
449 | b2d72ffe | Iustin Pop | ], |
450 | b2d72ffe | Iustin Pop | "nics": [ |
451 | b2d72ffe | Iustin Pop | { |
452 | b2d72ffe | Iustin Pop | "ip": null, |
453 | b2d72ffe | Iustin Pop | "mac": "aa:00:00:00:60:bf", |
454 | b2d72ffe | Iustin Pop | "bridge": "xen-br0" |
455 | b2d72ffe | Iustin Pop | } |
456 | b2d72ffe | Iustin Pop | ], |
457 | b2d72ffe | Iustin Pop | "vcpus": 1, |
458 | b2d72ffe | Iustin Pop | "disk_template": "plain", |
459 | b2d72ffe | Iustin Pop | "memory": 128, |
460 | b2d72ffe | Iustin Pop | "nodes": [ |
461 | b2d72ffe | Iustin Pop | "nodee1.com" |
462 | b2d72ffe | Iustin Pop | ], |
463 | b2d72ffe | Iustin Pop | "os": "etch-image" |
464 | b2d72ffe | Iustin Pop | }, |
465 | b2d72ffe | Iustin Pop | "instance2.example.com": { |
466 | b2d72ffe | Iustin Pop | "tags": [], |
467 | b2d72ffe | Iustin Pop | "should_run": false, |
468 | b2d72ffe | Iustin Pop | "disks": [ |
469 | b2d72ffe | Iustin Pop | { |
470 | b2d72ffe | Iustin Pop | "mode": "w", |
471 | b2d72ffe | Iustin Pop | "size": 512 |
472 | b2d72ffe | Iustin Pop | }, |
473 | b2d72ffe | Iustin Pop | { |
474 | b2d72ffe | Iustin Pop | "mode": "w", |
475 | b2d72ffe | Iustin Pop | "size": 256 |
476 | b2d72ffe | Iustin Pop | } |
477 | b2d72ffe | Iustin Pop | ], |
478 | b2d72ffe | Iustin Pop | "nics": [ |
479 | b2d72ffe | Iustin Pop | { |
480 | b2d72ffe | Iustin Pop | "ip": null, |
481 | b2d72ffe | Iustin Pop | "mac": "aa:00:00:55:f8:38", |
482 | b2d72ffe | Iustin Pop | "bridge": "xen-br0" |
483 | b2d72ffe | Iustin Pop | } |
484 | b2d72ffe | Iustin Pop | ], |
485 | b2d72ffe | Iustin Pop | "vcpus": 1, |
486 | b2d72ffe | Iustin Pop | "disk_template": "drbd", |
487 | b2d72ffe | Iustin Pop | "memory": 512, |
488 | b2d72ffe | Iustin Pop | "nodes": [ |
489 | b2d72ffe | Iustin Pop | "node2.example.com", |
490 | b2d72ffe | Iustin Pop | "node3.example.com" |
491 | b2d72ffe | Iustin Pop | ], |
492 | b2d72ffe | Iustin Pop | "os": "etch-image" |
493 | b2d72ffe | Iustin Pop | } |
494 | b2d72ffe | Iustin Pop | }, |
495 | b2d72ffe | Iustin Pop | "version": 1, |
496 | b2d72ffe | Iustin Pop | "nodes": { |
497 | b2d72ffe | Iustin Pop | "node1.example.com": { |
498 | b2d72ffe | Iustin Pop | "total_disk": 858276, |
499 | b2d72ffe | Iustin Pop | "primary_ip": "192.168.1.1", |
500 | b2d72ffe | Iustin Pop | "secondary_ip": "192.168.2.1", |
501 | b2d72ffe | Iustin Pop | "tags": [], |
502 | b2d72ffe | Iustin Pop | "free_memory": 3505, |
503 | b2d72ffe | Iustin Pop | "free_disk": 856740, |
504 | b2d72ffe | Iustin Pop | "total_memory": 4095 |
505 | b2d72ffe | Iustin Pop | }, |
506 | b2d72ffe | Iustin Pop | "node2.example.com": { |
507 | b2d72ffe | Iustin Pop | "total_disk": 858240, |
508 | b2d72ffe | Iustin Pop | "primary_ip": "192.168.1.3", |
509 | b2d72ffe | Iustin Pop | "secondary_ip": "192.168.2.3", |
510 | b2d72ffe | Iustin Pop | "tags": ["test"], |
511 | b2d72ffe | Iustin Pop | "free_memory": 3505, |
512 | b2d72ffe | Iustin Pop | "free_disk": 848320, |
513 | b2d72ffe | Iustin Pop | "total_memory": 4095 |
514 | b2d72ffe | Iustin Pop | }, |
515 | b2d72ffe | Iustin Pop | "node3.example.com.com": { |
516 | b2d72ffe | Iustin Pop | "total_disk": 572184, |
517 | b2d72ffe | Iustin Pop | "primary_ip": "192.168.1.3", |
518 | b2d72ffe | Iustin Pop | "secondary_ip": "192.168.2.3", |
519 | b2d72ffe | Iustin Pop | "tags": [], |
520 | b2d72ffe | Iustin Pop | "free_memory": 3505, |
521 | b2d72ffe | Iustin Pop | "free_disk": 570648, |
522 | b2d72ffe | Iustin Pop | "total_memory": 4095 |
523 | b2d72ffe | Iustin Pop | } |
524 | b2d72ffe | Iustin Pop | } |
525 | b2d72ffe | Iustin Pop | } |
526 | b2d72ffe | Iustin Pop | </screen> |
527 | b2d72ffe | Iustin Pop | <simpara>Input message, reallocation. Since only the request |
528 | b2d72ffe | Iustin Pop | entry in the input message is changed, the following shows only |
529 | b2d72ffe | Iustin Pop | this entry:</simpara> |
530 | b2d72ffe | Iustin Pop | <screen> |
531 | b2d72ffe | Iustin Pop | "request": { |
532 | b2d72ffe | Iustin Pop | "relocate_from": [ |
533 | b2d72ffe | Iustin Pop | "node3.example.com" |
534 | b2d72ffe | Iustin Pop | ], |
535 | b2d72ffe | Iustin Pop | "required_nodes": 1, |
536 | b2d72ffe | Iustin Pop | "type": "relocate", |
537 | b2d72ffe | Iustin Pop | "name": "instance2.example.com", |
538 | b2d72ffe | Iustin Pop | "disk_space_total": 832 |
539 | b2d72ffe | Iustin Pop | }, |
540 | b2d72ffe | Iustin Pop | </screen> |
541 | b2d72ffe | Iustin Pop | |
542 | b2d72ffe | Iustin Pop | </sect2> |
543 | b2d72ffe | Iustin Pop | <sect2> |
544 | b2d72ffe | Iustin Pop | <title>Response messages</title> |
545 | b2d72ffe | Iustin Pop | <simpara>Successful response message:</simpara> |
546 | b2d72ffe | Iustin Pop | <screen> |
547 | b2d72ffe | Iustin Pop | { |
548 | b2d72ffe | Iustin Pop | "info": "Allocation successful", |
549 | b2d72ffe | Iustin Pop | "nodes": [ |
550 | b2d72ffe | Iustin Pop | "node2.example.com", |
551 | b2d72ffe | Iustin Pop | "node1.example.com" |
552 | b2d72ffe | Iustin Pop | ], |
553 | b2d72ffe | Iustin Pop | "success": true |
554 | b2d72ffe | Iustin Pop | } |
555 | b2d72ffe | Iustin Pop | </screen> |
556 | b2d72ffe | Iustin Pop | <simpara>Failed response message:</simpara> |
557 | b2d72ffe | Iustin Pop | <screen> |
558 | b2d72ffe | Iustin Pop | { |
559 | b2d72ffe | Iustin Pop | "info": "Can't find a suitable node for position 2 (already selected: node2.example.com)", |
560 | b2d72ffe | Iustin Pop | "nodes": [], |
561 | b2d72ffe | Iustin Pop | "success": false |
562 | b2d72ffe | Iustin Pop | } |
563 | b2d72ffe | Iustin Pop | </screen> |
564 | b2d72ffe | Iustin Pop | </sect2> |
565 | b2d72ffe | Iustin Pop | |
566 | b2d72ffe | Iustin Pop | <sect2> |
567 | b2d72ffe | Iustin Pop | <title>Command line messages</title> |
568 | b2d72ffe | Iustin Pop | <screen> |
569 | b2d72ffe | Iustin Pop | # gnt-instance add -t plain -m 2g --os-size 1g --swap-size 512m --iallocator dumb-allocator -o etch-image instance3 |
570 | b2d72ffe | Iustin Pop | Selected nodes for the instance: node1.example.com |
571 | b2d72ffe | Iustin Pop | * creating instance disks... |
572 | b2d72ffe | Iustin Pop | [...] |
573 | b2d72ffe | Iustin Pop | |
574 | b2d72ffe | Iustin Pop | # gnt-instance add -t plain -m 3400m --os-size 1g --swap-size 512m --iallocator dumb-allocator -o etch-image instance4 |
575 | b2d72ffe | Iustin Pop | Failure: prerequisites not met for this operation: |
576 | b2d72ffe | Iustin Pop | Can't compute nodes using iallocator 'dumb-allocator': Can't find a suitable node for position 1 (already selected: ) |
577 | b2d72ffe | Iustin Pop | |
578 | b2d72ffe | Iustin Pop | # gnt-instance add -t drbd -m 1400m --os-size 1g --swap-size 512m --iallocator dumb-allocator -o etch-image instance5 |
579 | b2d72ffe | Iustin Pop | Failure: prerequisites not met for this operation: |
580 | b2d72ffe | Iustin Pop | Can't compute nodes using iallocator 'dumb-allocator': Can't find a suitable node for position 2 (already selected: node1.example.com) |
581 | b2d72ffe | Iustin Pop | |
582 | b2d72ffe | Iustin Pop | </screen> |
583 | b2d72ffe | Iustin Pop | </sect2> |
584 | b2d72ffe | Iustin Pop | </sect1> |
585 | b2d72ffe | Iustin Pop | |
586 | b2d72ffe | Iustin Pop | </article> |