Statistics
| Branch: | Tag: | Revision:

root / doc / rapi.rst @ 558fd122

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 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 508e9b20 Michael Hanselmann
194 508e9b20 Michael Hanselmann
``/2/redistribute-config``
195 508e9b20 Michael Hanselmann
++++++++++++++++++++++++++
196 508e9b20 Michael Hanselmann
197 508e9b20 Michael Hanselmann
Redistribute configuration to all nodes.
198 508e9b20 Michael Hanselmann
199 508e9b20 Michael Hanselmann
It supports the following commands: ``PUT``.
200 508e9b20 Michael Hanselmann
201 508e9b20 Michael Hanselmann
``PUT``
202 508e9b20 Michael Hanselmann
~~~~~~~
203 508e9b20 Michael Hanselmann
204 508e9b20 Michael Hanselmann
Redistribute configuration to all nodes. The result will be a job id.
205 508e9b20 Michael Hanselmann
206 508e9b20 Michael Hanselmann
207 c8e0a534 Iustin Pop
``/2/instances``
208 c8e0a534 Iustin Pop
++++++++++++++++
209 6d81475c Iustin Pop
210 c8e0a534 Iustin Pop
The instances resource.
211 6d81475c Iustin Pop
212 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``POST``.
213 6d81475c Iustin Pop
214 c8e0a534 Iustin Pop
``GET``
215 c8e0a534 Iustin Pop
~~~~~~~
216 6d81475c Iustin Pop
217 c8e0a534 Iustin Pop
Returns a list of all available instances.
218 6d81475c Iustin Pop
219 c8e0a534 Iustin Pop
Example::
220 6d81475c Iustin Pop
221 6d81475c Iustin Pop
    [
222 6d81475c Iustin Pop
      {
223 6d81475c Iustin Pop
        "name": "web.example.com",
224 6d81475c Iustin Pop
        "uri": "\/instances\/web.example.com"
225 6d81475c Iustin Pop
      },
226 6d81475c Iustin Pop
      {
227 6d81475c Iustin Pop
        "name": "mail.example.com",
228 6d81475c Iustin Pop
        "uri": "\/instances\/mail.example.com"
229 6d81475c Iustin Pop
      }
230 6d81475c Iustin Pop
    ]
231 6d81475c Iustin Pop
232 c8e0a534 Iustin Pop
If the optional *bulk* argument is provided and set to a true value
233 c8e0a534 Iustin Pop
(i.e ``?bulk=1``), the output contains detailed information about
234 c8e0a534 Iustin Pop
instances as a list.
235 6d81475c Iustin Pop
236 c8e0a534 Iustin Pop
Example::
237 6d81475c Iustin Pop
238 6d81475c Iustin Pop
    [
239 6d81475c Iustin Pop
      {
240 6d81475c Iustin Pop
         "status": "running",
241 6d81475c Iustin Pop
         "disk_usage": 20480,
242 6d81475c Iustin Pop
         "nic.bridges": [
243 6d81475c Iustin Pop
           "xen-br0"
244 6d81475c Iustin Pop
          ],
245 6d81475c Iustin Pop
         "name": "web.example.com",
246 6d81475c Iustin Pop
         "tags": ["tag1", "tag2"],
247 6d81475c Iustin Pop
         "beparams": {
248 6d81475c Iustin Pop
           "vcpus": 2,
249 6d81475c Iustin Pop
           "memory": 512
250 6d81475c Iustin Pop
         },
251 6d81475c Iustin Pop
         "disk.sizes": [
252 6d81475c Iustin Pop
             20480
253 6d81475c Iustin Pop
         ],
254 6d81475c Iustin Pop
         "pnode": "node1.example.com",
255 6d81475c Iustin Pop
         "nic.macs": ["01:23:45:67:89:01"],
256 6d81475c Iustin Pop
         "snodes": ["node2.example.com"],
257 6d81475c Iustin Pop
         "disk_template": "drbd",
258 6d81475c Iustin Pop
         "admin_state": true,
259 6d81475c Iustin Pop
         "os": "debian-etch",
260 6d81475c Iustin Pop
         "oper_state": true
261 6d81475c Iustin Pop
      },
262 6d81475c Iustin Pop
      ...
263 6d81475c Iustin Pop
    ]
264 6d81475c Iustin Pop
265 6d81475c Iustin Pop
266 c8e0a534 Iustin Pop
``POST``
267 c8e0a534 Iustin Pop
~~~~~~~~
268 6d81475c Iustin Pop
269 c8e0a534 Iustin Pop
Creates an instance.
270 6d81475c Iustin Pop
271 2cad4b91 Iustin Pop
If the optional *dry-run* argument is provided and set to a positive
272 2cad4b91 Iustin Pop
integer valu (e.g. ``?dry-run=1``), the job will not be actually
273 2cad4b91 Iustin Pop
executed, only the pre-execution checks will be done. Query-ing the
274 2cad4b91 Iustin Pop
job result will return, in both dry-run and normal case, the list of
275 2cad4b91 Iustin Pop
nodes selected for the instance.
276 2cad4b91 Iustin Pop
277 c8e0a534 Iustin Pop
Returns: a job ID that can be used later for polling.
278 6d81475c Iustin Pop
279 c8e0a534 Iustin Pop
``/2/instances/[instance_name]``
280 c8e0a534 Iustin Pop
++++++++++++++++++++++++++++++++
281 6d81475c Iustin Pop
282 c8e0a534 Iustin Pop
Instance-specific resource.
283 6d81475c Iustin Pop
284 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``DELETE``.
285 6d81475c Iustin Pop
286 c8e0a534 Iustin Pop
``GET``
287 c8e0a534 Iustin Pop
~~~~~~~
288 6d81475c Iustin Pop
289 c8e0a534 Iustin Pop
Returns information about an instance, similar to the bulk output from
290 c8e0a534 Iustin Pop
the instance list.
291 6d81475c Iustin Pop
292 c8e0a534 Iustin Pop
``DELETE``
293 c8e0a534 Iustin Pop
~~~~~~~~~~
294 6d81475c Iustin Pop
295 c8e0a534 Iustin Pop
Deletes an instance.
296 6d81475c Iustin Pop
297 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
298 2cad4b91 Iustin Pop
299 6d81475c Iustin Pop
300 d8260842 Michael Hanselmann
``/2/instances/[instance_name]/info``
301 d8260842 Michael Hanselmann
+++++++++++++++++++++++++++++++++++++++
302 d8260842 Michael Hanselmann
303 d8260842 Michael Hanselmann
It supports the following commands: ``GET``.
304 d8260842 Michael Hanselmann
305 d8260842 Michael Hanselmann
``GET``
306 d8260842 Michael Hanselmann
~~~~~~~
307 d8260842 Michael Hanselmann
308 d8260842 Michael Hanselmann
Requests detailed information about the instance. An optional parameter,
309 d8260842 Michael Hanselmann
``static`` (bool), can be set to return only static information from the
310 d8260842 Michael Hanselmann
configuration without querying the instance's nodes. The result will be a job
311 d8260842 Michael Hanselmann
id.
312 d8260842 Michael Hanselmann
313 d8260842 Michael Hanselmann
314 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/reboot``
315 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++++++++++++
316 6d81475c Iustin Pop
317 c8e0a534 Iustin Pop
Reboots URI for an instance.
318 6d81475c Iustin Pop
319 c8e0a534 Iustin Pop
It supports the following commands: ``POST``.
320 6d81475c Iustin Pop
321 c8e0a534 Iustin Pop
``POST``
322 c8e0a534 Iustin Pop
~~~~~~~~
323 6d81475c Iustin Pop
324 c8e0a534 Iustin Pop
Reboots the instance.
325 6d81475c Iustin Pop
326 c8e0a534 Iustin Pop
The URI takes optional ``type=hard|soft|full`` and
327 c8e0a534 Iustin Pop
``ignore_secondaries=False|True`` parameters.
328 6d81475c Iustin Pop
329 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
330 2cad4b91 Iustin Pop
331 2cad4b91 Iustin Pop
332 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/shutdown``
333 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++++++++++++++
334 6d81475c Iustin Pop
335 c8e0a534 Iustin Pop
Instance shutdown URI.
336 6d81475c Iustin Pop
337 c8e0a534 Iustin Pop
It supports the following commands: ``PUT``.
338 6d81475c Iustin Pop
339 c8e0a534 Iustin Pop
``PUT``
340 c8e0a534 Iustin Pop
~~~~~~~
341 6d81475c Iustin Pop
342 c8e0a534 Iustin Pop
Shutdowns an instance.
343 6d81475c Iustin Pop
344 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
345 2cad4b91 Iustin Pop
346 6d81475c Iustin Pop
347 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/startup``
348 c8e0a534 Iustin Pop
++++++++++++++++++++++++++++++++++++++++
349 6d81475c Iustin Pop
350 c8e0a534 Iustin Pop
Instance startup URI.
351 6d81475c Iustin Pop
352 c8e0a534 Iustin Pop
It supports the following commands: ``PUT``.
353 6d81475c Iustin Pop
354 c8e0a534 Iustin Pop
``PUT``
355 c8e0a534 Iustin Pop
~~~~~~~
356 6d81475c Iustin Pop
357 c8e0a534 Iustin Pop
Startup an instance.
358 6d81475c Iustin Pop
359 c8e0a534 Iustin Pop
The URI takes an optional ``force=False|True`` parameter to start the
360 c8e0a534 Iustin Pop
instance if even if secondary disks are failing.
361 6d81475c Iustin Pop
362 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
363 2cad4b91 Iustin Pop
364 f72542cc Michael Hanselmann
``/2/instances/[instance_name]/reinstall``
365 f72542cc Michael Hanselmann
++++++++++++++++++++++++++++++++++++++++++++++
366 f72542cc Michael Hanselmann
367 f72542cc Michael Hanselmann
Installs the operating system again.
368 f72542cc Michael Hanselmann
369 f72542cc Michael Hanselmann
It supports the following commands: ``POST``.
370 f72542cc Michael Hanselmann
371 f72542cc Michael Hanselmann
``POST``
372 f72542cc Michael Hanselmann
~~~~~~~~
373 f72542cc Michael Hanselmann
374 f72542cc Michael Hanselmann
Takes the parameters ``os`` (OS template name) and ``nostartup`` (bool).
375 f72542cc Michael Hanselmann
376 2cad4b91 Iustin Pop
377 4c98b915 Michael Hanselmann
``/2/instances/[instance_name]/replace-disks``
378 4c98b915 Michael Hanselmann
++++++++++++++++++++++++++++++++++++++++++++++
379 4c98b915 Michael Hanselmann
380 4c98b915 Michael Hanselmann
Replaces disks on an instance.
381 4c98b915 Michael Hanselmann
382 4c98b915 Michael Hanselmann
It supports the following commands: ``POST``.
383 4c98b915 Michael Hanselmann
384 4c98b915 Michael Hanselmann
``POST``
385 4c98b915 Michael Hanselmann
~~~~~~~~
386 4c98b915 Michael Hanselmann
387 4c98b915 Michael Hanselmann
Takes the parameters ``mode`` (one of ``replace_on_primary``,
388 4c98b915 Michael Hanselmann
``replace_on_secondary``, ``replace_new_secondary`` or ``replace_auto``),
389 4c98b915 Michael Hanselmann
``disks`` (comma separated list of disk indexes), ``remote_node`` and
390 4c98b915 Michael Hanselmann
``iallocator``.
391 4c98b915 Michael Hanselmann
392 4c98b915 Michael Hanselmann
393 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/tags``
394 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++++++++++
395 6d81475c Iustin Pop
396 c8e0a534 Iustin Pop
Manages per-instance tags.
397 6d81475c Iustin Pop
398 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
399 6d81475c Iustin Pop
400 c8e0a534 Iustin Pop
``GET``
401 c8e0a534 Iustin Pop
~~~~~~~
402 6d81475c Iustin Pop
403 c8e0a534 Iustin Pop
Returns a list of tags.
404 6d81475c Iustin Pop
405 c8e0a534 Iustin Pop
Example::
406 6d81475c Iustin Pop
407 c8e0a534 Iustin Pop
    ["tag1", "tag2", "tag3"]
408 6d81475c Iustin Pop
409 c8e0a534 Iustin Pop
``PUT``
410 c8e0a534 Iustin Pop
~~~~~~~
411 6d81475c Iustin Pop
412 c8e0a534 Iustin Pop
Add a set of tags.
413 6d81475c Iustin Pop
414 c8e0a534 Iustin Pop
The request as a list of strings should be ``PUT`` to this URI. The
415 508e9b20 Michael Hanselmann
result will be a job id.
416 6d81475c Iustin Pop
417 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
418 2cad4b91 Iustin Pop
419 2cad4b91 Iustin Pop
420 c8e0a534 Iustin Pop
``DELETE``
421 c8e0a534 Iustin Pop
~~~~~~~~~~
422 6d81475c Iustin Pop
423 c8e0a534 Iustin Pop
Delete a tag.
424 6d81475c Iustin Pop
425 c8e0a534 Iustin Pop
In order to delete a set of tags, the DELETE request should be
426 c8e0a534 Iustin Pop
addressed to URI like::
427 6d81475c Iustin Pop
428 c8e0a534 Iustin Pop
    /tags?tag=[tag]&tag=[tag]
429 6d81475c Iustin Pop
430 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
431 2cad4b91 Iustin Pop
432 2cad4b91 Iustin Pop
433 c8e0a534 Iustin Pop
``/2/jobs``
434 c8e0a534 Iustin Pop
+++++++++++
435 6d81475c Iustin Pop
436 c8e0a534 Iustin Pop
The ``/2/jobs`` resource.
437 6d81475c Iustin Pop
438 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
439 6d81475c Iustin Pop
440 c8e0a534 Iustin Pop
``GET``
441 c8e0a534 Iustin Pop
~~~~~~~
442 6d81475c Iustin Pop
443 c8e0a534 Iustin Pop
Returns a dictionary of jobs.
444 6d81475c Iustin Pop
445 c8e0a534 Iustin Pop
Returns: a dictionary with jobs id and uri.
446 6d81475c Iustin Pop
447 c8e0a534 Iustin Pop
``/2/jobs/[job_id]``
448 c8e0a534 Iustin Pop
++++++++++++++++++++
449 6d81475c Iustin Pop
450 6d81475c Iustin Pop
451 c8e0a534 Iustin Pop
Individual job URI.
452 6d81475c Iustin Pop
453 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``DELETE``.
454 6d81475c Iustin Pop
455 c8e0a534 Iustin Pop
``GET``
456 c8e0a534 Iustin Pop
~~~~~~~
457 6d81475c Iustin Pop
458 c8e0a534 Iustin Pop
Returns a job status.
459 6d81475c Iustin Pop
460 c8e0a534 Iustin Pop
Returns: a dictionary with job parameters.
461 6d81475c Iustin Pop
462 c8e0a534 Iustin Pop
The result includes:
463 6d81475c Iustin Pop
464 c8e0a534 Iustin Pop
- id: job ID as a number
465 c8e0a534 Iustin Pop
- status: current job status as a string
466 c8e0a534 Iustin Pop
- ops: involved OpCodes as a list of dictionaries for each
467 c8e0a534 Iustin Pop
  opcodes in the job
468 c8e0a534 Iustin Pop
- opstatus: OpCodes status as a list
469 c8e0a534 Iustin Pop
- opresult: OpCodes results as a list of lists
470 6d81475c Iustin Pop
471 c8e0a534 Iustin Pop
``DELETE``
472 c8e0a534 Iustin Pop
~~~~~~~~~~
473 6d81475c Iustin Pop
474 c8e0a534 Iustin Pop
Cancel a not-yet-started job.
475 6d81475c Iustin Pop
476 c8e0a534 Iustin Pop
``/2/nodes``
477 c8e0a534 Iustin Pop
++++++++++++
478 6d81475c Iustin Pop
479 c8e0a534 Iustin Pop
Nodes resource.
480 6d81475c Iustin Pop
481 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
482 6d81475c Iustin Pop
483 c8e0a534 Iustin Pop
``GET``
484 c8e0a534 Iustin Pop
~~~~~~~
485 6d81475c Iustin Pop
486 c8e0a534 Iustin Pop
Returns a list of all nodes.
487 6d81475c Iustin Pop
488 c8e0a534 Iustin Pop
Example::
489 6d81475c Iustin Pop
490 6d81475c Iustin Pop
    [
491 6d81475c Iustin Pop
      {
492 6d81475c Iustin Pop
        "id": "node1.example.com",
493 6d81475c Iustin Pop
        "uri": "\/instances\/node1.example.com"
494 6d81475c Iustin Pop
      },
495 6d81475c Iustin Pop
      {
496 6d81475c Iustin Pop
        "id": "node2.example.com",
497 6d81475c Iustin Pop
        "uri": "\/instances\/node2.example.com"
498 6d81475c Iustin Pop
      }
499 6d81475c Iustin Pop
    ]
500 6d81475c Iustin Pop
501 c8e0a534 Iustin Pop
If the optional 'bulk' argument is provided and set to 'true' value
502 c8e0a534 Iustin Pop
(i.e '?bulk=1'), the output contains detailed information about nodes
503 c8e0a534 Iustin Pop
as a list.
504 6d81475c Iustin Pop
505 c8e0a534 Iustin Pop
Example::
506 6d81475c Iustin Pop
507 6d81475c Iustin Pop
    [
508 6d81475c Iustin Pop
      {
509 6d81475c Iustin Pop
        "pinst_cnt": 1,
510 6d81475c Iustin Pop
        "mfree": 31280,
511 6d81475c Iustin Pop
        "mtotal": 32763,
512 6d81475c Iustin Pop
        "name": "www.example.com",
513 6d81475c Iustin Pop
        "tags": [],
514 6d81475c Iustin Pop
        "mnode": 512,
515 6d81475c Iustin Pop
        "dtotal": 5246208,
516 6d81475c Iustin Pop
        "sinst_cnt": 2,
517 6d81475c Iustin Pop
        "dfree": 5171712,
518 6d81475c Iustin Pop
        "offline": false
519 6d81475c Iustin Pop
      },
520 6d81475c Iustin Pop
      ...
521 6d81475c Iustin Pop
    ]
522 6d81475c Iustin Pop
523 f72542cc Michael Hanselmann
``/2/nodes/[node_name]``
524 f72542cc Michael Hanselmann
+++++++++++++++++++++++++++++++++
525 f72542cc Michael Hanselmann
526 f72542cc Michael Hanselmann
Returns information about a node.
527 f72542cc Michael Hanselmann
528 f72542cc Michael Hanselmann
It supports the following commands: ``GET``.
529 f72542cc Michael Hanselmann
530 73452f12 Michael Hanselmann
``/2/nodes/[node_name]/evacuate``
531 73452f12 Michael Hanselmann
+++++++++++++++++++++++++++++++++
532 73452f12 Michael Hanselmann
533 73452f12 Michael Hanselmann
Evacuates all secondary instances off a node.
534 73452f12 Michael Hanselmann
535 73452f12 Michael Hanselmann
It supports the following commands: ``POST``.
536 73452f12 Michael Hanselmann
537 73452f12 Michael Hanselmann
``POST``
538 73452f12 Michael Hanselmann
~~~~~~~~
539 73452f12 Michael Hanselmann
540 73452f12 Michael Hanselmann
To evacuate a node, either one of the ``iallocator`` or ``remote_node``
541 73452f12 Michael Hanselmann
parameters must be passed:
542 73452f12 Michael Hanselmann
543 73452f12 Michael Hanselmann
    evacuate?iallocator=[iallocator]
544 73452f12 Michael Hanselmann
    evacuate?remote_node=[nodeX.example.com]
545 73452f12 Michael Hanselmann
546 1c482bab Michael Hanselmann
``/2/nodes/[node_name]/migrate``
547 1c482bab Michael Hanselmann
+++++++++++++++++++++++++++++++++
548 1c482bab Michael Hanselmann
549 1c482bab Michael Hanselmann
Migrates all primary instances from a node.
550 1c482bab Michael Hanselmann
551 1c482bab Michael Hanselmann
It supports the following commands: ``POST``.
552 1c482bab Michael Hanselmann
553 1c482bab Michael Hanselmann
``POST``
554 1c482bab Michael Hanselmann
~~~~~~~~
555 1c482bab Michael Hanselmann
556 1c482bab Michael Hanselmann
No parameters are required, but ``live`` can be set to a boolean value.
557 1c482bab Michael Hanselmann
558 1c482bab Michael Hanselmann
    migrate?live=[0|1]
559 1c482bab Michael Hanselmann
560 64dae8fc Michael Hanselmann
``/2/nodes/[node_name]/role``
561 64dae8fc Michael Hanselmann
+++++++++++++++++++++++++++++
562 64dae8fc Michael Hanselmann
563 64dae8fc Michael Hanselmann
Manages node role.
564 64dae8fc Michael Hanselmann
565 64dae8fc Michael Hanselmann
It supports the following commands: ``GET``, ``PUT``.
566 64dae8fc Michael Hanselmann
567 64dae8fc Michael Hanselmann
The role is always one of the following:
568 64dae8fc Michael Hanselmann
569 64dae8fc Michael Hanselmann
  - drained
570 64dae8fc Michael Hanselmann
  - master
571 64dae8fc Michael Hanselmann
  - master-candidate
572 64dae8fc Michael Hanselmann
  - offline
573 64dae8fc Michael Hanselmann
  - regular
574 64dae8fc Michael Hanselmann
575 64dae8fc Michael Hanselmann
``GET``
576 64dae8fc Michael Hanselmann
~~~~~~~
577 64dae8fc Michael Hanselmann
578 64dae8fc Michael Hanselmann
Returns the current node role.
579 64dae8fc Michael Hanselmann
580 64dae8fc Michael Hanselmann
Example::
581 64dae8fc Michael Hanselmann
582 64dae8fc Michael Hanselmann
    "master-candidate"
583 64dae8fc Michael Hanselmann
584 64dae8fc Michael Hanselmann
``PUT``
585 64dae8fc Michael Hanselmann
~~~~~~~
586 64dae8fc Michael Hanselmann
587 64dae8fc Michael Hanselmann
Change the node role.
588 64dae8fc Michael Hanselmann
589 64dae8fc Michael Hanselmann
The request is a string which should be PUT to this URI. The result will be a
590 64dae8fc Michael Hanselmann
job id.
591 64dae8fc Michael Hanselmann
592 64dae8fc Michael Hanselmann
It supports the ``force`` argument.
593 64dae8fc Michael Hanselmann
594 7a95a954 Michael Hanselmann
``/2/nodes/[node_name]/storage``
595 7a95a954 Michael Hanselmann
++++++++++++++++++++++++++++++++
596 7a95a954 Michael Hanselmann
597 7a95a954 Michael Hanselmann
Manages storage units on the node.
598 7a95a954 Michael Hanselmann
599 7a95a954 Michael Hanselmann
``GET``
600 7a95a954 Michael Hanselmann
~~~~~~~
601 7a95a954 Michael Hanselmann
602 7a95a954 Michael Hanselmann
Requests a list of storage units on a node. Requires the parameters
603 7a95a954 Michael Hanselmann
``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``) and
604 7a95a954 Michael Hanselmann
``output_fields``. The result will be a job id, using which the result can be
605 7a95a954 Michael Hanselmann
retrieved.
606 7a95a954 Michael Hanselmann
607 1e82bc80 Michael Hanselmann
``/2/nodes/[node_name]/storage/modify``
608 1e82bc80 Michael Hanselmann
+++++++++++++++++++++++++++++++++++++++
609 1e82bc80 Michael Hanselmann
610 1e82bc80 Michael Hanselmann
Modifies storage units on the node.
611 1e82bc80 Michael Hanselmann
612 1e82bc80 Michael Hanselmann
``PUT``
613 1e82bc80 Michael Hanselmann
~~~~~~~
614 1e82bc80 Michael Hanselmann
615 1e82bc80 Michael Hanselmann
Modifies parameters of storage units on the node. Requires the parameters
616 1e82bc80 Michael Hanselmann
``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``) and ``name`` (name
617 1e82bc80 Michael Hanselmann
of the storage unit).  Parameters can be passed additionally. Currently only
618 1e82bc80 Michael Hanselmann
``allocatable`` (bool) is supported. The result will be a job id.
619 1e82bc80 Michael Hanselmann
620 723f4565 Michael Hanselmann
``/2/nodes/[node_name]/storage/repair``
621 723f4565 Michael Hanselmann
+++++++++++++++++++++++++++++++++++++++
622 723f4565 Michael Hanselmann
623 723f4565 Michael Hanselmann
Repairs a storage unit on the node.
624 723f4565 Michael Hanselmann
625 723f4565 Michael Hanselmann
``PUT``
626 723f4565 Michael Hanselmann
~~~~~~~
627 723f4565 Michael Hanselmann
628 723f4565 Michael Hanselmann
Repairs a storage unit on the node. Requires the parameters ``storage_type``
629 723f4565 Michael Hanselmann
(currently only ``lvm-vg`` can be repaired) and ``name`` (name of the storage
630 723f4565 Michael Hanselmann
unit). The result will be a job id.
631 723f4565 Michael Hanselmann
632 c8e0a534 Iustin Pop
``/2/nodes/[node_name]/tags``
633 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++
634 6d81475c Iustin Pop
635 c8e0a534 Iustin Pop
Manages per-node 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 a list of 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
Add 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 c8e0a534 Iustin Pop
``DELETE``
659 c8e0a534 Iustin Pop
~~~~~~~~~~
660 6d81475c Iustin Pop
661 c8e0a534 Iustin Pop
Deletes tags.
662 6d81475c Iustin Pop
663 c8e0a534 Iustin Pop
In order to delete a set of tags, the DELETE request should be
664 c8e0a534 Iustin Pop
addressed to URI like::
665 6d81475c Iustin Pop
666 c8e0a534 Iustin Pop
    /tags?tag=[tag]&tag=[tag]
667 6d81475c Iustin Pop
668 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
669 2cad4b91 Iustin Pop
670 2cad4b91 Iustin Pop
671 c8e0a534 Iustin Pop
``/2/os``
672 c8e0a534 Iustin Pop
+++++++++
673 6d81475c Iustin Pop
674 c8e0a534 Iustin Pop
OS resource.
675 6d81475c Iustin Pop
676 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
677 6d81475c Iustin Pop
678 c8e0a534 Iustin Pop
``GET``
679 c8e0a534 Iustin Pop
~~~~~~~
680 6d81475c Iustin Pop
681 c8e0a534 Iustin Pop
Return a list of all OSes.
682 6d81475c Iustin Pop
683 c8e0a534 Iustin Pop
Can return error 500 in case of a problem. Since this is a costly
684 c8e0a534 Iustin Pop
operation for Ganeti 2.0, it is not recommended to execute it too
685 c8e0a534 Iustin Pop
often.
686 6d81475c Iustin Pop
687 c8e0a534 Iustin Pop
Example::
688 6d81475c Iustin Pop
689 c8e0a534 Iustin Pop
    ["debian-etch"]
690 6d81475c Iustin Pop
691 c8e0a534 Iustin Pop
``/2/tags``
692 c8e0a534 Iustin Pop
+++++++++++
693 6d81475c Iustin Pop
694 c8e0a534 Iustin Pop
Manages cluster tags.
695 6d81475c Iustin Pop
696 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
697 6d81475c Iustin Pop
698 c8e0a534 Iustin Pop
``GET``
699 c8e0a534 Iustin Pop
~~~~~~~
700 6d81475c Iustin Pop
701 c8e0a534 Iustin Pop
Returns the cluster tags.
702 6d81475c Iustin Pop
703 c8e0a534 Iustin Pop
Example::
704 6d81475c Iustin Pop
705 c8e0a534 Iustin Pop
    ["tag1", "tag2", "tag3"]
706 6d81475c Iustin Pop
707 c8e0a534 Iustin Pop
``PUT``
708 c8e0a534 Iustin Pop
~~~~~~~
709 6d81475c Iustin Pop
710 c8e0a534 Iustin Pop
Adds a set of tags.
711 6d81475c Iustin Pop
712 c8e0a534 Iustin Pop
The request as a list of strings should be PUT to this URI. The result
713 c8e0a534 Iustin Pop
will be a job id.
714 6d81475c Iustin Pop
715 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
716 2cad4b91 Iustin Pop
717 2cad4b91 Iustin Pop
718 c8e0a534 Iustin Pop
``DELETE``
719 c8e0a534 Iustin Pop
~~~~~~~~~~
720 6d81475c Iustin Pop
721 c8e0a534 Iustin Pop
Deletes tags.
722 6d81475c Iustin Pop
723 c8e0a534 Iustin Pop
In order to delete a set of tags, the DELETE request should be
724 c8e0a534 Iustin Pop
addressed to URI like::
725 6d81475c Iustin Pop
726 c8e0a534 Iustin Pop
    /tags?tag=[tag]&tag=[tag]
727 6d81475c Iustin Pop
728 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
729 2cad4b91 Iustin Pop
730 2cad4b91 Iustin Pop
731 c8e0a534 Iustin Pop
``/version``
732 c8e0a534 Iustin Pop
++++++++++++
733 6d81475c Iustin Pop
734 c8e0a534 Iustin Pop
The version resource.
735 6d81475c Iustin Pop
736 c8e0a534 Iustin Pop
This resource should be used to determine the remote API version and
737 c8e0a534 Iustin Pop
to adapt clients accordingly.
738 6d81475c Iustin Pop
739 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
740 6d81475c Iustin Pop
741 c8e0a534 Iustin Pop
``GET``
742 c8e0a534 Iustin Pop
~~~~~~~
743 6d81475c Iustin Pop
744 c8e0a534 Iustin Pop
Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti
745 c8e0a534 Iustin Pop
2.0 returns ``2``.
746 558fd122 Michael Hanselmann
747 558fd122 Michael Hanselmann
.. vim: set textwidth=72 :