root / doc / rapi.rst @ 2263aec2
History | View | Annotate | Download (18.8 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. After modifying the password |
25 |
file, ``ganeti-rapi`` must be restarted. |
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 RFC2617_ ("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 RFC2617_ is supported. |
69 |
|
70 |
.. _JSON: http://www.json.org/ |
71 |
.. _REST: http://en.wikipedia.org/wiki/Representational_State_Transfer |
72 |
.. _RFC2617: http://tools.ietf.org/rfc/rfc2617.txt |
73 |
|
74 |
Generic parameters |
75 |
------------------ |
76 |
|
77 |
A few parameter mean the same thing across all resources which implement |
78 |
it. |
79 |
|
80 |
``bulk`` |
81 |
++++++++ |
82 |
|
83 |
Bulk-mode means that for the resources which usually return just a list |
84 |
of child resources (e.g. ``/2/instances`` which returns just instance |
85 |
names), the output will instead contain detailed data for all these |
86 |
subresources. This is more efficient than query-ing the sub-resources |
87 |
themselves. |
88 |
|
89 |
``dry-run`` |
90 |
+++++++++++ |
91 |
|
92 |
The optional *dry-run* argument, if provided and set to a positive |
93 |
integer value (e.g. ``?dry-run=1``), signals to Ganeti that the job |
94 |
should not be executed, only the pre-execution checks will be done. |
95 |
|
96 |
This is useful in trying to determine (without guarantees though, as in |
97 |
the meantime the cluster state could have changed) if the operation is |
98 |
likely to succeed or at least start executing. |
99 |
|
100 |
``force`` |
101 |
+++++++++++ |
102 |
|
103 |
Force operation to continue even if it will cause the cluster to become |
104 |
inconsistent (e.g. because there are not enough master candidates). |
105 |
|
106 |
Usage examples |
107 |
-------------- |
108 |
|
109 |
You can access the API using your favorite programming language as long |
110 |
as it supports network connections. |
111 |
|
112 |
Shell |
113 |
+++++ |
114 |
|
115 |
.. highlight:: sh |
116 |
|
117 |
Using wget:: |
118 |
|
119 |
wget -q -O - https://CLUSTERNAME:5080/2/info |
120 |
|
121 |
or curl:: |
122 |
|
123 |
curl https://CLUSTERNAME:5080/2/info |
124 |
|
125 |
|
126 |
Python |
127 |
++++++ |
128 |
|
129 |
.. highlight:: python |
130 |
|
131 |
:: |
132 |
|
133 |
import urllib2 |
134 |
f = urllib2.urlopen('https://CLUSTERNAME:5080/2/info') |
135 |
print f.read() |
136 |
|
137 |
|
138 |
JavaScript |
139 |
++++++++++ |
140 |
|
141 |
.. warning:: While it's possible to use JavaScript, it poses several |
142 |
potential problems, including browser blocking request due to |
143 |
non-standard ports or different domain names. Fetching the data on |
144 |
the webserver is easier. |
145 |
|
146 |
.. highlight:: javascript |
147 |
|
148 |
:: |
149 |
|
150 |
var url = 'https://CLUSTERNAME:5080/2/info'; |
151 |
var info; |
152 |
var xmlreq = new XMLHttpRequest(); |
153 |
xmlreq.onreadystatechange = function () { |
154 |
if (xmlreq.readyState != 4) return; |
155 |
if (xmlreq.status == 200) { |
156 |
info = eval("(" + xmlreq.responseText + ")"); |
157 |
alert(info); |
158 |
} else { |
159 |
alert('Error fetching cluster info'); |
160 |
} |
161 |
xmlreq = null; |
162 |
}; |
163 |
xmlreq.open('GET', url, true); |
164 |
xmlreq.send(null); |
165 |
|
166 |
Resources |
167 |
--------- |
168 |
|
169 |
.. highlight:: javascript |
170 |
|
171 |
``/`` |
172 |
+++++ |
173 |
|
174 |
The root resource. |
175 |
|
176 |
It supports the following commands: ``GET``. |
177 |
|
178 |
``GET`` |
179 |
~~~~~~~ |
180 |
|
181 |
Shows the list of mapped resources. |
182 |
|
183 |
Returns: a dictionary with 'name' and 'uri' keys for each of them. |
184 |
|
185 |
``/2`` |
186 |
++++++ |
187 |
|
188 |
The ``/2`` resource, the root of the version 2 API. |
189 |
|
190 |
It supports the following commands: ``GET``. |
191 |
|
192 |
``GET`` |
193 |
~~~~~~~ |
194 |
|
195 |
Show the list of mapped resources. |
196 |
|
197 |
Returns: a dictionary with ``name`` and ``uri`` keys for each of them. |
198 |
|
199 |
``/2/info`` |
200 |
+++++++++++ |
201 |
|
202 |
Cluster information resource. |
203 |
|
204 |
It supports the following commands: ``GET``. |
205 |
|
206 |
``GET`` |
207 |
~~~~~~~ |
208 |
|
209 |
Returns cluster information. |
210 |
|
211 |
Example:: |
212 |
|
213 |
{ |
214 |
"config_version": 2000000, |
215 |
"name": "cluster", |
216 |
"software_version": "2.0.0~beta2", |
217 |
"os_api_version": 10, |
218 |
"export_version": 0, |
219 |
"candidate_pool_size": 10, |
220 |
"enabled_hypervisors": [ |
221 |
"fake" |
222 |
], |
223 |
"hvparams": { |
224 |
"fake": {} |
225 |
}, |
226 |
"default_hypervisor": "fake", |
227 |
"master": "node1.example.com", |
228 |
"architecture": [ |
229 |
"64bit", |
230 |
"x86_64" |
231 |
], |
232 |
"protocol_version": 20, |
233 |
"beparams": { |
234 |
"default": { |
235 |
"auto_balance": true, |
236 |
"vcpus": 1, |
237 |
"memory": 128 |
238 |
} |
239 |
} |
240 |
} |
241 |
|
242 |
|
243 |
``/2/redistribute-config`` |
244 |
++++++++++++++++++++++++++ |
245 |
|
246 |
Redistribute configuration to all nodes. |
247 |
|
248 |
It supports the following commands: ``PUT``. |
249 |
|
250 |
``PUT`` |
251 |
~~~~~~~ |
252 |
|
253 |
Redistribute configuration to all nodes. The result will be a job id. |
254 |
|
255 |
|
256 |
``/2/instances`` |
257 |
++++++++++++++++ |
258 |
|
259 |
The instances resource. |
260 |
|
261 |
It supports the following commands: ``GET``, ``POST``. |
262 |
|
263 |
``GET`` |
264 |
~~~~~~~ |
265 |
|
266 |
Returns a list of all available instances. |
267 |
|
268 |
Example:: |
269 |
|
270 |
[ |
271 |
{ |
272 |
"name": "web.example.com", |
273 |
"uri": "\/instances\/web.example.com" |
274 |
}, |
275 |
{ |
276 |
"name": "mail.example.com", |
277 |
"uri": "\/instances\/mail.example.com" |
278 |
} |
279 |
] |
280 |
|
281 |
If the optional *bulk* argument is provided and set to a true value (i.e |
282 |
``?bulk=1``), the output contains detailed information about instances |
283 |
as a list. |
284 |
|
285 |
Example:: |
286 |
|
287 |
[ |
288 |
{ |
289 |
"status": "running", |
290 |
"disk_usage": 20480, |
291 |
"nic.bridges": [ |
292 |
"xen-br0" |
293 |
], |
294 |
"name": "web.example.com", |
295 |
"tags": ["tag1", "tag2"], |
296 |
"beparams": { |
297 |
"vcpus": 2, |
298 |
"memory": 512 |
299 |
}, |
300 |
"disk.sizes": [ |
301 |
20480 |
302 |
], |
303 |
"pnode": "node1.example.com", |
304 |
"nic.macs": ["01:23:45:67:89:01"], |
305 |
"snodes": ["node2.example.com"], |
306 |
"disk_template": "drbd", |
307 |
"admin_state": true, |
308 |
"os": "debian-etch", |
309 |
"oper_state": true |
310 |
}, |
311 |
... |
312 |
] |
313 |
|
314 |
|
315 |
``POST`` |
316 |
~~~~~~~~ |
317 |
|
318 |
Creates an instance. |
319 |
|
320 |
If the optional *dry-run* argument is provided and set to a positive |
321 |
integer valu (e.g. ``?dry-run=1``), the job will not be actually |
322 |
executed, only the pre-execution checks will be done. Query-ing the job |
323 |
result will return, in both dry-run and normal case, the list of nodes |
324 |
selected for the instance. |
325 |
|
326 |
Returns: a job ID that can be used later for polling. |
327 |
|
328 |
``/2/instances/[instance_name]`` |
329 |
++++++++++++++++++++++++++++++++ |
330 |
|
331 |
Instance-specific resource. |
332 |
|
333 |
It supports the following commands: ``GET``, ``DELETE``. |
334 |
|
335 |
``GET`` |
336 |
~~~~~~~ |
337 |
|
338 |
Returns information about an instance, similar to the bulk output from |
339 |
the instance list. |
340 |
|
341 |
``DELETE`` |
342 |
~~~~~~~~~~ |
343 |
|
344 |
Deletes an instance. |
345 |
|
346 |
It supports the ``dry-run`` argument. |
347 |
|
348 |
|
349 |
``/2/instances/[instance_name]/info`` |
350 |
+++++++++++++++++++++++++++++++++++++++ |
351 |
|
352 |
It supports the following commands: ``GET``. |
353 |
|
354 |
``GET`` |
355 |
~~~~~~~ |
356 |
|
357 |
Requests detailed information about the instance. An optional parameter, |
358 |
``static`` (bool), can be set to return only static information from the |
359 |
configuration without querying the instance's nodes. The result will be |
360 |
a job id. |
361 |
|
362 |
|
363 |
``/2/instances/[instance_name]/reboot`` |
364 |
+++++++++++++++++++++++++++++++++++++++ |
365 |
|
366 |
Reboots URI for an instance. |
367 |
|
368 |
It supports the following commands: ``POST``. |
369 |
|
370 |
``POST`` |
371 |
~~~~~~~~ |
372 |
|
373 |
Reboots the instance. |
374 |
|
375 |
The URI takes optional ``type=hard|soft|full`` and |
376 |
``ignore_secondaries=False|True`` parameters. |
377 |
|
378 |
It supports the ``dry-run`` argument. |
379 |
|
380 |
|
381 |
``/2/instances/[instance_name]/shutdown`` |
382 |
+++++++++++++++++++++++++++++++++++++++++ |
383 |
|
384 |
Instance shutdown URI. |
385 |
|
386 |
It supports the following commands: ``PUT``. |
387 |
|
388 |
``PUT`` |
389 |
~~~~~~~ |
390 |
|
391 |
Shutdowns an instance. |
392 |
|
393 |
It supports the ``dry-run`` argument. |
394 |
|
395 |
|
396 |
``/2/instances/[instance_name]/startup`` |
397 |
++++++++++++++++++++++++++++++++++++++++ |
398 |
|
399 |
Instance startup URI. |
400 |
|
401 |
It supports the following commands: ``PUT``. |
402 |
|
403 |
``PUT`` |
404 |
~~~~~~~ |
405 |
|
406 |
Startup an instance. |
407 |
|
408 |
The URI takes an optional ``force=False|True`` parameter to start the |
409 |
instance if even if secondary disks are failing. |
410 |
|
411 |
It supports the ``dry-run`` argument. |
412 |
|
413 |
``/2/instances/[instance_name]/reinstall`` |
414 |
++++++++++++++++++++++++++++++++++++++++++++++ |
415 |
|
416 |
Installs the operating system again. |
417 |
|
418 |
It supports the following commands: ``POST``. |
419 |
|
420 |
``POST`` |
421 |
~~~~~~~~ |
422 |
|
423 |
Takes the parameters ``os`` (OS template name) and ``nostartup`` (bool). |
424 |
|
425 |
|
426 |
``/2/instances/[instance_name]/replace-disks`` |
427 |
++++++++++++++++++++++++++++++++++++++++++++++ |
428 |
|
429 |
Replaces disks on an instance. |
430 |
|
431 |
It supports the following commands: ``POST``. |
432 |
|
433 |
``POST`` |
434 |
~~~~~~~~ |
435 |
|
436 |
Takes the parameters ``mode`` (one of ``replace_on_primary``, |
437 |
``replace_on_secondary``, ``replace_new_secondary`` or |
438 |
``replace_auto``), ``disks`` (comma separated list of disk indexes), |
439 |
``remote_node`` and ``iallocator``. |
440 |
|
441 |
|
442 |
``/2/instances/[instance_name]/activate-disks`` |
443 |
+++++++++++++++++++++++++++++++++++++++++++++++ |
444 |
|
445 |
Activate disks on an instance. |
446 |
|
447 |
It supports the following commands: ``PUT``. |
448 |
|
449 |
``PUT`` |
450 |
~~~~~~~ |
451 |
|
452 |
Takes the parameter ``ignore_size``. When set ignore the recorded |
453 |
size (useful for forcing activation when recorded size is wrong). |
454 |
|
455 |
|
456 |
``/2/instances/[instance_name]/deactivate-disks`` |
457 |
+++++++++++++++++++++++++++++++++++++++++++++++++ |
458 |
|
459 |
Deactivate disks on an instance. |
460 |
|
461 |
It supports the following commands: ``PUT``. |
462 |
|
463 |
``PUT`` |
464 |
~~~~~~~ |
465 |
|
466 |
Takes no parameters. |
467 |
|
468 |
|
469 |
``/2/instances/[instance_name]/tags`` |
470 |
+++++++++++++++++++++++++++++++++++++ |
471 |
|
472 |
Manages per-instance tags. |
473 |
|
474 |
It supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
475 |
|
476 |
``GET`` |
477 |
~~~~~~~ |
478 |
|
479 |
Returns a list of tags. |
480 |
|
481 |
Example:: |
482 |
|
483 |
["tag1", "tag2", "tag3"] |
484 |
|
485 |
``PUT`` |
486 |
~~~~~~~ |
487 |
|
488 |
Add a set of tags. |
489 |
|
490 |
The request as a list of strings should be ``PUT`` to this URI. The |
491 |
result will be a job id. |
492 |
|
493 |
It supports the ``dry-run`` argument. |
494 |
|
495 |
|
496 |
``DELETE`` |
497 |
~~~~~~~~~~ |
498 |
|
499 |
Delete a tag. |
500 |
|
501 |
In order to delete a set of tags, the DELETE request should be addressed |
502 |
to URI like:: |
503 |
|
504 |
/tags?tag=[tag]&tag=[tag] |
505 |
|
506 |
It supports the ``dry-run`` argument. |
507 |
|
508 |
|
509 |
``/2/jobs`` |
510 |
+++++++++++ |
511 |
|
512 |
The ``/2/jobs`` resource. |
513 |
|
514 |
It supports the following commands: ``GET``. |
515 |
|
516 |
``GET`` |
517 |
~~~~~~~ |
518 |
|
519 |
Returns a dictionary of jobs. |
520 |
|
521 |
Returns: a dictionary with jobs id and uri. |
522 |
|
523 |
``/2/jobs/[job_id]`` |
524 |
++++++++++++++++++++ |
525 |
|
526 |
|
527 |
Individual job URI. |
528 |
|
529 |
It supports the following commands: ``GET``, ``DELETE``. |
530 |
|
531 |
``GET`` |
532 |
~~~~~~~ |
533 |
|
534 |
Returns a job status. |
535 |
|
536 |
Returns: a dictionary with job parameters. |
537 |
|
538 |
The result includes: |
539 |
|
540 |
- id: job ID as a number |
541 |
- status: current job status as a string |
542 |
- ops: involved OpCodes as a list of dictionaries for each opcodes in |
543 |
the job |
544 |
- opstatus: OpCodes status as a list |
545 |
- opresult: OpCodes results as a list |
546 |
|
547 |
For a successful opcode, the ``opresult`` field corresponding to it will |
548 |
contain the raw result from its :term:`LogicalUnit`. In case an opcode |
549 |
has failed, its element in the opresult list will be a list of two |
550 |
elements: |
551 |
|
552 |
- first element the error type (the Ganeti internal error name) |
553 |
- second element a list of either one or two elements: |
554 |
|
555 |
- the first element is the textual error description |
556 |
- the second element, if any, will hold an error classification |
557 |
|
558 |
The error classification is most useful for the ``OpPrereqError`` |
559 |
error type - these errors happen before the OpCode has started |
560 |
executing, so it's possible to retry the OpCode without side |
561 |
effects. But whether it make sense to retry depends on the error |
562 |
classification: |
563 |
|
564 |
``resolver_error`` |
565 |
Resolver errors. This usually means that a name doesn't exist in DNS, |
566 |
so if it's a case of slow DNS propagation the operation can be retried |
567 |
later. |
568 |
|
569 |
``insufficient_resources`` |
570 |
Not enough resources (iallocator failure, disk space, memory, |
571 |
etc.). If the resources on the cluster increase, the operation might |
572 |
succeed. |
573 |
|
574 |
``wrong_input`` |
575 |
Wrong arguments (at syntax level). The operation will not ever be |
576 |
accepted unless the arguments change. |
577 |
|
578 |
``wrong_state`` |
579 |
Wrong entity state. For example, live migration has been requested for |
580 |
a down instance, or instance creation on an offline node. The |
581 |
operation can be retried once the resource has changed state. |
582 |
|
583 |
``unknown_entity`` |
584 |
Entity not found. For example, information has been requested for an |
585 |
unknown instance. |
586 |
|
587 |
``already_exists`` |
588 |
Entity already exists. For example, instance creation has been |
589 |
requested for an already-existing instance. |
590 |
|
591 |
``resource_not_unique`` |
592 |
Resource not unique (e.g. MAC or IP duplication). |
593 |
|
594 |
``internal_error`` |
595 |
Internal cluster error. For example, a node is unreachable but not set |
596 |
offline, or the ganeti node daemons are not working, etc. A |
597 |
``gnt-cluster verify`` should be run. |
598 |
|
599 |
``environment_error`` |
600 |
Environment error (e.g. node disk error). A ``gnt-cluster verify`` |
601 |
should be run. |
602 |
|
603 |
Note that in the above list, by entity we refer to a node or instance, |
604 |
while by a resource we refer to an instance's disk, or NIC, etc. |
605 |
|
606 |
|
607 |
``DELETE`` |
608 |
~~~~~~~~~~ |
609 |
|
610 |
Cancel a not-yet-started job. |
611 |
|
612 |
``/2/nodes`` |
613 |
++++++++++++ |
614 |
|
615 |
Nodes resource. |
616 |
|
617 |
It supports the following commands: ``GET``. |
618 |
|
619 |
``GET`` |
620 |
~~~~~~~ |
621 |
|
622 |
Returns a list of all nodes. |
623 |
|
624 |
Example:: |
625 |
|
626 |
[ |
627 |
{ |
628 |
"id": "node1.example.com", |
629 |
"uri": "\/nodes\/node1.example.com" |
630 |
}, |
631 |
{ |
632 |
"id": "node2.example.com", |
633 |
"uri": "\/nodes\/node2.example.com" |
634 |
} |
635 |
] |
636 |
|
637 |
If the optional 'bulk' argument is provided and set to 'true' value (i.e |
638 |
'?bulk=1'), the output contains detailed information about nodes as a |
639 |
list. |
640 |
|
641 |
Example:: |
642 |
|
643 |
[ |
644 |
{ |
645 |
"pinst_cnt": 1, |
646 |
"mfree": 31280, |
647 |
"mtotal": 32763, |
648 |
"name": "www.example.com", |
649 |
"tags": [], |
650 |
"mnode": 512, |
651 |
"dtotal": 5246208, |
652 |
"sinst_cnt": 2, |
653 |
"dfree": 5171712, |
654 |
"offline": false |
655 |
}, |
656 |
... |
657 |
] |
658 |
|
659 |
``/2/nodes/[node_name]`` |
660 |
+++++++++++++++++++++++++++++++++ |
661 |
|
662 |
Returns information about a node. |
663 |
|
664 |
It supports the following commands: ``GET``. |
665 |
|
666 |
``/2/nodes/[node_name]/evacuate`` |
667 |
+++++++++++++++++++++++++++++++++ |
668 |
|
669 |
Evacuates all secondary instances off a node. |
670 |
|
671 |
It supports the following commands: ``POST``. |
672 |
|
673 |
``POST`` |
674 |
~~~~~~~~ |
675 |
|
676 |
To evacuate a node, either one of the ``iallocator`` or ``remote_node`` |
677 |
parameters must be passed: |
678 |
|
679 |
evacuate?iallocator=[iallocator] |
680 |
evacuate?remote_node=[nodeX.example.com] |
681 |
|
682 |
``/2/nodes/[node_name]/migrate`` |
683 |
+++++++++++++++++++++++++++++++++ |
684 |
|
685 |
Migrates all primary instances from a node. |
686 |
|
687 |
It supports the following commands: ``POST``. |
688 |
|
689 |
``POST`` |
690 |
~~~~~~~~ |
691 |
|
692 |
No parameters are required, but ``live`` can be set to a boolean value. |
693 |
|
694 |
migrate?live=[0|1] |
695 |
|
696 |
``/2/nodes/[node_name]/role`` |
697 |
+++++++++++++++++++++++++++++ |
698 |
|
699 |
Manages node role. |
700 |
|
701 |
It supports the following commands: ``GET``, ``PUT``. |
702 |
|
703 |
The role is always one of the following: |
704 |
|
705 |
- drained |
706 |
- master |
707 |
- master-candidate |
708 |
- offline |
709 |
- regular |
710 |
|
711 |
``GET`` |
712 |
~~~~~~~ |
713 |
|
714 |
Returns the current node role. |
715 |
|
716 |
Example:: |
717 |
|
718 |
"master-candidate" |
719 |
|
720 |
``PUT`` |
721 |
~~~~~~~ |
722 |
|
723 |
Change the node role. |
724 |
|
725 |
The request is a string which should be PUT to this URI. The result will |
726 |
be a job id. |
727 |
|
728 |
It supports the ``force`` argument. |
729 |
|
730 |
``/2/nodes/[node_name]/storage`` |
731 |
++++++++++++++++++++++++++++++++ |
732 |
|
733 |
Manages storage units on the node. |
734 |
|
735 |
``GET`` |
736 |
~~~~~~~ |
737 |
|
738 |
Requests a list of storage units on a node. Requires the parameters |
739 |
``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``) and |
740 |
``output_fields``. The result will be a job id, using which the result |
741 |
can be retrieved. |
742 |
|
743 |
``/2/nodes/[node_name]/storage/modify`` |
744 |
+++++++++++++++++++++++++++++++++++++++ |
745 |
|
746 |
Modifies storage units on the node. |
747 |
|
748 |
``PUT`` |
749 |
~~~~~~~ |
750 |
|
751 |
Modifies parameters of storage units on the node. Requires the |
752 |
parameters ``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``) |
753 |
and ``name`` (name of the storage unit). Parameters can be passed |
754 |
additionally. Currently only ``allocatable`` (bool) is supported. The |
755 |
result will be a job id. |
756 |
|
757 |
``/2/nodes/[node_name]/storage/repair`` |
758 |
+++++++++++++++++++++++++++++++++++++++ |
759 |
|
760 |
Repairs a storage unit on the node. |
761 |
|
762 |
``PUT`` |
763 |
~~~~~~~ |
764 |
|
765 |
Repairs a storage unit on the node. Requires the parameters |
766 |
``storage_type`` (currently only ``lvm-vg`` can be repaired) and |
767 |
``name`` (name of the storage unit). The result will be a job id. |
768 |
|
769 |
``/2/nodes/[node_name]/tags`` |
770 |
+++++++++++++++++++++++++++++ |
771 |
|
772 |
Manages per-node tags. |
773 |
|
774 |
It supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
775 |
|
776 |
``GET`` |
777 |
~~~~~~~ |
778 |
|
779 |
Returns a list of tags. |
780 |
|
781 |
Example:: |
782 |
|
783 |
["tag1", "tag2", "tag3"] |
784 |
|
785 |
``PUT`` |
786 |
~~~~~~~ |
787 |
|
788 |
Add a set of tags. |
789 |
|
790 |
The request as a list of strings should be PUT to this URI. The result |
791 |
will be a job id. |
792 |
|
793 |
It supports the ``dry-run`` argument. |
794 |
|
795 |
``DELETE`` |
796 |
~~~~~~~~~~ |
797 |
|
798 |
Deletes tags. |
799 |
|
800 |
In order to delete a set of tags, the DELETE request should be addressed |
801 |
to URI like:: |
802 |
|
803 |
/tags?tag=[tag]&tag=[tag] |
804 |
|
805 |
It supports the ``dry-run`` argument. |
806 |
|
807 |
|
808 |
``/2/os`` |
809 |
+++++++++ |
810 |
|
811 |
OS resource. |
812 |
|
813 |
It supports the following commands: ``GET``. |
814 |
|
815 |
``GET`` |
816 |
~~~~~~~ |
817 |
|
818 |
Return a list of all OSes. |
819 |
|
820 |
Can return error 500 in case of a problem. Since this is a costly |
821 |
operation for Ganeti 2.0, it is not recommended to execute it too often. |
822 |
|
823 |
Example:: |
824 |
|
825 |
["debian-etch"] |
826 |
|
827 |
``/2/tags`` |
828 |
+++++++++++ |
829 |
|
830 |
Manages cluster tags. |
831 |
|
832 |
It supports the following commands: ``GET``, ``PUT``, ``DELETE``. |
833 |
|
834 |
``GET`` |
835 |
~~~~~~~ |
836 |
|
837 |
Returns the cluster tags. |
838 |
|
839 |
Example:: |
840 |
|
841 |
["tag1", "tag2", "tag3"] |
842 |
|
843 |
``PUT`` |
844 |
~~~~~~~ |
845 |
|
846 |
Adds a set of tags. |
847 |
|
848 |
The request as a list of strings should be PUT to this URI. The result |
849 |
will be a job id. |
850 |
|
851 |
It supports the ``dry-run`` argument. |
852 |
|
853 |
|
854 |
``DELETE`` |
855 |
~~~~~~~~~~ |
856 |
|
857 |
Deletes tags. |
858 |
|
859 |
In order to delete a set of tags, the DELETE request should be addressed |
860 |
to URI like:: |
861 |
|
862 |
/tags?tag=[tag]&tag=[tag] |
863 |
|
864 |
It supports the ``dry-run`` argument. |
865 |
|
866 |
|
867 |
``/version`` |
868 |
++++++++++++ |
869 |
|
870 |
The version resource. |
871 |
|
872 |
This resource should be used to determine the remote API version and to |
873 |
adapt clients accordingly. |
874 |
|
875 |
It supports the following commands: ``GET``. |
876 |
|
877 |
``GET`` |
878 |
~~~~~~~ |
879 |
|
880 |
Returns the remote API version. Ganeti 1.2 returned ``1`` and Ganeti 2.0 |
881 |
returns ``2``. |
882 |
|
883 |
.. vim: set textwidth=72 : |
884 |
.. Local Variables: |
885 |
.. mode: rst |
886 |
.. fill-column: 72 |
887 |
.. End: |