Statistics
| Branch: | Tag: | Revision:

root / doc / rapi.rst @ 2cad4b91

History | View | Annotate | Download (10.4 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 4352bf6d Iustin Pop
Usage examples
54 4352bf6d Iustin Pop
--------------
55 4352bf6d Iustin Pop
56 4352bf6d Iustin Pop
You can access the API using your favorite programming language as
57 4352bf6d Iustin Pop
long as it supports network connections.
58 4352bf6d Iustin Pop
59 4352bf6d Iustin Pop
Shell
60 4352bf6d Iustin Pop
+++++
61 4352bf6d Iustin Pop
62 c8e0a534 Iustin Pop
.. highlight:: sh
63 c8e0a534 Iustin Pop
64 4352bf6d Iustin Pop
Using wget::
65 4352bf6d Iustin Pop
66 c8e0a534 Iustin Pop
   wget -q -O - https://CLUSTERNAME:5080/2/info
67 4352bf6d Iustin Pop
68 4352bf6d Iustin Pop
or curl::
69 4352bf6d Iustin Pop
70 4352bf6d Iustin Pop
  curl https://CLUSTERNAME:5080/2/info
71 4352bf6d Iustin Pop
72 4352bf6d Iustin Pop
73 4352bf6d Iustin Pop
Python
74 4352bf6d Iustin Pop
++++++
75 4352bf6d Iustin Pop
76 c8e0a534 Iustin Pop
.. highlight: python
77 4352bf6d Iustin Pop
78 4352bf6d Iustin Pop
  import urllib2
79 4fb301b5 Tim Boring
  f = urllib2.urlopen('https://CLUSTERNAME:5080/2/info')
80 4352bf6d Iustin Pop
  print f.read()
81 4352bf6d Iustin Pop
82 4352bf6d Iustin Pop
83 4352bf6d Iustin Pop
JavaScript
84 4352bf6d Iustin Pop
++++++++++
85 4352bf6d Iustin Pop
86 2cad4b91 Iustin Pop
.. warning:: While it's possible to use JavaScript, it poses several
87 2cad4b91 Iustin Pop
  potential problems, including browser blocking request due to
88 2cad4b91 Iustin Pop
  non-standard ports or different domain names. Fetching the data on
89 2cad4b91 Iustin Pop
  the webserver is easier.
90 4352bf6d Iustin Pop
91 c8e0a534 Iustin Pop
.. highlight:: javascript
92 c8e0a534 Iustin Pop
93 4352bf6d Iustin Pop
::
94 4352bf6d Iustin Pop
95 4fb301b5 Tim Boring
  var url = 'https://CLUSTERNAME:5080/2/info';
96 4352bf6d Iustin Pop
  var info;
97 4352bf6d Iustin Pop
  var xmlreq = new XMLHttpRequest();
98 4352bf6d Iustin Pop
  xmlreq.onreadystatechange = function () {
99 4352bf6d Iustin Pop
    if (xmlreq.readyState != 4) return;
100 4352bf6d Iustin Pop
    if (xmlreq.status == 200) {
101 4352bf6d Iustin Pop
      info = eval("(" + xmlreq.responseText + ")");
102 4352bf6d Iustin Pop
      alert(info);
103 4352bf6d Iustin Pop
    } else {
104 4352bf6d Iustin Pop
      alert('Error fetching cluster info');
105 4352bf6d Iustin Pop
    }
106 4352bf6d Iustin Pop
    xmlreq = null;
107 4352bf6d Iustin Pop
  };
108 4352bf6d Iustin Pop
  xmlreq.open('GET', url, true);
109 4352bf6d Iustin Pop
  xmlreq.send(null);
110 4352bf6d Iustin Pop
111 4352bf6d Iustin Pop
Resources
112 4352bf6d Iustin Pop
---------
113 4352bf6d Iustin Pop
114 c8e0a534 Iustin Pop
.. highlight:: javascript
115 6d81475c Iustin Pop
116 c8e0a534 Iustin Pop
``/``
117 c8e0a534 Iustin Pop
+++++
118 6d81475c Iustin Pop
119 c8e0a534 Iustin Pop
The root resource.
120 6d81475c Iustin Pop
121 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
122 6d81475c Iustin Pop
123 c8e0a534 Iustin Pop
``GET``
124 c8e0a534 Iustin Pop
~~~~~~~
125 6d81475c Iustin Pop
126 c8e0a534 Iustin Pop
Shows the list of mapped resources.
127 6d81475c Iustin Pop
128 c8e0a534 Iustin Pop
Returns: a dictionary with 'name' and 'uri' keys for each of them.
129 6d81475c Iustin Pop
130 c8e0a534 Iustin Pop
``/2``
131 c8e0a534 Iustin Pop
++++++
132 6d81475c Iustin Pop
133 c8e0a534 Iustin Pop
The ``/2`` resource, the root of the version 2 API.
134 6d81475c Iustin Pop
135 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
136 6d81475c Iustin Pop
137 c8e0a534 Iustin Pop
``GET``
138 c8e0a534 Iustin Pop
~~~~~~~
139 6d81475c Iustin Pop
140 c8e0a534 Iustin Pop
Show the list of mapped resources.
141 6d81475c Iustin Pop
142 c8e0a534 Iustin Pop
Returns: a dictionary with ``name`` and ``uri`` keys for each of them.
143 6d81475c Iustin Pop
144 c8e0a534 Iustin Pop
``/2/info``
145 c8e0a534 Iustin Pop
+++++++++++
146 6d81475c Iustin Pop
147 c8e0a534 Iustin Pop
Cluster information resource.
148 6d81475c Iustin Pop
149 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
150 6d81475c Iustin Pop
151 c8e0a534 Iustin Pop
``GET``
152 c8e0a534 Iustin Pop
~~~~~~~
153 6d81475c Iustin Pop
154 c8e0a534 Iustin Pop
Returns cluster information.
155 6d81475c Iustin Pop
156 c8e0a534 Iustin Pop
Example::
157 6d81475c Iustin Pop
158 6d81475c Iustin Pop
  {
159 6d81475c Iustin Pop
    "config_version": 2000000,
160 6d81475c Iustin Pop
    "name": "cluster",
161 6d81475c Iustin Pop
    "software_version": "2.0.0~beta2",
162 6d81475c Iustin Pop
    "os_api_version": 10,
163 6d81475c Iustin Pop
    "export_version": 0,
164 6d81475c Iustin Pop
    "candidate_pool_size": 10,
165 6d81475c Iustin Pop
    "enabled_hypervisors": [
166 6d81475c Iustin Pop
      "fake"
167 6d81475c Iustin Pop
    ],
168 6d81475c Iustin Pop
    "hvparams": {
169 6d81475c Iustin Pop
      "fake": {}
170 6d81475c Iustin Pop
     },
171 6d81475c Iustin Pop
    "default_hypervisor": "fake",
172 6d81475c Iustin Pop
    "master": "node1.example.com",
173 6d81475c Iustin Pop
    "architecture": [
174 6d81475c Iustin Pop
      "64bit",
175 6d81475c Iustin Pop
      "x86_64"
176 6d81475c Iustin Pop
    ],
177 6d81475c Iustin Pop
    "protocol_version": 20,
178 6d81475c Iustin Pop
    "beparams": {
179 6d81475c Iustin Pop
      "default": {
180 6d81475c Iustin Pop
        "auto_balance": true,
181 6d81475c Iustin Pop
        "vcpus": 1,
182 6d81475c Iustin Pop
        "memory": 128
183 6d81475c Iustin Pop
       }
184 6d81475c Iustin Pop
      }
185 6d81475c Iustin Pop
    }
186 6d81475c Iustin Pop
187 c8e0a534 Iustin Pop
``/2/instances``
188 c8e0a534 Iustin Pop
++++++++++++++++
189 6d81475c Iustin Pop
190 c8e0a534 Iustin Pop
The instances resource.
191 6d81475c Iustin Pop
192 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``POST``.
193 6d81475c Iustin Pop
194 c8e0a534 Iustin Pop
``GET``
195 c8e0a534 Iustin Pop
~~~~~~~
196 6d81475c Iustin Pop
197 c8e0a534 Iustin Pop
Returns a list of all available instances.
198 6d81475c Iustin Pop
199 c8e0a534 Iustin Pop
Example::
200 6d81475c Iustin Pop
201 6d81475c Iustin Pop
    [
202 6d81475c Iustin Pop
      {
203 6d81475c Iustin Pop
        "name": "web.example.com",
204 6d81475c Iustin Pop
        "uri": "\/instances\/web.example.com"
205 6d81475c Iustin Pop
      },
206 6d81475c Iustin Pop
      {
207 6d81475c Iustin Pop
        "name": "mail.example.com",
208 6d81475c Iustin Pop
        "uri": "\/instances\/mail.example.com"
209 6d81475c Iustin Pop
      }
210 6d81475c Iustin Pop
    ]
211 6d81475c Iustin Pop
212 c8e0a534 Iustin Pop
If the optional *bulk* argument is provided and set to a true value
213 c8e0a534 Iustin Pop
(i.e ``?bulk=1``), the output contains detailed information about
214 c8e0a534 Iustin Pop
instances as a list.
215 6d81475c Iustin Pop
216 c8e0a534 Iustin Pop
Example::
217 6d81475c Iustin Pop
218 6d81475c Iustin Pop
    [
219 6d81475c Iustin Pop
      {
220 6d81475c Iustin Pop
         "status": "running",
221 6d81475c Iustin Pop
         "disk_usage": 20480,
222 6d81475c Iustin Pop
         "nic.bridges": [
223 6d81475c Iustin Pop
           "xen-br0"
224 6d81475c Iustin Pop
          ],
225 6d81475c Iustin Pop
         "name": "web.example.com",
226 6d81475c Iustin Pop
         "tags": ["tag1", "tag2"],
227 6d81475c Iustin Pop
         "beparams": {
228 6d81475c Iustin Pop
           "vcpus": 2,
229 6d81475c Iustin Pop
           "memory": 512
230 6d81475c Iustin Pop
         },
231 6d81475c Iustin Pop
         "disk.sizes": [
232 6d81475c Iustin Pop
             20480
233 6d81475c Iustin Pop
         ],
234 6d81475c Iustin Pop
         "pnode": "node1.example.com",
235 6d81475c Iustin Pop
         "nic.macs": ["01:23:45:67:89:01"],
236 6d81475c Iustin Pop
         "snodes": ["node2.example.com"],
237 6d81475c Iustin Pop
         "disk_template": "drbd",
238 6d81475c Iustin Pop
         "admin_state": true,
239 6d81475c Iustin Pop
         "os": "debian-etch",
240 6d81475c Iustin Pop
         "oper_state": true
241 6d81475c Iustin Pop
      },
242 6d81475c Iustin Pop
      ...
243 6d81475c Iustin Pop
    ]
244 6d81475c Iustin Pop
245 6d81475c Iustin Pop
246 c8e0a534 Iustin Pop
``POST``
247 c8e0a534 Iustin Pop
~~~~~~~~
248 6d81475c Iustin Pop
249 c8e0a534 Iustin Pop
Creates an instance.
250 6d81475c Iustin Pop
251 2cad4b91 Iustin Pop
If the optional *dry-run* argument is provided and set to a positive
252 2cad4b91 Iustin Pop
integer valu (e.g. ``?dry-run=1``), the job will not be actually
253 2cad4b91 Iustin Pop
executed, only the pre-execution checks will be done. Query-ing the
254 2cad4b91 Iustin Pop
job result will return, in both dry-run and normal case, the list of
255 2cad4b91 Iustin Pop
nodes selected for the instance.
256 2cad4b91 Iustin Pop
257 c8e0a534 Iustin Pop
Returns: a job ID that can be used later for polling.
258 6d81475c Iustin Pop
259 c8e0a534 Iustin Pop
``/2/instances/[instance_name]``
260 c8e0a534 Iustin Pop
++++++++++++++++++++++++++++++++
261 6d81475c Iustin Pop
262 c8e0a534 Iustin Pop
Instance-specific resource.
263 6d81475c Iustin Pop
264 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``DELETE``.
265 6d81475c Iustin Pop
266 c8e0a534 Iustin Pop
``GET``
267 c8e0a534 Iustin Pop
~~~~~~~
268 6d81475c Iustin Pop
269 c8e0a534 Iustin Pop
Returns information about an instance, similar to the bulk output from
270 c8e0a534 Iustin Pop
the instance list.
271 6d81475c Iustin Pop
272 c8e0a534 Iustin Pop
``DELETE``
273 c8e0a534 Iustin Pop
~~~~~~~~~~
274 6d81475c Iustin Pop
275 c8e0a534 Iustin Pop
Deletes an instance.
276 6d81475c Iustin Pop
277 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
278 2cad4b91 Iustin Pop
279 6d81475c Iustin Pop
280 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/reboot``
281 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++++++++++++
282 6d81475c Iustin Pop
283 c8e0a534 Iustin Pop
Reboots URI for an instance.
284 6d81475c Iustin Pop
285 c8e0a534 Iustin Pop
It supports the following commands: ``POST``.
286 6d81475c Iustin Pop
287 c8e0a534 Iustin Pop
``POST``
288 c8e0a534 Iustin Pop
~~~~~~~~
289 6d81475c Iustin Pop
290 c8e0a534 Iustin Pop
Reboots the instance.
291 6d81475c Iustin Pop
292 c8e0a534 Iustin Pop
The URI takes optional ``type=hard|soft|full`` and
293 c8e0a534 Iustin Pop
``ignore_secondaries=False|True`` parameters.
294 6d81475c Iustin Pop
295 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
296 2cad4b91 Iustin Pop
297 2cad4b91 Iustin Pop
298 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/shutdown``
299 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++++++++++++++
300 6d81475c Iustin Pop
301 c8e0a534 Iustin Pop
Instance shutdown URI.
302 6d81475c Iustin Pop
303 c8e0a534 Iustin Pop
It supports the following commands: ``PUT``.
304 6d81475c Iustin Pop
305 c8e0a534 Iustin Pop
``PUT``
306 c8e0a534 Iustin Pop
~~~~~~~
307 6d81475c Iustin Pop
308 c8e0a534 Iustin Pop
Shutdowns an instance.
309 6d81475c Iustin Pop
310 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
311 2cad4b91 Iustin Pop
312 6d81475c Iustin Pop
313 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/startup``
314 c8e0a534 Iustin Pop
++++++++++++++++++++++++++++++++++++++++
315 6d81475c Iustin Pop
316 c8e0a534 Iustin Pop
Instance startup URI.
317 6d81475c Iustin Pop
318 c8e0a534 Iustin Pop
It supports the following commands: ``PUT``.
319 6d81475c Iustin Pop
320 c8e0a534 Iustin Pop
``PUT``
321 c8e0a534 Iustin Pop
~~~~~~~
322 6d81475c Iustin Pop
323 c8e0a534 Iustin Pop
Startup an instance.
324 6d81475c Iustin Pop
325 c8e0a534 Iustin Pop
The URI takes an optional ``force=False|True`` parameter to start the
326 c8e0a534 Iustin Pop
instance if even if secondary disks are failing.
327 6d81475c Iustin Pop
328 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
329 2cad4b91 Iustin Pop
330 2cad4b91 Iustin Pop
331 c8e0a534 Iustin Pop
``/2/instances/[instance_name]/tags``
332 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++++++++++
333 6d81475c Iustin Pop
334 c8e0a534 Iustin Pop
Manages per-instance tags.
335 6d81475c Iustin Pop
336 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
337 6d81475c Iustin Pop
338 c8e0a534 Iustin Pop
``GET``
339 c8e0a534 Iustin Pop
~~~~~~~
340 6d81475c Iustin Pop
341 c8e0a534 Iustin Pop
Returns a list of tags.
342 6d81475c Iustin Pop
343 c8e0a534 Iustin Pop
Example::
344 6d81475c Iustin Pop
345 c8e0a534 Iustin Pop
    ["tag1", "tag2", "tag3"]
346 6d81475c Iustin Pop
347 c8e0a534 Iustin Pop
``PUT``
348 c8e0a534 Iustin Pop
~~~~~~~
349 6d81475c Iustin Pop
350 c8e0a534 Iustin Pop
Add a set of tags.
351 6d81475c Iustin Pop
352 c8e0a534 Iustin Pop
The request as a list of strings should be ``PUT`` to this URI. The
353 c8e0a534 Iustin Pop
result willl be a job id.
354 6d81475c Iustin Pop
355 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
356 2cad4b91 Iustin Pop
357 2cad4b91 Iustin Pop
358 c8e0a534 Iustin Pop
``DELETE``
359 c8e0a534 Iustin Pop
~~~~~~~~~~
360 6d81475c Iustin Pop
361 c8e0a534 Iustin Pop
Delete a tag.
362 6d81475c Iustin Pop
363 c8e0a534 Iustin Pop
In order to delete a set of tags, the DELETE request should be
364 c8e0a534 Iustin Pop
addressed to URI like::
365 6d81475c Iustin Pop
366 c8e0a534 Iustin Pop
    /tags?tag=[tag]&tag=[tag]
367 6d81475c Iustin Pop
368 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
369 2cad4b91 Iustin Pop
370 2cad4b91 Iustin Pop
371 c8e0a534 Iustin Pop
``/2/jobs``
372 c8e0a534 Iustin Pop
+++++++++++
373 6d81475c Iustin Pop
374 c8e0a534 Iustin Pop
The ``/2/jobs`` resource.
375 6d81475c Iustin Pop
376 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
377 6d81475c Iustin Pop
378 c8e0a534 Iustin Pop
``GET``
379 c8e0a534 Iustin Pop
~~~~~~~
380 6d81475c Iustin Pop
381 c8e0a534 Iustin Pop
Returns a dictionary of jobs.
382 6d81475c Iustin Pop
383 c8e0a534 Iustin Pop
Returns: a dictionary with jobs id and uri.
384 6d81475c Iustin Pop
385 c8e0a534 Iustin Pop
``/2/jobs/[job_id]``
386 c8e0a534 Iustin Pop
++++++++++++++++++++
387 6d81475c Iustin Pop
388 6d81475c Iustin Pop
389 c8e0a534 Iustin Pop
Individual job URI.
390 6d81475c Iustin Pop
391 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``DELETE``.
392 6d81475c Iustin Pop
393 c8e0a534 Iustin Pop
``GET``
394 c8e0a534 Iustin Pop
~~~~~~~
395 6d81475c Iustin Pop
396 c8e0a534 Iustin Pop
Returns a job status.
397 6d81475c Iustin Pop
398 c8e0a534 Iustin Pop
Returns: a dictionary with job parameters.
399 6d81475c Iustin Pop
400 c8e0a534 Iustin Pop
The result includes:
401 6d81475c Iustin Pop
402 c8e0a534 Iustin Pop
- id: job ID as a number
403 c8e0a534 Iustin Pop
- status: current job status as a string
404 c8e0a534 Iustin Pop
- ops: involved OpCodes as a list of dictionaries for each
405 c8e0a534 Iustin Pop
  opcodes in the job
406 c8e0a534 Iustin Pop
- opstatus: OpCodes status as a list
407 c8e0a534 Iustin Pop
- opresult: OpCodes results as a list of lists
408 6d81475c Iustin Pop
409 c8e0a534 Iustin Pop
``DELETE``
410 c8e0a534 Iustin Pop
~~~~~~~~~~
411 6d81475c Iustin Pop
412 c8e0a534 Iustin Pop
Cancel a not-yet-started job.
413 6d81475c Iustin Pop
414 c8e0a534 Iustin Pop
``/2/nodes``
415 c8e0a534 Iustin Pop
++++++++++++
416 6d81475c Iustin Pop
417 c8e0a534 Iustin Pop
Nodes resource.
418 6d81475c Iustin Pop
419 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
420 6d81475c Iustin Pop
421 c8e0a534 Iustin Pop
``GET``
422 c8e0a534 Iustin Pop
~~~~~~~
423 6d81475c Iustin Pop
424 c8e0a534 Iustin Pop
Returns a list of all nodes.
425 6d81475c Iustin Pop
426 c8e0a534 Iustin Pop
Example::
427 6d81475c Iustin Pop
428 6d81475c Iustin Pop
    [
429 6d81475c Iustin Pop
      {
430 6d81475c Iustin Pop
        "id": "node1.example.com",
431 6d81475c Iustin Pop
        "uri": "\/instances\/node1.example.com"
432 6d81475c Iustin Pop
      },
433 6d81475c Iustin Pop
      {
434 6d81475c Iustin Pop
        "id": "node2.example.com",
435 6d81475c Iustin Pop
        "uri": "\/instances\/node2.example.com"
436 6d81475c Iustin Pop
      }
437 6d81475c Iustin Pop
    ]
438 6d81475c Iustin Pop
439 c8e0a534 Iustin Pop
If the optional 'bulk' argument is provided and set to 'true' value
440 c8e0a534 Iustin Pop
(i.e '?bulk=1'), the output contains detailed information about nodes
441 c8e0a534 Iustin Pop
as a list.
442 6d81475c Iustin Pop
443 c8e0a534 Iustin Pop
Example::
444 6d81475c Iustin Pop
445 6d81475c Iustin Pop
    [
446 6d81475c Iustin Pop
      {
447 6d81475c Iustin Pop
        "pinst_cnt": 1,
448 6d81475c Iustin Pop
        "mfree": 31280,
449 6d81475c Iustin Pop
        "mtotal": 32763,
450 6d81475c Iustin Pop
        "name": "www.example.com",
451 6d81475c Iustin Pop
        "tags": [],
452 6d81475c Iustin Pop
        "mnode": 512,
453 6d81475c Iustin Pop
        "dtotal": 5246208,
454 6d81475c Iustin Pop
        "sinst_cnt": 2,
455 6d81475c Iustin Pop
        "dfree": 5171712,
456 6d81475c Iustin Pop
        "offline": false
457 6d81475c Iustin Pop
      },
458 6d81475c Iustin Pop
      ...
459 6d81475c Iustin Pop
    ]
460 6d81475c Iustin Pop
461 c8e0a534 Iustin Pop
``/2/nodes/[node_name]/tags``
462 c8e0a534 Iustin Pop
+++++++++++++++++++++++++++++
463 6d81475c Iustin Pop
464 c8e0a534 Iustin Pop
Manages per-node tags.
465 6d81475c Iustin Pop
466 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
467 6d81475c Iustin Pop
468 c8e0a534 Iustin Pop
``GET``
469 c8e0a534 Iustin Pop
~~~~~~~
470 6d81475c Iustin Pop
471 c8e0a534 Iustin Pop
Returns a list of tags.
472 6d81475c Iustin Pop
473 c8e0a534 Iustin Pop
Example::
474 6d81475c Iustin Pop
475 c8e0a534 Iustin Pop
    ["tag1", "tag2", "tag3"]
476 6d81475c Iustin Pop
477 c8e0a534 Iustin Pop
``PUT``
478 c8e0a534 Iustin Pop
~~~~~~~
479 6d81475c Iustin Pop
480 c8e0a534 Iustin Pop
Add a set of tags.
481 6d81475c Iustin Pop
482 c8e0a534 Iustin Pop
The request as a list of strings should be PUT to this URI. The result
483 c8e0a534 Iustin Pop
will be a job id.
484 6d81475c Iustin Pop
485 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
486 2cad4b91 Iustin Pop
487 c8e0a534 Iustin Pop
``DELETE``
488 c8e0a534 Iustin Pop
~~~~~~~~~~
489 6d81475c Iustin Pop
490 c8e0a534 Iustin Pop
Deletes tags.
491 6d81475c Iustin Pop
492 c8e0a534 Iustin Pop
In order to delete a set of tags, the DELETE request should be
493 c8e0a534 Iustin Pop
addressed to URI like::
494 6d81475c Iustin Pop
495 c8e0a534 Iustin Pop
    /tags?tag=[tag]&tag=[tag]
496 6d81475c Iustin Pop
497 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
498 2cad4b91 Iustin Pop
499 2cad4b91 Iustin Pop
500 c8e0a534 Iustin Pop
``/2/os``
501 c8e0a534 Iustin Pop
+++++++++
502 6d81475c Iustin Pop
503 c8e0a534 Iustin Pop
OS resource.
504 6d81475c Iustin Pop
505 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
506 6d81475c Iustin Pop
507 c8e0a534 Iustin Pop
``GET``
508 c8e0a534 Iustin Pop
~~~~~~~
509 6d81475c Iustin Pop
510 c8e0a534 Iustin Pop
Return a list of all OSes.
511 6d81475c Iustin Pop
512 c8e0a534 Iustin Pop
Can return error 500 in case of a problem. Since this is a costly
513 c8e0a534 Iustin Pop
operation for Ganeti 2.0, it is not recommended to execute it too
514 c8e0a534 Iustin Pop
often.
515 6d81475c Iustin Pop
516 c8e0a534 Iustin Pop
Example::
517 6d81475c Iustin Pop
518 c8e0a534 Iustin Pop
    ["debian-etch"]
519 6d81475c Iustin Pop
520 c8e0a534 Iustin Pop
``/2/tags``
521 c8e0a534 Iustin Pop
+++++++++++
522 6d81475c Iustin Pop
523 c8e0a534 Iustin Pop
Manages cluster tags.
524 6d81475c Iustin Pop
525 c8e0a534 Iustin Pop
It supports the following commands: ``GET``, ``PUT``, ``DELETE``.
526 6d81475c Iustin Pop
527 c8e0a534 Iustin Pop
``GET``
528 c8e0a534 Iustin Pop
~~~~~~~
529 6d81475c Iustin Pop
530 c8e0a534 Iustin Pop
Returns the cluster tags.
531 6d81475c Iustin Pop
532 c8e0a534 Iustin Pop
Example::
533 6d81475c Iustin Pop
534 c8e0a534 Iustin Pop
    ["tag1", "tag2", "tag3"]
535 6d81475c Iustin Pop
536 c8e0a534 Iustin Pop
``PUT``
537 c8e0a534 Iustin Pop
~~~~~~~
538 6d81475c Iustin Pop
539 c8e0a534 Iustin Pop
Adds a set of tags.
540 6d81475c Iustin Pop
541 c8e0a534 Iustin Pop
The request as a list of strings should be PUT to this URI. The result
542 c8e0a534 Iustin Pop
will be a job id.
543 6d81475c Iustin Pop
544 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
545 2cad4b91 Iustin Pop
546 2cad4b91 Iustin Pop
547 c8e0a534 Iustin Pop
``DELETE``
548 c8e0a534 Iustin Pop
~~~~~~~~~~
549 6d81475c Iustin Pop
550 c8e0a534 Iustin Pop
Deletes tags.
551 6d81475c Iustin Pop
552 c8e0a534 Iustin Pop
In order to delete a set of tags, the DELETE request should be
553 c8e0a534 Iustin Pop
addressed to URI like::
554 6d81475c Iustin Pop
555 c8e0a534 Iustin Pop
    /tags?tag=[tag]&tag=[tag]
556 6d81475c Iustin Pop
557 2cad4b91 Iustin Pop
It supports the ``dry-run`` argument.
558 2cad4b91 Iustin Pop
559 2cad4b91 Iustin Pop
560 c8e0a534 Iustin Pop
``/version``
561 c8e0a534 Iustin Pop
++++++++++++
562 6d81475c Iustin Pop
563 c8e0a534 Iustin Pop
The version resource.
564 6d81475c Iustin Pop
565 c8e0a534 Iustin Pop
This resource should be used to determine the remote API version and
566 c8e0a534 Iustin Pop
to adapt clients accordingly.
567 6d81475c Iustin Pop
568 c8e0a534 Iustin Pop
It supports the following commands: ``GET``.
569 6d81475c Iustin Pop
570 c8e0a534 Iustin Pop
``GET``
571 c8e0a534 Iustin Pop
~~~~~~~
572 6d81475c Iustin Pop
573 c8e0a534 Iustin Pop
Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti
574 c8e0a534 Iustin Pop
2.0 returns ``2``.