Statistics
| Branch: | Tag: | Revision:

root / doc / rapi.rst @ 4c98b915

History | View | Annotate | Download (12.9 kB)

1 4352bf6d Iustin Pop
Ganeti remote API
2 4352bf6d Iustin Pop
=================
3 4352bf6d Iustin Pop
4 c8e0a534 Iustin Pop
Documents Ganeti version |version|
5 4352bf6d Iustin Pop
6 4352bf6d Iustin Pop
.. contents::
7 4352bf6d Iustin Pop
8 4352bf6d Iustin Pop
Introduction
9 4352bf6d Iustin Pop
------------
10 4352bf6d Iustin Pop
11 4352bf6d Iustin Pop
Ganeti supports a remote API for enable external tools to easily
12 4352bf6d Iustin Pop
retrieve information about a cluster's state. The remote API daemon,
13 4352bf6d Iustin Pop
*ganeti-rapi*, is automatically started on the master node. By default
14 4352bf6d Iustin Pop
it runs on TCP port 5080, but this can be changed either in
15 4352bf6d Iustin Pop
``.../constants.py`` or via the command line parameter *-p*. SSL mode,
16 4352bf6d Iustin Pop
which is used by default, can also be disabled by passing command line
17 4352bf6d Iustin Pop
parameters.
18 4352bf6d Iustin Pop
19 4352bf6d Iustin Pop
Protocol
20 4352bf6d Iustin Pop
--------
21 4352bf6d Iustin Pop
22 4352bf6d Iustin Pop
The protocol used is JSON_ over HTTP designed after the REST_
23 4352bf6d Iustin Pop
principle.
24 4352bf6d Iustin Pop
25 4352bf6d Iustin Pop
.. _JSON: http://www.json.org/
26 4352bf6d Iustin Pop
.. _REST: http://en.wikipedia.org/wiki/Representational_State_Transfer
27 4352bf6d Iustin Pop
28 2cad4b91 Iustin Pop
Generic parameters
29 2cad4b91 Iustin Pop
------------------
30 2cad4b91 Iustin Pop
31 2cad4b91 Iustin Pop
A few parameter mean the same thing across all resources which implement it.
32 2cad4b91 Iustin Pop
33 2cad4b91 Iustin Pop
``bulk``
34 2cad4b91 Iustin Pop
++++++++
35 2cad4b91 Iustin Pop
36 2cad4b91 Iustin Pop
Bulk-mode means that for the resources which usually return just a
37 2cad4b91 Iustin Pop
list of child resources (e.g. ``/2/instances`` which returns just
38 2cad4b91 Iustin Pop
instance names), the output will instead contain detailed data for all
39 2cad4b91 Iustin Pop
these subresources. This is more efficient than query-ing the
40 2cad4b91 Iustin Pop
sub-resources themselves.
41 2cad4b91 Iustin Pop
42 2cad4b91 Iustin Pop
``dry-run``
43 2cad4b91 Iustin Pop
+++++++++++
44 2cad4b91 Iustin Pop
45 2cad4b91 Iustin Pop
The optional *dry-run* argument, if provided and set to a positive
46 2cad4b91 Iustin Pop
integer value (e.g. ``?dry-run=1``), signals to Ganeti that the job
47 2cad4b91 Iustin Pop
should not be executed, only the pre-execution checks will be done.
48 2cad4b91 Iustin Pop
49 2cad4b91 Iustin Pop
This is useful in trying to determine (without guarantees though, as
50 2cad4b91 Iustin Pop
in the meantime the cluster state could have changed) if the operation
51 2cad4b91 Iustin Pop
is likely to succeed or at least start executing.
52 2cad4b91 Iustin Pop
53 3427d34f Michael Hanselmann
``force``
54 3427d34f Michael Hanselmann
+++++++++++
55 3427d34f Michael Hanselmann
56 3427d34f Michael Hanselmann
Force operation to continue even if it will cause the cluster to become
57 3427d34f Michael Hanselmann
inconsistent (e.g. because there are not enough master candidates).
58 3427d34f Michael Hanselmann
59 4352bf6d Iustin Pop
Usage examples
60 4352bf6d Iustin Pop
--------------
61 4352bf6d Iustin Pop
62 4352bf6d Iustin Pop
You can access the API using your favorite programming language as
63 4352bf6d Iustin Pop
long as it supports network connections.
64 4352bf6d Iustin Pop
65 4352bf6d Iustin Pop
Shell
66 4352bf6d Iustin Pop
+++++
67 4352bf6d Iustin Pop
68 c8e0a534 Iustin Pop
.. highlight:: sh
69 c8e0a534 Iustin Pop
70 4352bf6d Iustin Pop
Using wget::
71 4352bf6d Iustin Pop
72 c8e0a534 Iustin Pop
   wget -q -O - https://CLUSTERNAME:5080/2/info
73 4352bf6d Iustin Pop
74 4352bf6d Iustin Pop
or curl::
75 4352bf6d Iustin Pop
76 4352bf6d Iustin Pop
  curl https://CLUSTERNAME:5080/2/info
77 4352bf6d Iustin Pop
78 4352bf6d Iustin Pop
79 4352bf6d Iustin Pop
Python
80 4352bf6d Iustin Pop
++++++
81 4352bf6d Iustin Pop
82 c8e0a534 Iustin Pop
.. highlight: python
83 4352bf6d Iustin Pop
84 4352bf6d Iustin Pop
  import urllib2
85 4fb301b5 Tim Boring
  f = urllib2.urlopen('https://CLUSTERNAME:5080/2/info')
86 4352bf6d Iustin Pop
  print f.read()
87 4352bf6d Iustin Pop
88 4352bf6d Iustin Pop
89 4352bf6d Iustin Pop
JavaScript
90 4352bf6d Iustin Pop
++++++++++
91 4352bf6d Iustin Pop
92 2cad4b91 Iustin Pop
.. warning:: While it's possible to use JavaScript, it poses several
93 2cad4b91 Iustin Pop
  potential problems, including browser blocking request due to
94 2cad4b91 Iustin Pop
  non-standard ports or different domain names. Fetching the data on
95 2cad4b91 Iustin Pop
  the webserver is easier.
96 4352bf6d Iustin Pop
97 c8e0a534 Iustin Pop
.. highlight:: javascript
98 c8e0a534 Iustin Pop
99 4352bf6d Iustin Pop
::
100 4352bf6d Iustin Pop
101 4fb301b5 Tim Boring
  var url = 'https://CLUSTERNAME:5080/2/info';
102 4352bf6d Iustin Pop
  var info;
103 4352bf6d Iustin Pop
  var xmlreq = new XMLHttpRequest();
104 4352bf6d Iustin Pop
  xmlreq.onreadystatechange = function () {
105 4352bf6d Iustin Pop
    if (xmlreq.readyState != 4) return;
106 4352bf6d Iustin Pop
    if (xmlreq.status == 200) {
107 4352bf6d Iustin Pop
      info = eval("(" + xmlreq.responseText + ")");
108 4352bf6d Iustin Pop
      alert(info);
109 4352bf6d Iustin Pop
    } else {
110 4352bf6d Iustin Pop
      alert('Error fetching cluster info');
111 4352bf6d Iustin Pop
    }
112 4352bf6d Iustin Pop
    xmlreq = null;
113 4352bf6d Iustin Pop
  };
114 4352bf6d Iustin Pop
  xmlreq.open('GET', url, true);
115 4352bf6d Iustin Pop
  xmlreq.send(null);
116 4352bf6d Iustin Pop
117 4352bf6d Iustin Pop
Resources
118 4352bf6d Iustin Pop
---------
119 4352bf6d Iustin Pop
120 c8e0a534 Iustin Pop
.. highlight:: javascript
121 6d81475c Iustin Pop
122 c8e0a534 Iustin Pop
``/``
123 c8e0a534 Iustin Pop
+++++
124 6d81475c Iustin Pop
125 c8e0a534 Iustin Pop
The root resource.
126 6d81475c Iustin Pop
127 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
128 6d81475c Iustin Pop
129 c8e0a534 Iustin Pop
``GET``
130 c8e0a534 Iustin Pop
~~~~~~~
131 6d81475c Iustin Pop
132 c8e0a534 Iustin Pop
Shows the list of mapped resources.
133 6d81475c Iustin Pop
134 c8e0a534 Iustin Pop
Returns: a dictionary with 'name' and 'uri' keys for each of them.
135 6d81475c Iustin Pop
136 c8e0a534 Iustin Pop
``/2``
137 c8e0a534 Iustin Pop
++++++
138 6d81475c Iustin Pop
139 c8e0a534 Iustin Pop
The ``/2`` resource, the root of the version 2 API.
140 6d81475c Iustin Pop
141 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
142 6d81475c Iustin Pop
143 c8e0a534 Iustin Pop
``GET``
144 c8e0a534 Iustin Pop
~~~~~~~
145 6d81475c Iustin Pop
146 c8e0a534 Iustin Pop
Show the list of mapped resources.
147 6d81475c Iustin Pop
148 c8e0a534 Iustin Pop
Returns: a dictionary with ``name`` and ``uri`` keys for each of them.
149 6d81475c Iustin Pop
150 c8e0a534 Iustin Pop
``/2/info``
151 c8e0a534 Iustin Pop
+++++++++++
152 6d81475c Iustin Pop
153 c8e0a534 Iustin Pop
Cluster information resource.
154 6d81475c Iustin Pop
155 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
156 6d81475c Iustin Pop
157 c8e0a534 Iustin Pop
``GET``
158 c8e0a534 Iustin Pop
~~~~~~~
159 6d81475c Iustin Pop
160 c8e0a534 Iustin Pop
Returns cluster information.
161 6d81475c Iustin Pop
162 c8e0a534 Iustin Pop
Example::
163 6d81475c Iustin Pop
164 6d81475c Iustin Pop
  {
165 6d81475c Iustin Pop
    "config_version": 2000000,
166 6d81475c Iustin Pop
    "name": "cluster",
167 6d81475c Iustin Pop
    "software_version": "2.0.0~beta2",
168 6d81475c Iustin Pop
    "os_api_version": 10,
169 6d81475c Iustin Pop
    "export_version": 0,
170 6d81475c Iustin Pop
    "candidate_pool_size": 10,
171 6d81475c Iustin Pop
    "enabled_hypervisors": [
172 6d81475c Iustin Pop
      "fake"
173 6d81475c Iustin Pop
    ],
174 6d81475c Iustin Pop
    "hvparams": {
175 6d81475c Iustin Pop
      "fake": {}
176 6d81475c Iustin Pop
     },
177 6d81475c Iustin Pop
    "default_hypervisor": "fake",
178 6d81475c Iustin Pop
    "master": "node1.example.com",
179 6d81475c Iustin Pop
    "architecture": [
180 6d81475c Iustin Pop
      "64bit",
181 6d81475c Iustin Pop
      "x86_64"
182 6d81475c Iustin Pop
    ],
183 6d81475c Iustin Pop
    "protocol_version": 20,
184 6d81475c Iustin Pop
    "beparams": {
185 6d81475c Iustin Pop
      "default": {
186 6d81475c Iustin Pop
        "auto_balance": true,
187 6d81475c Iustin Pop
        "vcpus": 1,
188 6d81475c Iustin Pop
        "memory": 128
189 6d81475c Iustin Pop
       }
190 6d81475c Iustin Pop
      }
191 6d81475c Iustin Pop
    }
192 6d81475c Iustin Pop
193 c8e0a534 Iustin Pop
``/2/instances``
194 c8e0a534 Iustin Pop
++++++++++++++++
195 6d81475c Iustin Pop
196 c8e0a534 Iustin Pop
The instances resource.
197 6d81475c Iustin Pop
198 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``POST``.
199 6d81475c Iustin Pop
200 c8e0a534 Iustin Pop
``GET``
201 c8e0a534 Iustin Pop
~~~~~~~
202 6d81475c Iustin Pop
203 c8e0a534 Iustin Pop
Returns a list of all available instances.
204 6d81475c Iustin Pop
205 c8e0a534 Iustin Pop
Example::
206 6d81475c Iustin Pop
207 6d81475c Iustin Pop
    [
208 6d81475c Iustin Pop
      {
209 6d81475c Iustin Pop
        "name": "web.example.com",
210 6d81475c Iustin Pop
        "uri": "\/instances\/web.example.com"
211 6d81475c Iustin Pop
      },
212 6d81475c Iustin Pop
      {
213 6d81475c Iustin Pop
        "name": "mail.example.com",
214 6d81475c Iustin Pop
        "uri": "\/instances\/mail.example.com"
215 6d81475c Iustin Pop
      }
216 6d81475c Iustin Pop
    ]
217 6d81475c Iustin Pop
218 c8e0a534 Iustin Pop
If the optional *bulk* argument is provided and set to a true value
219 c8e0a534 Iustin Pop
(i.e ``?bulk=1``), the output contains detailed information about
220 c8e0a534 Iustin Pop
instances as a list.
221 6d81475c Iustin Pop
222 c8e0a534 Iustin Pop
Example::
223 6d81475c Iustin Pop
224 6d81475c Iustin Pop
    [
225 6d81475c Iustin Pop
      {
226 6d81475c Iustin Pop
         "status": "running",
227 6d81475c Iustin Pop
         "disk_usage": 20480,
228 6d81475c Iustin Pop
         "nic.bridges": [
229 6d81475c Iustin Pop
           "xen-br0"
230 6d81475c Iustin Pop
          ],
231 6d81475c Iustin Pop
         "name": "web.example.com",
232 6d81475c Iustin Pop
         "tags": ["tag1", "tag2"],
233 6d81475c Iustin Pop
         "beparams": {
234 6d81475c Iustin Pop
           "vcpus": 2,
235 6d81475c Iustin Pop
           "memory": 512
236 6d81475c Iustin Pop
         },
237 6d81475c Iustin Pop
         "disk.sizes": [
238 6d81475c Iustin Pop
             20480
239 6d81475c Iustin Pop
         ],
240 6d81475c Iustin Pop
         "pnode": "node1.example.com",
241 6d81475c Iustin Pop
         "nic.macs": ["01:23:45:67:89:01"],
242 6d81475c Iustin Pop
         "snodes": ["node2.example.com"],
243 6d81475c Iustin Pop
         "disk_template": "drbd",
244 6d81475c Iustin Pop
         "admin_state": true,
245 6d81475c Iustin Pop
         "os": "debian-etch",
246 6d81475c Iustin Pop
         "oper_state": true
247 6d81475c Iustin Pop
      },
248 6d81475c Iustin Pop
      ...
249 6d81475c Iustin Pop
    ]
250 6d81475c Iustin Pop
251 6d81475c Iustin Pop
252 c8e0a534 Iustin Pop
``POST``
253 c8e0a534 Iustin Pop
~~~~~~~~
254 6d81475c Iustin Pop
255 c8e0a534 Iustin Pop
Creates an instance.
256 6d81475c Iustin Pop
257 2cad4b91 Iustin Pop
If the optional *dry-run* argument is provided and set to a positive
258 2cad4b91 Iustin Pop
integer valu (e.g. ``?dry-run=1``), the job will not be actually
259 2cad4b91 Iustin Pop
executed, only the pre-execution checks will be done. Query-ing the
260 2cad4b91 Iustin Pop
job result will return, in both dry-run and normal case, the list of
261 2cad4b91 Iustin Pop
nodes selected for the instance.
262 2cad4b91 Iustin Pop
263 c8e0a534 Iustin Pop
Returns: a job ID that can be used later for polling.
264 6d81475c Iustin Pop
265 c8e0a534 Iustin Pop
``/2/instances/[instance_name]``
266 c8e0a534 Iustin Pop
++++++++++++++++++++++++++++++++
267 6d81475c Iustin Pop
268 c8e0a534 Iustin Pop
Instance-specific resource.
269 6d81475c Iustin Pop
270 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``DELETE``.
271 6d81475c Iustin Pop
272 c8e0a534 Iustin Pop
``GET``
273 c8e0a534 Iustin Pop
~~~~~~~
274 6d81475c Iustin Pop
275 c8e0a534 Iustin Pop
Returns information about an instance, similar to the bulk output from
276 c8e0a534 Iustin Pop
the instance list.
277 6d81475c Iustin Pop
278 c8e0a534 Iustin Pop
``DELETE``
279 c8e0a534 Iustin Pop
~~~~~~~~~~
280 6d81475c Iustin Pop
281 c8e0a534 Iustin Pop
Deletes an instance.
282 6d81475c Iustin Pop
283 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
284 2cad4b91 Iustin Pop
285 6d81475c Iustin Pop
286 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/reboot``
287 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++++++++++++
288 6d81475c Iustin Pop
289 c8e0a534 Iustin Pop
Reboots URI for an instance.
290 6d81475c Iustin Pop
291 c8e0a534 Iustin Pop
It supports the following commands: ``POST``.
292 6d81475c Iustin Pop
293 c8e0a534 Iustin Pop
``POST``
294 c8e0a534 Iustin Pop
~~~~~~~~
295 6d81475c Iustin Pop
296 c8e0a534 Iustin Pop
Reboots the instance.
297 6d81475c Iustin Pop
298 c8e0a534 Iustin Pop
The URI takes optional ``type=hard|soft|full`` and
299 c8e0a534 Iustin Pop
``ignore_secondaries=False|True`` parameters.
300 6d81475c Iustin Pop
301 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
302 2cad4b91 Iustin Pop
303 2cad4b91 Iustin Pop
304 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/shutdown``
305 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++++++++++++++
306 6d81475c Iustin Pop
307 c8e0a534 Iustin Pop
Instance shutdown URI.
308 6d81475c Iustin Pop
309 c8e0a534 Iustin Pop
It supports the following commands: ``PUT``.
310 6d81475c Iustin Pop
311 c8e0a534 Iustin Pop
``PUT``
312 c8e0a534 Iustin Pop
~~~~~~~
313 6d81475c Iustin Pop
314 c8e0a534 Iustin Pop
Shutdowns an instance.
315 6d81475c Iustin Pop
316 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
317 2cad4b91 Iustin Pop
318 6d81475c Iustin Pop
319 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/startup``
320 c8e0a534 Iustin Pop
++++++++++++++++++++++++++++++++++++++++
321 6d81475c Iustin Pop
322 c8e0a534 Iustin Pop
Instance startup URI.
323 6d81475c Iustin Pop
324 c8e0a534 Iustin Pop
It supports the following commands: ``PUT``.
325 6d81475c Iustin Pop
326 c8e0a534 Iustin Pop
``PUT``
327 c8e0a534 Iustin Pop
~~~~~~~
328 6d81475c Iustin Pop
329 c8e0a534 Iustin Pop
Startup an instance.
330 6d81475c Iustin Pop
331 c8e0a534 Iustin Pop
The URI takes an optional ``force=False|True`` parameter to start the
332 c8e0a534 Iustin Pop
instance if even if secondary disks are failing.
333 6d81475c Iustin Pop
334 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
335 2cad4b91 Iustin Pop
336 2cad4b91 Iustin Pop
337 4c98b915 Michael Hanselmann
``/2/instances/[instance_name]/replace-disks``
338 4c98b915 Michael Hanselmann
++++++++++++++++++++++++++++++++++++++++++++++
339 4c98b915 Michael Hanselmann
340 4c98b915 Michael Hanselmann
Replaces disks on an instance.
341 4c98b915 Michael Hanselmann
342 4c98b915 Michael Hanselmann
It supports the following commands: ``POST``.
343 4c98b915 Michael Hanselmann
344 4c98b915 Michael Hanselmann
``POST``
345 4c98b915 Michael Hanselmann
~~~~~~~~
346 4c98b915 Michael Hanselmann
347 4c98b915 Michael Hanselmann
Takes the parameters ``mode`` (one of ``replace_on_primary``,
348 4c98b915 Michael Hanselmann
``replace_on_secondary``, ``replace_new_secondary`` or ``replace_auto``),
349 4c98b915 Michael Hanselmann
``disks`` (comma separated list of disk indexes), ``remote_node`` and
350 4c98b915 Michael Hanselmann
``iallocator``.
351 4c98b915 Michael Hanselmann
352 4c98b915 Michael Hanselmann
353 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/tags``
354 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++++++++++
355 6d81475c Iustin Pop
356 c8e0a534 Iustin Pop
Manages per-instance tags.
357 6d81475c Iustin Pop
358 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
359 6d81475c Iustin Pop
360 c8e0a534 Iustin Pop
``GET``
361 c8e0a534 Iustin Pop
~~~~~~~
362 6d81475c Iustin Pop
363 c8e0a534 Iustin Pop
Returns a list of tags.
364 6d81475c Iustin Pop
365 c8e0a534 Iustin Pop
Example::
366 6d81475c Iustin Pop
367 c8e0a534 Iustin Pop
    ["tag1", "tag2", "tag3"]
368 6d81475c Iustin Pop
369 c8e0a534 Iustin Pop
``PUT``
370 c8e0a534 Iustin Pop
~~~~~~~
371 6d81475c Iustin Pop
372 c8e0a534 Iustin Pop
Add a set of tags.
373 6d81475c Iustin Pop
374 c8e0a534 Iustin Pop
The request as a list of strings should be ``PUT`` to this URI. The
375 c8e0a534 Iustin Pop
result willl be a job id.
376 6d81475c Iustin Pop
377 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
378 2cad4b91 Iustin Pop
379 2cad4b91 Iustin Pop
380 c8e0a534 Iustin Pop
``DELETE``
381 c8e0a534 Iustin Pop
~~~~~~~~~~
382 6d81475c Iustin Pop
383 c8e0a534 Iustin Pop
Delete a tag.
384 6d81475c Iustin Pop
385 c8e0a534 Iustin Pop
In order to delete a set of tags, the DELETE request should be
386 c8e0a534 Iustin Pop
addressed to URI like::
387 6d81475c Iustin Pop
388 c8e0a534 Iustin Pop
    /tags?tag=[tag]&tag=[tag]
389 6d81475c Iustin Pop
390 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
391 2cad4b91 Iustin Pop
392 2cad4b91 Iustin Pop
393 c8e0a534 Iustin Pop
``/2/jobs``
394 c8e0a534 Iustin Pop
+++++++++++
395 6d81475c Iustin Pop
396 c8e0a534 Iustin Pop
The ``/2/jobs`` resource.
397 6d81475c Iustin Pop
398 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
399 6d81475c Iustin Pop
400 c8e0a534 Iustin Pop
``GET``
401 c8e0a534 Iustin Pop
~~~~~~~
402 6d81475c Iustin Pop
403 c8e0a534 Iustin Pop
Returns a dictionary of jobs.
404 6d81475c Iustin Pop
405 c8e0a534 Iustin Pop
Returns: a dictionary with jobs id and uri.
406 6d81475c Iustin Pop
407 c8e0a534 Iustin Pop
``/2/jobs/[job_id]``
408 c8e0a534 Iustin Pop
++++++++++++++++++++
409 6d81475c Iustin Pop
410 6d81475c Iustin Pop
411 c8e0a534 Iustin Pop
Individual job URI.
412 6d81475c Iustin Pop
413 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``DELETE``.
414 6d81475c Iustin Pop
415 c8e0a534 Iustin Pop
``GET``
416 c8e0a534 Iustin Pop
~~~~~~~
417 6d81475c Iustin Pop
418 c8e0a534 Iustin Pop
Returns a job status.
419 6d81475c Iustin Pop
420 c8e0a534 Iustin Pop
Returns: a dictionary with job parameters.
421 6d81475c Iustin Pop
422 c8e0a534 Iustin Pop
The result includes:
423 6d81475c Iustin Pop
424 c8e0a534 Iustin Pop
- id: job ID as a number
425 c8e0a534 Iustin Pop
- status: current job status as a string
426 c8e0a534 Iustin Pop
- ops: involved OpCodes as a list of dictionaries for each
427 c8e0a534 Iustin Pop
  opcodes in the job
428 c8e0a534 Iustin Pop
- opstatus: OpCodes status as a list
429 c8e0a534 Iustin Pop
- opresult: OpCodes results as a list of lists
430 6d81475c Iustin Pop
431 c8e0a534 Iustin Pop
``DELETE``
432 c8e0a534 Iustin Pop
~~~~~~~~~~
433 6d81475c Iustin Pop
434 c8e0a534 Iustin Pop
Cancel a not-yet-started job.
435 6d81475c Iustin Pop
436 c8e0a534 Iustin Pop
``/2/nodes``
437 c8e0a534 Iustin Pop
++++++++++++
438 6d81475c Iustin Pop
439 c8e0a534 Iustin Pop
Nodes resource.
440 6d81475c Iustin Pop
441 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
442 6d81475c Iustin Pop
443 c8e0a534 Iustin Pop
``GET``
444 c8e0a534 Iustin Pop
~~~~~~~
445 6d81475c Iustin Pop
446 c8e0a534 Iustin Pop
Returns a list of all nodes.
447 6d81475c Iustin Pop
448 c8e0a534 Iustin Pop
Example::
449 6d81475c Iustin Pop
450 6d81475c Iustin Pop
    [
451 6d81475c Iustin Pop
      {
452 6d81475c Iustin Pop
        "id": "node1.example.com",
453 6d81475c Iustin Pop
        "uri": "\/instances\/node1.example.com"
454 6d81475c Iustin Pop
      },
455 6d81475c Iustin Pop
      {
456 6d81475c Iustin Pop
        "id": "node2.example.com",
457 6d81475c Iustin Pop
        "uri": "\/instances\/node2.example.com"
458 6d81475c Iustin Pop
      }
459 6d81475c Iustin Pop
    ]
460 6d81475c Iustin Pop
461 c8e0a534 Iustin Pop
If the optional 'bulk' argument is provided and set to 'true' value
462 c8e0a534 Iustin Pop
(i.e '?bulk=1'), the output contains detailed information about nodes
463 c8e0a534 Iustin Pop
as a list.
464 6d81475c Iustin Pop
465 c8e0a534 Iustin Pop
Example::
466 6d81475c Iustin Pop
467 6d81475c Iustin Pop
    [
468 6d81475c Iustin Pop
      {
469 6d81475c Iustin Pop
        "pinst_cnt": 1,
470 6d81475c Iustin Pop
        "mfree": 31280,
471 6d81475c Iustin Pop
        "mtotal": 32763,
472 6d81475c Iustin Pop
        "name": "www.example.com",
473 6d81475c Iustin Pop
        "tags": [],
474 6d81475c Iustin Pop
        "mnode": 512,
475 6d81475c Iustin Pop
        "dtotal": 5246208,
476 6d81475c Iustin Pop
        "sinst_cnt": 2,
477 6d81475c Iustin Pop
        "dfree": 5171712,
478 6d81475c Iustin Pop
        "offline": false
479 6d81475c Iustin Pop
      },
480 6d81475c Iustin Pop
      ...
481 6d81475c Iustin Pop
    ]
482 6d81475c Iustin Pop
483 73452f12 Michael Hanselmann
``/2/nodes/[node_name]/evacuate``
484 73452f12 Michael Hanselmann
+++++++++++++++++++++++++++++++++
485 73452f12 Michael Hanselmann
486 73452f12 Michael Hanselmann
Evacuates all secondary instances off a node.
487 73452f12 Michael Hanselmann
488 73452f12 Michael Hanselmann
It supports the following commands: ``POST``.
489 73452f12 Michael Hanselmann
490 73452f12 Michael Hanselmann
``POST``
491 73452f12 Michael Hanselmann
~~~~~~~~
492 73452f12 Michael Hanselmann
493 73452f12 Michael Hanselmann
To evacuate a node, either one of the ``iallocator`` or ``remote_node``
494 73452f12 Michael Hanselmann
parameters must be passed:
495 73452f12 Michael Hanselmann
496 73452f12 Michael Hanselmann
    evacuate?iallocator=[iallocator]
497 73452f12 Michael Hanselmann
    evacuate?remote_node=[nodeX.example.com]
498 73452f12 Michael Hanselmann
499 1c482bab Michael Hanselmann
``/2/nodes/[node_name]/migrate``
500 1c482bab Michael Hanselmann
+++++++++++++++++++++++++++++++++
501 1c482bab Michael Hanselmann
502 1c482bab Michael Hanselmann
Migrates all primary instances from a node.
503 1c482bab Michael Hanselmann
504 1c482bab Michael Hanselmann
It supports the following commands: ``POST``.
505 1c482bab Michael Hanselmann
506 1c482bab Michael Hanselmann
``POST``
507 1c482bab Michael Hanselmann
~~~~~~~~
508 1c482bab Michael Hanselmann
509 1c482bab Michael Hanselmann
No parameters are required, but ``live`` can be set to a boolean value.
510 1c482bab Michael Hanselmann
511 1c482bab Michael Hanselmann
    migrate?live=[0|1]
512 1c482bab Michael Hanselmann
513 64dae8fc Michael Hanselmann
``/2/nodes/[node_name]/role``
514 64dae8fc Michael Hanselmann
+++++++++++++++++++++++++++++
515 64dae8fc Michael Hanselmann
516 64dae8fc Michael Hanselmann
Manages node role.
517 64dae8fc Michael Hanselmann
518 64dae8fc Michael Hanselmann
It supports the following commands: ``GET``, ``PUT``.
519 64dae8fc Michael Hanselmann
520 64dae8fc Michael Hanselmann
The role is always one of the following:
521 64dae8fc Michael Hanselmann
522 64dae8fc Michael Hanselmann
  - drained
523 64dae8fc Michael Hanselmann
  - master
524 64dae8fc Michael Hanselmann
  - master-candidate
525 64dae8fc Michael Hanselmann
  - offline
526 64dae8fc Michael Hanselmann
  - regular
527 64dae8fc Michael Hanselmann
528 64dae8fc Michael Hanselmann
``GET``
529 64dae8fc Michael Hanselmann
~~~~~~~
530 64dae8fc Michael Hanselmann
531 64dae8fc Michael Hanselmann
Returns the current node role.
532 64dae8fc Michael Hanselmann
533 64dae8fc Michael Hanselmann
Example::
534 64dae8fc Michael Hanselmann
535 64dae8fc Michael Hanselmann
    "master-candidate"
536 64dae8fc Michael Hanselmann
537 64dae8fc Michael Hanselmann
``PUT``
538 64dae8fc Michael Hanselmann
~~~~~~~
539 64dae8fc Michael Hanselmann
540 64dae8fc Michael Hanselmann
Change the node role.
541 64dae8fc Michael Hanselmann
542 64dae8fc Michael Hanselmann
The request is a string which should be PUT to this URI. The result will be a
543 64dae8fc Michael Hanselmann
job id.
544 64dae8fc Michael Hanselmann
545 64dae8fc Michael Hanselmann
It supports the ``force`` argument.
546 64dae8fc Michael Hanselmann
547 7a95a954 Michael Hanselmann
``/2/nodes/[node_name]/storage``
548 7a95a954 Michael Hanselmann
++++++++++++++++++++++++++++++++
549 7a95a954 Michael Hanselmann
550 7a95a954 Michael Hanselmann
Manages storage units on the node.
551 7a95a954 Michael Hanselmann
552 7a95a954 Michael Hanselmann
``GET``
553 7a95a954 Michael Hanselmann
~~~~~~~
554 7a95a954 Michael Hanselmann
555 7a95a954 Michael Hanselmann
Requests a list of storage units on a node. Requires the parameters
556 7a95a954 Michael Hanselmann
``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``) and
557 7a95a954 Michael Hanselmann
``output_fields``. The result will be a job id, using which the result can be
558 7a95a954 Michael Hanselmann
retrieved.
559 7a95a954 Michael Hanselmann
560 1e82bc80 Michael Hanselmann
``/2/nodes/[node_name]/storage/modify``
561 1e82bc80 Michael Hanselmann
+++++++++++++++++++++++++++++++++++++++
562 1e82bc80 Michael Hanselmann
563 1e82bc80 Michael Hanselmann
Modifies storage units on the node.
564 1e82bc80 Michael Hanselmann
565 1e82bc80 Michael Hanselmann
``PUT``
566 1e82bc80 Michael Hanselmann
~~~~~~~
567 1e82bc80 Michael Hanselmann
568 1e82bc80 Michael Hanselmann
Modifies parameters of storage units on the node. Requires the parameters
569 1e82bc80 Michael Hanselmann
``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``) and ``name`` (name
570 1e82bc80 Michael Hanselmann
of the storage unit).  Parameters can be passed additionally. Currently only
571 1e82bc80 Michael Hanselmann
``allocatable`` (bool) is supported. The result will be a job id.
572 1e82bc80 Michael Hanselmann
573 c8e0a534 Iustin Pop
``/2/nodes/[node_name]/tags``
574 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++
575 6d81475c Iustin Pop
576 c8e0a534 Iustin Pop
Manages per-node tags.
577 6d81475c Iustin Pop
578 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
579 6d81475c Iustin Pop
580 c8e0a534 Iustin Pop
``GET``
581 c8e0a534 Iustin Pop
~~~~~~~
582 6d81475c Iustin Pop
583 c8e0a534 Iustin Pop
Returns a list of tags.
584 6d81475c Iustin Pop
585 c8e0a534 Iustin Pop
Example::
586 6d81475c Iustin Pop
587 c8e0a534 Iustin Pop
    ["tag1", "tag2", "tag3"]
588 6d81475c Iustin Pop
589 c8e0a534 Iustin Pop
``PUT``
590 c8e0a534 Iustin Pop
~~~~~~~
591 6d81475c Iustin Pop
592 c8e0a534 Iustin Pop
Add a set of tags.
593 6d81475c Iustin Pop
594 c8e0a534 Iustin Pop
The request as a list of strings should be PUT to this URI. The result
595 c8e0a534 Iustin Pop
will be a job id.
596 6d81475c Iustin Pop
597 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
598 2cad4b91 Iustin Pop
599 c8e0a534 Iustin Pop
``DELETE``
600 c8e0a534 Iustin Pop
~~~~~~~~~~
601 6d81475c Iustin Pop
602 c8e0a534 Iustin Pop
Deletes tags.
603 6d81475c Iustin Pop
604 c8e0a534 Iustin Pop
In order to delete a set of tags, the DELETE request should be
605 c8e0a534 Iustin Pop
addressed to URI like::
606 6d81475c Iustin Pop
607 c8e0a534 Iustin Pop
    /tags?tag=[tag]&tag=[tag]
608 6d81475c Iustin Pop
609 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
610 2cad4b91 Iustin Pop
611 2cad4b91 Iustin Pop
612 c8e0a534 Iustin Pop
``/2/os``
613 c8e0a534 Iustin Pop
+++++++++
614 6d81475c Iustin Pop
615 c8e0a534 Iustin Pop
OS resource.
616 6d81475c Iustin Pop
617 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
618 6d81475c Iustin Pop
619 c8e0a534 Iustin Pop
``GET``
620 c8e0a534 Iustin Pop
~~~~~~~
621 6d81475c Iustin Pop
622 c8e0a534 Iustin Pop
Return a list of all OSes.
623 6d81475c Iustin Pop
624 c8e0a534 Iustin Pop
Can return error 500 in case of a problem. Since this is a costly
625 c8e0a534 Iustin Pop
operation for Ganeti 2.0, it is not recommended to execute it too
626 c8e0a534 Iustin Pop
often.
627 6d81475c Iustin Pop
628 c8e0a534 Iustin Pop
Example::
629 6d81475c Iustin Pop
630 c8e0a534 Iustin Pop
    ["debian-etch"]
631 6d81475c Iustin Pop
632 c8e0a534 Iustin Pop
``/2/tags``
633 c8e0a534 Iustin Pop
+++++++++++
634 6d81475c Iustin Pop
635 c8e0a534 Iustin Pop
Manages cluster tags.
636 6d81475c Iustin Pop
637 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
638 6d81475c Iustin Pop
639 c8e0a534 Iustin Pop
``GET``
640 c8e0a534 Iustin Pop
~~~~~~~
641 6d81475c Iustin Pop
642 c8e0a534 Iustin Pop
Returns the cluster tags.
643 6d81475c Iustin Pop
644 c8e0a534 Iustin Pop
Example::
645 6d81475c Iustin Pop
646 c8e0a534 Iustin Pop
    ["tag1", "tag2", "tag3"]
647 6d81475c Iustin Pop
648 c8e0a534 Iustin Pop
``PUT``
649 c8e0a534 Iustin Pop
~~~~~~~
650 6d81475c Iustin Pop
651 c8e0a534 Iustin Pop
Adds a set of tags.
652 6d81475c Iustin Pop
653 c8e0a534 Iustin Pop
The request as a list of strings should be PUT to this URI. The result
654 c8e0a534 Iustin Pop
will be a job id.
655 6d81475c Iustin Pop
656 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
657 2cad4b91 Iustin Pop
658 2cad4b91 Iustin Pop
659 c8e0a534 Iustin Pop
``DELETE``
660 c8e0a534 Iustin Pop
~~~~~~~~~~
661 6d81475c Iustin Pop
662 c8e0a534 Iustin Pop
Deletes tags.
663 6d81475c Iustin Pop
664 c8e0a534 Iustin Pop
In order to delete a set of tags, the DELETE request should be
665 c8e0a534 Iustin Pop
addressed to URI like::
666 6d81475c Iustin Pop
667 c8e0a534 Iustin Pop
    /tags?tag=[tag]&tag=[tag]
668 6d81475c Iustin Pop
669 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
670 2cad4b91 Iustin Pop
671 2cad4b91 Iustin Pop
672 c8e0a534 Iustin Pop
``/version``
673 c8e0a534 Iustin Pop
++++++++++++
674 6d81475c Iustin Pop
675 c8e0a534 Iustin Pop
The version resource.
676 6d81475c Iustin Pop
677 c8e0a534 Iustin Pop
This resource should be used to determine the remote API version and
678 c8e0a534 Iustin Pop
to adapt clients accordingly.
679 6d81475c Iustin Pop
680 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
681 6d81475c Iustin Pop
682 c8e0a534 Iustin Pop
``GET``
683 c8e0a534 Iustin Pop
~~~~~~~
684 6d81475c Iustin Pop
685 c8e0a534 Iustin Pop
Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti
686 c8e0a534 Iustin Pop
2.0 returns ``2``.