root / doc / rapi.rst @ 414ebaf1
History | View | Annotate | Download (31.7 kB)
1 |
Ganeti remote API |
---|---|
2 |
================= |
3 |
|
4 |
Documents Ganeti version |version| |
5 |
|
6 |
.. contents:: |
7 |
|
8 |
Introduction |
9 |
------------ |
10 |
|
11 |
Ganeti supports a remote API for enable external tools to easily |
12 |
retrieve information about a cluster's state. The remote API daemon, |
13 |
*ganeti-rapi*, is automatically started on the master node. By default |
14 |
it runs on TCP port 5080, but this can be changed either in |
15 |
``.../constants.py`` or via the command line parameter *-p*. SSL mode, |
16 |
which is used by default, can also be disabled by passing command line |
17 |
parameters. |
18 |
|
19 |
|
20 |
Users and passwords |
21 |
------------------- |
22 |
|
23 |
``ganeti-rapi`` reads users and passwords from a file (usually |
24 |
``/var/lib/ganeti/rapi/users``) on startup. Changes to the file will be |
25 |
read automatically. |
26 |
|
27 |
Each line consists of two or three fields separated by whitespace. The |
28 |
first two fields are for username and password. The third field is |
29 |
optional and can be used to specify per-user options. Currently, |
30 |
``write`` is the only option supported and enables the user to execute |
31 |
operations modifying the cluster. Lines starting with the hash sign |
32 |
(``#``) are treated as comments. |
33 |
|
34 |
Passwords can either be written in clear text or as a hash. Clear text |
35 |
passwords may not start with an opening brace (``{``) or they must be |
36 |
prefixed with ``{cleartext}``. To use the hashed form, get the MD5 hash |
37 |
of the string ``$username:Ganeti Remote API:$password`` (e.g. ``echo -n |
38 |
'jack:Ganeti Remote API:abc123' | openssl md5``) [#pwhash]_ and prefix |
39 |
it with ``{ha1}``. Using the scheme prefix for all passwords is |
40 |
recommended. Scheme prefixes are not case sensitive. |
41 |
|
42 |
Example:: |
43 |
|
44 |
# Give Jack and Fred read-only access |
45 |
jack abc123 |
46 |
fred {cleartext}foo555 |
47 |
|
48 |
# Give write access to an imaginary instance creation script |
49 |
autocreator xyz789 write |
50 |
|
51 |
# Hashed password for Jessica |
52 |
jessica {HA1}7046452df2cbb530877058712cf17bd4 write |
53 |
|
54 |
|
55 |
.. [#pwhash] Using the MD5 hash of username, realm and password is |
56 |
described in :rfc:`2617` ("HTTP Authentication"), sections 3.2.2.2 and |
57 |
3.3. The reason for using it over another algorithm is forward |
58 |
compatibility. If ``ganeti-rapi`` were to implement HTTP Digest |
59 |
authentication in the future, the same hash could be used. |
60 |
In the current version ``ganeti-rapi``'s realm, ``Ganeti Remote |
61 |
API``, can only be changed by modifying the source code. |
62 |
|
63 |
|
64 |
Protocol |
65 |
-------- |
66 |
|
67 |
The protocol used is JSON_ over HTTP designed after the REST_ principle. |
68 |
HTTP Basic authentication as per :rfc:`2617` is supported. |
69 |
|
70 |
.. _JSON: http://www.json.org/ |
71 |
.. _REST: http://en.wikipedia.org/wiki/Representational_State_Transfer |
72 |
|
73 |
HTTP requests with a body (e.g. ``PUT`` or ``POST``) require the request |
74 |
header ``Content-type`` be set to ``application/json`` (see :rfc:`2616` |
75 |
(HTTP/1.1), section 7.2.1). |
76 |
|
77 |
|
78 |
A note on JSON as used by RAPI |
79 |
++++++++++++++++++++++++++++++ |
80 |
|
81 |
JSON_ as used by Ganeti RAPI does not conform to the specification in |
82 |
:rfc:`4627`. Section 2 defines a JSON text to be either an object |
83 |
(``{"key": "value", …}``) or an array (``[1, 2, 3, …]``). In violation |
84 |
of this RAPI uses plain strings (``"master-candidate"``, ``"1234"``) for |
85 |
some requests or responses. Changing this now would likely break |
86 |
existing clients and cause a lot of trouble. |
87 |
|
88 |
.. highlight:: ruby |
89 |
|
90 |
Unlike Python's `JSON encoder and decoder |
91 |
<http://docs.python.org/library/json.html>`_, other programming |
92 |
languages or libraries may only provide a strict implementation, not |
93 |
allowing plain values. For those, responses can usually be wrapped in an |
94 |
array whose first element is then used, e.g. the response ``"1234"`` |
95 |
becomes ``["1234"]``. This works equally well for more complex values. |
96 |
Example in Ruby:: |
97 |
|
98 |
require "json" |
99 |
|
100 |
# Insert code to get response here |
101 |
response = "\"1234\"" |
102 |
|
103 |
decoded = JSON.parse("[#{response}]").first |
104 |
|
105 |
Short of modifying the encoder to allow encoding to a less strict |
106 |
format, requests will have to be formatted by hand. Newer RAPI requests |
107 |
already use a dictionary as their input data and shouldn't cause any |
108 |
problems. |
109 |
|
110 |
|
111 |
PUT or POST? |
112 |
------------ |
113 |
|
114 |
According to :rfc:`2616` the main difference between PUT and POST is |
115 |
that POST can create new resources but PUT can only create the resource |
116 |
the URI was pointing to on the PUT request. |
117 |
|
118 |
Unfortunately, due to historic reasons, the Ganeti RAPI library is not |
119 |
consistent with this usage, so just use the methods as documented below |
120 |
for each resource. |
121 |
|
122 |
For more details have a look in the source code at |
123 |
``lib/rapi/rlib2.py``. |
124 |
|
125 |
|
126 |
Generic parameter types |
127 |
----------------------- |
128 |
|
129 |
A few generic refered parameter types and the values they allow. |
130 |
|
131 |
``bool`` |
132 |
++++++++ |
133 |
|
134 |
A boolean option will accept ``1`` or ``0`` as numbers but not |
135 |
i.e. ``True`` or ``False``. |
136 |
|
137 |
Generic parameters |
138 |
------------------ |
139 |
|
140 |
A few parameter mean the same thing across all resources which implement |
141 |
it. |
142 |
|
143 |
``bulk`` |
144 |
++++++++ |
145 |
|
146 |
Bulk-mode means that for the resources which usually return just a list |
147 |
of child resources (e.g. ``/2/instances`` which returns just instance |
148 |
names), the output will instead contain detailed data for all these |
149 |
subresources. This is more efficient than query-ing the sub-resources |
150 |
themselves. |
151 |
|
152 |
``dry-run`` |
153 |
+++++++++++ |
154 |
|
155 |
The boolean *dry-run* argument, if provided and set, signals to Ganeti |
156 |
that the job should not be executed, only the pre-execution checks will |
157 |
be done. |
158 |
|
159 |
This is useful in trying to determine (without guarantees though, as in |
160 |
the meantime the cluster state could have changed) if the operation is |
161 |
likely to succeed or at least start executing. |
162 |
|
163 |
``force`` |
164 |
+++++++++++ |
165 |
|
166 |
Force operation to continue even if it will cause the cluster to become |
167 |
inconsistent (e.g. because there are not enough master candidates). |
168 |
|
169 |
Usage examples |
170 |
-------------- |
171 |
|
172 |
You can access the API using your favorite programming language as long |
173 |
as it supports network connections. |
174 |
|
175 |
Ganeti RAPI client |
176 |
++++++++++++++++++ |
177 |
|
178 |
Ganeti includes a standalone RAPI client, ``lib/rapi/client.py``. |
179 |
|
180 |
Shell |
181 |
+++++ |
182 |
|
183 |
.. highlight:: sh |
184 |
|
185 |
Using wget:: |
186 |
|
187 |
wget -q -O - https://CLUSTERNAME:5080/2/info |
188 |
|
189 |
or curl:: |
190 |
|
191 |
curl https://CLUSTERNAME:5080/2/info |
192 |
|
193 |
|
194 |
Python |
195 |
++++++ |
196 |
|
197 |
.. highlight:: python |
198 |
|
199 |
:: |
200 |
|
201 |
import urllib2 |
202 |
f = urllib2.urlopen('https://CLUSTERNAME:5080/2/info') |
203 |
print f.read() |
204 |
|
205 |
|
206 |
JavaScript |
207 |
++++++++++ |
208 |
|
209 |
.. warning:: While it's possible to use JavaScript, it poses several |
210 |
potential problems, including browser blocking request due to |
211 |
non-standard ports or different domain names. Fetching the data on |
212 |
the webserver is easier. |
213 |
|
214 |
.. highlight:: javascript |
215 |
|
216 |
:: |
217 |
|
218 |
var url = 'https://CLUSTERNAME:5080/2/info'; |
219 |
var info; |
220 |
var xmlreq = new XMLHttpRequest(); |
221 |
xmlreq.onreadystatechange = function () { |
222 |
if (xmlreq.readyState != 4) return; |
223 |
if (xmlreq.status == 200) { |
224 |
info = eval("(" + xmlreq.responseText + ")"); |
225 |
alert(info); |
226 |
} else { |
227 |
alert('Error fetching cluster info'); |
228 |
} |
229 |
xmlreq = null; |
230 |
}; |
231 |
xmlreq.open('GET', url, true); |
232 |
xmlreq.send(null); |
233 |
|
234 |
Resources |
235 |
--------- |
236 |
|
237 |
.. highlight:: javascript |
238 |
|
239 |
``/`` |
240 |
+++++ |
241 |
|
242 |
The root resource. |
243 |
|
244 |
It supports the following commands: ``GET``. |
245 |
|
246 |
``GET`` |
247 |
~~~~~~~ |
248 |
|
249 |
Shows the list of mapped resources. |
250 |
|
251 |
Returns: a dictionary with 'name' and 'uri' keys for each of them. |
252 |
|
253 |
``/2`` |
254 |
++++++ |
255 |
|
256 |
The ``/2`` resource, the root of the version 2 API. |
257 |
|
258 |
It supports the following commands: ``GET``. |
259 |
|
260 |
``GET`` |
261 |
~~~~~~~ |
262 |
|
263 |
Show the list of mapped resources. |
264 |
|
265 |
Returns: a dictionary with ``name`` and ``uri`` keys for each of them. |
266 |
|
267 |
``/2/info`` |
268 |
+++++++++++ |
269 |
|
270 |
Cluster information resource. |
271 |
|
272 |
It supports the following commands: ``GET``. |
273 |
|
274 |
``GET`` |
275 |
~~~~~~~ |
276 |
|
277 |
Returns cluster information. |
278 |
|
279 |
Example:: |
280 |
|
281 |
{ |
282 |
"config_version": 2000000, |
283 |
"name": "cluster", |
284 |
"software_version": "2.0.0~beta2", |
285 |
"os_api_version": 10, |
286 |
"export_version": 0, |
287 |
"candidate_pool_size": 10, |
288 |
"enabled_hypervisors": [ |
289 |
"fake" |
290 |
], |
291 |
"hvparams": { |
292 |
"fake": {} |
293 |
}, |
294 |
"default_hypervisor": "fake", |
295 |
"master": "node1.example.com", |
296 |
"architecture": [ |
297 |
"64bit", |
298 |
"x86_64" |
299 |
], |
300 |
"protocol_version": 20, |
301 |
"beparams": { |
302 |
"default": { |
303 |
"auto_balance": true, |
304 |
"vcpus": 1, |
305 |
"memory": 128 |
306 |
} |
307 |
} |
308 |
} |
309 |
|
310 |
|
311 |
``/2/redistribute-config`` |
312 |
++++++++++++++++++++++++++ |
313 |
|
314 |
Redistribute configuration to all nodes. |
315 |
|
316 |
It supports the following commands: ``PUT``. |
317 |
|
318 |
``PUT`` |
319 |
~~~~~~~ |
320 |
|
321 |
Redistribute configuration to all nodes. The result will be a job id. |
322 |
|
323 |
|
324 |
``/2/features`` |
325 |
+++++++++++++++ |
326 |
|
327 |
``GET`` |
328 |
~~~~~~~ |
329 |
|
330 |
Returns a list of features supported by the RAPI server. Available |
331 |
features: |
332 |
|
333 |
``instance-create-reqv1`` |
334 |
Instance creation request data version 1 supported. |
335 |
``instance-reinstall-reqv1`` |
336 |
Instance reinstall supports body parameters. |
337 |
|
338 |
|
339 |
``/2/modify`` |
340 |
++++++++++++++++++++++++++++++++++++++++ |
341 |
|
342 |
Modifies cluster parameters. |
343 |
|
344 |
Supports the following commands: ``PUT``. |
345 |
|
346 |
``PUT`` |
347 |
~~~~~~~ |
348 |
|
349 |
Returns a job ID. |
350 |
|
351 |
Body parameters: |
352 |
|
353 |
.. opcode_params:: OP_CLUSTER_SET_PARAMS |
354 |
|
355 |
|
356 |
``/2/groups`` |
357 |
+++++++++++++ |
358 |
|
359 |
The groups resource. |
360 |
|
361 |
It supports the following commands: ``GET``, ``POST``. |
362 |
|
363 |
``GET`` |
364 |
~~~~~~~ |
365 |
|
366 |
Returns a list of all existing node groups. |
367 |
|
368 |
Example:: |
369 |
|
370 |
[ |
371 |
{ |
372 |
"name": "group1", |
373 |
"uri": "\/2\/groups\/group1" |
374 |
}, |
375 |
{ |
376 |
"name": "group2", |
377 |
"uri": "\/2\/groups\/group2" |
378 |
} |
379 |
] |
380 |
|
381 |
If the optional bool *bulk* argument is provided and set to a true value |
382 |
(i.e ``?bulk=1``), the output contains detailed information about node |
383 |
groups as a list. |
384 |
|
385 |
Example:: |
386 |
|
387 |
[ |
388 |
{ |
389 |
"name": "group1", |
390 |
"node_cnt": 2, |
391 |
"node_list": [ |
392 |
"node1.example.com", |
393 |
"node2.example.com" |
394 |
], |
395 |
"uuid": "0d7d407c-262e-49af-881a-6a430034bf43" |
396 |
}, |
397 |
{ |
398 |
"name": "group2", |
399 |
"node_cnt": 1, |
400 |
"node_list": [ |
401 |
"node3.example.com" |
402 |
], |
403 |
"uuid": "f5a277e7-68f9-44d3-a378-4b25ecb5df5c" |
404 |
} |
405 |
] |
406 |
|
407 |
``POST`` |
408 |
~~~~~~~~ |
409 |
|
410 |
Creates a node group. |
411 |
|
412 |
If the optional bool *dry-run* argument is provided, the job will not be |
413 |
actually executed, only the pre-execution checks will be done. |
414 |
|
415 |
Returns: a job ID that can be used later for polling. |
416 |
|
417 |
Body parameters: |
418 |
|
419 |
.. opcode_params:: OP_GROUP_ADD |
420 |
|
421 |
Earlier versions used a parameter named ``name`` which, while still |
422 |
supported, has been renamed to ``group_name``. |
423 |
|
424 |
|
425 |
``/2/groups/[group_name]`` |
426 |
++++++++++++++++++++++++++ |
427 |
|
428 |
Returns information about a node group. |
429 |
|
430 |
It supports the following commands: ``GET``, ``DELETE``. |
431 |
|
432 |
``GET`` |
433 |
~~~~~~~ |
434 |
|
435 |
Returns information about a node group, similar to the bulk output from |
436 |
the node group list. |
437 |
|
438 |
``DELETE`` |
439 |
~~~~~~~~~~ |
440 |
|
441 |
Deletes a node group. |
442 |
|
443 |
It supports the ``dry-run`` argument. |
444 |
|
445 |
|
446 |
``/2/groups/[group_name]/modify`` |
447 |
+++++++++++++++++++++++++++++++++ |
448 |
|
449 |
Modifies the parameters of a node group. |
450 |
|
451 |
Supports the following commands: ``PUT``. |
452 |
|
453 |
``PUT`` |
454 |
~~~~~~~ |
455 |
|
456 |
Returns a job ID. |
457 |
|
458 |
Body parameters: |
459 |
|
460 |
.. opcode_params:: OP_GROUP_SET_PARAMS |
461 |
:exclude: group_name |
462 |
|
463 |
|
464 |
``/2/groups/[group_name]/rename`` |
465 |
+++++++++++++++++++++++++++++++++ |
466 |
|
467 |
Renames a node group. |
468 |
|
469 |
Supports the following commands: ``PUT``. |
470 |
|
471 |
``PUT`` |
472 |
~~~~~~~ |
473 |
|
474 |
Returns a job ID. |
475 |
|
476 |
Body parameters: |
477 |
|
478 |
.. opcode_params:: OP_GROUP_RENAME |
479 |
:exclude: group_name |
480 |
|
481 |
|
482 |
``/2/groups/[group_name]/assign-nodes`` |
483 |
+++++++++++++++++++++++++++++++++++++++ |
484 |
|
485 |
Assigns nodes to a group. |
486 |
|
487 |
Supports the following commands: ``PUT``. |
488 |
|
489 |
``PUT`` |
490 |
~~~~~~~ |
491 |
|
492 |
Returns a job ID. It supports the ``dry-run`` and ``force`` arguments. |
493 |
|
494 |
Body parameters: |
495 |
|
496 |
.. opcode_params:: OP_GROUP_ASSIGN_NODES |
497 |
:exclude: group_name, force, dry_run |
498 |
|
499 |
|
500 |
``/2/groups/[group_name]/tags`` |
501 |
+++++++++++++++++++++++++++++++ |
502 |
|
503 |
Manages per-nodegroup tags. |
504 |
|
505 |
Supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
506 |
|
507 |
``GET`` |
508 |
~~~~~~~ |
509 |
|
510 |
Returns a list of tags. |
511 |
|
512 |
Example:: |
513 |
|
514 |
["tag1", "tag2", "tag3"] |
515 |
|
516 |
``PUT`` |
517 |
~~~~~~~ |
518 |
|
519 |
Add a set of tags. |
520 |
|
521 |
The request as a list of strings should be ``PUT`` to this URI. The |
522 |
result will be a job id. |
523 |
|
524 |
It supports the ``dry-run`` argument. |
525 |
|
526 |
|
527 |
``DELETE`` |
528 |
~~~~~~~~~~ |
529 |
|
530 |
Delete a tag. |
531 |
|
532 |
In order to delete a set of tags, the DELETE request should be addressed |
533 |
to URI like:: |
534 |
|
535 |
/tags?tag=[tag]&tag=[tag] |
536 |
|
537 |
It supports the ``dry-run`` argument. |
538 |
|
539 |
|
540 |
``/2/instances`` |
541 |
++++++++++++++++ |
542 |
|
543 |
The instances resource. |
544 |
|
545 |
It supports the following commands: ``GET``, ``POST``. |
546 |
|
547 |
``GET`` |
548 |
~~~~~~~ |
549 |
|
550 |
Returns a list of all available instances. |
551 |
|
552 |
Example:: |
553 |
|
554 |
[ |
555 |
{ |
556 |
"name": "web.example.com", |
557 |
"uri": "\/instances\/web.example.com" |
558 |
}, |
559 |
{ |
560 |
"name": "mail.example.com", |
561 |
"uri": "\/instances\/mail.example.com" |
562 |
} |
563 |
] |
564 |
|
565 |
If the optional bool *bulk* argument is provided and set to a true value |
566 |
(i.e ``?bulk=1``), the output contains detailed information about |
567 |
instances as a list. |
568 |
|
569 |
Example:: |
570 |
|
571 |
[ |
572 |
{ |
573 |
"status": "running", |
574 |
"disk_usage": 20480, |
575 |
"nic.bridges": [ |
576 |
"xen-br0" |
577 |
], |
578 |
"name": "web.example.com", |
579 |
"tags": ["tag1", "tag2"], |
580 |
"beparams": { |
581 |
"vcpus": 2, |
582 |
"memory": 512 |
583 |
}, |
584 |
"disk.sizes": [ |
585 |
20480 |
586 |
], |
587 |
"pnode": "node1.example.com", |
588 |
"nic.macs": ["01:23:45:67:89:01"], |
589 |
"snodes": ["node2.example.com"], |
590 |
"disk_template": "drbd", |
591 |
"admin_state": true, |
592 |
"os": "debian-etch", |
593 |
"oper_state": true |
594 |
}, |
595 |
... |
596 |
] |
597 |
|
598 |
|
599 |
``POST`` |
600 |
~~~~~~~~ |
601 |
|
602 |
Creates an instance. |
603 |
|
604 |
If the optional bool *dry-run* argument is provided, the job will not be |
605 |
actually executed, only the pre-execution checks will be done. Query-ing |
606 |
the job result will return, in both dry-run and normal case, the list of |
607 |
nodes selected for the instance. |
608 |
|
609 |
Returns: a job ID that can be used later for polling. |
610 |
|
611 |
Body parameters: |
612 |
|
613 |
``__version__`` (int, required) |
614 |
Must be ``1`` (older Ganeti versions used a different format for |
615 |
instance creation requests, version ``0``, but that format is no |
616 |
longer supported) |
617 |
|
618 |
.. opcode_params:: OP_INSTANCE_CREATE |
619 |
|
620 |
Earlier versions used parameters named ``name`` and ``os``. These have |
621 |
been replaced by ``instance_name`` and ``os_type`` to match the |
622 |
underlying opcode. The old names can still be used. |
623 |
|
624 |
|
625 |
``/2/instances/[instance_name]`` |
626 |
++++++++++++++++++++++++++++++++ |
627 |
|
628 |
Instance-specific resource. |
629 |
|
630 |
It supports the following commands: ``GET``, ``DELETE``. |
631 |
|
632 |
``GET`` |
633 |
~~~~~~~ |
634 |
|
635 |
Returns information about an instance, similar to the bulk output from |
636 |
the instance list. |
637 |
|
638 |
``DELETE`` |
639 |
~~~~~~~~~~ |
640 |
|
641 |
Deletes an instance. |
642 |
|
643 |
It supports the ``dry-run`` argument. |
644 |
|
645 |
|
646 |
``/2/instances/[instance_name]/info`` |
647 |
+++++++++++++++++++++++++++++++++++++++ |
648 |
|
649 |
It supports the following commands: ``GET``. |
650 |
|
651 |
``GET`` |
652 |
~~~~~~~ |
653 |
|
654 |
Requests detailed information about the instance. An optional parameter, |
655 |
``static`` (bool), can be set to return only static information from the |
656 |
configuration without querying the instance's nodes. The result will be |
657 |
a job id. |
658 |
|
659 |
|
660 |
``/2/instances/[instance_name]/reboot`` |
661 |
+++++++++++++++++++++++++++++++++++++++ |
662 |
|
663 |
Reboots URI for an instance. |
664 |
|
665 |
It supports the following commands: ``POST``. |
666 |
|
667 |
``POST`` |
668 |
~~~~~~~~ |
669 |
|
670 |
Reboots the instance. |
671 |
|
672 |
The URI takes optional ``type=soft|hard|full`` and |
673 |
``ignore_secondaries=0|1`` parameters. |
674 |
|
675 |
``type`` defines the reboot type. ``soft`` is just a normal reboot, |
676 |
without terminating the hypervisor. ``hard`` means full shutdown |
677 |
(including terminating the hypervisor process) and startup again. |
678 |
``full`` is like ``hard`` but also recreates the configuration from |
679 |
ground up as if you would have done a ``gnt-instance shutdown`` and |
680 |
``gnt-instance start`` on it. |
681 |
|
682 |
``ignore_secondaries`` is a bool argument indicating if we start the |
683 |
instance even if secondary disks are failing. |
684 |
|
685 |
It supports the ``dry-run`` argument. |
686 |
|
687 |
|
688 |
``/2/instances/[instance_name]/shutdown`` |
689 |
+++++++++++++++++++++++++++++++++++++++++ |
690 |
|
691 |
Instance shutdown URI. |
692 |
|
693 |
It supports the following commands: ``PUT``. |
694 |
|
695 |
``PUT`` |
696 |
~~~~~~~ |
697 |
|
698 |
Shutdowns an instance. |
699 |
|
700 |
It supports the ``dry-run`` argument. |
701 |
|
702 |
.. opcode_params:: OP_INSTANCE_SHUTDOWN |
703 |
:exclude: instance_name, dry_run |
704 |
|
705 |
|
706 |
``/2/instances/[instance_name]/startup`` |
707 |
++++++++++++++++++++++++++++++++++++++++ |
708 |
|
709 |
Instance startup URI. |
710 |
|
711 |
It supports the following commands: ``PUT``. |
712 |
|
713 |
``PUT`` |
714 |
~~~~~~~ |
715 |
|
716 |
Startup an instance. |
717 |
|
718 |
The URI takes an optional ``force=1|0`` parameter to start the |
719 |
instance even if secondary disks are failing. |
720 |
|
721 |
It supports the ``dry-run`` argument. |
722 |
|
723 |
``/2/instances/[instance_name]/reinstall`` |
724 |
++++++++++++++++++++++++++++++++++++++++++++++ |
725 |
|
726 |
Installs the operating system again. |
727 |
|
728 |
It supports the following commands: ``POST``. |
729 |
|
730 |
``POST`` |
731 |
~~~~~~~~ |
732 |
|
733 |
Returns a job ID. |
734 |
|
735 |
Body parameters: |
736 |
|
737 |
``os`` (string, required) |
738 |
Instance operating system. |
739 |
``start`` (bool, defaults to true) |
740 |
Whether to start instance after reinstallation. |
741 |
``osparams`` (dict) |
742 |
Dictionary with (temporary) OS parameters. |
743 |
|
744 |
For backwards compatbility, this resource also takes the query |
745 |
parameters ``os`` (OS template name) and ``nostartup`` (bool). New |
746 |
clients should use the body parameters. |
747 |
|
748 |
|
749 |
``/2/instances/[instance_name]/replace-disks`` |
750 |
++++++++++++++++++++++++++++++++++++++++++++++ |
751 |
|
752 |
Replaces disks on an instance. |
753 |
|
754 |
It supports the following commands: ``POST``. |
755 |
|
756 |
``POST`` |
757 |
~~~~~~~~ |
758 |
|
759 |
Takes the parameters ``mode`` (one of ``replace_on_primary``, |
760 |
``replace_on_secondary``, ``replace_new_secondary`` or |
761 |
``replace_auto``), ``disks`` (comma separated list of disk indexes), |
762 |
``remote_node`` and ``iallocator``. |
763 |
|
764 |
Either ``remote_node`` or ``iallocator`` needs to be defined when using |
765 |
``mode=replace_new_secondary``. |
766 |
|
767 |
``mode`` is a mandatory parameter. ``replace_auto`` tries to determine |
768 |
the broken disk(s) on its own and replacing it. |
769 |
|
770 |
|
771 |
``/2/instances/[instance_name]/activate-disks`` |
772 |
+++++++++++++++++++++++++++++++++++++++++++++++ |
773 |
|
774 |
Activate disks on an instance. |
775 |
|
776 |
It supports the following commands: ``PUT``. |
777 |
|
778 |
``PUT`` |
779 |
~~~~~~~ |
780 |
|
781 |
Takes the bool parameter ``ignore_size``. When set ignore the recorded |
782 |
size (useful for forcing activation when recorded size is wrong). |
783 |
|
784 |
|
785 |
``/2/instances/[instance_name]/deactivate-disks`` |
786 |
+++++++++++++++++++++++++++++++++++++++++++++++++ |
787 |
|
788 |
Deactivate disks on an instance. |
789 |
|
790 |
It supports the following commands: ``PUT``. |
791 |
|
792 |
``PUT`` |
793 |
~~~~~~~ |
794 |
|
795 |
Takes no parameters. |
796 |
|
797 |
|
798 |
``/2/instances/[instance_name]/disk/[disk_index]/grow`` |
799 |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
800 |
|
801 |
Grows one disk of an instance. |
802 |
|
803 |
Supports the following commands: ``POST``. |
804 |
|
805 |
``POST`` |
806 |
~~~~~~~~ |
807 |
|
808 |
Returns a job ID. |
809 |
|
810 |
Body parameters: |
811 |
|
812 |
.. opcode_params:: OP_INSTANCE_GROW_DISK |
813 |
:exclude: instance_name, disk |
814 |
|
815 |
|
816 |
``/2/instances/[instance_name]/prepare-export`` |
817 |
+++++++++++++++++++++++++++++++++++++++++++++++++ |
818 |
|
819 |
Prepares an export of an instance. |
820 |
|
821 |
It supports the following commands: ``PUT``. |
822 |
|
823 |
``PUT`` |
824 |
~~~~~~~ |
825 |
|
826 |
Takes one parameter, ``mode``, for the export mode. Returns a job ID. |
827 |
|
828 |
|
829 |
``/2/instances/[instance_name]/export`` |
830 |
+++++++++++++++++++++++++++++++++++++++++++++++++ |
831 |
|
832 |
Exports an instance. |
833 |
|
834 |
It supports the following commands: ``PUT``. |
835 |
|
836 |
``PUT`` |
837 |
~~~~~~~ |
838 |
|
839 |
Returns a job ID. |
840 |
|
841 |
Body parameters: |
842 |
|
843 |
.. opcode_params:: OP_BACKUP_EXPORT |
844 |
:exclude: instance_name |
845 |
:alias: target_node=destination |
846 |
|
847 |
|
848 |
``/2/instances/[instance_name]/migrate`` |
849 |
++++++++++++++++++++++++++++++++++++++++ |
850 |
|
851 |
Migrates an instance. |
852 |
|
853 |
Supports the following commands: ``PUT``. |
854 |
|
855 |
``PUT`` |
856 |
~~~~~~~ |
857 |
|
858 |
Returns a job ID. |
859 |
|
860 |
Body parameters: |
861 |
|
862 |
.. opcode_params:: OP_INSTANCE_MIGRATE |
863 |
:exclude: instance_name, live |
864 |
|
865 |
|
866 |
``/2/instances/[instance_name]/rename`` |
867 |
++++++++++++++++++++++++++++++++++++++++ |
868 |
|
869 |
Renames an instance. |
870 |
|
871 |
Supports the following commands: ``PUT``. |
872 |
|
873 |
``PUT`` |
874 |
~~~~~~~ |
875 |
|
876 |
Returns a job ID. |
877 |
|
878 |
Body parameters: |
879 |
|
880 |
.. opcode_params:: OP_INSTANCE_RENAME |
881 |
:exclude: instance_name |
882 |
|
883 |
|
884 |
``/2/instances/[instance_name]/modify`` |
885 |
++++++++++++++++++++++++++++++++++++++++ |
886 |
|
887 |
Modifies an instance. |
888 |
|
889 |
Supports the following commands: ``PUT``. |
890 |
|
891 |
``PUT`` |
892 |
~~~~~~~ |
893 |
|
894 |
Returns a job ID. |
895 |
|
896 |
Body parameters: |
897 |
|
898 |
.. opcode_params:: OP_INSTANCE_SET_PARAMS |
899 |
:exclude: instance_name |
900 |
|
901 |
|
902 |
``/2/instances/[instance_name]/console`` |
903 |
++++++++++++++++++++++++++++++++++++++++ |
904 |
|
905 |
Request information for connecting to instance's console. |
906 |
|
907 |
Supports the following commands: ``GET``. |
908 |
|
909 |
``GET`` |
910 |
~~~~~~~ |
911 |
|
912 |
Returns a dictionary containing information about the instance's |
913 |
console. Contained keys: |
914 |
|
915 |
``instance`` |
916 |
Instance name. |
917 |
``kind`` |
918 |
Console type, one of ``ssh``, ``vnc`` or ``msg``. |
919 |
``message`` |
920 |
Message to display (``msg`` type only). |
921 |
``host`` |
922 |
Host to connect to (``ssh`` and ``vnc`` only). |
923 |
``port`` |
924 |
TCP port to connect to (``vnc`` only). |
925 |
``user`` |
926 |
Username to use (``ssh`` only). |
927 |
``command`` |
928 |
Command to execute on machine (``ssh`` only) |
929 |
``display`` |
930 |
VNC display number (``vnc`` only). |
931 |
|
932 |
|
933 |
``/2/instances/[instance_name]/tags`` |
934 |
+++++++++++++++++++++++++++++++++++++ |
935 |
|
936 |
Manages per-instance tags. |
937 |
|
938 |
It supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
939 |
|
940 |
``GET`` |
941 |
~~~~~~~ |
942 |
|
943 |
Returns a list of tags. |
944 |
|
945 |
Example:: |
946 |
|
947 |
["tag1", "tag2", "tag3"] |
948 |
|
949 |
``PUT`` |
950 |
~~~~~~~ |
951 |
|
952 |
Add a set of tags. |
953 |
|
954 |
The request as a list of strings should be ``PUT`` to this URI. The |
955 |
result will be a job id. |
956 |
|
957 |
It supports the ``dry-run`` argument. |
958 |
|
959 |
|
960 |
``DELETE`` |
961 |
~~~~~~~~~~ |
962 |
|
963 |
Delete a tag. |
964 |
|
965 |
In order to delete a set of tags, the DELETE request should be addressed |
966 |
to URI like:: |
967 |
|
968 |
/tags?tag=[tag]&tag=[tag] |
969 |
|
970 |
It supports the ``dry-run`` argument. |
971 |
|
972 |
|
973 |
``/2/jobs`` |
974 |
+++++++++++ |
975 |
|
976 |
The ``/2/jobs`` resource. |
977 |
|
978 |
It supports the following commands: ``GET``. |
979 |
|
980 |
``GET`` |
981 |
~~~~~~~ |
982 |
|
983 |
Returns a dictionary of jobs. |
984 |
|
985 |
Returns: a dictionary with jobs id and uri. |
986 |
|
987 |
``/2/jobs/[job_id]`` |
988 |
++++++++++++++++++++ |
989 |
|
990 |
|
991 |
Individual job URI. |
992 |
|
993 |
It supports the following commands: ``GET``, ``DELETE``. |
994 |
|
995 |
``GET`` |
996 |
~~~~~~~ |
997 |
|
998 |
Returns a job status. |
999 |
|
1000 |
Returns: a dictionary with job parameters. |
1001 |
|
1002 |
The result includes: |
1003 |
|
1004 |
- id: job ID as a number |
1005 |
- status: current job status as a string |
1006 |
- ops: involved OpCodes as a list of dictionaries for each opcodes in |
1007 |
the job |
1008 |
- opstatus: OpCodes status as a list |
1009 |
- opresult: OpCodes results as a list |
1010 |
|
1011 |
For a successful opcode, the ``opresult`` field corresponding to it will |
1012 |
contain the raw result from its :term:`LogicalUnit`. In case an opcode |
1013 |
has failed, its element in the opresult list will be a list of two |
1014 |
elements: |
1015 |
|
1016 |
- first element the error type (the Ganeti internal error name) |
1017 |
- second element a list of either one or two elements: |
1018 |
|
1019 |
- the first element is the textual error description |
1020 |
- the second element, if any, will hold an error classification |
1021 |
|
1022 |
The error classification is most useful for the ``OpPrereqError`` |
1023 |
error type - these errors happen before the OpCode has started |
1024 |
executing, so it's possible to retry the OpCode without side |
1025 |
effects. But whether it make sense to retry depends on the error |
1026 |
classification: |
1027 |
|
1028 |
.. pyassert:: |
1029 |
|
1030 |
errors.ECODE_ALL == set([errors.ECODE_RESOLVER, errors.ECODE_NORES, |
1031 |
errors.ECODE_INVAL, errors.ECODE_STATE, errors.ECODE_NOENT, |
1032 |
errors.ECODE_EXISTS, errors.ECODE_NOTUNIQUE, errors.ECODE_FAULT, |
1033 |
errors.ECODE_ENVIRON]) |
1034 |
|
1035 |
:pyeval:`errors.ECODE_RESOLVER` |
1036 |
Resolver errors. This usually means that a name doesn't exist in DNS, |
1037 |
so if it's a case of slow DNS propagation the operation can be retried |
1038 |
later. |
1039 |
|
1040 |
:pyeval:`errors.ECODE_NORES` |
1041 |
Not enough resources (iallocator failure, disk space, memory, |
1042 |
etc.). If the resources on the cluster increase, the operation might |
1043 |
succeed. |
1044 |
|
1045 |
:pyeval:`errors.ECODE_INVAL` |
1046 |
Wrong arguments (at syntax level). The operation will not ever be |
1047 |
accepted unless the arguments change. |
1048 |
|
1049 |
:pyeval:`errors.ECODE_STATE` |
1050 |
Wrong entity state. For example, live migration has been requested for |
1051 |
a down instance, or instance creation on an offline node. The |
1052 |
operation can be retried once the resource has changed state. |
1053 |
|
1054 |
:pyeval:`errors.ECODE_NOENT` |
1055 |
Entity not found. For example, information has been requested for an |
1056 |
unknown instance. |
1057 |
|
1058 |
:pyeval:`errors.ECODE_EXISTS` |
1059 |
Entity already exists. For example, instance creation has been |
1060 |
requested for an already-existing instance. |
1061 |
|
1062 |
:pyeval:`errors.ECODE_NOTUNIQUE` |
1063 |
Resource not unique (e.g. MAC or IP duplication). |
1064 |
|
1065 |
:pyeval:`errors.ECODE_FAULT` |
1066 |
Internal cluster error. For example, a node is unreachable but not set |
1067 |
offline, or the ganeti node daemons are not working, etc. A |
1068 |
``gnt-cluster verify`` should be run. |
1069 |
|
1070 |
:pyeval:`errors.ECODE_ENVIRON` |
1071 |
Environment error (e.g. node disk error). A ``gnt-cluster verify`` |
1072 |
should be run. |
1073 |
|
1074 |
Note that in the above list, by entity we refer to a node or instance, |
1075 |
while by a resource we refer to an instance's disk, or NIC, etc. |
1076 |
|
1077 |
|
1078 |
``DELETE`` |
1079 |
~~~~~~~~~~ |
1080 |
|
1081 |
Cancel a not-yet-started job. |
1082 |
|
1083 |
|
1084 |
``/2/jobs/[job_id]/wait`` |
1085 |
+++++++++++++++++++++++++ |
1086 |
|
1087 |
``GET`` |
1088 |
~~~~~~~ |
1089 |
|
1090 |
Waits for changes on a job. Takes the following body parameters in a |
1091 |
dict: |
1092 |
|
1093 |
``fields`` |
1094 |
The job fields on which to watch for changes. |
1095 |
|
1096 |
``previous_job_info`` |
1097 |
Previously received field values or None if not yet available. |
1098 |
|
1099 |
``previous_log_serial`` |
1100 |
Highest log serial number received so far or None if not yet |
1101 |
available. |
1102 |
|
1103 |
Returns None if no changes have been detected and a dict with two keys, |
1104 |
``job_info`` and ``log_entries`` otherwise. |
1105 |
|
1106 |
|
1107 |
``/2/nodes`` |
1108 |
++++++++++++ |
1109 |
|
1110 |
Nodes resource. |
1111 |
|
1112 |
It supports the following commands: ``GET``. |
1113 |
|
1114 |
``GET`` |
1115 |
~~~~~~~ |
1116 |
|
1117 |
Returns a list of all nodes. |
1118 |
|
1119 |
Example:: |
1120 |
|
1121 |
[ |
1122 |
{ |
1123 |
"id": "node1.example.com", |
1124 |
"uri": "\/nodes\/node1.example.com" |
1125 |
}, |
1126 |
{ |
1127 |
"id": "node2.example.com", |
1128 |
"uri": "\/nodes\/node2.example.com" |
1129 |
} |
1130 |
] |
1131 |
|
1132 |
If the optional 'bulk' argument is provided and set to 'true' value (i.e |
1133 |
'?bulk=1'), the output contains detailed information about nodes as a |
1134 |
list. |
1135 |
|
1136 |
Example:: |
1137 |
|
1138 |
[ |
1139 |
{ |
1140 |
"pinst_cnt": 1, |
1141 |
"mfree": 31280, |
1142 |
"mtotal": 32763, |
1143 |
"name": "www.example.com", |
1144 |
"tags": [], |
1145 |
"mnode": 512, |
1146 |
"dtotal": 5246208, |
1147 |
"sinst_cnt": 2, |
1148 |
"dfree": 5171712, |
1149 |
"offline": false |
1150 |
}, |
1151 |
... |
1152 |
] |
1153 |
|
1154 |
``/2/nodes/[node_name]`` |
1155 |
+++++++++++++++++++++++++++++++++ |
1156 |
|
1157 |
Returns information about a node. |
1158 |
|
1159 |
It supports the following commands: ``GET``. |
1160 |
|
1161 |
``/2/nodes/[node_name]/evacuate`` |
1162 |
+++++++++++++++++++++++++++++++++ |
1163 |
|
1164 |
Evacuates all secondary instances off a node. |
1165 |
|
1166 |
It supports the following commands: ``POST``. |
1167 |
|
1168 |
``POST`` |
1169 |
~~~~~~~~ |
1170 |
|
1171 |
To evacuate a node, either one of the ``iallocator`` or ``remote_node`` |
1172 |
parameters must be passed:: |
1173 |
|
1174 |
evacuate?iallocator=[iallocator] |
1175 |
evacuate?remote_node=[nodeX.example.com] |
1176 |
|
1177 |
The result value will be a list, each element being a triple of the job |
1178 |
id (for this specific evacuation), the instance which is being evacuated |
1179 |
by this job, and the node to which it is being relocated. In case the |
1180 |
node is already empty, the result will be an empty list (without any |
1181 |
jobs being submitted). |
1182 |
|
1183 |
And additional parameter ``early_release`` signifies whether to try to |
1184 |
parallelize the evacuations, at the risk of increasing I/O contention |
1185 |
and increasing the chances of data loss, if the primary node of any of |
1186 |
the instances being evacuated is not fully healthy. |
1187 |
|
1188 |
If the dry-run parameter was specified, then the evacuation jobs were |
1189 |
not actually submitted, and the job IDs will be null. |
1190 |
|
1191 |
|
1192 |
``/2/nodes/[node_name]/migrate`` |
1193 |
+++++++++++++++++++++++++++++++++ |
1194 |
|
1195 |
Migrates all primary instances from a node. |
1196 |
|
1197 |
It supports the following commands: ``POST``. |
1198 |
|
1199 |
``POST`` |
1200 |
~~~~~~~~ |
1201 |
|
1202 |
If no mode is explicitly specified, each instances' hypervisor default |
1203 |
migration mode will be used. Query parameters: |
1204 |
|
1205 |
``live`` (bool) |
1206 |
If set, use live migration if available. |
1207 |
``mode`` (string) |
1208 |
Sets migration mode, ``live`` for live migration and ``non-live`` for |
1209 |
non-live migration. Supported by Ganeti 2.2 and above. |
1210 |
|
1211 |
|
1212 |
``/2/nodes/[node_name]/role`` |
1213 |
+++++++++++++++++++++++++++++ |
1214 |
|
1215 |
Manages node role. |
1216 |
|
1217 |
It supports the following commands: ``GET``, ``PUT``. |
1218 |
|
1219 |
The role is always one of the following: |
1220 |
|
1221 |
- drained |
1222 |
- master |
1223 |
- master-candidate |
1224 |
- offline |
1225 |
- regular |
1226 |
|
1227 |
``GET`` |
1228 |
~~~~~~~ |
1229 |
|
1230 |
Returns the current node role. |
1231 |
|
1232 |
Example:: |
1233 |
|
1234 |
"master-candidate" |
1235 |
|
1236 |
``PUT`` |
1237 |
~~~~~~~ |
1238 |
|
1239 |
Change the node role. |
1240 |
|
1241 |
The request is a string which should be PUT to this URI. The result will |
1242 |
be a job id. |
1243 |
|
1244 |
It supports the bool ``force`` argument. |
1245 |
|
1246 |
``/2/nodes/[node_name]/storage`` |
1247 |
++++++++++++++++++++++++++++++++ |
1248 |
|
1249 |
Manages storage units on the node. |
1250 |
|
1251 |
``GET`` |
1252 |
~~~~~~~ |
1253 |
|
1254 |
.. pyassert:: |
1255 |
|
1256 |
constants.VALID_STORAGE_TYPES == set([constants.ST_FILE, |
1257 |
constants.ST_LVM_PV, |
1258 |
constants.ST_LVM_VG]) |
1259 |
|
1260 |
Requests a list of storage units on a node. Requires the parameters |
1261 |
``storage_type`` (one of :pyeval:`constants.ST_FILE`, |
1262 |
:pyeval:`constants.ST_LVM_PV` or :pyeval:`constants.ST_LVM_VG`) and |
1263 |
``output_fields``. The result will be a job id, using which the result |
1264 |
can be retrieved. |
1265 |
|
1266 |
``/2/nodes/[node_name]/storage/modify`` |
1267 |
+++++++++++++++++++++++++++++++++++++++ |
1268 |
|
1269 |
Modifies storage units on the node. |
1270 |
|
1271 |
``PUT`` |
1272 |
~~~~~~~ |
1273 |
|
1274 |
Modifies parameters of storage units on the node. Requires the |
1275 |
parameters ``storage_type`` (one of :pyeval:`constants.ST_FILE`, |
1276 |
:pyeval:`constants.ST_LVM_PV` or :pyeval:`constants.ST_LVM_VG`) |
1277 |
and ``name`` (name of the storage unit). Parameters can be passed |
1278 |
additionally. Currently only :pyeval:`constants.SF_ALLOCATABLE` (bool) |
1279 |
is supported. The result will be a job id. |
1280 |
|
1281 |
``/2/nodes/[node_name]/storage/repair`` |
1282 |
+++++++++++++++++++++++++++++++++++++++ |
1283 |
|
1284 |
Repairs a storage unit on the node. |
1285 |
|
1286 |
``PUT`` |
1287 |
~~~~~~~ |
1288 |
|
1289 |
.. pyassert:: |
1290 |
|
1291 |
constants.VALID_STORAGE_OPERATIONS == { |
1292 |
constants.ST_LVM_VG: set([constants.SO_FIX_CONSISTENCY]), |
1293 |
} |
1294 |
|
1295 |
Repairs a storage unit on the node. Requires the parameters |
1296 |
``storage_type`` (currently only :pyeval:`constants.ST_LVM_VG` can be |
1297 |
repaired) and ``name`` (name of the storage unit). The result will be a |
1298 |
job id. |
1299 |
|
1300 |
``/2/nodes/[node_name]/tags`` |
1301 |
+++++++++++++++++++++++++++++ |
1302 |
|
1303 |
Manages per-node tags. |
1304 |
|
1305 |
It supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
1306 |
|
1307 |
``GET`` |
1308 |
~~~~~~~ |
1309 |
|
1310 |
Returns a list of tags. |
1311 |
|
1312 |
Example:: |
1313 |
|
1314 |
["tag1", "tag2", "tag3"] |
1315 |
|
1316 |
``PUT`` |
1317 |
~~~~~~~ |
1318 |
|
1319 |
Add a set of tags. |
1320 |
|
1321 |
The request as a list of strings should be PUT to this URI. The result |
1322 |
will be a job id. |
1323 |
|
1324 |
It supports the ``dry-run`` argument. |
1325 |
|
1326 |
``DELETE`` |
1327 |
~~~~~~~~~~ |
1328 |
|
1329 |
Deletes tags. |
1330 |
|
1331 |
In order to delete a set of tags, the DELETE request should be addressed |
1332 |
to URI like:: |
1333 |
|
1334 |
/tags?tag=[tag]&tag=[tag] |
1335 |
|
1336 |
It supports the ``dry-run`` argument. |
1337 |
|
1338 |
|
1339 |
``/2/query/[resource]`` |
1340 |
+++++++++++++++++++++++ |
1341 |
|
1342 |
Requests resource information. Available fields can be found in man |
1343 |
pages and using ``/2/query/[resource]/fields``. The resource is one of |
1344 |
:pyeval:`utils.CommaJoin(constants.QR_VIA_RAPI)`. See the :doc:`query2 |
1345 |
design document <design-query2>` for more details. |
1346 |
|
1347 |
Supports the following commands: ``GET``, ``PUT``. |
1348 |
|
1349 |
``GET`` |
1350 |
~~~~~~~ |
1351 |
|
1352 |
Returns list of included fields and actual data. Takes a query parameter |
1353 |
named "fields", containing a comma-separated list of field names. Does |
1354 |
not support filtering. |
1355 |
|
1356 |
``PUT`` |
1357 |
~~~~~~~ |
1358 |
|
1359 |
Returns list of included fields and actual data. The list of requested |
1360 |
fields can either be given as the query parameter "fields" or as a body |
1361 |
parameter with the same name. The optional body parameter "filter" can |
1362 |
be given and must be either ``null`` or a list containing filter |
1363 |
operators. |
1364 |
|
1365 |
|
1366 |
``/2/query/[resource]/fields`` |
1367 |
++++++++++++++++++++++++++++++ |
1368 |
|
1369 |
Request list of available fields for a resource. The resource is one of |
1370 |
:pyeval:`utils.CommaJoin(constants.QR_VIA_RAPI)`. See the |
1371 |
:doc:`query2 design document <design-query2>` for more details. |
1372 |
|
1373 |
Supports the following commands: ``GET``. |
1374 |
|
1375 |
``GET`` |
1376 |
~~~~~~~ |
1377 |
|
1378 |
Returns a list of field descriptions for available fields. Takes an |
1379 |
optional query parameter named "fields", containing a comma-separated |
1380 |
list of field names. |
1381 |
|
1382 |
|
1383 |
``/2/os`` |
1384 |
+++++++++ |
1385 |
|
1386 |
OS resource. |
1387 |
|
1388 |
It supports the following commands: ``GET``. |
1389 |
|
1390 |
``GET`` |
1391 |
~~~~~~~ |
1392 |
|
1393 |
Return a list of all OSes. |
1394 |
|
1395 |
Can return error 500 in case of a problem. Since this is a costly |
1396 |
operation for Ganeti 2.0, it is not recommended to execute it too often. |
1397 |
|
1398 |
Example:: |
1399 |
|
1400 |
["debian-etch"] |
1401 |
|
1402 |
``/2/tags`` |
1403 |
+++++++++++ |
1404 |
|
1405 |
Manages cluster tags. |
1406 |
|
1407 |
It supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
1408 |
|
1409 |
``GET`` |
1410 |
~~~~~~~ |
1411 |
|
1412 |
Returns the cluster tags. |
1413 |
|
1414 |
Example:: |
1415 |
|
1416 |
["tag1", "tag2", "tag3"] |
1417 |
|
1418 |
``PUT`` |
1419 |
~~~~~~~ |
1420 |
|
1421 |
Adds a set of tags. |
1422 |
|
1423 |
The request as a list of strings should be PUT to this URI. The result |
1424 |
will be a job id. |
1425 |
|
1426 |
It supports the ``dry-run`` argument. |
1427 |
|
1428 |
|
1429 |
``DELETE`` |
1430 |
~~~~~~~~~~ |
1431 |
|
1432 |
Deletes tags. |
1433 |
|
1434 |
In order to delete a set of tags, the DELETE request should be addressed |
1435 |
to URI like:: |
1436 |
|
1437 |
/tags?tag=[tag]&tag=[tag] |
1438 |
|
1439 |
It supports the ``dry-run`` argument. |
1440 |
|
1441 |
|
1442 |
``/version`` |
1443 |
++++++++++++ |
1444 |
|
1445 |
The version resource. |
1446 |
|
1447 |
This resource should be used to determine the remote API version and to |
1448 |
adapt clients accordingly. |
1449 |
|
1450 |
It supports the following commands: ``GET``. |
1451 |
|
1452 |
``GET`` |
1453 |
~~~~~~~ |
1454 |
|
1455 |
Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti 2.0 |
1456 |
returns ``2``. |
1457 |
|
1458 |
.. vim: set textwidth=72 : |
1459 |
.. Local Variables: |
1460 |
.. mode: rst |
1461 |
.. fill-column: 72 |
1462 |
.. End: |