Statistics
| Branch: | Tag: | Revision:

root / doc / rapi.rst @ b76aac08

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